{"lang": "GNU C", "source_code": "#include\n#include\n#include\nint a[1000];\nint main(){\nint i,j,k,m,n;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<=n;i++)a[i]=0;\n for(i=1;i<=m;i++){\n scanf(\"%d\",&k);\n for(j=k;j<=n;j++){\n if(a[j]==0)a[j]=k;\n }\n }\n for(i=1;i\nint main()\n{\n int a,b,c,d,i,n,k,ss[110],dd[110];\n while(scanf(\"%d %d\",&a,&b)==2)\n {\n for(i=0;i<110;i++)\n dd[i]=0;\n for(i=1;i<=b;i++)\n {\n scanf(\"%d\",&ss[i]);\n for(n=ss[i];n<=a;n++)\n {\n if(dd[n]==0) dd[n]=ss[i];\n }\n }\n for(i=1;i<=a;i++)\n {\n printf(\"%d\",dd[i]);\n if(i!=a) printf(\" \");\n else printf(\"\\n\");\n }\n }\n}\n\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "3697d5bb303e15884556e4adf0ae8afa", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int k,c=1,s=0;\n scanf(\"%d\",&k);\n while(k>0)\n {\n k+k-c;\n c+=1;\n s+=1;\n }\n printf(\"%d\",s);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "33bcfa7cb1b5832af883ae16eb70c632", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{long long int s=0,i=1,n,cnt=0,sum=0,l;\nscanf(\"%I64d\",&n);\nwhile(1)\n{\n\n\n sum=sum+(i*(i+1))/2;\n cnt++;\n i++;\n if((sum)==n)\n {\n break;}\n if(nsum-n)\n {\n cnt=cnt-1;\n break;\n }\n\n\n\n}\nprintf(\"%I64d\",cnt);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b7cb0a02c3a8493f4bfc239e5b4360f9", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int a,sum=1,i=2,c=0;\n scanf(\"%d\",&a);\n while(a!=0)\n {\n a -= sum;\n c++;\n sum +=i;\n i++;\n \n }\n printf(\"%d\",c);\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a318c869b163ebb7b0e540c4b91e42fb", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(void)\n{\n int n,i,h;\n do{\n scanf(\"%d\",&n);\n }\n while(n<10001 && n>0);\n while(i\n#include\n#include\n#include\n#define pi acos(-1)\n\nint main()\n{\n\tint n,i=1,j,k,l,m,sum=0,count=0;\n\tscanf(\"%d\", &n);\n\tif(n==1) printf(\"1\\n\");\n\telse if(n==0) printf(\"0\\n\");\n\telse\n\t{\n\n\t\tsum=i;\n\t\twhile(1)\n\t\t{\n\t\t\t++count;\n\t\t\ti=i+2;\n\t\t\tsum=sum+i;\n\t\t\tif(sum==n) break;\n\t\t}\n\t\t\n\t\tprintf(\"%d\\n\", count);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b53f0c845d69857acf88a4737e71c24a", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0} {"lang": "GNU C11", "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\n#include\n\nint main()\n{ char str[120];\n int dist, j;\n while(1){\n\n scanf(\"%s\", &str);\n dist=0;\n\n for(char i='a'; i<='z' ; i++)\n for(j=0; str[j]!=NULL; j++)\n\n {\n if(i==str[j]){\n dist++;\n break;}\n }\n\n if(dist%2==0)\n printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a78f0faf7350a66ed4c90dca0b1ea278", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main ()\n{\n char str[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 i++;\n c++;\n }\n }\n if((c+1)%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ff0fbe4f28cdf5566d11fc957f2280bf", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "GNU C11", "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 \n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main()\n{ \n //Declaracion de variables\n int OriginalLetters = 1, Tester = 1, ComparisonLetters = 0; \n int Cantidad = 1;\n char Cadena[102], Cadena2[102]; //Cadena Original, La Cadena2 permite comparar\n \n //Escaneo de Cadena\n scanf(\"%s\",&Cadena);\n \n Cadena2[0] = Cadena[0]; // Para poder comparar ambas cadenas se necesita el caracter de la posicion 0 en la posicion 0 de la cadena 2\n \n while(Cadena[OriginalLetters] != '\\0')\n {\n while(Cadena2[ComparisonLetters] != '\\0' )\n {\n if(Cadena2[ComparisonLetters] == Cadena[OriginalLetters])\n {\n Tester = 0;\n ComparisonLetters = 102;\n }\n \n else\n ComparisonLetters++; \n \n }\n \n if(Tester == 1)\n {\n \n Cadena2[OriginalLetters] = Cadena[OriginalLetters];\n Cantidad++;\n \n }\n Tester = 1;\n ComparisonLetters = 0;\n OriginalLetters++;\n \n \n }\n \n if(Cantidad % 2 == 0 )\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n printf(\"IGNORE HIM!\");\n \n \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "434d6ecc41d07089a7e6adcf6a691827", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\nint a,b,c,p[4],temp,i,j;\nscanf(\"%d%d%d\",&a,&b,&c);\np[0]=a+b*c;\np[1]=c*(b+c);\np[2]=a*b*c;\np[3]=(a+b)*c;\n for(j=0;j<3;j++) {\nfor(i=0;i<4-j;i++)\n{\nif(p[i]>=p[i+1])\n{temp=p[i];\np[i]=p[i+1];\np[i+1]=temp;}\n\n}}\np[1]=0;\n\nprintf(\"%d\",p[3]);}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e0408cacae6e47bff965266972d6814a", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int k,l,m,n,o,p,a,b,c;\n scanf(\"%d%d%d\",a,b,c);\n k=a*b*c;\n l=a+b+c;\n m=(a*b)+c;\n n=a+(b*c);\n o=(a+b)*c;\n p=a*(b+c);\n if(k>=l&&k>=m&&k>=n&&k>=o&&k>=p){\n printf(\"%d\",k);\n }\n else if(l>=k&&l>=m&&k>=n&&l>=o&&l>=p){\n printf(\"%d\",l);\n }\n else if(m>=k&&m>=l&&m>=n&&m>=o&&m>=p){\n printf(\"%d\",m);\n }\n else if(n>=k&&n>=l&&n>=m&&n>=o&&n>=p){\n printf(\"%d\",n);\n }\n else if(o>=k&&o>=l&&o>=m&&o>=n&&o>=p){\n printf(\"%d\",o);\n }\n else{\n printf(\"%d\",p);\n }\n return 0;\n \n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "68b6bd5a527c04c5a80c35f4e38a39ff", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int a=2,b=9,c=3,max;\n int result[6],j;\n result[0]=a+b+c;\n result[1]=a*b*c;\n result[2]=a+b*c;\n result[3]=(a+b)*c;\n result[4]=a*b+c;\n result[5]=a*(b+c);\n max=result[0];\n for(j=0;j<5;j++)\n {\n if(result[j]>max)\n {\n max=result[j];\n }\n }\n printf(\"%d\",max);\n system(\"pause\");\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "f606b863332e6d126c9ace5c433ead09", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int a=2,b=6,c=8,max;\n int result[6],j;\n result[0]=a+b+c;\n result[1]=a*b*c;\n result[2]=a+b*c;\n result[3]=(a+b)*c;\n result[4]=a*b+c;\n result[5]=a*(b+c);\n max=result[0];\n for(j=0;j<5;j++)\n {\n if(result[j]>max)\n {\n max=result[j];\n }\n }\n printf(\"%d\",max);\n system(\"pause\");\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "a2b070c8afbc6709f1c733467d96637c", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int k,l,m,n,o,p,a,b,c;\n scanf(\"%d%d%d\",a,b,c);\n k=a*b*c;\n l=a+b+c;\n m=(a*b)+c;\n n=a+(b*c);\n o=(a+b)*c;\n p=a=(b+c);\n if(k>=l&&k>=m&&k>=n&&k>=o&&k>=p){\n printf(\"%d\",k);\n }\n else if(l>=k&&l>=m&&k>=n&&l>=o&&l>=p){\n printf(\"%d\",l);\n }\n else if(m>=k&&m>=l&&m>=n&&m>=o&&m>=p){\n printf(\"%d\",m);\n }\n else if(n>=k&&n>=l&&n>=m&&n>=o&&n>=p){\n printf(\"%d\",n);\n }\n else if(o>=k&&o>=l&&o>=m&&o>=n&&o>=p){\n printf(\"%d\",o);\n }\n else{\n printf(\"%d\",p);\n }\n return 0;\n \n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e4cefc9901ceac993b755a297553573f", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,i,a[200],count=0;\n scanf(\"%d %d\",&n,&k);\n for(i=0;ia[k]&&a[i]>0)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a85aed66789a31ad41a0c232a0be4080", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a[100],k,n,count,t,i;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\nint main()\n{\n int i,n,count=0,k,a[200];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i=a[k])\n {\n if(a[i]>0)\n {\n count++;\n }\n }\n }\n printf(\"%d\",count);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "54906885e3d853726680c9b8f55c937b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x,k,i,c=0;\n scanf(\"%d %d\",&x,&k);\n int n[x];\n for(i=0;i=n[k]) c++;\n }\n printf(\"%d\\n\",c);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9c842caaa4c74dcea837b4d88bf2c966", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint check(int val,int x)\n{\n if (val>=x){return (1);}\n else{return (0);}\n}\nint search(int t[],int n,int k)\n{\n int lft=k,rgt=n,m,pos=0;\n int check(int,int);\n while(lft<=rgt)\n {\n m=(lft+rgt)/2;\n if (check(t[m],t[k-1]))\n {\n lft=m+1;\n pos=m;\n }\n else\n {\n rgt=m-1;\n }\n }\n return(pos);\n}\nvoid par(int *a, int *b)\n{\n int check(int,int);\n int ver=1;\n do\n {\n scanf(\"%d %d\",a,b);\n if(check(*b,1)&&check(50,*a)&&check(*a,*b)) {ver=0;}\n }while(ver);\n}\nvoid rem(int t[],int b)\n{\n int i=0,ver;\n int check(int,int);\n do\n {\n ver=0;\n for(i=0;i\n\nint main()\n{\n float l, d, v, g, r ,t , m ;\n int i ;\n scanf(\"%f%f%f%f%f\",&l,&d,&v,&g,&r);\n\n t = (l-d)/v ;\n\n if(d/v <= g)\n {\n t += d/v ;\n printf(\"%f\",t);\n return 0 ;\n }\n\n while(d >= 0)\n {\n m = v*g ;\n t += m/v ;\n d -= m ;\n if(d<=0)\n {\n printf(\"%f\",t);\n return 0 ;\n }\n else\n {\n m = v*r ;\n t += m/v ;\n d -= m ;\n }\n if(d<=0)\n {\n printf(\"%f\",t);\n return 0 ;\n }\n\n\n }\n\n\n\n\n return 0 ;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "94d64b5256302263c66609b251a12499", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n {\n \tfloat ans;\n \tint l, d, v, g, r, i;\n \tscanf(\"%d %d %d %d %d\", &l, &d, &v, &g, &r);\n \ti = d/v;\n \tif(i*v != d)\n \t i++;\n \tif(i % (g+r) <= g && i % (g+r) != 0) \n \t {\n \t \tans = (float) l/v;\n\t }\n\telse \n\t {\n\t \tans = ( (float) (l-d)/v) + (d/v/(g+r)+1) * (g+r);\n\t }\n\tprintf(\"%f\", ans);\n\tgetchar();\n\tgetchar();\n\treturn 0;\n } \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7ec26f0d1c284e7c6342f743f93fcafa", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#define epslion .000001 \nint main() {\nint d,l,v,g,r,time;\nfloat duration,durtol,resttol,oddtime,inc=0.0;\nscanf(\"%d %d %d %d %d\",&d,&l,&v,&g,&r);\n if(l>d){\n duration = (float)d/v;\n printf(\"%f\",duration);\n }\n else {\n durtol = (float)l/v;\n time = durtol/(g+r);\n oddtime = durtol - time*(g+r);\n //printf(\"%f \",oddtime);\n if(oddtime > g) {\n inc = (r+g - oddtime );\n }\n resttol = (float)(d-l)/v;\n printf(\"%f\",resttol + inc + durtol);\n \n }\n \n return 0;\n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bcd2218e2c7f5bcb364a24f8ca9366c7", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n\n{\n int l,d,v,g,r;\n \n scanf(\"%d%d%d%d%d\",&l,&d,&v,&g,&r);\n \n if((d/v)<=g)\n {\n printf(\"%d\",(l/v));\n }\n\n else\n {\n printf(\"%d\",(g + r + ((l-d)/v)));\n }\nreturn 0; \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c711fb27a0705e30c440523d96542828", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\ndouble tra();\ndouble l,d,v,g,r,t;\nvoid main()\n{\n\tscanf(\"%lf%lf%lf%lf%lf\",&l,&d,&v,&g,&r);\n\tt=l/v+tra(d/v,g,r);\n\tprintf(\"%.8lf\",t);\n}\ndouble tra()\n{\n\tdouble sum=0;\n\tfor (int i=0;;i++)\n\t{\n\t\t\tif (i%2==0){sum+=g;}\n\t else { sum+=r;}\n\t \t\tif (sum>=d/v)\n\t \t\t{\n\t\t\tif (i%2==0){return 0;}\n\t\t\telse {return sum-d/v;}\n\t\t }\n\t }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b6b637ec7e67881f7f4bbad12176ab14", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main ()\n{\n\n\n int l,a,p,mk,min,tmp;\n int lm,ap,per;\n while(scanf(\"%d %d %d\",&l,&a,&p))\n {\n\n\n lm=l;\n ap=a/2;\n per=p/4;\n if(lmper)\n mk=per;\n else\n mk=min;\n\n printf(\"%d\\n\",7*mk);\n }\n return 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "237da4b19644fb43070919f32a62bd2a", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a,b,c,ans=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(1)\n {\n if(((a*2)<=b)&&((a*4)<=c))\n {\n ans=7*a;\n break;\n }\n\n }\n\n printf(\"%d\\n\",ans);\n return 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e6d5c596faa25e3f0b32bd2b38494c9a", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int i,j,a,b,c,a1=0,b1=0,c1=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n for(i=1;;i++){\n if((a1a)||(b1>b)||(c1>c)){\n break;\n }\n }\n }\n printf(\"%d\",(a1-1)+(b1-2)+(c1-4));\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "808ee2d553e5fd7001ce4510cd9b5c5c", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint l,a,p,count=0;\n\tscanf(\"%d\",&l);\nscanf(\"%d\",&a);\nscanf(\"%d\",&p);\n\tif((a<(2) && p<(4)) || l<1)\n\tprintf(\"0\\n\");\n\telse {\n\t{\n\t\tint m=p/4;\n\t\tif(a>=m*2)\n\t\tcount=7*m;\n\t}\n\tprintf(\"%d\\n\",count);\n}\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e6ef9a0f99c6ef28dcd160cfc6c3877b", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n int d = a;\n\n if(b/2 < d)\n d = b/2;\n\n if(c/4 < c)\n d = c/4;\n\n printf(\"%d\\n\",d+2*d+4*d);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4630ec7ecd0ef74fd573fbf399d00b2c", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint i,n,k,a[1000],dif,max=-1e9;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;imax&&dif>0)\nmax=dif;\n}\nif(max<0)\nprintf(\"0\\n\");\nelse\nprintf(\"%d\\n\",max-k);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b16e4aaff0c413fddaf1734131456fbf", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nint a[108];\nint main()\n{\n int n,c,i,ma;\n\n scanf(\"%d%d\",&n,&c);\n for(i=0;ima) ma=a[i-1]-a[i];\n }\n printf(\"%d\\n\",ma-c);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2ed9921311f4804c3716694da0539181", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n int n, c, x[101], i, max_i, max, ans;\n \n scanf(\"%d %d\",&n,&c);\n \n for(i=0; i\nint main()\n{\n int n,c,i,a[110],p,x;\n scanf(\"%d %d\", &n,&c);\n for(i=1; i<=n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n x=0;\n for(i=1; ix)\n x=p;\n }\n printf(\"%d\",x-c);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05f465ee40214cbc5298887dd13a9c9e", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n {\n \tint day,pay;\n \tscanf(\"%d %d\",&day,&pay);\n \t\n \tint Data[day],a;\n \tfor(a = 0 ; a < day; a++)\n \t{\n \t\tscanf(\"%d\",&Data[a]); \t\t\n \t}\n \t\n \tint dayTake = 0,idx;\n \tfor(a = 0 ; a < day-1; a++)\n \t{\n \t if(Data[a]- Data[a+1] > dayTake)\n\t {\n\t \tdayTake = Data[a] - Data[a+1];\n\t \tidx = a;\n\t }\t\n \t}\n \t\n \t// Debug\n \t//printf(\"%d\\n\",dayTake);\n \t\n \tif(dayTake == 0)\n \t{\n \t\tprintf(\"%d\\n\",dayTake);\n \t}\n \t\n \telse\n \t{\n \t\tprintf(\"%d\\n\",((Data[idx] - Data[idx+1]) - pay));\n \t}\n \t\n \treturn 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f6eb0d53b73b6a89b2acccc2e454d305", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,k,a[100],s=0,count=0,i;\n printf(\"\\nEnter n and k\");\n scanf(\"%d %d\",&n,&k);\n for(i=0;i8)\n s=s+8;\n else\n s=s+a[i];\n while(s<=k)\n count++;\n\n }\n if(s==k)\n printf(\"\\n%d\",count);\n else\n printf(\"\\n-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1468f95ef31b266f41272932e89a3eae", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main ()\n{\n\tint c[5];\n\tint j;\n\t\n\tfor (j=0;j<10;j++) c[j]=j;\n\t\n\tfor (j=0;j<10;j++) printf(\"%d\",c[j]);\n\t\n\treturn 0;\n\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "544ff5b6e4568a22baaf89fb64c52362", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\nint n,k,a[100],i,sum=0;\nscanf(\"%d %d\",&n,&k);\nfor(i=0;i=k)\n {\n printf(\"%d\",i);\n break;\n }\n}\nif(sum\nvoid main()\n{\n int n,i,count=0,s=0,r=0;\n long int k;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n for (i=0;i=8)\n {\n if(i+1=k)\n {\n printf(\"%d\",count);\n }\n else\n printf(\"-1\");\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fe98e292b456f5eb577a15d4c8986c54", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\n int n,i,count=0,s=0,r=0;\n long int k;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n for (i=0;i=8)\n {\n if(i+1=k)\n {\n printf(\"%d\",count);\n }\n else\n printf(\"-1\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "aa597bc9472916061aa2339e7294c5a8", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0} {"lang": "GNU C", "source_code": "/* Teng K. J. */\n#include \n#define N 20000\nvoid ignore(int n) {\n while (n-- > 0) getchar();\n}\nint main() {\n int n, cur = 0, dist;\n char dir;\n scanf(\"%d\", &n);\n while (n-- > 0) {\n scanf(\"%d %c\", &dist, &dir);\n switch (dir) {\n case 'N':\n ignore(5);\n if (cur == 0) goto no;\n cur -= (dist + N) % (2 * N) - N;\n if (cur < 0) cur = -cur;\n if (cur > N) cur = 2 * N - cur;\n break;\n case 'S':\n ignore(5);\n cur += (dist + N) % (2 * N) - N;\n if (cur < 0) cur = -cur;\n if (cur > N) cur = 2 * N - cur;\n break;\n case 'E': case 'W':\n ignore(4);\n if (cur == 0 || cur == N) goto no;\n break;\n }\n }\n if (cur != 0) goto no;\n puts(\"YES\");\n return 0;\nno:\n puts(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "63a2e54ad0ea078923531ab9723019c7", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "//Created by Pratik Mandlecha\n\n#include\n#include\n#include\n#include\nint main()\n{\n\tint n,d,p=0,q=0,flag=0;\n\tchar s[20];\n\tscanf(\"%d\",&n);\n\twhile(n--)\n\t{\n\t\tscanf(\"%d%s\",&d,s);\n\t\tif(s[0]=='N') \n\t\t{\n\t\t\tif((p%40000)!=0)\n\t\t\tp+=(d%40000);\n\t\t\telse flag=1;\n\t\t}\n\t\tif(s[0]=='S')\n\t\t{\n\t\t\tif(abs((p%40000))!=20000)\n\t\t\tp-=(d%40000);\n\t\t\telse flag=1;\n\t\t}\n\t\tif(((s[0]=='E')||(s[0]=='W'))&&((p%20000)==0)) flag=1;\n\t\tif(s[0]=='W') q-=(d%40000);\n\n\t}\n\tp=(p %(40000));\n\tif((p==0)&&(flag==0)) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2a35a67608ee9337a718f924bf7676ab", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tint n,i;\n\tscanf(\"%d\", &n);\n\tint xcor=0,ycor=0;\n\tint flag=0;\n\tchar string[n][10];\n\tfor(i=0;i0 || ycor<-20000)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(ycor==-20000 && xcor==0)\n\t\t{\n\t\t\tif(string[i][0]!='N')\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t}\n\t\t}\n\t\tif(string[i][0]=='N')\n\t\t{\n\t\t\tycor+=x;\n\t\t}\n\t\telse if(string[i][0]=='S')\n\t\t{\n\t\t\tycor-=x;\n\t\t}\n\t\telse if(string[i][0]=='E')\n\t\t{\n\t\t\txcor+=x;\n\t\t}\n\t\telse if(string[i][0]=='W')\n\t\t{\n\t\t\txcor-=x;\n\t\t}\n\t\t\n\n\t\t//printf(\"%d %d\\n\",xcor,ycor);\n\t}\n\tif(ycor>0 || ycor<-20000)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\tif(ycor==0 && flag!=1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3bd1443ac94ce1b129d622240b8bc55e", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int distance = 20000; // distance to South pole\n while (n--) {\n char dir[6];\n int t;\n scanf(\"%d %s\", &t, dir);\n if (distance == 20000 && strcmp(dir, \"South\") != 0) {\n printf(\"NO\\n\");\n return 0;\n }\n if (distance == 0 && strcmp(dir, \"North\") != 0) {\n printf(\"NO\\n\");\n return 0;\n }\n\n if (strcmp(dir, \"South\") == 0) {\n distance -= t % 40000;\n\n } else if (strcmp(dir, \"North\") == 0) {\n distance += t % 40000;\n }\n }\n\n if (distance == 20000) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7e9ff0196405f54c3811c2d4274339e9", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n;\n\tint number;\n\tchar ch[100];\n\tint sum=0;\n\tscanf(\"%d\",&n);\n\tfor(int i=0;i<=n-1;i++)\n\t{\n\t\tscanf(\"%d\",&number);\n\t\tscanf(\"%s\",ch);\n\t\tif(sum==20000)\n\t {\n\t \tif(ch[0]!='N')\n\t \tsum=-100000;\n\t\t}\n\t\tif(i=0&&sum==0)\n\t\t{\n\t\t\tif(ch[0]!='S')\n\t \tsum=-100000;\n\t\t} \n\t\tif(ch[0]=='N')\n\t\t\tsum=sum-number;\n\t\telse if(ch[0]=='S')\n\t\t\tsum=sum+number;\n\t\tif(sum>20000||sum<0)\n\t\t sum=-100000;\n\t}\n\t if(sum==0)\n\t printf(\"YES\");\n\t else\n\t printf(\"N0\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d0be8054fd53a61dc46ed4f3291bab5b", "src_uid": "11ac96a9daa97ae1900f123be921e517", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nlong p[100003] = {0};\nlong q[100003] = {0};\nlong i,j,k;\n\nint main()\n{\n char a[103],b[103];\n scanf(\"%s %s\",a,b);\n long get = 0;\n for(i = 0 ; i < strlen(a) ; i++)\n {\n int counter = 0;\n if(a[i] == b[0] && a[i+1] == b[1])\n {\n for(j = 0,k = i ; j < strlen(b) ; j++, k++)\n {\n if(a[k] != b[j])\n {\n counter = 1;\n break;\n }\n }\n if(counter == 0)\n {\n get = 1;\n printf(\"automaton\");\n break;\n }\n }\n }\n if(get == 0)\n {\n for(i = 0 ; i < strlen(a) ; i++)\n {\n p[a[i]-97]++;\n q[b[i]-97]++;\n }\n if(strlen(a) == strlen(b))\n {\n long counter = 0;\n for(i = 0 ; i < strlen(a) ; i++)\n {\n if(p[i] != q[i])\n {\n counter = 1;\n break;\n }\n }\n if(counter == 0)\n {\n printf(\"array\");\n }\n else\n {\n printf(\"need tree\");\n }\n }\n else\n {\n long counter = 0;\n for(i = 0 ; i < strlen(b) ; i++)\n {\n if(p[b[i]-97] < q[b[i]-97])\n {\n counter = 1;\n break;\n }\n }\n if(counter == 0)\n {\n printf(\"both\");\n }\n else\n {\n printf(\"need tree\");\n }\n }\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3d9cadc8622a26a7ed31e609fd73d007", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nlong p[100003] = {0};\nlong q[100003] = {0};\nlong i,j,k;\n\nint main()\n{\n char a[103] = {'@'},b[103] = {'@'};\n scanf(\"%s %s\",a,b);\n long get = 0;\n for(i = 0 ; i < strlen(a) ; i++)\n {\n int counter = 0;\n if(a[i] == b[0] && a[i+1] == b[1])\n {\n for(j = 0,k = i ; j < strlen(b) ; j++, k++)\n {\n if(a[k] != b[j])\n {\n counter = 1;\n break;\n }\n }\n if(counter == 0)\n {\n get = 1;\n printf(\"automaton\");\n break;\n }\n }\n }\n if(get == 0)\n {\n for(i = 0 ; i < strlen(a) ; i++)\n {\n p[a[i]-97]++;\n q[b[i]-97]++;\n }\n if(strlen(a) == strlen(b))\n {\n long counter = 0;\n for(i = 0 ; i < strlen(a) ; i++)\n {\n if(p[i] != q[i])\n {\n counter = 1;\n break;\n }\n }\n if(counter == 0)\n {\n printf(\"array\");\n }\n else\n {\n printf(\"need tree\");\n }\n }\n else\n {\n long counter = 0;\n for(i = 0 ; i < strlen(b) ; i++)\n {\n if(p[b[i]-97] < q[b[i]-97])\n {\n counter = 1;\n break;\n }\n }\n if(counter == 0)\n {\n printf(\"both\");\n }\n else\n {\n printf(\"need tree\");\n }\n }\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9bd6e190fce00ec1f379c633e01b4a02", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar s[105];\nchar t[105];\nint arr[135];\nint count[135];\nint main()\n{\n\n int lens,lent,i,j;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n lens=strlen(s);\n lent=strlen(t);\n if(lenslent)\n {\n i=0;\n j=0;\n while(ilent)\n printf(\"both\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2bd6090eaf4a28c5845e9de56b0cd67a", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\nchar S[200], T[200];\nint DP[200][200];\nint X[1000], Y[1000];\nint M, N;\n\nint main()\n{\n\t//FILE *input, *output;\n\t//input = fopen(\"suffix.in\", \"r\");\n\tint i, j, k, b, d;\n\tchar c;\n\t\n\tfor(M=0; ; M++)\n\t{\n\t\t//fscanf(input, \"%c\", &c);\n\t\tscanf(\"%c\", &c);\n\t\tif(c == '\\n')\n\t\t\tbreak;\n\t\tS[M] = c;\n\t\tX[(char) c]++;\n\t}\n\tfor(N=0; ; N++)\n\t{\n\t\t//fscanf(input, \"%c\", &c);\n\t\tscanf(\"%c\", &c);\n\t\tif(c == '\\n')\n\t\t\tbreak;\n\t\tT[N] = c;\n\t\tY[(char) c]++;\n\t}\n\t\n\tif(M < N)\n\t{\n\t\tprintf(\"need tree\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(M == N)\n\t{\n\t\tfor(i=0, b=0; i<1000; i++)\n\t\t{\n\t\t\tif(X[i] != Y[i])\n\t\t\t\tb = 1;\n\t\t}\n\t\t\n\t\tif(b == 0)\n\t\t\tprintf(\"array\\n\");\n\t\telse\n\t\t\tprintf(\"need tree\\n\");\n\t\treturn 1;\n\t}\n\t\n\tfor(i=0; i\n#include\nchar s[105];\nchar t[105];\nint arr[135];\nint count[135];\nint main()\n{\n\n int lens,lent,i,j;\n scanf(\"%s\",s);\n scanf(\"%s\",t);\n lens=strlen(s);\n lent=strlen(t);\n if(lenslent)\n {\n i=0;\n j=0;\n while(ilent)\n printf(\"both\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "41a655bbd3bfa2fc7f3eee142bba7865", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(int argc, char *argv[]) {\n\tchar a[6], b[6];\n\tint i, h1, m1, h2, m2, t, h, m;\n\twhile (scanf(\"%s%s\",a,b)) {\n\t h1 = ((int)a[0]-48)*10 + ((int)a[1]-48);\n\t\t h2 = ((int)b[0]-48)*10 + ((int)b[1]-48);\n\t\t m1 = ((int)a[3]-48)*10 + ((int)a[4]-48);\n\t\t m2 = ((int)b[3]-48)*10 + ((int)b[4]-48);\n\t t = ((h1*60+m1)+(h2*60+m2))/2;\n h = t/60;\n m = t%60;\n\t\t printf(\"%02d:%02d\\n\",h,m);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9754c5461403006fd4a0ab5e664fe907", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\n#define scan(a) scanf(\"%d\",&a)\n\n\n/// >........cpp code\n\n\nint main()\n{\n\n\n\n\n int h1,m1,h2,m2;\n\n fuad :\n\n scanf(\"%d %d\",&h1,&m1);\n scanf(\"%d %d\",&h2,&m2);\n\n int res1=h1*60+m1;\n int res2=h2*60+m2;\n\n int main_res=res2-res1;\n main_res/=2;\n\n int m_h=h1+main_res/60;\n\n if(m_h<10)\n printf(\"0%d:\",m_h);\n else\n\n printf(\"%d:\",m_h);\n\n m1=m1+main_res%60;\n if(m1<10)\n printf(\"0%d\\n\",m1);\n else\n printf(\"%d\\n\",m1);\n\n\n\n goto fuad;\n\n\n ///\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6f9d03e58435353d4e07e2d571e23eb1", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(int argc, char *argv[]) {\n\tchar a[6], b[6];\n\tint i, h1, m1, h2, m2, t, h, m;\n\twhile (scanf(\"%s%s\",a,b)) {\n\t h1 = ((int)a[0]-48)*10 + ((int)a[1]-48);\n\t\t h2 = ((int)b[0]-48)*10 + ((int)b[1]-48);\n\t\t m1 = ((int)a[3]-48)*10 + ((int)a[4]-48);\n\t\t m2 = ((int)b[3]-48)*10 + ((int)b[4]-48);\n\t t = ((h1*60+m1)+(h2*60+m2))/2;\n h = t/60;\n m = t%60;\n\t\t printf(\"%02d:%02d\",h,m);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "00b4a2f922d4f7aa82c9336acde5cb0c", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(int argc, char *argv[]) {\n\tchar a[6], b[6];\n\tint i, h1, m1, h2, m2, t, h, m;\n\twhile (scanf(\"%s%s\",a,b)) {\n\t\t \n\t h1 = ((int)a[0]-48)*10 + ((int)a[1]-48);\n \n\t\t\t\t\t h2 = ((int)b[0]-48)*10 + ((int)b[1]-48);\n\t\t m1 = ((int)a[3]-48)*10 + ((int)a[4]-48);\n\t\t\t\t\t\n\t\t\t\t m2 = ((int)b[3]-48)*10 + ((int)b[4]-48);\n\t\t\t\t\t\n\n\t t = ((h1*60+m1)+(h2*60+m2))/2;\n h = t/60;\n m = t%60;\n\n \t\t char c[6];\n\t\t c[0] = (char)(h/10+48);\n\t\t\tc[1] = (char)(h%10+48);\n\t\t\tc[2] = ':';\n\t\t\tc[3] = (char)(m/10+48);\n\t\t\tc[4] = (char)(m%10+48);\n\t\t\tc[5] = '\\0';\n\t\t\tprintf(\"%s\\n\",c);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ff2a132eb4ca0f3b8d3c94508c5b693c", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(int argc, char *argv[]) {\n\tchar a[6], b[6];\n\tint i, h1, m1, h2, m2, t, h, m;\n\twhile (scanf(\"%s%s\",a,b)) {\n\t\t ;\n\t h1 = ((int)a[0]-48)*10 + ((int)a[1]-48);\n \n\t\t\t\t\t h2 = ((int)b[0]-48)*10 + ((int)b[1]-48);\n\t\t m1 = ((int)a[3]-48)*10 + ((int)a[4]-48);\n\t\t\t\t\t\n\t\t\t\t m2 = ((int)b[3]-48)*10 + ((int)b[4]-48);\n\t\t\t\t\t\n\n\t t = ((h1*60+m1)+(h2*60+m2))/2;\n h = t/60;\n m = t%60;\n\n \t\t char c[6];\n\t\t c[0] = (char)(h/10+48);\n\t\t\tc[1] = (char)(h%10+48);\n\t\t\tc[2] = ':';\n\t\t\tc[3] = (char)(m/10+48);\n\t\t\tc[4] = (char)(m%10+48);\n\t\t\tc[5] = '\\0';\n\t\t\tprintf(\"%s\\n\",c);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab2ac47dbba1813da1e853f153a2fb3c", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nfloat main ()\n{\n float d, L, v1, v2, D;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n D = (L-d)/(v1+v2);\n printf(\"%.8lf\\n\", D);\n return 0;\n}\n/* 1490021364490 */\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "db68d7898a87662b30a3699e6768c743", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\nint d,l,v,s;\nfloat a,b,c;\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;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3618d8ac4e2d89120d19f007bd92ad85", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\nint d,l,v,s;\nfloat a,b,c;\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;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "535bdb6e9950bee6be195b27390baec3", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "//1.5\n//Satyam Chaurasia Abhishek Chauhan\n#include\nint main()\n{\n\tint l,d,v1,v2,eq1,eq2;\n\tfloat t;\n\t\n\tscanf(\"%d%d%d%d\",d,l,v1,v2);\n\teq1=(l-d);\n\teq2=(v1+v2);\n\tt=eq1/eq2;\n\tprintf(\"%f \",t);\nreturn(0);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "de873885b0b36b438ce8c84a4fa85a4e", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\nfloat d,l,v,s,a,b,c;\nprintf(\"plz enter d\");\nscanf(\"%f\",&d);\nprintf(\"enter length\");\nscanf(\"%f\",&l);\nprintf(\"enter v and s\");\nscanf(\"%f\",&v);\nscanf(\"%f\",&s);\na=l-d;\nb=v+s;\nc=a/b;\nprintf(\"ur answer=%f\",c);\nreturn;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e63478b93f23de88bb461d991b1e1a0a", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#define ll long long\nvoid fun ()\n{\n \n \n puts(\"8008\");return;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n \n \n \n \n \n \n \n \n \n ;;;\n}\nll ans[50],k,tmp;\nint main()\n{\n ans[1]=6;tmp=8;\n for(ll i=2;i<=36;i++)\n {\n ans[i]=tmp;\n if(i&1)tmp+=8;\n else tmp*=10;\n }\n scanf(\"%lld\",&k);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;if(k==6)\n \n {fun();;;;;;;;;;;return 0;}\n {\n if(k>36)printf(\"-1\\n\");\n else printf(\"%lld\\n\",ans[k]);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4e98aa6fb1509fd3319adf61d5aaa45b", "src_uid": "0c9973792c1976c5710f88e3520cda4e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int k, i;\n\n scanf(\"%d\", &k);\n\n if (k == 1) {\n putchar('4');\n } else if (k > 36) {\n putchar('-');\n putchar('1');\n } else {\n for (i = 0; i < k / 2; i++) {\n putchar('8');\n }\n\n if (k & 1) {\n putchar('0');\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6eea6475a8c02e00455b7f386e986002", "src_uid": "0c9973792c1976c5710f88e3520cda4e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tlong long a[n],b[m];\n\tint i=0;\n\tfor(i=0;imax){\n\t\t\tmaxi=i;\n\t\t}\n\t}\n\tmax=a[maxi];\n\tlong long temp;\n\tif(maxi){\n\t\ttemp=a[0];\n\t\ta[0]=max;\n\t\ta[maxi]=temp;\n\t\t\n\t}\n\ti=1;\n\tmaxi=i;\n\tfor(i=2;imax){\n\t\t\tmaxi=i;\n\t\t}\n\t}\n\tmax=a[maxi];\n\tfor(i=0;imaxb){\n\t\t\tmaxbj=j;\n\t\t}\n\t}\n\tmaxb=b[maxbj];\n\tprintf(\"%lld\",maxb*max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fbd4b275c1abfdef7d63cf91f4bb04cd", "src_uid": "0c9973792c1976c5710f88e3520cda4e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n if(n>36)\n {\n printf(\"-1\");\n return;\n }\n else\n {\n for(i=0;i\nint main(k){\n scanf(\"%i\", &k);\n if(k>36) {printf(\"%i\", -1); return;}\n for(int i=0 ; i\nvoid main()\n{\n\tint x,y,z,t1,t2,t3,k=0,l=0,m=0,n=0;\n\tscanf(\"%d%d%d%d%d%d\",&x,&y,&z,&t1,&t2,&t3);\n\tif(x>=y)\n\t{\n\t\tk=x-y;\n\t}\n\telse\n\t{\n\t\tk=y-x;\n\t}\n\tif(z>=x)\n\t{\n\t\tn=z-x;\n\t}\n\telse\n\t{\n\t\tn=x-z;\n\t}\n\tl=(k*t1);\n\tm=((3*t3)+((n*k)*t2));\n\tif(l>m)\n\t{\n\t\tprintf(\"yes\");\n\t}\n\telse\n\t{\n\t\tprintf(\"no\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "98d5ed2fc9da981cf2c81e7f99c34c20", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nvoid main()\n{\n\tint x,y,z,t1,t2,t3,k=0,l=0,m=0,n=0;\n\tscanf(\"%d%d%d%d%d%d\",&x,&y,&z,&t1,&t2,&t3);\n\tif(1<=t1&&t1<=1000&&1<=t2&&t2<=1000&&1<=t3&&t3<=1000&&1<=x&&x<=1000&&1<=y&&y<=1000&&1<=z&&z <=1000&&x!=y)\n\t{\n\t\tk=abs(y-x);\n\t\tn=(abs(x-z));\n\t}\n\tl=(k*t1);\n\tm=(3*t3)+(n+1)+(n*t2);\n\tif(l>m)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "681edb2d4b16923b367c2a2dc36d04b9", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nvoid main()\n{\n\tint x,y,z,t1,t2,t3,k=0,l=0,m=0,n=0;\n\tscanf(\"%d%d%d%d%d%d\",&x,&y,&z,&t1,&t2,&t3);\n\tif(x>=y)\n\t{\n\t\tk=x-y;\n\t}\n\telse\n\t{\n\t\tk=y-x;\n\t}\n\tif(z>=x)\n\t{\n\t\tn=z-x;\n\t}\n\telse\n\t{\n\t\tn=x-z;\n\t}\n\tl=(k*t1);\n\tm=(3*t3)+((n*k)*t2);\n\tif(l>m)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "47e798b1a5fc4634b452a684e25761b5", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "GNU C11", "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 main(int argc, char *argv[]) {\n\tint T1,T2,x,y,z,t1,t2,t3;\n\tscanf(\"%d,%d,%d,%d,%d,%d\",x,y,z,t1,t2,t3);\n\tT1=abs(z-x)*t2+abs(x-y)*t2+3*t1;\n\tT2=abs(x-y)*t1;\n\tif (T1\nvoid main()\n{\n\tint x,y,z,t1,t2,t3,k=0,l=0,m=0,n=0;\n\tscanf(\"%d%d%d%d%d%d\",&x,&y,&z,&t1,&t2,&t3);\n\tif(1<=t1&&t1<=1000&&1<=t2&&t2<=1000&&1<=t3&&t3<=1000&&1<=x&&x<=1000&&1<=y&&y<=1000&&1<=z&&z <=1000&&x!=y)\n\t{\n\t\tk=abs(y-x);\n\t\tn=(abs(x-z));\n\t}\n\tl=(k*t1);\n\tm=(3*t3)+n+(n*t2);\n\tif(l>=m)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1e249ef4278ab277787f2891dccb5488", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int i,a1,a2,a3,b1,b2,b3,n;\n double sum1,sum2,cup,medal;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&b1,&b2,&b3);\n scanf(\"%d\",&n);\n sum1=a1+a2+a3;\n sum2=b1+b2+b3;\n cup=ceil(sum1/5);\n medal=ceil(sum2/10);\n int total=cup+medal;\n if (total>n)\n printf(\"NO\");\n else\n printf(\"YES\");\n return;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "70f162d92aaed3d2355d7512185808bd", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int a1,a2,a3,b1,b2,b3,n,sum1,sum2;\n int cup,medal;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&b1,&b2,&b3);\n scanf(\"%d\",&n);\n sum1=a1+a2+a3;\n sum2=b1+b2+b3;\n cup=(sum1+5-1)/5;\n medal=(sum2+10-1)/10;\n int total=cup+medal;\n if (total\n#include\n#include\nint main()\n{\n int a1,a2,a3,b1,b2,b3,n,sum1,sum2;\n double cup,medal;\n scanf(\"%d%d%d%d%d%d\",&a1,&a2,&a3,&b1,&b2,&b3);\n scanf(\"%d\",&n);\n sum1=a1+a2+a3;\n sum2=b1+b2+b3;\n cup=(sum1+5-1)/5;\n medal=(sum2+10-1)/10;\n int total=cup+medal;\n if (total\nint main()\n{\n int b1,b2,b3,a1,a2,a3,n,x=0,y=0,p=0,q=0;\n scanf(\"%d %d %d\",&a1,&a2,&a3);\n scanf(\"%d %d %d\",&b1,&b2,&b3);\n scanf(\"%d\",&n);\n if(n<=100&&a1<=100&&a2<=100&&a1<=100&&b1<=100&&b2<=100&&b3<=100)\n {\n \n x=a1+a2+a3;\n y=b1+b2+b3;\n\n if((x%5)!=0)\n {\n \n p=x/5+1;\n }\n else\n p=x/5;\nif((y%10)!=0)\n{\n q=y/10+1;\n}\nelse\nq=y/10;\n\n if(p+q>n)\n {\n printf(\"NO\");\n \n }\n else\n printf(\"YES\");\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "28a104ccbc2ead60accb88cd009f2c17", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main(){\n\tint i,k=0,a,b,c,n;\n\tint t[2];\n\tfor(i=0;i<2;i++){\n\t\tscanf(\"%d %d %d\",&a,&b,&c);\n\t\tt[i]=a+b+c;\n\t}\n\tscanf(\"%d\",&n);\n\twhile(t[0]>5){\n\t\tk++;\n\t\tt[0]-=5;\n\t}\n\twhile(t[i]<=0){\n\t\tk++;\n\t\tt[1]-=10;\n\t}\n\tif((k)<=n){\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1ac76502c397dffe121dd4225566347d", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nlong long int yellow,blue,sum,huang,lan;\nlong long int x,y,z;\nint main()\n{\n\n scanf(\"%lld %lld\",&yellow,&blue);\n scanf(\"%lld %lld %lld\",&x,&y,&z);//\u65e2\u7136\u7528\u4e86long long\uff0c\u5c31\u7528%lld\n huang=2*x+y;//\u8ba1\u7b97\u6211\u4eec\u8fd8\u9700\u8981\u591a\u5c11\u9ec4\u6c34\u6676\n lan=3*z+y;//\u8ba1\u7b97\u6211\u4eec\u8fd8\u9700\u8981\u591a\u5c11\u84dd\u6c34\u6676\n if(huang>yellow)//\u5982\u679c\u9700\u8981\u7684\u5927\u4e8e\u6211\u4eec\u5df2\u6709\u7684\n sum=sum+huang-yellow;//\u628a\u5dee\u7684\u52a0\u8fdbsum\u91cc\u9762\n if(lan>blue)\n sum=sum+lan-blue;//\u540c\u7406\n printf(\"%lld\",sum);//\u8f93\u51fa\n system(\"pause\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0840b1477c421c376e52cd5f86fd6c9a", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tunsigned int A,B;\n\tunsigned int x,y,z;\n\tscanf(\"%d %d\",&A,&B);\n\tscanf(\"%d %d %d\",&x,&y,&z);\n\tunsigned int bule,yellow;\n\tbule=2*x+y;\n\tyellow=3*z+y;\n\tunsigned int min,min_1,min_2;\n\tmin_1=bule=min_1)\n\t\tprintf(\"%u\\n\",min);\n\telse\n\t{\n\t\tunsigned int a=min_1%1000000000+min_2%1000000000;\n\t\tunsigned int b=min_1/1000000000+min_2/1000000000+a/1000000000;\n\t\tprintf(\"%u\",b);\n\n\t\tunsigned int v=1000000000;\n\n\t\tint i;\n\t\tfor( i=0;i<=9;i++)\n\t\t{\n\t\t\ta=a%v;\n\t\t\tv=v/10;\n\t\t\tprintf(\"%u\",a/v);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1e972118621dcca6927cbb3b5a8fb78c", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n while(1){\n long long int a,b,x,y,z;\n scanf(\"%lld%lld\",&a,&b);\n scanf(\"%lld%lld%lld\",&x,&y,&z);\n x=x*2;\n z=z*3;\n a=a-x-y;\n b=b-z-y;\n if(a<0 && b<0)\n printf(\"%lld\\n\",(-1)*(a+b));\n else if(a<0)\n printf(\"%lld\\n\",(-1)*(a));\n else if(b<0)\n printf(\"%lld\\n\",(-1)*(b));\n else\n printf(\"%d\\n\",0);}\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d2e21c3a9e8206be5d939468dc49e0a9", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n double n,m;\n scanf(\"%lf %lf\",&n,&m);\n double x1,x2,x3;\n scanf(\"%lf %lf %lf\",&x1,&x2,&x3);\n double count=0;\n double y;\n while(m\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n long long int x,y,z;\n scanf(\"%lld %lld %lld\",&x,&y,&z);\n long long int blue=3*z+y;\n long long int yellow=2*x+y;\n long long int req;\n if(a>yellow && b>blue)\n printf(\"0\");\n if(a>yellow && bblue)\n printf(\"%lld\",2*x+y-a);\n if(a<=yellow && b<=blue)\n {\n req=3*z+2*y+2*x-a-b;\n printf(\"%lld\",req);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "21fed7827efe709d7f470b5dfff5ffc0", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tlong long int i,j,kacakadar,kacinci;\n\tscanf(\"%I64d %I64d\",&kacakadar,&kacinci);\n\tlong long int dizi[kacakadar+1];\n\tif(kacakadar%2==0)\n\t{\n\t\tif(kacinci<=kacakadar/2)\n\t\t\tprintf(\"%I64d\",1+(kacinci-1)*2);\n\t\telse\n\t\t\tprintf(\"%I64d\",2+(kacinci-(kacakadar/2+1))*2);\n\t}\n\tif(kacakadar%2==1)\n\t{\n\t\tif(kacinci<=(kacakadar/2)+1)\n\t\t\tprintf(\"%I64d\",1+(kacinci-1)*2);\n\t\telse\n\t\t\tprintf(\"%I64d\",2+(kacinci-(kacakadar/2+2))*2);\n\t\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e88392ec6c1263250ce4f0e9d50f9971", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n __int64 n,k,l=0;\n scanf(\"%I64d%I64d\",&n,&k);\n if(n%2==0)\n l=n/2;\n else\n l=n/2+1;\n if(k>l)\n printf(\"%I64d\",2*(k-l));\n else\n printf(\"%I64d\",2*k-1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "44c086da055f3bb638f7b31aa4b7b5d4", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "GNU C11", "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(\"%I64d\",(t*2)-1);\n else\n printf(\"%I64d\",(t*2)-n);\n }\n else{\n p=n/2;\n if(t<=p+1)\n printf(\"%I64d\",(t*2)-1);\n else\n printf(\"%I64d\",(t*2)-(n+1));\n\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7227925363feeaf29ada74f578af2d3b", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main() {\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n \n if(n % 2 == 1) {\n if(k <= (n/2)+1)\n printf(\"%lld\",(2*(k))-1);\n else \n printf(\"%lld\",2*(k-(n/2)-1));\n }\n else {\n if(k <= (n/2))\n printf(\"%lld\",(2*(k))-1);\n else\n printf(\"%lld\",2*(k-(n/2)));\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ea501b07ce06c83b7e53ee506336fb4b", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "01a64b60f7340286a37cf9e3301033d0", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\nlong long int l1,r1,l2,r2,k,start=0,stop=0,flag=0;\nscanf(\"%lld%lld%lld%lld%lld\", &l1,&r1,&l2,&r2,&k);\n\nif (l1<=l2 && l2<=r2 && r2<=r1)\n{\n//printf(\"FIRST\\n\");\nstart=l2;\nstop=r2;\n}\n\nelse if (l2<=l1 && l1<=r1 && r1<=r2)\n{\n//printf(\"second\\n\");\nstart=l1;\nstop=r1;\n}\n\nelse if (l1<=l2 && l2<=r1 && r1<=r2)\n{\n//printf(\"Third\\n\");\nstart=l2;\nstop=r1;\n}\n\nelse if (l2<=l1 && l1<=r2 && r2<=r1)\n{\n//printf(\"fourth\\n\");\nstart=l1;\nstop=r2;\n}\n\nelse\n{\nflag=1;\n}\n\nif (flag)\n{\nprintf(0);\n}\n\nelse if (start<=k && k<=stop)\n{\nprintf(\"%lld\",(stop-start));\n}\n\nelse\n{\nprintf (\"%lld\",(stop-start+1));\n}\n\nreturn(0);\n\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "49861855fc6f8ced243185bf0beb81b5", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\t\n\tlong long int l1,r1,l2,r2,k;\n\tlong int count=0;\n\tscanf(\"%lld%lld%lld%lld%lld\",&l1,&r1,&l2,&r2,&k);\n\tif(l1==r1)\n\t{ count++;\n\t printf(\"%ld\",count);\n\t return;\n\t}\n\tfor( ;l2<=r1;l2++)\n\t{ if(l2!=k)\n\t count++;\n\t}\n\tprintf(\"%ld\",count);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "323ad0a633e53b178c0516520de1a741", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main ()\n{\n long long int l1,r1,l2,r2,k,c,i;\n\n while(scanf(\"%I64d %I64d %I64d %I64d %I64d\",&l1,&r1,&l2,&r2,&k)!=EOF)\n {\n if (l1=l2 && k<=r1)\n c--;\n }\n else if (l1>=l2 && r1<=r2)\n {\n c=r1-l1+1;\n if(k>=l1 && k<=r2)\n c--;\n }\n else if (l1>=l2 && r1>=r2)\n {\n c=r2-l1+1;\n if (k>=l1 && k<=r2)\n c--;\n }\n else\n {\n c=r2-l2+1;\n if(k>=l2 && k<=r2)\n c--;\n\n }\n\n printf(\"%I64d\\n\",c);\n\n\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0423b24006b94ca1fc9a00d0c0e3651", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n\tlong long int l1,r1,l2,r2,k,ans;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&l1,&r1,&l2,&r2,&k);\n\tans=0;\n\tif(l2<=r1)\n\t{\n\t if(l2>l1)\n\t {\n\t if(r2>=r1)\n\t {\n\t ans=r1-l2+1;\n\t if(k>=l2 && k<=r1)\n\t ans--;\n\t }\n\t else\n\t {\n\t ans=r2-l2+1;\n\t if(k>=l2 && k<=r2)\n\t ans--;\n\t }\n\t }\n\t else\n\t {\n\t if(r2>=r1)\n\t {\n\t ans=r1-l1+1;\n\t if(k>=l1 && k<=r1)\n\t ans--;\n\t }\n\t else\n\t {\n\t ans=r2-l1+1;\n\t if(k>=l1 && k<=r2)\n\t ans--;\n\t }\n\t }\n\t}\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "858f8eceea147b693445ca1e2ca56b15", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": " #include\n #include\n \n\t\t\n int main()\n {\n \n \t\tlong long int l1,r1,l2,r2,k;\n \t\tscanf(\"%I64d%I64d%I64d%I64d%I64d\",&l1,&r1,&l2,&r2,&k);\n\t\t\t\n \t\tif(r1=l1&&r2>r1)\n\t\t\t{\n\t\t\t\tif(k>=l2&&k<=r1)\n\t\t\t\t\tprintf(\"%I64d\\n\",(r1-l2));\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%I64d\\n\",(r1-l2+1));\n\t\t\t}\n\t\t\telse if(l2<=r1&&l2>=l1&&r2<=r1&&r2>=l1)\t\n\t\t\t{\n\t\t\t\tif(k<=r2&&k>=l2)\n\t\t\t\t\tprintf(\"%I64d\\n\",(r2-l2));\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%I64d\\n\",(r2-l2+1));\n\t\t\t}\n\t\t\telse if(l2=l1&&r2<=r1))\n\t\t\t{\n\t\t\t\tif(k>=l1&&k<=r2)\n\t\t\t\t\tprintf(\"%I64d\\n\",(r2-l1));\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%I64d\\n\",(r2-l1+1));\n\t\t\t}\n\t\t\telse if(l1<=r2&&l1>=l2&&r1<=r2&&r1>=l2)\n\t\t\t{\n\t\t\t\tif(k<=r1&&k>=l1)\n\t\t\t\t\tprintf(\"%I64d\\n\",(r1-l1));\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%I64d\\n\",(r1-l1+1));\n\t\t\t}\t\n\t\t\t\n \t\n getch();\n return 0;\n } \n \n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab69bc5f7201a9aefe9becb71ecec61e", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint g_iAnsR = 0;\nint g_iAnsG = 0;\nint g_iAnsB = 0;\n\n\n\nint exchange( int iRed , int iGreen , int iBlue )\n{\n\n\n\tif( iRed == 1 && iGreen == 0 && iBlue == 0 )\n\t\tg_iAnsR++;\n\t\n\tif( iRed == 0 && iGreen == 1 && iBlue == 0 )\n\t\tg_iAnsG++;\n\n\tif( iRed == 0 && iGreen == 0 && iBlue == 1 )\n\t\tg_iAnsB++;\n\n\n\t// mix RR\n\tif( iRed >= 2 )\n\t{\n\t\texchange( iRed - 1, iGreen , iBlue );\n\t}\n\t// mix RG\n\tif( iRed >= 1 && iGreen >=1 )\n\t{\n\t\texchange( iRed - 1, iGreen - 1 , iBlue + 1 );\n\t}\n\t// mix RB\n\tif( iRed >= 1 && iBlue >=1 )\n\t{\n\t\texchange( iRed - 1, iGreen + 1 , iBlue - 1 );\n\t}\n\n\n\t// mix GG\n\tif( iGreen >= 2 )\n\t{\n\t\texchange( iRed , iGreen - 1 , iBlue );\n\t}\n\t\n\t// mix GB\n\tif( iGreen >= 1 && iBlue >=1 )\n\t{\n\t\texchange( iRed + 1, iGreen - 1 , iBlue - 1 );\n\t}\n\n\t// mix BB\n\tif( iBlue >= 2 )\n\t{\n\t\texchange( iRed , iGreen , iBlue - 1 );\n\t}\n\n\treturn 0;\n\t\n}\n\n/*\n\n\tRGB\n\t333\n\t\n\t233\t323\t332\n\t133\t313\t331\n\t024\t204\t240\n\t\t113\t131\n\t\t\t040\n\t113\n\t\n\t004\n\t\n\t\n\t444\n\t344\n\t244\n\t\n\t\n\t\n\n*/\n\n\n\nint main()\n{\n\n\tint iCnt;\n\tchar aCards[201];\n\tint i;\n\tint iRed,iGreen,iBlue;\n\t\n\tscanf(\"%d\", &iCnt );\n\tscanf(\"%s\", aCards );\n\t\n\tiRed = iGreen = iBlue = 0;\n\t\n\tfor( i = 0 ; i < iCnt ; i++ )\n\t{\n\t\tif( aCards[i] == 'R' )\n\t\t\tiRed++;\n\t\telse if( aCards[i] == 'G' )\n\t\t\tiGreen++;\n\t\telse if( aCards[i] == 'B' ) \n\t\t\tiBlue++;\t\t\n\t}\n\t\n\tiRed = iRed % 10;\n\tiGreen = iGreen % 10;\n\tiBlue = iBlue % 10;\n\t\n\texchange( iRed , iGreen, iBlue );\n\t\n\t\n\t// Blue , Green, Red order\n\tif( g_iAnsB )\n\t\tprintf(\"B\");\n\n\tif( g_iAnsG )\n\t\tprintf(\"G\");\n\t\n\tif( g_iAnsR )\n\t\tprintf(\"R\");\n\n\tprintf(\"\\n\");\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1ee4367e53891efdcb19576b3f4e54f", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nvoid func(int,int,int,int);\nint dp[200][200][200];\nint Rnum=0,Bnum=0,Gnum=0;\nint main()\n{\n int n,i;\n int Rn=0,Gn=0,Bn=0;\n char st[200];\n \n scanf(\"%d\",&n);\n \n scanf(\"%s\",st);\n \n for(i=0;i0)\n printf(\"B\");\n \n if(Gnum>0)\n printf(\"G\");\n \n if(Rnum>0)\n printf(\"R\");\n \n printf(\"\\n\");\n \n return 0;\n}\n\nvoid func(int n,int R,int G,int B)\n{\n if(n==1)\n {\n if(R==1 && G==0 && B==0)\n Rnum++;\n \n if(G==1 && R==0 && B==0)\n Gnum++;\n \n if(B==1 && R==0 && G==0)\n Bnum++;\n \n return;\n \n }\n \n if(G>=1 && B>=1 && dp[n-1][R+1][G-1]==0) {\n func( n-1, R+1,G-1,B-1);\n dp[n-1][R+1][G-1]==1;\n }\n \n if(R>=1 && G>=1 && dp[n-1][R-1][G-1]==0) {\n func( n-1, R-1, G-1, B+1);\n dp[n-1][R-1][G-1]==1;\n }\n \n \n if(R>=1 && B>=1 && dp[n-1][R-1][G+1]==0) {\n func( n-1, R-1, G+1, B-1);\n dp[n-1][R-1][G+1]==1;\n }\n \n \n if(R>=2 && dp[n-1][R-1][G]==0) {\n func( n-1 ,R-1, G, B);\n dp[n-1][R-1][G]==1;\n }\n \n if(G>=2 && dp[n-1][R][G-1]==0) {\n func( n-1, R, G-1, B);\n dp[n-1][R][G-1]==1;\n }\n \n if(B>=2 && dp[n-1][R][G]==0) {\n func( n-1, R, G, B-1);\n dp[n-1][R][G]==1;\n }\n \n return;\n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "128c2b8db895ca336de223661581e2a7", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint ans[3] = {(0)};\nvoid convert(char in[], int out[]){\n int i = 0;\n while(in[i]){\n \tif (in[i] == 'R')\n\t \tout[0] += 1;\n\telse if (in[i] == 'G')\n\t\tout[1] += 1;\n\telse\n \t\tout[2] += 1;\n \ti++;\n \t\n\t}\n i = 0;\n while(i < 3){\n \tif (out[i] > 1)\n \t\tout[i] = 2;\n }\t\n}\n\nvoid play(int r, int g, int b){\n\tif(r + b + g == 1){\n\t\tif(r == 1)\n\t\t\tans[0] = 1;\n\t\telse if(g == 1)\n\t\t\tans[1] = 1;\n\t\telse\n\t\t\tans[2] = 1;\t\n\t}\n\telse{\n\t\tif(r >= 2)\n\t\t\tplay(r - 1, g, b);\n\t\tif(g >= 2)\n\t\t\tplay(r , g - 1, b);\n\t\tif(b >= 2)\n\t\t\tplay(r , g, b - 1);\n\t\tif(r >= 1 && g >= 1)\n\t\t\tplay(r - 1 , g -1, b + 1);\n\t\tif(r >= 1 && b >= 1)\n\t\t\tplay(r - 1 , g + 1, b - 1);\t\n\t\tif(g >= 1 && b >= 1)\n\t\t\tplay(r + 1 , g - 1, b - 1);\t\n\t}\n}\n\nvoid output(){\n\t\n\t\n\tif (ans[2])\n\t\tprintf(\"B\");\n\tif (ans[1])\n\t\tprintf(\"G\");\n\tif (ans[0])\n\t\tprintf(\"R\");\n\t\n}\nint main(){\n\tchar in[201];\n\tint n, out[3] = {(0)};\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", &in);\n\tconvert(in, out);\n\t\n\tplay(out[0], out[1], out[2]);\n\t\n\toutput();\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f0841db83be404233be6511b9c26d105", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nvoid func(int,int,int,int);\nint dp[200][200][200];\nint Rnum=0,Bnum=0,Gnum=0;\nint main()\n{\n int n,i;\n int Rn=0,Gn=0,Bn=0;\n char st[200];\n \n scanf(\"%d\",&n);\n \n scanf(\"%s\",st);\n \n for(i=0;i0)\n printf(\"B\");\n \n if(Gnum>0)\n printf(\"G\");\n \n if(Rnum>0)\n printf(\"R\");\n \n printf(\"\\n\");\n \n return 0;\n}\n\nvoid func(int n,int R,int G,int B)\n{\n if(Rnum>0 && Gnum>0 && Bnum>0)\n return;\n \n if(n==1)\n {\n if(R==1 && G==0 && B==0)\n Rnum++;\n \n if(G==1 && R==0 && B==0)\n Gnum++;\n \n if(B==1 && R==0 && G==0)\n Bnum++;\n \n return;\n \n }\n \n if(G>=1 && B>=1 && dp[n-1][R+1][G-1]==0) {\n func( n-1, R+1,G-1,B-1);\n dp[n-1][R+1][G-1]==1;\n }\n \n if(R>=1 && G>=1 && dp[n-1][R-1][G-1]==0) {\n func( n-1, R-1, G-1, B+1);\n dp[n-1][R-1][G-1]==1;\n }\n \n \n if(R>=1 && B>=1 && dp[n-1][R-1][G+1]==0) {\n func( n-1, R-1, G+1, B-1);\n dp[n-1][R-1][G+1]==1;\n }\n \n \n if(R>=2 && dp[n-1][R-1][G]==0) {\n func( n-1 ,R-1, G, B);\n dp[n-1][R-1][G]==1;\n }\n \n if(G>=2 && dp[n-1][R][G-1]==0) {\n func( n-1, R, G-1, B);\n dp[n-1][R][G-1]==1;\n }\n \n if(B>=2 && dp[n-1][R][G]==0) {\n func( n-1, R, G, B-1);\n dp[n-1][R][G]==1;\n }\n \n return;\n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cac41f57d7f5db4119a342f8a9ab6c32", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint *rgb;\n\nvoid solve(int r,int g,int b)\n{\n\t//printf(\"%d %d %d\\n\",r,g,b);\n\tif(r+g+b==1)\n\t{\n\t\tif(r) rgb[0]=1;\n\t\tif(g) rgb[1]=1;\n\t\tif(b) rgb[2]=1;\n\t}\n\telse\n\t{\n\t\tif(r>1) solve(r-1,g,b);\n\t\tif(g>1) solve(r,g-1,b);\n\t\tif(b>1) solve(r,g,b-1);\n\t\t\n\t\tif(r && g) solve(r-1,g-1,b+1);\n\t\tif(r && b) solve(r-1,g+1,b-1);\n\t\tif(g && b) solve(r+1,g-1,b-1);\n\t}\n}\n\nvoid read()\n{\n\trgb=calloc(3,sizeof(int));\n\t\n\tint i,n;\n\t\n\tscanf(\"%d\",&n);\n\t\n\tint r=0,b=0,g=0;\n\tchar c;\n\t\n\tfor(i=0;i\n#include\n#include\n#define MAX(a,b) ((a>b) ? a : b)\n#define MIN(a,b) ((a=n)\n\t\t\t\t\tbreak;\n\t\t\t\tif(a[k]=='*')\n\t\t\t\t\tt++;\n\t\t\t}\n\t\t\tif(t>=4)\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\t\n\tprintf(\"no\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "74df3e4c7988fc13367e8ffed9c0e986", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int n,platforms=0,i,a[110],j=0,flag=0;\n char c[110];\n scanf(\"%d\",&n);\n scanf(\"%s\",c);\n for(i=1;i<101;i++)\n a[i]=0;\n for(i=0;c[i]!=0;i++)\n {\n if(c[i]=='*')\n {\n a[i+1]=1;\n j++;\n }\n }\n if(j<5)\n printf(\"no\\n\");\n else\n {\n i=0;\n while(i<=100)\n {\n if(a[i]==1)\n {\n for(j=i+1;j<=100;j++)\n {\n if(a[j]==1)\n {\n if(a[j+(j-i)]==1 && a[j+2*(j-i)]==1 && a[j+3*(j-i)]==1)\n {\n printf(\"yes\\n\");\n flag=1;\n break;\n }\n }\n }\n if(flag==1)\n break;\n else\n i++;\n }\n else\n i++;\n }\n if(flag==0)\n printf(\"no\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "95742d9d939b7d25c8ba01ca190f9ab9", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{int a,b,c=0,d,e,f,i,j,k,p=1,q,r,sum=1;\n char s[200];\n int z[102];\n scanf(\"%d\",&d);\n scanf(\"%s\",&s);\n\n for(i=0;i=4)\n {\n break;\n }\n }\n if(sum>=4)\n {\n printf(\"yes\\n\");\n }\n else\n {\n printf(\"no\\n\");\n }\nreturn 0;}", "lang_cluster": "C", "compilation_error": false, "code_uid": "de15a89fb3d1fc0520a9f09e8b32c2b2", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tchar line[n];\n\tscanf(\"%s\", line);\n\n\tchar *found = strchr(line, '*');\n\tchar c1, c2, c3, c4;\n\tint i, j;\n\tfor ( i = found-line; i < n; i++ ) {\n\t\tif ( line[i] != '*' ) continue;\n\n\t\tfor ( j = 1; j < n && i+4*j < n; j++ ) {\n\t\t\tc1 = *(line+i+j); c2 = *(line+i+2*j);\n\t\t\tc3 = *(line+i+3*j); c4 = *(line+i+4*j);\n\t\t\tif ( c1 != '.' && c2 != '.' && c3 != '.' && c4 != '.' ) {\n\t\t\t\tprintf(\"yes\\n\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"no\\n\");\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ac03702fcae5694518bb9d29005ad0cd", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int n,i,count=0,j,k;\n scanf(\"%d\",&n);\n char str[n];\n int ara[n];\n scanf(\"%s\",str);\n for(i=0,j=0;i=4){\n printf(\"yes\");\n break;\n }\n }\n if(i==21)printf(\"no\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "93549b455e280831df10e24fa0d88020", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n, res;\n scanf(\"%d\", &n);\n \n res = ((int)n/2)*3 + n%2;\n \n printf(\"%d\", res);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "46c2cdeb9887ac8788325fb85ab956d6", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int n;\n scanf(\"%d\",&n);\n int max=1,tmp=0;\n int i,j;\n for(i=1;i<=n-1;i++){\n \n for(j=1;j<=n-i;j++){\n if(n-i>=n-j) tmp=n+i;\n else tmp=n+j;\n if(max\nint main()\n{\nlong long int n,a[100000],i,j,max;\nscanf(\"%I64d\",&n);\nfor(i=1;i<=n;i++)\n{if(i<=n/2)\na[i]=n+i;\nelse\na[i]=(2*n)-i;}\nmax=a[1];\nfor(j=1;j<=n;j++)\n{if(a[j]>max)\nmax=a[j];}\nprintf(\"%I64d\",max);\nreturn(0);}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e1802a603f9f9ecce7bd2f66260260dc", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n# include \n#include\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",(2*n)-(n/2)) ;\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05fca308ea8ff5ecde87cc8aeaf95e38", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n\tint n;\n\t\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", (3 * n) / 2);\n\t\n\tgetch();\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ce9f472f3617ac3df62f71c55070411f", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "\n\n#include\n\nint main()\n{\n int a,b, n, x, n1=0, n0=0, i, j;\n\n scanf(\"%d %d %d\", &a, &b, &n);\n\n for(i=0, x=0; ia)\n {\n n0--;\n x=1;\n }\n }\n else\n {\n n1++;\n if(n1>b)\n {\n n1--;\n x=0;\n }\n }\n\n printf(\"%d\", x);\n\n if(n!=1)\n {\n n--;\n x=swap(x);\n }\n }\n\n printf(\"\\n\");\n\n return 0;\n}\n\nint swap(int n)\n{\n if(n==1)\n return 0;\n else\n return 1;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cd7e94943effecebd78d6a2b03020a94", "src_uid": "ef4123b8f3f3b511fde8b79ea9a6b20c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include\n#include\n\nint main(){\nint a1,b1,x,n,i;\nscanf(\"%d%d%d\",&a1,&b1,&x);\n\nn=a1+b1;\nint a[n];\nfor(i=0;i0){\n a[i]=0;\n a1--;\n continue;\n }\n if(b1>0){\n a[i]=1;\n b1--;\n continue;\n }\n }\n}\nfor(i=0;i\nint main()\n{\n\tint a, b, x, xa, xb;\n\tscanf(\"%d %d %d\", &a, &b, &x);\n\txa=0;\n\txb=0;\n\tfor(int i=0; i<=x-1; i++){\n\t\tif(xa==xb){\n\t\t\tprintf(\"0\");\n\t\t\txa++; a--;\n\t\t}\n\t\telse if(xa>xb){\n\t\t\tprintf(\"1\");\n\t\t\txb++; b--;\n\t\t}\n\t}\n\tif(xa==xb){\n\t\tfor(int i=0; ixb){\n\t\tfor(int i=0; i\n#include\nint main()\n{\n int a,b,x,i,r=0,p=0,q=0,l;\n scanf(\"%d %d %d\",&a,&b,&x);\n char str[201];\n if(x>=2)\n {\n for(i=0;i1) {str[i]='0';\n printf(\"%c\",str[i]);\n p++;}\n else\n {\n str[i]='1';\n printf(\"%c\",str[i]); \n q++; \n }\n }\n else\n {\n if(str[i-1]=='0')\n {\n str[i]='1';\n printf(\"%c\",str[i]);\n q++;\n r++;\n if(r==x-1)\n {l=i;\n break;}\n }\n else\n {\n str[i]='0';\n printf(\"%c\",str[i]);\n p++;\n r++;\n if(r==x-1)\n {\n l=i;\n break;\n }\n }\n }\n }\n if(str[l]=='0')\n {\n int g,h;\n g=a-p;\n h=b-q;\n while(g--)\n {\n printf(\"0\");\n }\n while(h--)\n {\n printf(\"1\");\n }\n }\n else\n {\n int g,h;\n g=a-p;\n h=b-q;\n while(h--)\n {\n printf(\"1\");\n }\n while(g--)\n {\n printf(\"0\");\n }\n }\n }\n else\n {\n while(a--) printf(\"0\");\n while(b--) printf(\"1\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8262c9fa82b58dd3040c26cb50a085b2", "src_uid": "ef4123b8f3f3b511fde8b79ea9a6b20c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main ()\n{\n\tint ss[2] = {0}, x, i;\n\tchar s[101] = {0};\n\n\tscanf (\"%d%d%d\", &ss[0], &ss[1], &x);\n\n\tif (x % 2 == 1)\n\t\tfor (i = 0; i <= x; i++)\n\t\t{\n\t\t\ts[i] = i % 2 + '0';\n\t\t\tss[i % 2]--;\n\t\t}\n\telse\n\t\tif (ss[0] > ss[1])\n\t\t\tfor (i = 0; i <= x; i++)\n\t\t\t{\n\t\t\t\ts[i] = i % 2 + '0';\n\t\t\t\tss[i % 2]--;\n\t\t\t}\n\t\telse\n\t\t\tfor (i = 0; i <= x; i++)\n\t\t\t{\n\t\t\t\ts[i] = (i + 1) % 2 + '0';\n\t\t\t\tss[(i + 1) % 2]--;\n\t\t\t}\n\n\tfor (i = 0; i <= ss[s[0] - '0']; i++)\n\t\tprintf (\"%c\", s[0]);\n\n\tfor (i = 0; i <= ss[s[1] - '0']; i++)\n\t\tprintf (\"%c\", s[1]);\n\n\tfor (i = 2; s[i]; i++)\n\t\tprintf (\"%c\", s[i]);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "db445c86fcadec717e30b5b78d2686eb", "src_uid": "ef4123b8f3f3b511fde8b79ea9a6b20c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid main()\n{\nlong long n;long long i;long long j;long long count;count=0;\nscanf(\"%lld\",&n);\n\nlong long x[n];long long y[n];\nlong long *p;\n\np=(long long*)calloc(90000000,sizeof(long long));\nfor(i=0;i<90000000;i++)\n\tp[i]=0;\n\nfor(i=0;i\n#define N 1000000\nint t[N+N]={};\nint main()\n{\n int n,cpt=0;\n int x[n];\n int y[n];\n printf(\"deeeeee\");\n scanf(\"%d\",&n);\n for(int i=0; i\n#include \n\n\nint main()\n{\n\n\tdouble total_time;\n\tclock_t start, end;\n\tstart = clock();\n\t//time count starts\n\tsrand(time(NULL));\n\n\n\n int n,a[2000],i,j,k,t,count=0;\n scanf (\"%d\", &n);\n int x[n*2];\n for (i=0; i\n#include \n\n\nint main()\n{\n\n\tdouble total_time;\n\tclock_t start, end;\n\tstart = clock();\n\t//time count starts\n\tsrand(time(NULL));\n\n\n\n int n,a[2000],i,j,k,t,count=0;\n scanf (\"%d\", &n);\n int x[n*2];\n for (i=0; i\nint main()\n{\n int n,a=0;\n int x[2100]={0},y[2100]={0};\n scanf(\"%d\",&n);\n for(int i=0;i=1&&(x[i]^y[j])<=2*n)\n {\n a++;\n }\n }\n if(a%2==0)\n printf(\"Karen\");\n else\n printf(\"Koyomi\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "36d26921a392ad6a6d9a0de9b3ddf05d", "src_uid": "1649d2592eadaa8f8d076eae2866cffc", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main () {\n unsigned long long a;\n int b, i;\n scanf(\"%d\", b);\n for (i = 0; i < b; i++) {\n a += pow(2, i);\n }\n printf(\"%lld\", a);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6fd55335d7b222915ff4e6e85163ece7", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main () {\n unsigned long long a;\n int b, i;\n scanf(\"%d\", b);\n for (i = 0; i < b; i++) {\n a += pow(2, i);\n }\n printf(\"%lld\", a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7bd4fb54cd2d13e7979d8e5fb5d9f975", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main () {\n unsigned long long a = 0;\n int b, i;\n scanf(\"%d\", b);\n for (i = 0; i <= b; i++) {\n a += pow(2, i);\n }\n printf(\"%lld\", a - 1);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3cc420627f1f4cd01aea7fdf72b15696", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main () {\n unsigned long long a = 0;\n int b, i;\n scanf(\"%d\", b);\n for (i = 0; i < b; i++) {\n a += pow(2, i);\n }\n printf(\"%lld\", a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ddab57aaed91772401a81a050b3a977", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nvoid main()\n{\n int num,i,sum=0;\n scanf(\"%d\",&num);\n for(i=num;i>=1;i--)\n {\n sum =sum+powl(2,i);\n }\n printf(\"%d\",sum);\n\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "82db853eba2212df77f8424e0d03e002", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \nint main() \n{\n\tint a,b,c,n;\n\tscanf(\"%d %d\",&a,&b);\n\tscanf(\"%d %d\",&c,&n);\n\tn=n-a-b-c;\n\tif(n>0)\n\tprintf(\"%d\",n);\n\telse\n\tprintf(-1);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e42f2d273727f26e0dfa52424987cc06", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n,a,b,c,x;\n scanf(\"%d\",a);\n scanf(\"%d\",b);\n scanf(\"%d\",c);\n scanf(\"%d\",n);\n x=a+b-c;\n if(n-x>=1&&a>=c&&b>=c)\n printf(\"%d\",n-x);\n else\n printf(\"-1\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "60cb608845138c33525533f4889fff7d", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n\tint a,b,c,n;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&n);\n\tint a1=a,b1=b,c1=c,n1=n;\n\ta1=a-c1;\n\tb1=b-c1;\n\tint r;\n\tif(a1<=0 || b1<=0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t\texit(0);\n\t}\n\tr=n-(a1+b1+c1);\n\tif(r<=0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\",r);\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "76f071f10fbbc61abbb29dd8052eb211", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n\t\n\tint a,b,c,n,x,y,z;\n\t\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&n);\n\t\n\tx=a;\n\ty=b-c;\n\tz=n-(x+y);\n\t\n/*\tif(a>n||b>n||c>n||((a+b)==n&&c==0)||((a==b&&b==c)&&n0)||(c>a||c>b))\n\tprintf(\"-1\");\n\telse printf(\"%d\",z);*/\n\tif(z0&&c\nint main()\n{\n int a, b, c, n, ans;\n scanf(\"%d %d %d %d\", &a, &b, &c, &n);\n ans = n - (a-c+b);\n if(ans > 0 && a > c && b > c)\n printf(\"%d\", ans);\n\n else\n printf(\"-1\");\n \n \n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "199efc9bfd2598d2e737f93b6b04803c", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "850cdfe4008ce23fd2f9a78cd92f60ec", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "GNU C", "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\n\nif(a == 0)\n printf(\"YES\");\n\nelse\n printf(\"NO\");\n\n\n\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d997673e476ca3aaa867b67b62662c1", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define LEN 250\n#define L 26\n\nint repeats(char stringArr[LEN],int R[L]){\n int i;\n \n for (i=0;i\n#include\n#include\nint main()\n{\n\tchar s[105],a[105],b[105];\n\tscanf(\"%s\",a);\n\tscanf(\"%s\",b);\n\tscanf(\"%s\",s);\n\tint i,p=strlen(a),q=strlen(b),t=strlen(s),m[26],n[26];\n\tif(t==(p+q))\n\t{\n\t\tfor(i=0;i<26;i++)\n\t\t{\n\t\t\tm[i]=0;\n\t\t\tn[i]=0;\n\t\t}\n\t\tfor(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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a04d66de5dc61abedbf9d480d6304cce", "src_uid": "b6456a39d38fabcd25267793ed94d90c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,k,b,t;\n int time;\n scanf(\"%d%d%d%d\",&k,&b,&n,&t);\n while(k!=0){\n time=(t/k)-b;\n if(time>n)printf(\"0\\n\");\n else printf(\"%d\\n\",n-time);\n scanf(\"%d%d%d%d\",&k,&b,&n,&t);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b94f71719b76b47a17f72bfc5f28ffee", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int k , b , n , t , number = 0 , sum = 1 , counter , sum2;\n scanf(\"%d %d %d %d\",&k,&b,&n,&t);\n for (counter = 0 ; counter < n ; counter++)\n {\n sum = k * sum + b;\n }\n sum2 = k * t + b;\n if (sum2 < sum)\n {\n number = 1;\n }\n while (sum2 < sum)\n {\n number++;\n sum2 = sum2 * k + b;\n }\n printf(\"%d\",number);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "06d22c17fd72c871e9665207612d4acd", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n\nint main()\n{\n long long b,k,n,t,a[100000];\n int i=0;\n int sec=0;\n scanf(\"%lld\",&k);\n scanf(\"%lld\",&b);\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&t);\n a[0]=1;\n for (i=1 ; a[i-1]n)\n printf(\"0\");\n else if (a[i]==t)\n printf(\"%lld\",n-sec);\n else\n printf(\"%lld\",n-(sec-1));\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e1fc27d09ff63e34644364a72c070b57", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int counter=-1,pop=1,k,b,t,n;\n scanf(\"%d %d %d %d\",&k,&b,&n,&t);\n while(pop<=t)\n {\n pop=pop*k+b;\n counter++;\n //printf(\"%d\\n\",pop);\n }\n if(counter>n){\n printf(\"0\");\n return 0;\n }\n printf(\"%d\",n-counter);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "73a568464b8f203fd136bd1483bf50b9", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef long long ll;\n\nint main() {\n int k,b,n,t,i;\n ll z;\n scanf(\"%d %d %d %d\",&k,&b,&n,&t);\n z=1;\n for(i=0;zn) puts(\"0\");\n else printf(\"%d\\n\",n-i+1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2ea5ac2a0e032a78f7f165473c957d30", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n\n if(n==1){\n printf(\"-1\");\n return 0;\n }\n for(i=0;ia[n-2]){\n printf(\"UP\");\n }\n else if(a[n-1]\nint main(){\n\tint i,n,a,alast,abeforelast;\n\tscanf(\"%d\",&n);\n\tif(n==1){\n\t\tscanf(\"%d\",&a);\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tfor(i=0;ialast){\n\t\tif(alast>0){\n\t\t\tprintf(\"DOWN\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if(alast==0){\n\t\t\tprintf(\"UP\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c250ac3414572098bd66f1bf0aaf56f4", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tif(n==1)\n\t\tprintf(\"-1\");\n\telse\n\t{\n\t\tif(a[n]==15)\n\t\t\tprintf(\"DOWN\");\n\t\telse\n\t\t{\n\t\t\tif(a[n]==0)\n\t\t\t\tprintf(\"UP\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(a[n]>a[n-1])\n\t\t\t\t\tprintf(\"UP\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"DOWN\");\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6bf8f2e189d6fdeeaf0fce4578bdd23c", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int i,j,n;\n scanf(\"%d\", &n);\n int a[n], b[30]={\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \n 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1\n };\n for(i=0;i-1)&&(a[i]<15)&&(a[i-1]==(a[i]-1)))\n printf(\"UP\");\n else\n printf(\"DOWN\");\n }\n }\n \n \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1a03c6dfacb28b73d6b1f48d82d4e7f6", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint i,n;\n\tint find=2;\n\tint day[93];\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\tscanf(\"%d\",&day[i]);\n\t}\n\tif(n==1)\n\tprintf(\"-1\");\n\ti=1;\n\twhile(iday[i+1]||day[i=1]==15)\n\t\t{find=0;\n\t\t}\n\t\ti++;\n\t\t}\n\tif(find==1)\n\t\tprintf(\"UP\");\n\tif(find==0)\n\t\tprintf(\"DOWN\");\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "adde8e8e447babeb68d0df472e84193e", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n char a,b,c,d,e;\n int i,j,k,l;\n scanf(\"%d:%d\",&i,&j);\n \n \n for(l=0; ;l++)\n {\n if(j>59)\n {\n i++;\n j=0;\n }\n else if(i==24 && j==0)\n break;\n else if(i%10==j/10)\n break;\n \n }\n printf(\"%d\",l);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4a4be079347a268cf99ba7598b67f3e2", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int h, m, i, j, ne, ekok, dosok;\n char ch;\n scanf(\"%d%c%d\", &h, &ch, &m);\n ekok = h % 10;\n dosok = h / 10;\n ne = ekok * 10 + dosok;\n if(h == 23 && m <= 32) {\n printf(\"%d\\n\", 32 - m);\n }\n else if(h == 23 && m > 32) printf(\"%d\\n\",60 - m);\n //printf(\"%d\", ne);\n if(ne >= m && h != 23){\n printf(\"%d\\n\", ne - m);\n }\n else if(ne\nint isPalindrome(int x)\n{\n\tif(x%10==x/1000 && (x/100)%10==(x%100)/10)\n\t\treturn 1;\n\telse\n\t\treturn 2;\n}\nint main()\n{\n\tchar str[5];\n\tscanf(\"%s\",str);\n\tint i;\n\tint x;\n\tfor(i=0;i<5;i++)\n\t\tstr[i]=str[i]-'0';\n\tx=str[0]*1000+str[1]*100+str[3]*10+str[4];\n\tif(x/100==23)\n\t{\n\t\tprintf(\"%d\",60-x%100);\n\t\treturn 0;\n\t}\n\tint count=0;\n\twhile(1)\n\t{\n\t\tif(isPalindrome(x)==1)\n\t\t{\n\t\t\tprintf(\"%d\",count);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcount++;\n\t\t\tif(x%100<=58)\n\t\t\t\tx++;\n\t\t\telse\n\t\t\t\tx=x+100-(x%100);\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ceea32a4d8b9b8ad69f97da56726dcf", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char time[5],time1[3],time3[3],org[3];\n int i=0,num1=0,num2=0,num3=0,total,c=0;\n scanf(\"%s\",time);\n for(i=0;i<2;i++)\n {\n time1[i]=time[1-i];\n time3[i]=time[3+i];\n // printf(\"%c\",time3[i]);\n org[i]=time[i];\n if(time[i]!=time[4-i])\n c=1;\n }\n // printf(\" i=%d\\n\",i);\n time1[i]='\\0';\n time3[i]='\\0';\n // printf(\" Hi %s\\n\",time3);\n org[i]='\\0';\n num1=atoi(time1);\n num2=atoi(time3);\n num3=atoi(org);\n // printf(\"%d %d\\n\",num1,num2);\n if(c==0)\n printf(\"%d\",0);\n else if(num1>num2 && (num1<=59))\n printf(\"%d\",(num1-num2));\n else\n {\n if(num1==num2)\n printf(\"%d\",0);\n else if(num3==23)\n printf(\"%d\",(60-num2));\n else\n {\n num3++;\n org[0]=48+num3%10;\n org[1]=48+num3/10;\n org[2]='\\0';\n // printf(\"Bye %c\\n\",org);\n num3=atoi(org);\n printf(\"%d\",(60-num2)+num3);\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b4edd25ce8b510633c6569e0cc52268", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint f (int a)\n{\n\tint x=0;\n\tx+=a%10;\n\tx*=10;\n a=a/10;\t\n x+=a;\t\t\n a=x;\n return a;\n} \nint main()\n{\n\tint a,b,c=0,x=0;\n\tchar d;\n\tscanf(\"%d\",&a);\n\tgetch();\n\tscanf(\"%c\",&d);\n\tscanf(\"%d\",&b);\n//\tprintf(\"%d %d\",a,b);\n if (a==23 && b>46) c=60-b;\n else{\n x=f(a);\n\twhile (x!=b){\n\t\tb++;\n\t\tc++;\n\t\tif (b==60){\n\t\t\tb=0;\n\t\t\ta++;\n\t\t\tx=f(a);\n\t\t}\n\t\tif (a==24) a=0;\n\t}\n }\n\tprintf(\"%d\",c);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "01d3503e9160419adf11e013de44dd6a", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a,b,d=0,e,i,j,f;\nscanf(\"%d %d\",&a,&b);\nint c[a][a];\nfor(i=0;i\nint main()\n{\n long long int n,x,i,count=0,s;\n scanf(\"%I64d%I64d\",&n,&x);\n s=x/n;\n for(i=s; i<=n; i++)\n {\n if(x%i==0 && (x/i)<=n)\n count++;\n }\n printf(\"%I64d\",count);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0d28e52152c04e77b07fe2d8cd59fb04", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nmain()\n{\n\n long n,x,i,j,k=0;\n\n scanf(\"%li %li\",&n,&x);\n\n for(i=0;i<=n;i++)\n for(j=0;j<=n;j++)\n if(i*j==x) k++;\n\n\n printf(\"%d\\n\",k);\n\n system(\"pause\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "43afa97325d8da1f0aec899cc6e7bad7", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a,b,c=0,i,j;\n scanf(\"%d %d\",&a,&b);\n int arr[a+1][a+1];\n for(i=1;i<=a;i++){\n for(j=1;j<=a;j++){\n arr[i][j]=i*j;\n }\n }\n for(i=1;i<=a;i++){\n for(j=1;j<=a;j++){\n if(arr[i][j]==b){\n c++;\n }\n }\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "18801a26fe2fa0d809bbbe191bb91ee9", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a,b,c=0,i,j;\n scanf(\"%d %d\",&a,&b);\n int arr[a+1][a+1];\n for(i=1;i<=a;i++){\n for(j=1;j<=a;j++){\n arr[i][j]=i*j;\n }\n }\n for(i=1;i<=a;i++){\n for(j=1;j<=a;j++){\n if(arr[i][j]==b){\n c++;\n }\n }\n }\n printf(\"%d\\n\",c);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "597865d777051a905bcbe6296d9268c9", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int M,N,x, y;\n scanf(\"%d %d\", &M, &N);\n y=M*N/2;\n for (x=1; x<=y; x=x+1)\n { if (x=y && N!=1)printf(\"%d\", x); }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b638a0154cf17b78161717f921e95f3a", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int M, N, x, i ;\n for(i=0;M>=16 || N>=16 || M<=1 || N<=1 || N<=M;i=i+0){\n\n scanf(\"%d%d\",&M, &N);\n }\n x=(M*N) / 2;\n\n printf(\"%d\", x);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1fabaae2ac4591e7085aeacf8b9a94d3", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int m,n;\n while(1) {\n scanf(\"%d %d\",&m,&n);\n printf(\"%d\\n\", (m*n) / 2);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eb29f1327210040cf4c0652c7727c39f", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int M, N, x,i;\n for(i=0;M>=16 || N>=16 || M<=1 || N<=1 || N<=M;i=i+0){\n\n scanf(\"%d%d\",&M, &N);\n }\n x=M*N;\n printf(\"%d\", x/2);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b40e5d5353b80628fb0f267719bc363", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main(){\n int M, N, resultado;\n for(;;){\n\t\tscanf(\"%d %d\", &M, &N);\n\t\tresultado = (M*N)/2;\n\t\tprintf(\"%d\\n\", resultado);\n\t}\n}\n/* 1498226413884 */\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2730ef9dfa0ea7ca002017e9b8fc08b0", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint main(void)\n{\t\n\tint array[5][5];\n\tint i,j;\n\tint sum=0;\n\t\n\tfor (i = 0; i < 5; i++)\n\t{\tfor (j = 0; j < 5; j++)\n\t\t{\n\t\t\tscanf(\"%d\",array[i][j]);\n\t\t}\n\t}\n\n\tif(array[3][3]!=1){\n\tfor (i = 0; i < 5; ++i)\n\t{\tfor (j = 0; j < 5; ++j)\n\t\t{\tif(array[i][j]==1)\n\t\t\t{\t\t\t\t\n\t\t\t\tsum=(3-i)+(3-j);\n\t\t\t\ti+=3-i;\n\t\t\t\tj+=3-j;\t\n\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t}\t\t\t\t\t\n\t\t}\n\t}}\n\tprintf(\"%d\\n\",sum);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa7c718cdd1c16e371b994696200206e", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int a[4][4];\n int i,j,ans=0;\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n scanf(\"%d\",a[i][j]);}}\n for(i=0;i<5;i++){\n for(j=0;j<5;j++){\n if(a[i][j]=='1'){\n if(i==0 || i==4)\n ans+=2;\n if(i==1 || i==3)\n ans++;\n if(j==0 || j==4)\n ans+=2;\n if(j==1 || j==3)\n ans++;\n }\n }\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fe0862adfc8a322ebfc0f8f942e7e1c0", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int a[5][5],j,i,x,y;\n for(i=1;i<=5;i++)\n {\n for(j=1;j<=5;j++)\n {\n scanf(\"%d\",&a[i][j]);\n }\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 break;\n }\n }\n\n }\n x=i-3;\n y=j-3;\n x=abs(x);\n y=abs(y);\n printf(\"%d\",x+y);\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a512139714c7fbc336495a9cab36af3", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nmain()\n{\n\n int matrice[5][5];\n int i,j,nbr=6;\nfor(i=0;i<5;i++)\n{\nscanf(\"%d %d %d %d %d\",&matrice[i][0],&matrice[i][1],&matrice[i][2],&matrice[i][3],&matrice[i][4]);\n}\n for(i=0;i<5;i++)\n {\n for(j=0;j<5;j++)\n {\n if(matrice[i][j]==1)\n {\n if(i<2)\n nbr=2-i;\n else\n nbr=i-2;\n if(j<2)\n nbr+=2-j;\n else\n nbr+=j-2;\n\n }\n }\n\n }\n printf(\"%d\",nbr);\n getch();\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3dbb596ffdc64ded4826ddb24f5567c", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nmain()\n{\n\n int matrice[5][5];\n int i,j,nbr=6;\n\n\n for(i=0;i<5;i++)\n {\n for(j=0;j<5;j++)\n {\n\n matrice[i][j]=getch();\n\n\n if(matrice[i][j]=='1')\n {\n nbr=abs(i-2)+abs(j-2);\n\n }\n }\n\n }\n printf(\"%d\",nbr);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fc7faa7910b9032a744402e473753a83", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main ()\n{\n\tint cont,num,cant_num,prev,good,best;\n\tscanf(\"%d\",&cant_num);\n\tbest=0;\n\tprev=0;\n\tgood=0;\n\tfor(cont=0;cont\n\nint main() {\n int N;\n int K;\n scanf(\"%d %d\", &N, &K);\n int* counters = malloc(100 * sizeof(int));\n for (int i = 0; i < 100; i++) {\n *(counters + i * sizeof(int)) = 0;\n }\n int t;\n for (int i = 0; i < N; ) {\n scanf(\"%d\", &t);\n *(counters + t * sizeof(int)) = ++i;\n }\n int distincts = 0;\n for (int i = 0; i < 100; i++) {\n if (*(counters + i * sizeof(int))) \n distincts++;\n }\n int p= 0;\n if (distincts >= K) {\n printf(\"YES\\n\");\n for (int i = 0; i < 100 && p < K; i++) {\n if (*(counters + i * sizeof(int))) {\n printf(\"%d \", *(counters + i * sizeof(int)));\n p++;\n }\n } \n }\n else {\n printf(\"NO\");\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2a3451a9d7f39bc71d3c7633ca92625e", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n int N;\n int K;\n scanf(\"%d %d\", &N, &K);\n int* counters = malloc(100 * sizeof(int));\n for (int i = 0; i < 100; i++) {\n *(counters + i * sizeof(int)) = 0;\n }\n int t;\n for (int i = 0; i < N; ) {\n scanf(\"%d\", &t);\n *(counters + t * sizeof(int)) = ++i;\n }\n int distincts = 0;\n for (int i = 0; i < 100; i++) {\n if (*(counters + i * sizeof(int))) \n distincts++;\n }\n int p = 0;\n if (distincts >= K) {\n printf(\"YES\\n\");\n for (int i = 0; i < 100 && p < K; i++) {\n if (*(counters + i * sizeof(int))) {\n printf(\"%d \", *(counters + i * sizeof(int)));\n p++;\n }\n } \n }\n else {\n printf(\"NO\");\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5bd21a3e5ad8c0343a02e475b21fcee5", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint main(void)\n{\n bool exists = false;\n int n, k, membc = 0, npoint;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n int teamind[k];\n int teamp[k];\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &npoint);\n exists = false;\n for(int j = 0; j < membc && membc < k; j++)\n {\n if(teamp[j] == npoint) exists = true;\n }\n if(exists == false)\n {\n teamp[membc] = npoint;\n teamind[membc] = i + 1;\n membc++;\n }\n }\n if(membc < k) printf(\"NO\");\n else\n {\n printf(\"YES\\n\");\n for(int i = 0; i < k; i++)\n {\n printf(\"%d \", teamind[i]);\n }\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5932ade37c9343463bd11a522c3287ee", "src_uid": "5de6574d57ab04ca195143e08d28d0ad", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(void)\n{\n int n,k,i,j,l,m;\n scanf(\"%d%d\",&n,&k);\n int a[n],team[k];\n for(i=0;i\n\nint main(void)\n{\n\tint a,b,c,d,i,e,f,j;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\te=b;\n\tf=d;\n\tif(a%2==0&&b%2==1)\n\t{printf(\"-1\");return 0;}\n\tif(c%2==0&&d%2==1)\n\t{printf(\"-1\");return 0;}\n\tfor(i=1;;i++)\n\t{\n\t\tfor (j=1;;j++)\n\t\t{\n\t\t\tif(e==f)\n\t\t\t{printf(\"%d\",f);return 0;\n\t\t\t}\n\t\t\t\n\t\t\tf=d+(j*c);\n\t\t\tif(f>e)\n\t\t\t{break;\n\t\t\t}\n\t\t}\t\t\n\t\te=b+(i*a);\n\t\t\n\t}\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b3940485d6b5eeb9e7d8b078a24f30d", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int a,b,c,d,i,n1,n2;\n\n scanf(\"%lld %lld\",&a,&b);\n scanf(\"%lld %lld\",&c,&d);\n n1=b;\n n2=d;\n\n if(((a%2==0) && (b%2!=0) && (c%2==0) && (d%2==0)) || ((c%2==0) && (d%2!=0) && (a%2==0) && (b%2==0))){\n printf(\"-1\");\n return 0;\n }\n\n else if(a==15 && b==63 && c==51 && d==13){\n printf(\"-1\");\n return 0;\n }\n\n else if(a==46 && b==44 && c==23 && d==55){\n printf(\"-1\");\n return 0;\n }\n\n for(;;){\n if(n2>n1){\n n1=n1+a;\n }\n else if(n1>n2){\n n2=n2+c;\n }\n else if(n1==n2) break;\n }\n printf(\"%lld\",n1);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ccd4fa63c7a4b64c91cb0b7a730793ea", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,c,d,e,f,k=0;\n scanf(\"%d%d\",&a,&b);\n scanf(\"%d%d\",&c,&d);\n int ara[100],i;\n for(i=1;i<100;i++)\n {\n ara[i]=0;\n }\n for(i=1;i<=10;i++)\n {\n e=b+((i-1)*a);\n ara[e]++;\n f=d+((i-1)*c);\n ara[f]++;\n }\n for(i=1;i<100;i++)\n {\n if(ara[i]>1)\n {\n k=i;\n printf(\"%d\\n\",i);\n goto end;\n }\n\n\n }\n\n end:\n if(k==0)\n printf(\"-1\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a5958911dc2c43b5d6e563559e91c310", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,c,d,e,f,k=0;\n scanf(\"%d%d\",&a,&b);\n scanf(\"%d%d\",&c,&d);\n int ara[1000],i;\n for(i=1;i<1000;i++)\n {\n ara[i]=0;\n }\n for(i=1;i<=100;i++)\n {\n e=b+((i-1)*a);\n ara[e]++;\n f=d+((i-1)*c);\n ara[f]++;\n }\n for(i=1;i<1000;i++)\n {\n if(ara[i]>1)\n {\n k=i;\n printf(\"%d\\n\",i);\n goto end;\n }\n\n\n }\n\n end:\n if(k==0)\n printf(\"-1\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3aca64c13b71d01b94274dd5cebb2ac8", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,c,d,e,f,k=0;\n scanf(\"%d%d\",&a,&b);\n scanf(\"%d%d\",&c,&d);\n int ara[10000],i;\n for(i=1;i<10000;i++)\n {\n ara[i]=0;\n }\n for(i=1;i<=1000;i++)\n {\n e=b+((i-1)*a);\n ara[e]++;\n f=d+((i-1)*c);\n ara[f]++;\n }\n for(i=1;i<10000;i++)\n {\n if(ara[i]>1)\n {\n k=i;\n printf(\"%d\\n\",i);\n goto end;\n }\n\n\n }\n\n end:\n if(k==0)\n printf(\"-1\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e451e68c704dfa9286bd9d8a90f43689", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main() {\n\tint i=0, n=0, j=0, x;\n\tchar a[100];\n\tgets (a);\n\tx = strlen(a)-1;\n\twhile(i < x) {\n\t\tif(a[i]== a[i-1]) {\n\t\tif(a[i]=='1') n++;\n\t\telse if (a[i]=='0') j++;\n\t\telse return 0;\n\t}\n\telse {\n\t\tif (a[i]=='1') j=0;\n\t\telse i=0; \n\t}\n\t\ti++;\n\t}\n\tif (n >=7 || j>=7) printf(\"YES\");\n\telse printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a07c6c50f49bfa508146f0d62149a97b", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{int i=0,j=0;\nchar a[101];\nscanf(\"%s\",a);\nwhile(i<101)\nif(a[i]!='\\0'){\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{j++;\nbreak;\n}\ni++;\n}}\nif(j==0)\nprintf(\"NO\");\nif(j>0)\nprintf(\"YES\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "103d780ebfce942aff830f69926b8958", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char s[100];\n int i,d,c1=0,c2=0;\n gets(s);\n d=strlen(s);\n for(i=0;i=7||c2>=7)\n printf(\"YES\");\n else\n printf(\"NO\");\n getch();\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1cbd7e570a884d157f3573e2706b77a3", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char s[100];\n int i,c1=0,c2=0;\n gets(s);\n strlen(s);\n for(i=0;i=7||c2>=7)\n printf(\"YES\");\n else\n printf(\"NO\");\n getch();\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7041e77ac9def910bb05920ad70f68de", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int i,j,c,t,o = 0,z = 0;\n scanf(\"%d\",&j);\n t = j;\n while (j != 0){\n j /= 10;\n c ++;\n }\n char a[c];\n itoa(j,a,10);\n for (i = 0 ; i < c ; i ++){\n if (a[i] == '0'){\n z ++;\n }\n else{\n z = 0;\n }\n if (a[i] == '1'){\n o ++;\n }\n else{\n o = 0;\n }\n if(o >= 7 || z >= 7){\n printf(\"YES\");\n }\n else {\n printf(\"NO\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0887ba66d359c7f89361bf9f1364f7ff", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar c[6][500];\nint main()\n{\n long len1,len2,len3,len4;\n gets(c[1]);\n gets(c[2]);\n gets(c[3]);\n gets(c[4]);\n len1=strlen(c[1])-2;\n len2=strlen(c[2])-2;\n len3=strlen(c[3])-2;\n len4=strlen(c[4])-2;\n if(len1>=len2*2&&len1>=len3*2&&len1>=len4*2)\n printf(\"A\");\n else if(len2>=len1*2&&len2>=len3*2&&len2>=len4*2)\n printf(\"B\");\n else if(len3>=len2*2&&len3>=len1*2&&len3>=len4*2)\n printf(\"C\");\n else if(len4>=len2*2&&len4>=len3*2&&len4>=len1*2)\n printf(\"D\");\n else if(len1<=len2/2&&len1<=len3/2&&len1<=len4/2)\n printf(\"A\");\n else if(len2<=len1/2&&len2<=len3/2&&len2<=len4/2)\n printf(\"B\");\n else if(len3<=len2/2&&len3<=len1/2&&len3<=len4/2)\n printf(\"C\");\n else if(len4<=len2/2&&len4<=len3/2&&len4<=len1/2)\n printf(\"D\");\n else printf(\"C\");\n return 0;\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d811abac9c4ad3b203b5864cde137857", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n//#include\n#include\n\nint main()\n{\n char s1[105],s2[105],s3[105],s4[105];\n \n //printf(\"A.\");\n scanf(\"%s\",s1);\n //printf(\"B.\");\n scanf(\"%s\",s2);\n //printf(\"C.\");\n scanf(\"%s\",s3);\n //printf(\"D.\");\n scanf(\"%s\",s4);\n \n int l1=strlen(s1)-2;\n int l2=strlen(s2)-2;\n int l3=strlen(s3)-2;\n int l4=strlen(s4)-2;\n \n //printf(\"%d %d %d %d\\n\",l1,l2,l3,l4);\n \n if(l1<=l2/2 && l1<=l3/2 && l1<=l4/2)\n printf(\"A\");\n else if(l1>=2*l2 && l1>=2*l3 && l1>=2*l4)\n printf(\"A\");\n else if(l2<=l1/2 && l2<=l3/2 && l2<=l4/2)\n printf(\"B\");\n else if(l2>=2*l1 && l2>=2*l3 && l2>=2*l4)\n printf(\"B\");\n else if(l3<=l1/2 && l3<=l2/2 && l3<=l4/2)\n printf(\"C\");\n else if(l3>=2*l1 && l3>=2*l2 && l3>=2*l4)\n printf(\"C\");\n else if(l4<=l1/2 && l4<=l2/2 && l4<=l3/2)\n printf(\"D\");\n else if(l4>=2*l1 && l4>=2*l2 && l4>=2*l3)\n printf(\"D\");\n \n else\n printf(\"C\");\n \n //getch();\n return 0;\n}\n \n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "609919d2a4727763b0cb3a8e76741e52", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define sc scanf\n#define pr printf\n#define dnum 100001\n\nchar str[4][110];\nint len[4];\n\nint main()\n{\n int n,m,i,j,min,max;\n\n\n sc(\"%s%s%s%s\",str[0],str[1],str[2],str[3]);\n \n for(i = 0; i< 4; ++i)\n {\n len[i] = strlen(str[i])-2;\n }\n\n for(i = 0; i < 4; ++i)\n {\n min = 0;\n max = 0;\n for(j = 0; j < 4; ++j)\n {\n if(i != j)\n {\n if(len[i]*2 <= len[j])\n {\n min++;\n }\n\n if(len[i] >= len[j]*2)\n {\n max++;\n }\n }\n }\n\n if(max == 3 || min == 3)break;\n }\n\n if(max != 3 && min != 3)\n {\n printf(\"C\\n\");\n }\n else\n {\n printf(\"%c\\n\",i+'A');\n }\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8ee19c40f8c0c54ace00441955e1fb45", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n char a[200];\n char b[200];\n char c[200];\n char d[200];\n char x;\n int i;\n int len[4];\n\n scanf(\"%c\", &x);\n scanf(\"%c\", &x);\n scanf(\"%s\\n\", a);\n //getch();\n scanf(\"%c\", &x);\n scanf(\"%c\", &x);\n scanf(\"%s\\n\", b);\n //getch();\n scanf(\"%c\", &x);\n scanf(\"%c\", &x);\n //getch();\n scanf(\"%s\\n\", c);\n //getch();\n scanf(\"%c\", &x);\n scanf(\"%c\", &x);\n //getch();\n scanf(\"%s\", d);\n //printf(\"%s\\n%s\\n%s\\n%s\\n\", a, b, c, d);\n len[0] = strlen(a);\n len[1] = strlen(b);\n len[2] = strlen(c);\n len[3] = strlen(d);\n\n int min = 101;\n int max = -1;\n int mini;\n int maxi;\n for (i = 0; i < 4; i++) {\n if (len[i] > max) {\n max = len[i];\n maxi = i;\n }\n if (len[i] < min) {\n min = len[i];\n mini = i;\n }\n }\n int flag1 = 1;\n int flag = 1;\n for (i = 0; i < 4; i++) {\n if (i != mini) {\n if (min > (len[i]/2)) {\n flag = 0;\n break;\n }\n }\n }\n if (flag) {\n if (mini == 0) {\n printf(\"A\");\n } else if (mini == 1) {\n printf(\"B\");\n } else if (mini == 2) {\n printf(\"C\");\n } else {\n printf(\"D\");\n }\n flag1 = 0;\n }\n flag = 1;\n for (i = 0; i < 4; i++) {\n if (i != maxi)\n if (max < (2*len[i])) {\n flag = 0;\n break;\n }\n }\n if (flag) {\n if (maxi == 0) {\n printf(\"A\");\n } else if (maxi == 1) {\n printf(\"B\");\n } else if (maxi == 2) {\n printf(\"C\");\n } else {\n printf(\"D\");\n }\n flag1 = 0;\n }\n if (flag1) {\n printf(\"C\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "66fb51d72b1ddc870e1f9d7ff41f29ab", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nsolve();\nint main()\n{\nsolve();\nreturn 0;\n}\nsolve()\n{\n int la,lb,lc,ld;\nchar a[105],b[105],c[105],d[105],ch;\nscanf(\"%s%c%s%c%s%c%s%c\",&a,&ch,&b,&ch,&c,&ch,&d,&ch);\nla=strlen(a)-2;\nlb=strlen(b)-2;\nlc=strlen(c)-2;\nld=strlen(d)-2;\nif(((la<=lb/2)&&(la<=lc/2)&&(la<=ld/2))||((la>=lb*2)&&(la>=lc*2)&&(la>=ld*2)))\nprintf(\"A\");\nelse if(((lb<=la)/2&&(lb<=lc/2)&&(lb<=ld/2))||((lb>=la*2)&&(lb>=lc*2)&&(lb>=ld*2)))\nprintf(\"B\");\n\nelse if(((ld<=la/2)&&(ld<=lc/2)&&(ld<=lb/2))||((ld>=la*2)&&(ld>=lc*2)&&(ld>=lb*2)))\nprintf(\"D\");\nelse\nprintf(\"C\");\nprintf(\"\\n\");\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4ad953cb4295a64f942a9ed60c8a5ca5", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\nvoid main()\n{\nint a[10]={0} , i , j , n , flag;\n\nfor(i=0;i<6;i++)\n{\nscanf(\"%d\" , &n);\nfor(j=1;j<10;j++)\n{\nif(n==j)\n{\na[n]++;\nbreak;\n}\n}\n }\n\nfor(i=1;i<10;i++)\n{\nif(a[i]==4)\n{\nfor(j=1;j<10;j++)\n{\nif(a[j]==2)\n{\nflag=1;\nbreak;\n}\n\n\nelse\n{\nflag=0;\n}\n}\nbreak;\n}\n\n\nelse if(a[i]==6)\n{\nflag=1;\nbreak;\n}\n\n\nelse\nflag=2;\n}\n\nif(flag==1)\nprintf(\"Elephant\");\nelse if(flag==0)\nprintf(\"Bear\");\nelse if(flag==2)\nprintf(\"Alien\");\n\ngetch();\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "70141d60f6a492d66a301bb1b2953953", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n//#include\n\nint main()\n{\n int i,arr[6],count[10]={0},c1=0,c2=0;\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&arr[i]);\n count[arr[i]]++;\n }\n for(i=1;i<10;i++)\n {\n if(count[i]==4)\n { c1=1; break; }\n }\n if(!c1)\n {\n printf(\"Alien\");\n // getch();\n }\n else\n {\n for(i=1;i<10;i++)\n {\n if(count[i]==2)\n { c2=1; break; }\n }\n /* for(i=1;i<10;i++)\n {\n if(count[i]==1)\n { temp[k]=1; k++; }\n }*/\n if(c1&&c2)\n {\n printf(\"Elephant\");\n }\n else\n {\n printf(\"Bear\");\n }\n }\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7f91c064d34110a79d719284d2769c6f", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n int a[6],count=0,i,count1=0;\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n qsort(a, 6, sizeof(int), cmpfunc);\n\n for(i=1;i<6;i++)\n {\n if(a[i] != a[i-1])\n count++;\n if(a[i] == a[i-1])\n count1++;\n }\n if(count<=1 && count1>=3)\n printf(\"Elephant\\n\");\n else if(count==2 && count1>=3)\n printf(\"Bear\\n\");\n else\n printf(\"Alien\\n\");\n return 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8fd3e7770ff032195a606d82705cb0bb", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int i,j,d,A[10],cnt=1,C[10]={0};\n for(i=0;i<6;i++){\n scanf(\"%d\",&A[i]);\n }\n C[0]=A[0];\n for(i=1;i<6;i++){\n d=0;\n for(j=0;j3) printf(\"Alien\");\n else if(cnt==3) printf(\"Bear\");\n else printf(\"Elephant\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cbfa8f4abd5a9385ea4a833eb7ddec79", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nint h[2000];\nint main()\n{\n int t=0,n,i,p,q,j,l,r,x,y,k;\n int a[6];int flg=0,z;\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&a[i]);\n h[a[i]]++;\n }\n for(i=0;i<6;i++)\n {\n if( h[a[i]]==6)\n {\n printf(\"Elephant\");\n return 0;\n }\n }\n\n\n for(i=0;i<6;i++)\n {\n if( h[a[i]]==4)\n {\n a[i]=0;\n flg=1;\n }\n }\n for(i=0;i<6;i++)\n {\n if( h[a[i]]==2 && a[i]>0 && flg==1)\n {\n a[i]=-1;\n flg=2;\n }\n }\n if(flg==2)\n {\n printf(\"Elephant\");\n return 0;\n }\n\n for(i=0;i<6;i++)\n {\n if( h[a[i]]==1 && a[i]>0 && flg==1)\n {\n x=a[i];\n a[i]=-2;\n //z=i;\n break;\n }\n }\n\n for(i=0;i<6;i++)\n {\n if( h[a[i]]==1 && a[i]>0 && flg==1)\n {\n y=a[i];\n a[i]=-3;\n break;\n }\n }\n\n for(i=0;i<6;i++)\n {\n if(a[i]>0)\n {\n printf(\"Alien\");\n return 0;\n }\n }\n if(x!=y && flg==1)\n {\n printf(\"Bear\");\n return 0;\n }\n\nreturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "01e8c90bbc3c1db851237150b02fcc81", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char s[1000000];\n int i,k=0;\n while(1){\n scanf(\"%s\",s);\n for(i=0; i\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n while(n>0)\n {\n if(n%1000==144)\n {\n n/=1000;\n }\n else if(n%100==14)\n {\n n/=100;\n }\n\n else if(n%10==1)\n {\n n/=10;\n }\n else\n {\n printf(\"NO\");\n \n }\n }\n printf(\"YES\");\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "725374bfdad4d616e583cf293bcf32f0", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint N,A,B,C;\n\tchar Error=0;\n\tscanf(\"%d\",&N);\n\twhile(N)\n\t{\n\t\tA=N%10;\n\t\tB=N%100;\n\t\tC=N%1000;\n\t\tif(A==1)\n\t\t{\n\t\t\tN/=10;\n\t\t}\n\t\telse if(B==14)\n\t\t{\n\t\t\tN/=100;\n\t\t}\n\t\telse if(C==114)\n\t\t{\n\t\t\tN/=1000;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tError=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tputs(Error?\"NO\":\"YES\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e84de32e82e34e4308450f4774f13ee4", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n\nlong long n,rev;\n\nvoid s1(int);\nvoid s2(int);\nvoid s3(int);\nvoid s4(int);\n\nvoid s1(int rev)\n{\n if(!rev)\n {\n printf(\"YES\");\n return;\n }\n else if(rev%10==4)\n s2(rev/10);\n else\n s1(rev/10);\n}\n\nvoid s2(int rev)\n{\n if(!rev)\n {\n printf(\"YES\");\n return;\n }\n else if(rev%10==4)\n s3(rev/10);\n else\n s1(rev/10);\n}\nvoid s3(int rev)\n{\n if(!rev)\n {\n printf(\"YES\");\n return;\n }\n else if(rev%10==4)\n s4(rev/10);\n else\n s1(rev/10);\n}\n\nvoid s4(int rev)\n{\n printf(\"NO\");\n return;\n}\n\nint main()\n{\n scanf(\"%I64d\",&n);\n while(n)\n {\n if(n%10!=1&&n%10!=4)\n {\n printf(\"NO\");\n getch();\n return 0;\n }\n rev=rev+n%10;\n rev*=10;\n n/=10;\n }\n rev/=10;\n if(rev%10==1)\n s1(rev/10);\n else\n s4(rev/10);\n return 0;\n}\n \n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7a2d87e962b4663b055b87377b3b636b", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar a[1000000001];\nint main(){\n\t//long int n;\n\t//scanf(\"%ld\",&n);\n\t//sprintf(a,\"%ld\",n);\n\tscanf(\"%s\",a);\n\tint i;\n\tfor(i=0;i\n#include\nint main()\n{\n char str[101];\n int l, i, count = 0, count1 = 0;\n scanf(\"%s\", str);\n l = strlen(str);\n for(i = 0; i < l; i++)\n {\n if(str[i] == '-')\n count++;\n else\n count1++;\n }\n if(count1 == 0)\n printf(\"YES\\n\");\n else if(count%2 == 0 || count == 0)\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "80084daee742ab895cec13b480de6091", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n char s[100];\n int p=0,l=0,i=0;\n scanf(\"%s\",s);\n while(s[i]!='\\0');\n {\n if(s[i]=='o')\n p++;\n else\n l++;\n i++;\n }\n if(l==0||p==0)\n printf(\"YES\");\n else if(l%p==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1f726fa83a9f422dca4c31e8cbfddf50", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n char s[100];\n int p=0,l=0,i=0;\n scanf(\"%s\",s);\n while(s[i]!=NULL);\n {\n if(s[i]=='o')\n p++;\n else\n l++;\n }\n if(l==0||p==0)\n printf(\"YES\");\n else if(l%p==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c8c707b7dbe82bcc8df6a90707733a37", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n char s[105];\n int p=0,l=0,i=0;\n scanf(\"%s\",s);\n while(s[i]!='\\0');\n {\n if(s[i]=='o')\n p++;\n else\n l++;\n }\n if(l==0||p==0)\n printf(\"YES\");\n else if(l%p==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9dc6959cfafcc42ebfd0d4f52c7bb32b", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint compare(char a[], char b[])\n{\n int i, j;\n\n int ara[26];\n for(i = 0; i < 26; i++){\n ara[i] = 0;\n }\n\n for(i = 0; a[i] != '\\0'; i++) if(ara[a[i]-'a'] == 0) ara[a[i]-'a']++;\n for(i = 0; b[i] != '\\0'; i++) if(ara[b[i]-'a'] == 1) ara[b[i]-'a']--;\n for(i = 0; i < 26; i++) if(ara[i]) break;\n\n if(i == 26) return 1;\n else return 0;\n\n}\n\nint main()\n{\n int i, j, n, count;\n\n scanf(\"%d\", &n);\n\n char root[n][1001], word[1001];\n\n root[0][0] = '\\0';\n\n for(i = 0, count = 0; i < n; i++){\n scanf(\" %s\", word);\n\n for(j = 0; root[j][0] != '\\0'; j++){\n if(compare(word, root[j])){\n break;\n }\n }\n if(root[j][0] == '\\0'){\n count++;\n strcpy(root[j], word);\n root[j+1][0] = '\\0';\n }\n }\n\n printf(\"%d\\n\", count);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "564d88884664c8bdf28d41c08dac418f", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,pos,l,r,i,ans=0,start,end;\n scanf(\"%d%d%d%d\",&n,&pos,&l,&r);\n if(posr)\n {\n {for(i=pos;i>=r;i--)\n {\n ans++;\n }\n if(l!=1)\n {\n for(i=r;i>=l;i--)\n {\n ans++;\n }\n printf(\"%d\",ans);\n return 0;\n }\n printf(\"%d\",ans);\n return 0;}\n }\n int sum=0;\n for(i=l;i<=pos;i++)\n {\n sum++;\n }\n int sum1=0;\n for(i=pos;i<=r;i++)\n {\n sum1++;\n }\n while(pos<=r&&r!=n&&sum>=sum1)\n {\n\n pos+=1;\n ans++;\n }\n if(pos==r+1)\n {\n pos-=1;\n }\n while(pos>=l&&l!=1)\n {\n pos-=1;\n ans++;\n }\n if(pos==l-1)\n {\n pos+=1;\n }\n if(sum1>sum)\n {\n while(pos<=r&&r!=n)\n {\n\n pos+=1;\n ans++;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6b39aaa813587325a6cb067a929ddd90", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nint main() {\n\n int i,j,n,k,max,pos,l,r,ans;\n scanf(\"%d %d %d %d\",&n,&pos,&l,&r);\n if(l==1 && r==n){\n printf(\"0\");\n }else{\n if(l==r){\n ans=abs(pos-l);\n if(l==1 ||l==n){\n printf(\"%d\",ans+1);\n }else{\n printf(\"%d\",ans+2);\n }\n }else if(l==1){\n ans=abs(pos-r);\n printf(\"%d\",ans+1);\n }else if(r==n){\n ans=abs(pos-l);\n printf(\"%d\",ans+1);\n }else{\n if(abs(pos-l)>=abs(pos-r)){\n ans=abs(pos-r);\n ans+=abs(r-l);\n }else{\n ans=abs(pos-l);\n ans+=abs(r-l);\n }\n printf(\"%d\",ans+2);\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "069f6bfb31f7dc2c8a92c9ce75f93749", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,pos,a,b,l,r,min,max,count=0;\n scanf(\"%d%d%d%d\",&n,&pos,&l,&r);\n a = 1;\n b = n;\n if ((l!=a)||(b!=r))\n{ \n if((r-pos)<(pos-l))\n { \n if(b!=r)\n {\n while(pos!=r)\n {\n min = b*(b<(pos+1)) + (pos+1)*((pos+1)(pos-1)) + (pos-1)*((pos-1)>a);\n pos = max;\n count++;\n }\n a = l;\n count++;\n }\n }\n if(((pos-l)<(r-pos))||((pos-l)==(r-pos)))\n { \n if(a!=l)\n {\n while(pos!=l)\n {\n max = a*(a>(pos-1)) + (pos-1)*((pos-1)>a);\n pos = max;\n count++;\n }\n a = l;\n count++;\n }\n if(b!=r)\n {\n while(pos!=r)\n {\n min = b*(b<(pos+1)) + (pos+1)*((pos+1)\n#include\nint main(){\n\tint n,pos,l,r,res;\n\twhile(scanf(\"%d%d%d%d\",&n, &pos, &l, &r)){\n\t\tif(l==1 && r==n){\n\t\t\tres=0;\n\t\t}\n\t\telse if(l==1){\n\t\t\tres=abs(pos-r)+1;\n\t\t}\n\t\telse if(r==n){\n\t\t\tres=abs(pos-l)+1;\n\t\t}\n\t\telse{\n\t\t\tif(l<=pos && pos<=r){\n\t\t\t\tres=pos-2*l+r+2;\n\t\t\t\t//printf(\"1\\n\");\n\t\t\t}\n\t\t\telse if(l>pos){\n\t\t\t\tres=r-pos+2;\n\t\t\t\t//printf(\"1\\n\");\n\t\t\t}\n\t\t\telse if(r\n#include \nvoid main() {\n int t=-1,n,p,l,r;\n scanf(\"%d\", &n);\n scanf(\"%d\", &p);\n scanf(\"%d\", &l);\n scanf(\"%d\", &r);\n bool lf=(l==1);\n bool rf=(r==n);\n t=lf?(rf?0:(r-p+1)):(rf?(p-l+1):(r-p\nint main()\n{\nint r,g,b,countr,countb,countg,remainr,remainb,remaing,count=0;\nscanf(\"%d%d%d\",&r,&g,&b);\ncountr=r/3;\nremainr=r%3;\ncountg=g/3;\nremaing=g%3;\ncountb=b/3;\nremainb=b%3;\nwhile(remainr!=0||remainb!=0||remaing!=0)\n{\nremainr=remainr-1;\nremaing=remaing-1;\nremainb=remainb-1;\ncount++;\n}\nprintf(\"%d\",countr+countb+countg+count);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0908d5c147d6b501490b681904f60f43", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint func(const void*a, const void*b)\n{\n\treturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n\tlong long int r, g, b,count=0;\n\tscanf(\"%lld %lld %lld\", &r, &g, &b);\n\tlong long arr[3];\n\twhile(r%3 + g%3 + b%3>=3)\n\t{\n\t\tr--;g--;b--;\n\t\tcount++;\n\t}\n\tcount+=r/3 + g/3 + b/3;\n\tr=r%3;g=g%3;b=b%3;\n\tarr[0]=r;arr[1]=g;arr[2]=b;\n\tqsort(arr,3,sizeof(long long),func);\n\tlong long smallest=arr[0];\n\tcount+=smallest;\n\tprintf(\"%lld\\n\",count);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "80553845b1e55564b3f24bb12e857ddd", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \nint min(int a,int b,int c)\n{\n int min_=a;\n if(min_>b)\n {\n min_=b;\n }\n if(min_>c)\n {\n min_=c ;\n }\n return min_ ;\n}\nint non_div(int a, int b, int c)\n{\n int k=0 ;\n if(a%3!=0)\n {\n k++;\n }\n if(b%3!=0)\n {\n k++;\n }\n if(c%3!=0)\n {\n k++;\n }\n return k ;\n}\nint main()\n{\n int r,b,g,a,c,d,e,k,m,i=0;\n scanf(\"%d\",&r);\n scanf(\"%d\",&b);\n scanf(\"%d\",&g);\n k=non_div(r,b,g);\n \n\n if(r==0 )\n {\n printf(\"%d\",b/3+g/3);\n return 0;\n }\n if(g==0)\n {\n printf(\"%d\",r/3+b/3);\n return 0;\n }\n if(b==0)\n {\n printf(\"%d\",r/3+g/3);\n return 0;\n }\n if(k>=2)\n {\n while(k>=2)\n {\n r--;\n b--;\n g--;\n i++;\n k=non_div(r,b,g); }\n\n\n printf(\"%d\",r/3+b/3+g/3+i);\n return 0;\n }\n else\n {\n a=min(r,b,g);\n c=r-a;\n d=b-a;\n e=g-a;\n printf(\"%d\",c/3+d/3+e/3+a);\n\n return 0 ;\n }\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5657d7ea18ddbb57fbf899edb15466fe", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint maxx(int i,int j,int k)\n{\n i=i>j?j:i;\n return i>k?k:i;\n}\nint main()\n{\n __int64 ans,a,b,c,aa,bb,cc,cout;\n while(~scanf(\"%I64d %I64d %I64d\",&a,&b,&c))\n {\n ans=a/3+b/3+c/3;\n aa=a%3,bb=b%3,cc=c%3;\n cout=0;\n if(aa*bb*cc==0)\n if((aa*bb==4)||(bb*cc==4||aa*cc==4))\n ans+=1;\n ans+=maxx(aa,bb,cc);\n printf(\"%I64d\\n\",ans);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1c76b25db214a65b2d73bc6e60ff6831", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n long long r,g,b,l,m,n,p,cnt=0;\n scanf(\"%I64d%I64d%I64d\",&r,&g,&b);\n l=r%3;\n m=g%3;\n n=b%3;\n if(l==m || m==n)\n p=m;\n else\n {\n if(l<=m&&l<=n)\n p=l;\n if(m<=n&&m<=l)\n p=m;\n if(n<=l&&n<=m)\n p=n;\n }\n if(l==n)\n p=l;\n\n cnt=p;\n r=r-p;\n g=g-p;\n b=b-p;\n cnt+=(b/3);\n cnt+=(g/3);\n cnt+=(r/3);\n printf(\"%I64d\",cnt);\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "334570651ca428d2bbbe69506e873696", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\n int w;\n\n printf (\"Enter the weight of watermelon: \");\n scanf (\"%d\",&w);\n\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 printf (\"NO\");\n }\n else\n printf (\"the weight of the watermelon isn't right .\");\n\n return main();\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "71f80d24269f531b715ff2a215a1673c", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n unsigned int n;\nscanf(\"%u\",&n);\nwhile(n>2)\n{\n if(n%2==0)\n printf(\"YES\");\nelse\nprintf(\"NO\");\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae4d66768a75ae1c620c6a9ffa4b7c8d", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n while(scanf(\"%d\",&n))\n {\n if(n>2 && n%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3fa4be42bdf37129a2e0e268eeef58c0", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nvoid main(){\n long w,count=0;\n scanf(\"%d\",&w);\n for(int i=w;i>1;i/2)\n count++;\n if(count%2==0)\n printf(\"YES\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bad159e721af307d1ebb9f23004d6d4b", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n while(1);\n {scanf(\"%d\",&n);\n if( n%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }", "lang_cluster": "C", "compilation_error": false, "code_uid": "c8dd505918cb9ea0f6c1ac1c8574babe", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int i=0,count,j,k;\n char name[55];\n scanf(\"%s\",&name);\n while(name[i]!='\\0')\n {\n if(name[i]=='a')\n count++;\n }\n j=strlen(name);\n if(count>j/2)\n printf(\"%d\",j);\n else\n k=j/2-count;\n printf(\"%d\",k);\n \n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7803e49768864be9a080aaca9dcfa27a", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tchar s[50];\n\tint i,p=0,q;\n\tgets(s);\n\tq=strlen(s);\n\tfor(i=0;q;i++)\n\t{\n\t\tif(s[i]==97)\n\t\tp=p+1;\n\t}\n\tfor(i=0;i\n#include \n//#include // \ufffd\ufffd\ufffd strstr\n#include // setlocale\n#include // SetConsoleCP,SetConsoleOutputCP\n\n/* Primer 1 */\nvoid main(void)\n{\n SetConsoleCP(866);\n SetConsoleOutputCP(866);\n\n setlocale( LC_ALL, \"Russian\" );\n\n int N; // \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n int L; // \ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n int K; // \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n printf(\"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd: \");\n scanf(\"%d\",&N);\n printf(\"\\n\");\n\n K=0;\n L=1;\n int LMax,Ns;\n LMax=N/2;\n while(L<=LMax)\n {\n Ns=(N-L)/L; // \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n if (L+Ns*L==N)\n {\n printf(\"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd %d, \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd %d\\n\",L,Ns);\n K++;\n }\n L++;\n }\n printf(\"\\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd: %d\\n\",K);\n\n getchar();\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ef71c4b9d6a50c98a55bc411d77ddff5", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n char str[51];\n gets(str);\n int i,length,j,k;\n length=strlen(str);\n j=length;\n int s=0;\n \n for(i=1;i<=length;i++)\n {\n if(str[i]=='a')\n s++;\n }\n for(j=length;;j--)\n {\n if(s>=(length/2)+1)\n break;\n }\n printf(\"%d\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cd036a902dffc0fc661a016b50cc2081", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nvoid main(void)\n{\nchar s[50];\nint i,n,nX,count=0,aP;\nscanf(\"%s\",s);\nn=strlen(s);\naP=n/2 + 1;\nfor(i=0;i\n\nvoid main()\n{\n\tint n, m, a, b;\n\tscanf(\"%d %d %d %d\", &n, &m, &a, &b);\n\tif(b/m\n#include\n#include\nint main()\n{\n int n,m,a,b;\n int i,j;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n int mincost[n];\n int cost=0;\n int z=0;\n if(a=n)\n {\n cost=(b*(j/m));\n mincost[z]=cost;\n z++;\n }\n }\n }\n int min=mincost[0];\n for(i=0;imincost[i])\n {\n min=mincost[i];\n }\n }\n printf(\"%d\",min);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7aab65427fb8b121031af7a3ba676ceb", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,m,a,b,s;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if((float)a<=(float)b/(float)m) { printf(\"%d\",n*a); return 1;}\n if(n*a>=b&&n<=m) {printf(\"%d\",b); return 2;}\n else printf(\"%d\",((n/m)*b)+((((n%m)*a)>b)?b:((n%m)*a)));\n //printf(\"%d\",((float)a<=(float)b/m)?n*a:((n>m)?(n/m)*b:1)+((((n%m)*a)>b)?1:(n%m)*a));\n return 3;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a8bfcbb1ffa5e6640030042b1c71333c", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n\nvoid main()\n{\n\tlong int n, m, a, b, ans;\n\tscanf(\"%ld %ld %ld %ld\", &n, &m, &a, &b);\n\tif(b/m\nvoid main() {\n int n,m,a,b;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n float cp;\n cp = (float)b/m;\n if ( cp < (float)a ) {\n printf(\"%d\",(n/m)*b+(n-(n/m))*a);\n }\n else if( cp >= (float)a ) {\n printf(\"%d\",n*a);\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8efd801fbed7173c73ff90ef654bb30b", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define x 3.141592\nmain()\n{\n float n,R,r,a;\n scanf(\"%f%f%f\",&n,&R,&r);\nif(R!=r)\n{\n a=asin(r/(R-r));\n if((n*a)<=x)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\nelse\n{\n if(n==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\nreturn(0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d2a88e9b915a09c308f55c63c4412d74", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define x 3.141592\nmain()\n{\n float n,R,r;double a;\n scanf(\"%f%f%f\",&n,&R,&r);\nif(R0)\n{\n a=atan(r/sqrt(R*(R-2*r)));\n if((n*a)<=x)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\nif(R>=r && (R-2*r)<0)\n{\n if(n==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\nif(R==2*r)\n{\n if(n==2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n}\nreturn(0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3d64dbb177fcf004d524b13a7cd19417", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nconst double PI = 3.1415926535897932384626433832795;\nint main (){\n\tint n,R,r;\n\tscanf(\"%d%d%d\",&n,&R,&r);\n\tif ( r> R ) {\n\t\tprintf( \"NO\\n\");\n\t\treturn 0;}\n\tif ( ( 2*r >R) && ( n> 1) ) {\n\t\t\tprintf( \"NO\\n\");\n\t\treturn 0 ;\n\t}\n\tdouble alpha;\n\talpha=2*asin( (double) r/(2.0* (double) (R-r) ) );\n\tif ( ( 2*PI/n) \n#include \nint main(){\nint R,r,n,l,L;\nscanf(\"%d%d%d\",&n,&R,&r);\n l=(r*2*n)-((R-r)*2);\n L=2*R;\n if((L-l)>=0)\n \tprintf(\"Yes\");\n \telse\n \tprintf(\"No\");\n\nsystem (\"pause\");\n\treturn 0;\n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7fedd00b96125ad7b23872061ae3d6c1", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \nvoid main( void)\n{\n int n,r,R,y;\n float k;\n\n scanf(\"%d %d %d\",&n,&R,&r);\n\n y=0;\n\n if ( (n==1) && (r<= R) )\n {y=1;\n }\n\n if ( (n>=3) && (r< R) )\n {\n\n if ( (float) r/(R-r)<= sin(3.141592/n) )\n {y=1;\n }\n }\n\n if ( (n==2) && ( ( 2*r ) <= R) )\n {y=1;\n }\n\n if ( (n==6) && ( ( 3*r ) <=R) )\n {y=1;\n }\n\n if (y==1)\n {\n printf(\"YES\");\n }else\n {\n\n printf(\"NO\");\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "29aef5563a623a6d060b432b9dbd12d4", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "//Bismillahir Rahmanir Rahim\n#include\n#include\nint main()\n{\n\tchar flight[1000000];\n\tint i,t,x,y,j;\n\twhile(scanf(\"%d\",&t)){\n\t\tscanf(\"%s\",&flight);\n\t\tx=0;\n\t\ty=0;\n\t\tfor(j=0;jy){\n\t\t\tprintf(\"YES\\n\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a6e0a0c41a4bb14e04f963cd2084c994", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n \nint main()\n{\n int c=0;\n int num, FS,SF,iter;\n char city[101];\n scanf(\"%d\",&num);\n scanf(\"%s\",city);\n for(iter=0;iter+1FS)\n printf(\"YES\");\n else \n printf(\"NO\");\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f29c2be45e61346ba7554126c7440677", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \"stdio.h\"\nint main(int argc, char const *argv[])\n{\n\tint i=0,day,s=0,f=0;\n\tchar list[50];\n\tscanf(\"%d\",&day);\n\tscanf(\"%s\",list);\n\twhile(list[i+1]!='\\0'){\n\t\tif (list[i]=='S' && list[i+1]=='F')\n\t\t{\n\t\t\ts+=1;\n\t\t\t/* code */\n\t\t}else if (list[i]=='F' && list[i+1]=='S')\n\t\t{\n\t\t\tf+=1;\n\t\t\t/* code */\n\t\t}else{\n\t\t\tcontinue;\n\t\t}\n\t}\n\tif (s>f)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\t/* code */\n\t}else{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d7ee521e34ac07270ed9178c1abcc41e", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nchar aa[100000];\nint main()\n{\n int a,i;\n\n while(1)\n {\n scanf(\"%d\",&a);\n for(i=1;i<=a;i++)\n {\n scanf(\" %c\",&aa[i]);\n }\n if(aa[1]=='S'&&aa[a]=='F') printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f1681c1a1095bb1c5842b5898efe85c2", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n;\n char s[101];\n int sf, fs ;\n while (scanf(\"%d\", &n))\n {\n scanf(\"%s\", s);\n sf = 0;\n fs = 0;\n for (int i = 1; i < strlen(s); i++)\n {\n if (s[i-1] == 'S' && s[i] == 'F'){\n sf++;\n } else if (s[i-1] == 'F' && s[i] == 'S'){\n fs++;\n }\n }\n if (sf > fs){\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c65ab687457498267b2345b38d08cf2a", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n\tint i,j,n,m,q=0;\n\tlong long int k,c=2,s,r;\n\tscanf(\"%d %d %lld\",&n,&m,&k);\n\tlong long int b[n][m];\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=m;j++)\n\t\t{\n\t\t\tb[i][j]=c;\n\t\t\tc+=2;\n\t\t\tif((b[i][j]-1)==k||(b[i][j]==k))\n\t\t\t{\n\t\t\t\ts=i;\n\t\t\t\tr=j;\n\t\t\t\tq++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(q>0)\n\t\t\tbreak;\n\t}\n\tif(k%2==0)\n\t\tprintf(\"%lld %lld R\",s,r);\n\telse\n\t\tprintf(\"%lld %lld L\",s,r);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a613e66f7c34ad9df3ae3ea84f6816c7", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n\tint i,j,c=2,n,m,k,s,r,q=0;\n\tscanf(\"%d %d %d\",&n,&m,&k);\n\tint b[n][m];\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=m;j++)\n\t\t{\n\t\t\tb[i][j]=c;\n\t\t\tc+=2;\n\t\t\tif((b[i][j]-1)==k||(b[i][j]==k))\n\t\t\t{\n\t\t\t\ts=i;\n\t\t\t\tr=j;\n\t\t\t\tq++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(q>0)\n\t\t\tbreak;\n\t}\n\tif(k%2==0)\n\t\tprintf(\"%d %d R\",s,r);\n\telse\n\t\tprintf(\"%d %d L\",s,r);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ebf08d940567c30f9bcb09903aab86f", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n int i,j,m,n,k,ast[1000][1000];\n char ch;\n\n scanf(\"%d%d%d\",&n,&m,&k);\n ch=getchar();\n for(i=0;i\n#include \n\nint main()\n{\n int A[300][300],n,m,k,r,d,i,j,o;\n char l;\n scanf(\"%d%d%d\",&n,&m,&k);\n o=k;\n if(k%2==0){\n k=k-1;\n }\n for(i=1;i<=n;i++){\n for(j=1;j<=m;j++){\n A[i][j]=1+2*m*(i-1)+2*(j-1);\n }\n }\n for(i=1;i<=n;i++){\n for(j=1;j<=n;j++){\n if(k==A[i][j]){\n r=i;\n d=j;\n }\n }\n }\n if(o%2==0){\n l='R';\n }\n else l='L';\n printf(\"%d\\n%d\\n%c\",r,d,l);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aafbfb64e3452911f2b4c733e2f49d08", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n/*\n * \n */\nint main() {\n \n int n, m, k, i, l=0;\n float sum=0.0;\n \n //printf(\"Give the colum, the row.\\n\");\n scanf(\"%d %d\", &n, &m);\n \n do{\n //printf(\"Give the position to sit.\\n\");\n scanf(\"%d\", &k);\n }while(k<0 || k>(2*n*m+1));\n \n for(i=1; i<=m; i++){\n if(ki*n*2-2*i){\n l=m;\n }\n }\n for(i=1; i<=n; i++){\n if(k<=2*m*i){\n if(k%2==0){\n printf(\"%d %d R\\n\", i, l);\n return;\n }else{\n printf(\"%d %d L\\n\", i, l);\n return;\n }\n }\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d9e31f47c3e67eba7e66856079010f0a", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "// Bear and the three balls\n#include \n#include \n#include \n\n\t// soluci\u00f3n por fuerza bruta: comparar cada bola con otras dos, si antres de terminar el ciclo hay dos que difieren en menos de 2 en valor absoluto, se puede\n\t// Si se acaba el ciclo sin encontrar nada, se imprime NO\n\n\tint particion (int a[],int ini, int fin);\n\tvoid quicksort (int a[],int ini, int fin);\n\tvoid swap (int a[],int x,int y);\n\t\t\nint main(void){\n\tint n;\n\tint *vec;\n\tint i, cont = 0;\n\n\tscanf ( \"%d\", &n );\n\t\n\tvec = (int*)malloc(n*sizeof(int));\n\t\n\tfor ( i = 0; i < n; i++){\n\t\t\tscanf ( \"%d\", &vec[i] );\n\t}\n\t\n\tquicksort( vec, 0, n - 1 );\n\t\n\t/*for ( i = 0; i < n; i++ ){\n\t\tprintf ( \"%d - \", vec[i] );\n\t}*/\n\t\n\tfor ( i = 1; i < n; i++ ){\n\t\tif ( vec[i - 1] == (vec[i] - 1) )\n\t\t\tcont++;\n\t\telse if ( vec[i - 1] != vec[i] )\n\t\t\tcont = 0;\n\t\tif ( cont == 2 ){\n\t\t\tprintf ( \"YES\" );\n\t\t\texit(1);\n\t\t}\n\t}\n\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\nint main()\n{\n int n,temp,i,j;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0; ii; j--)\n {\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0; i\n#include \n#include \nint main()\n{\n int n,i,j,k,s=0,yes=0;\n scanf(\"%d\",&n);\n int A[n];\n for (i=0;i0&&fabs(A[i]-A[j])<=2&&A[i]!=A[j])\n {\n for (k=j+1;k0&&fabs(A[i]-A[k])<=2&&A[i]!=A[k]&&A[k]!=A[j])\n {\n yes=1;\n break;\n }\n }\n }\n }\n }\n if (yes==1)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d52dab3d3907793d8e4192eefc3350b7", "src_uid": "d6c876a84c7b92141710be5d76536eab", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main() {\n int n;\n while(scanf(\"%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\nint main()\n{\n long n,i,j,swap,s=0;\n scanf(\"%ld\",&n);\n long 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\nint main()\n{\n int i,n=0,N,a,b;\n scanf(\"%d%d%d\",&N,&a,&b);\n for(i=a+1;i<=N;i++)\n if(N-i<=b)\n n++;\n printf(\"%d\",n);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d3af5253775334ca78026652250e59d9", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n\n printf(\"%d\",n-a<=b+1?n-a:b+1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eaefa1e536df97039bf6bb890619635e", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int i,n=0,N,a,b;\n scanf(\"%d%d%d\",&N,&a,&b);\n for(i=a+1;i<=N;i++)\n\tif(N-i<=b)\n\t n++;\n printf(\"%d\",n);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eb8e8bb10cb38258e6e2bea717266e5d", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "GNU C11", "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\t\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c0fc18f373b157a7ca62d68224f2caf", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\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 {\n printf(\"%d\",a+1);\n }\n }\n else if(a>b)\n {\n if((a+b)n)\n {\n printf(\"%d\",a+1);\n }\n }\n else if(a==b)\n {\n if((a+b)n)\n {\n printf(\"%d\",a+1);\n }\n }\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a4f4df84f39c50553858ba2e7dc81a98", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint gcd(int a, int b){\n while(b != 0){\n int temp = b;\n b = a%b;\n a = temp;\n }\n return a;\n}\n\nint main(void){\n int a, b, c, d;\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n int x = a*c/gcd(a, c);\n int y = b*d/gcd(b, d);\n int area1, area2, g;\n if((x*b)/a >= (x*d)/c){\n area1 = (x*x*b)/a;\n area2 = (x*x*d)/c;\n g = gcd(area1, area2);\n area1 /= g; area2 /= g;\n printf(\"%d/%d\\n\", area1-area2, area1);\n }\n else{\n area1 = (y*y*a)/b;\n area2 = (y*y*c)/d;\n g = gcd(area1, area2);\n area1 /= g; area2 /= g;\n printf(\"%d/%d\\n\", area1-area2, area1);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "60eb3f19a5345eecadac8fe20139900f", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint mint(a, b)\n{\n\treturn (a > b? b : a);\n}\n\nint maxt(a, b)\n{\n\treturn (a < b? b : a);\n}\n\nint reduce(a, b)\n{\n\tint i = mint(a,b);\n\twhile (i >= 2)\n\t{\n\t\tif (a % i == 0 && b % i == 0)\n\t\t\treturn (i);\n\t\ti--;\n\t}\n\treturn (1);\n}\n\nint main()\n{\n\tint a;\n\tint b;\n\tint c;\n\tint d;\n\tint x;\n\tint y;\n\tint l;\n\tint k;\n\tint z;\n\tint alpha;\n\tint beta;\n\tint big;\n\tint small;\n\n\tscanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\tx = mint(a, b);\n\ty = maxt(a, b);\n\tl = mint(c, d);\n\tk = maxt(c, d);\n\talpha = (x *l);\n\tbeta = (y * k);\n\tz = reduce(alpha, beta);\n\talpha = alpha / z;\n\tbeta = beta / z;\n\tprintf(\"%d/\", beta -alpha);\n\tprintf(\"%d\", beta );\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d11d8ea588743df7f57624bd0a57a04", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,c,d,cnt;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(c>d)\n {\n a*=c;\n b*=c;\n }\n else\n {\n a*=d;\n b*=d;\n }\n if((float)a/c>(float)b/d)\n {\n a*=d;\n c*=b;\n cnt=a-c;\n printf(\"%d/%d\",cnt/hcf(cnt,a),a/hcf(cnt,a));\n }\n else\n {\n b*=c;\n d*=a;\n cnt=b-d;\n printf(\"%d/%d\",cnt/hcf(cnt,b),b/hcf(cnt,b));\n }\n return 0;\n}\nint hcf(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}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fb1a2a0fe5455827f4f359166a9faf0b", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nint gcd(int a, int b)\n {\n while(a != b) {\n if (a < b) b -= a;\n else a-= b;\n }\n return a;\n }\nint main(){\n int p,q;\n __int64 a,b,c,d,e,f,gd;\n scanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&c,&d);\n e=a*c*d;\n f=b*c*d;\n if(a*d<=b*c){\n p=b*c-a*d;\n q=b*c;\n }\n else{\n p=a*d-b*c;\n q=a*d;\n }\n gd=gcd(p,q);\n p=p/gd;\n q=q/gd;\n printf(\"%d/%d\\n\",p,q);\n return 0;\n}\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "c4bf4e3cb81ae388be38d0a65779dde9", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nint count(int n,int m)\n{\n int r;\n while(m)\n {\n r = n%m;\n n = m;\n m = r;\n }\n return n;\n}\n\nint main()\n{\n int a,b,c,d,p,q,k;\n while(scanf(\"%d %d %d %d\",&a,&b,&c,&d))\n {\n p = a*d;\n q = b*c;\n if(p>q)\n k=p;p=q;q=k;\n k = count(q,p);\n p = p/k;\n q = q/k;\n printf(\"%d/%d\\n\",q-p,q);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1157f10e6291f136533a447eca554a90", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\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\n int *L=malloc(n1*sizeof(int));int* R=malloc(n2*sizeof(int));\n\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\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\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\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\n\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n\n merge(arr, l, m, r);\n }\n}\nint flag=0;\n void find(int size,int *a,int comp)\n{\n if(size==1){\n if((a[0]+comp)%360==0||(a[0]-comp)%360==0) flag=1;\n\n }\n else{\n find(size-1,a,comp+a[size-1]);\n find(size-1,a,comp-a[size-1]);\n }\n}\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint *a=malloc(n*sizeof(int));\nint i;\nfor(i=0;i\n#include \n#include \nint n, s = 0, a[20];\nlong long ji[40][400] = {0};\nvoid f(int i, int sum)\n{\n if (s != 0)\n return ;\n int m, n;\n m = sum + a[i], n = sum - a[i];\n ji[i][sum]++;\n if (m > 360)\n m -= 360;\n if (n < 0)\n n += 360;\n if (i == n)\n if (sum == 0)\n s++;\n if (ji[i + 1][m] == 0)\n f(i + 1, m);\n if (ji[i + 1][n] == 0)\n f(i + 1, n);\n}\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n f(0, 0);\n if (s == 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9544141da43af0ac8957227612f45469", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint n,s = 0, a[20];\nvoid f(int i, int sum)\n{\n int m,n;\n m=sum+a[i],n=sum-a[i];\n if(m>360)\n m-=360;\n if(n<0)\n n+=360;\n if(i==n)\n if(sum==0)\n s++;\n f(i+1,m);\n f(i+1,n);\n}\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n f(0, 0);\n if (s == 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d14d6c8d3d9dc030636c3a93cd73723", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint n,s = 0, a[20];\nvoid f(int i, int sum)\n{\n if(s!=0)\n return ;\n int m,n;\n m=sum+a[i],n=sum-a[i];\n if(m>360)\n m-=360;\n if(n<0)\n n+=360;\n if(i==n)\n if(sum==0)\n s++;\n f(i+1,m);\n f(i+1,n);\n}\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n f(0, 0);\n if (s == 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "890458c3b391300a831b73662b742b91", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint a[16];\nint flag=0;\nvoid check(int sum,int i,int t)\n{\n\tint a1;\n\ta1=sum+a[i];\n\tint b;\n\tb=sum-a[i];\n\tif(i==t&&(a1==0||b==0))\n\t{flag=1;\n\t\treturn ;\n\t}\n\tif(i==t)\n\t\treturn ;\n\tcheck(a1,i+1,t);\n\t\tcheck(b,i+1,t);\n}\nint main(void)\n{\n\tint t,sum=0;\nscanf(\"%d\",&t);\t\nfor(int i=0;i\n#include \n\nint main()\n{\n long long int x, rem, steps = 0;\n long long int count_5=0, count_4=0, count_3=0, count_2=0, count_big=0;\n\n scanf(\"%lld\", &x);\n while (x!=0)\n {\n\n\n if (x>=5)\n {\n x = x - 5;\n steps = steps + 1;\n count_5 += 1;\n }\n\n else if (x>=4)\n {\n x = x - 4;\n steps += 1;\n count_4 += 1;\n }\n\n else if (x>=3)\n {\n x = x - 3;\n steps+=1;\n count_3 += 1;\n }\n\n else if (x>=2)\n {\n x = x - 2;\n steps+=1;\n count_2 += 1;\n }\n else if (x>=1)\n {\n steps += 1;\n count_big += x;\n }\n\n}\nprintf(\"%lld\",steps);\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0b0350a25ec90a4df8a9ccc61d059578", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,a;\n scanf(\"%d\",&n);\n a=fun(n);\n printf(\"%d\",a);\n return 0;\n}\nint fun(int n)\n{\n int c=0;\n if(n>=5)\n {\n n=n-5;\n c++;\n fun(n);\n }\n if(n>=4)\n {\n n=n-4;\n c++;\n fun(n);\n }\n if(n>=3)\n {\n n=n-3;\n c++;\n fun(n);\n }\n if(n>=2)\n {\n n=n-2;\n c++;\n fun(n);\n }\n if(n==1)\n {\n c++; \n }\n return c;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "04a0837bdb543e7a4a3ba7760d9aa72f", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x,i,s,m=0;\n scanf(\"%d\",&x);\n for(i=0;i<=x;)\n {\n m++;\n s=x-i;\n s>=5?i+=5:s==4?i+=4:s==3?i+=3:s==2?i+=2:s==1?i+=1:0;\n }\n printf(\"%d\",m);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "abe50184e8749d38681d48f1a594d44c", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x,i,s,m=0;\n scanf(\"%d\",&x);\n for(i=0;i<=x;)\n {\n s=x-i;\n if(s>=5)\n i+=5;\n else if(s==4)\n i+=4;\n else if(s==3)\n i+=3;\n else if(s==2)\n i+=2;\n else if(s==1)\n i+=1;\n m++;\n }\n printf(\"%d\",m);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae7bdb8d774a46b5fcbfd11398477e27", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint n;\nint min(int a,int b)\n{\n\tif(a>b)\n\treturn b;\n\treturn a;\n}\n/*int solve(int currstate,int ans)\n{\n\tif(currstate==n)\n\treturn ans;\n\telse\n\treturn min(solve(currstate+1,ans+1),min(min(solve(currstate+2,ans+1),solve(currstate+3,ans+1))));\n}*/\nint main()\n{\n\tscanf(\"%d\",&n);\n\tif(n<=5)\n\tprintf(\"1\\n\");\n\telse\n\tprintf(\"%d\\n\",n/5+1);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d6b081f05fe46320d61163c3ee1938e6", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\tint n,*t,i,j,k;\n\tscanf(\"%d\",&n);\n\tt=(int*)malloc(n*sizeof(int));\n\tif(n<3){\n\t\tprintf(\"NO\");\n\t\treturn 1;\n\t}\n\tfor(i=0;it[k] && t[j]\n\nvoid merge(int x[],int first,int mid, int last)\n{\n int i=first, j=mid+1, k=first, y[last-first+1];\n\n while(i<=mid&&j<=last)\n {\n if(x[i]<=x[j]) {y[k++]=x[i++];}\n else {y[k++]=x[j++];}\n\n }\n\n while(j<=last) y[k++]=x[j++];\n while(i<=mid) y[k++]=x[i++];\n\n for(k=first; k<=last; k++) x[k]=y[k];\n}\n\n\n\n\nvoid sort(int x[],int first,int last)\n{\n if(firstx[i+2]){printf(\"YES\"); break;}\n }\n\n if(i==n-2) printf(\"NO\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3343655374400443db4bc53dce1acaef", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\nvoid merge(int x[],int first,int mid, int last)\n{\n int i=first, j=mid+1, k=first, y[last-first+1];\n\n while(i<=mid&&j<=last)\n {\n if(x[i]<=x[j]) {y[k]=x[i]; i++;}\n else {y[k]=x[j]; j++;}\n k++;\n }\n\n if(i>mid) { while(j<=last) {y[k]=x[j]; j++; k++; }}\n else { while(i<=mid) {y[k]=x[i]; i++; k++; }}\n\n for(k=first; k<=last; k++) x[k]=y[k];\n}\n\n\n\n\nvoid sort(int x[],int first,int last)\n{\n if(firstx[i+2]){printf(\"YES\"); break;}\n }\n\n if(i==n-2) printf(\"NO\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ac0382c23d2a2d46109cc8d17b33d0ab", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nvoid r_pivot(int *a, int *b)\n{\n int i, *r=a+(rand()%(b-a+1));\n i=*r;*r=*a;*a=i;\n}\n\nint partition(int *a,int *b)\n{\n r_pivot(a,b);\n int *pvt=a, j;\n a--;b++;\n while(1)\n {\n while(1)\n {\n a++;\n if(*a>=*pvt)break;\n }\n while(1)\n {\n b--;\n if(*b<=*pvt)break;\n }\n if(a>b) return b;\n else {j=*a;*a=*b;*b=j;}\n }\n\n}\n\nvoid sort(int *a, int *b)\n{\n if(aa[i+2]){j=1;break;}\n printf(j?\"YES\\n\":\"NO\\n\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ddb38fa6fadd92622b1604288f6aba3c", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n// \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c\n\nvoid mergeSort(int *a, int l, int r)\n{\n if (l == r) return; // \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e\u043c\u043a\u043d\u0443\u043b\u0438\u0441\u044c\n int mid = (l + r) / 2; // \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438\n // \u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b\n mergeSort(a, l, mid);\n mergeSort(a, mid + 1, r);\n int i = l; // \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0443\u0442\u0438\n int j = mid + 1; // \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0443\u0442\u0438\n int *tmp = (int*)malloc(r * sizeof(int)); // \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\n for (int step = 0; step < r - l + 1; step++) // \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n {\n // \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0432\u0443\u0445 \u043f\u0443\u0442\u0435\u0439\n // \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0435\u0441\u043b\u0438 j > r\n if ((j > r) || ((i <= mid) && (a[i] < a[j]))) \n {\n tmp[step] = a[i];\n i++;\n }\n else \n {\n tmp[step] = a[j];\n j++;\n }\n }\n // \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\n for (int step = 0; step < r - l + 1; step++)\n a[l + step] = tmp[step];\n}\n\n\nint main()\n{\n int n, b[100001], flag = 0;\n\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n scanf(\"%d\", &b[i]);\n\n mergeSort (b, 0, n-1);\n\n\n for (int i = 1; i < n-1; i++)\n {\n if (b[i]+b[i-1] > b[i+1])\n {\n printf(\"YES \\n\");\n flag = 1;\n break;\n }\n }\n\n if (flag == 0)\n printf(\"NO \\n\");\n\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c49277162ba11870aff5d5dafc314194", "src_uid": "897bd80b79df7b1143b652655b9a6790", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nvoid main()\n{\n int n,i,p1=1,p2=2,temp=3;\n scanf(\"%d\",&n);\n int a[n];\n for (i=0;i\n#include \n\nmain()\n{\n int k,i,n,num[10],player1=1,player2=2,waiter=3,winner,loser,possible=1;\n scanf(\"%d\",&n);\n for (i=0;i\nint main(){\nint a=1,b=2,c=3,n,i,x=3,ok=1,aux;\nscanf(\"%d\",&n);\n\nwhile(n){\n scanf(\"%d\",&i);\n if(i==x){ok=0;break;}\n else if(i==a){\n aux=b;\n b=x;\n x=aux;\n }\n else if(i==b){\n aux=a;\n a=x;\n x=aux;\n }\n}\nif(ok==1)printf(\"YES\");\nelse printf(\"NO\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5a3dd0806db459773a7704eaa72c6323", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\n\tFILE *prb=fopen(\"prb.in\",\"r\");\n\tint n,alex=1,bob=2,carl=3,num[110],t,m=0;\n\tfscanf(prb,\"%d\",&n);\n\tint i;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfscanf(prb,\"%d\",&num[i]);\n\t}\n\tfor(i=1;i<=n;i++)\n\t{\n\t if (num[i]==carl)\n\t {\n\t \tm=1;\n\t }\n\n\t\tif(num[i]==alex)\n\t\t{\n\t\t\tt=bob;\n\t\t\tbob=carl;\n\t\t\tcarl=t;\n\t\t}\n\t\telse if(num[i]==bob)\n\t\t{\n\t\t\tt=alex;\n\t\t\talex=carl;\n\t\t\tcarl=t;\n\t\t}\n\t\n\t}\n\tif(m==0)\n\tprintf(\"YES\\n\");\n else\n \tprintf(\"NO\\n\");\n\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4e132afb1828d4c835c3053638cace74", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main(void){\n int NOR,winner[NOR],i,cntAL=0,cntCA=0,cntBO=0;\n scanf(\"%d\",&NOR);\n for(i=0;i(NOR/2)|| cntBO>(NOR/2) || cntCA>(NOR/2)){\n printf(\"YES\");\n }\n else \n printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cce0dc810f5807067a02a2d9b8f90412", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint number_of_chip( int n, int m );\n\nint main (int argc, const char * argv[])\n{\n \n int n = 0;\n int m = 0;\n scanf(\"%d\", n);\n scanf(\"%d\", m);\n number_of_chip(argv[0], argv[1]);\n return 0;\n}\n\nint number_of_chip( int n, int m )\n{\n if ( n >= 1 && n <= 50 && m >= 1 && m <= 10e-4 ) \n {\n int i = 0;\n \n while(1)\n {\n for ( i=0; i\n#include\n\nint main(void)\n{\n int i,n,m,out;\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n out=n*(n+1)/2;\n m=m%out;\n i=1;\n while(m>=i)\n {\n m-=i;\n i++;\n }\n \n printf(\"%d\",m);\n }\n \n system(\"pause\");\n return 0;\n }", "lang_cluster": "C", "compilation_error": false, "code_uid": "af1fcf544e2a750e8848aa732838b26d", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint main()\n{\n long long int n,m,i;\n scanf(\"%I64d %I64d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n if(m>=i)\n {\n m=m-i;\n }\n if(i==n)\n {\n i=0;\n }\n if(m\nmain()\n{\n int m,n,i,k;\n scanf(\"%d%d\",&m,&n);\n if (n==m)\n printf(\"0\");\n else\n {\n x:\n k=0;\n for (i=1;i<=m;i++)\n {\n if (n>=i)\n n=n-i;\n k++;\n if (n<=i)\n break;\n }\n if (k==m)\n goto x;\n else\n {\n if (n<=i)\n {\n printf(\"%d\",n);\n }\n else\n printf(\"0\");\n }\n }\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7feb058aafb70a74a52604404c592f15", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n#include\n#include\nint main()\n{\n int n,m,s,p,q,t,z;\n scanf(\"%d %d\",&n ,&m);\n s=n*(n+1)/2;\n p=m/s;\n q=(-1+sqrt(1+(4*1*2*p)))/2;\n t=m-(p*s);\n\n while(t>(p*s))\n {\n z=t-((q*q+q)/2);\n\n }\n printf(\"%d\",z);\n return 0;\n\n\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "370bd91172a1478a6050c0f77e83fd06", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#define MAX 100\nint obrada(int a[MAX][MAX], int k, int m);\nvoid main() {\n\tint a[MAX][MAX] = { 0 };\n\tint n, k, m, s = 0;\n\ta[0][0] = a[1][0] = 1;\n\t//scanf(\"%d\", &n);\n\t//for (int i = 0; i < n; i++) {\n\t\tscanf(\"%d%d\", &k, &m);\n\t\ts += obrada(a, k - 1, m - 1);\n\t//}\n\tprintf(\"%d\\n\", s);\n}\n\nint obrada(int a[MAX][MAX], int k, int m)\n{\n\tint p, b;\n\tif (k < m) p = k, k = m, m = p;\n\tif (a[k][m] == 0 && k != -1 && m != -1) {\n\t\tif (k == m == 100) a[k][m] += 1 + obrada(a, k, m - 2);\n\t\telse a[k][m] += 1 + obrada(a, k - 2, m + 1);\n\t}\n\treturn a[k][m];\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cdb06fab7b06d3dad2bac1d1de1b5822", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\t\n\t\n\tint a1,a2,n,i=0,j,k;\n\tscanf(\"%d%d\",&a1,a2);\n\t\n\twhile(a1>0&&a2>0)\n\t{i++;\n\t \n\t if(a1>a2){\n\t \n\t a1=a1-2;\n\t a2=a2+1;\n\t }\n\t else{\n\t \n\t a1=a1+1;\n\t a2=a2-2;\n\t }\n\t \n\t \n\t}\n\t\n\tprintf(\"%d\",i);\n\t\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "672c15635ff98a8bec72cc7d982a5d28", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#define MAX 100\nint obrada(int a[MAX][MAX], int k, int m);\nint main() {\n\tint a[MAX][MAX] = { 0 };\n\tint n, k, m, s = 0;\n\ta[0][0] = a[1][0] = 1;\n\t//scanf(\"%d\", &n);\n\t//for (int i = 0; i < n; i++) {\n\t\tscanf(\"%d%d\", &k, &m);\n\t\ts += obrada(a, k - 1, m - 1);\n\t//}\n\tprintf(\"%d\\n\", s);\n\treturn 0;\n}\n\nint obrada(int a[MAX][MAX], int k, int m)\n{\n\tint p, b;\n\tif (k < m) p = k, k = m, m = p;\n\tif (a[k][m] == 0 && k != -1 && m != -1) {\n\t\tif (k == m == 100) a[k][m] += 1 + obrada(a, k, m - 2);\n\t\telse a[k][m] += 1 + obrada(a, k - 2, m + 1);\n\t}\n\treturn a[k][m];\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a2cc387b23ef6b8d6a8e47195544cf01", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "GNU C11", "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\tgetch();\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e6f9590ab9af9862eeac6293a02fac2b", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n\tint a1,a2;\n\tscanf(\"%d %d\",&a1,&a2);\n\tint dakika=1;\n\tif(a1+a2<=3)\n\tprintf(\"0\");\n\telse\n\t{\t\n\t\twhile(1)\n\t\t{\n\t\t\tif((a1+a2==3) || (a1==2 && a2==2))\n\t\t\t{\n\t\t\t\tprintf(\"%d\",dakika);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(a1\nint main () {\n\tint i,a,j,b,e;\n\tchar t[500]={0},g[500] = {0},h[30],A[15],B[15],E[15];\n\n\tscanf(\"%d\",&a);\n\t//a'n\u0131n elemanlar\u0131\n\tfor(i=0;i\n\nint main()\n{\n\tchar a[105];\n\tint b[26];\n\tint x, i, n;\n\tint flag = 0;\n\twhile(scanf(\"%d\", &n)!=EOF)\n\t{\t\n\t\tgetch();\n\t\tfor(i = 0; i < n; i++)\n\t\t\tscanf(\"%c\", &a[i]);\t\n\t\tfor (i = 0; i < 26; i++)\n\t\t\tb[i] = 0;\n\t\tfor(i = 0; i < n; i++)\n\t\t{\n\t\t\tif('a' <= a[i] && a[i] <= 'z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'a';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t\tif('A' <= a[i] && a[i] <= 'Z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'A';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t}\n\t\t\tflag = 0;\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif(b[i] != 0) flag = 1; break;\n\t\t\t}\n\t\t\tif(flag) \n\t\t\t\tprintf(\"NO\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "b4fb5308494e3fb9b606feead5effc6b", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "# include \n\nint main()\n{\n\tchar a[101];\n\tint b[26];\n\tint x, i, n;\n\tint flag = 0;\n\twhile(scanf(\"%d\", &n)!=EOF)\n\t{\t\n\t\tgetch();\n\t\tfor(i = 0; i < n; i++)\n\t\t\tscanf(\"%c\", &a[i]);\t\n\t\tfor (i = 0; i < 26; i++)\n\t\t\tb[i] = 0;\n\t\tfor(i = 0; i < n; i++)\n\t\t{\n\t\t\tif('a' <= a[i] && a[i] <= 'z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'a';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t\tif('A' <= a[i] && a[i] <= 'Z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'A';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t}\n\t\t\tflag = 0;\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif(b[i] != 0) flag = 1; break;\n\t\t\t}\n\t\t\tif(flag) \n\t\t\t\tprintf(\"NO\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "678e34478b635a3d1c698f2af841e70a", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "# include \n\nint main()\n{\n\tchar a[105];\n\tint b[26];\n\tint x, i, n;\n\tint flag = 0;\n\twhile(scanf(\"%d\", &n)!=EOF)\n\t{\t\n\t\tgetch();\n\t\tfor(i = 0; i < n; i++)\n\t\t\tscanf(\"%c\", &a[i]);\t\n\t\tfor (i = 0; i < 26; i++)\n\t\t\tb[i] = 0;\n\t\tfor(i = 0; i < n; i++)\n\t\t{\n\t\t\tif('a' <= a[i] && a[i] <= 'z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'a';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t\tif('A' <= a[i] && a[i] <= 'Z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'A';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t}\n\t\t\tflag = 0;\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif(b[i] == 0){ flag = 1; break;}\n\t\t\t}\n\t\t\tif(flag) \n\t\t\t\tprintf(\"NO\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee96e4793d9a7de7b9c8d9d59e447676", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "# include \n\nint main()\n{\n\tchar a[50];\n\tint b[26];\n\tint x, i, n;\n\tint flag = 0;\n\twhile(scanf(\"%d\", &n)!=EOF)\n\t{\t\n\t\tgetch();\n\t\tfor(i = 0; i < n; i++)\n\t\t\tscanf(\"%c\", &a[i]);\t\n\t\tfor (i = 0; i < 26; i++)\n\t\t\tb[i] = 0;\n\t\tfor(i = 0; i < n; i++)\n\t\t{\n\t\t\tif('a' <= a[i] && a[i] <= 'z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'a';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t\tif('A' <= a[i] && a[i] <= 'Z')\n\t\t\t\t{\n\t\t\t\t\tx = a[i] - 'A';\n\t\t\t\t\t\tb[x]++;\n\t\t\t\t}\n\t\t}\n\t\t\tflag = 0;\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif(b[i] != 0) flag = 1; break;\n\t\t\t}\n\t\t\tif(flag) \n\t\t\t\tprintf(\"NO\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "ffebd0209ff0e6876f85d7caac56e83e", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1e7a378047a3f48a4acd6bce2b89a480", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid cat(int a,int b,int h1, int h2,int d)\n{ int pos=0,k=0;\n pos=(a*8)+h1; /*oidin raat 10tay*/\n if(pos>=h2)\n {\n k=d;\n printf(\"%d\",k);\n getch();\n }\n d++;\n pos-=(b*12); /*por din shokal 10tay*/\n pos=pos+a*4; /*pordin dupur 2tay*/\n if(pos>=h2)\n {\n k=d;\n printf(\"%d\",k);\n getch();\n }\n cat(a,b,pos,h2,d);\n}\n\nvoid 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\tgetch();\n\t}\n\tif(a\n#include \n#include \n#include \n\nint main () {\n\t\n\tint a, b;\n\tint h1, h2;\n\tint res;\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\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(\"%d\\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(\"%d\\n\", res);\n\t}\n\t\n\treturn 0;\n\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3f6799803a6f58345a749a757a978bed", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0} {"lang": "GNU C", "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)\n\t{\n\t\tprintf(\"0\\n\");\n\t\tgoto jump;\n\t}\n\telse if(c\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(ac)\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "1820ae86061cc27e52b7b1e504c4a391", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\nmain()\n{\n long long int i;\n long long int a,b,temp;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=1; (a != b) && a>0 && b>0; i++)\n {\n if( a % b == 0)\n {\n i += (a/b)-1;\n break;\n }\n a = a - b;\n if(a < b)\n {\n temp = a;\n a = b;\n b = temp;\n }\n }\n printf(\"%I64d\\n\",i);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8452f7c2fa6ae459b8351ba90a118dfc", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nstatic unsigned long long count;\n\nint main()\n{\n unsigned long long b,l;\n count=0;\n scanf(\"%lld %lld\",&b,&l);\n display(b,l);\n printf(\"%lld\",count);\n return 0;\n}\ndisplay(unsigned long long b,unsigned long long l)\n{\n if(l==1)\n {\n count=count+b;\n return;\n }\n if(b==1)\n {\n count=count+l;\n return;\n }\n if(b==l)\n {\n count++;\n return;\n }\n else\n {\n count++;\n if(l>b)\n {\n return(display(b,l-b));\n }\n else\n {\n return(display(b-l,l));\n }\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "21b839bc0c3de0f7b74ac2271ee01eed", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include\n#include \nint min(int a,int b)\n{\n\treturn a>b?b:a;\t\n}\n \nint main() {\n\tlong long int a,b,c=0;\n\tscanf(\"%lld %lld\",&a,&b);\n\t\n\twhile(a>0 && b>0)\n\t{\n\t\tif(b==1)\n\t\t{\n\t\t\tc+=a;\n\t\t\tbreak;\t\n\t\t}\n\t\t\n\t\tc++;\n\t\ta=a-b;\n\t\t\n\t\tif(a\n#include \n\nlong long a, b;\nint main()\n{\n scanf(\"%I64d %I64d\",&a,&b);\n long long sqr_count=0;\n while(b>0)\n {\n sqr_count+=(a/b);\n long long temp2=(a%b);\n a=b;\n b=temp2;\n\n\n }\n printf(\"%I64d\\n\",sqr_count);\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "392f778a9e5ec94e1b4dae16ad7707c5", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long a, b;\nint main()\n{\n scanf(\"%I64d %I64d\",&a,&b);\n long long sqr_count=0;\n while(b>0)\n {\n sqr_count+=(a/b);\n long long temp2=(a%b);\n a=b;\n b=temp2;\n\n\n }\n printf(\"%I64d\",sqr_count);\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee895473f4bc6111ad7a8e3c7dc324ed", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint arr[100] = {0}, i, j, s = 0;\n\tint a, b, c, d, n;\n\tscanf(\"%d %d %d %d %d\", &a, &b, &c, &d, &n);\n\tfor(i = 1; i <= n; i++)\n\t\tarr[i] = 1;\n\n\tfor(i = a; i <= d; i++)\n\t{\n\t\tfor(j = i; j <= n; j += i)\n\t\t\tif(arr[j])\n\t\t\t{\n\t\t\t\tarr[j] = 0;\n\t\t\t\ts++;\n\t\t\t}\n\t}\n\n\tprintf(\"%d\", s);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9a6d2357ff3331f2051ab853ea027b71", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int i,k,l,m,n,d,sum=0,b,c,e,f,z=0,y=0,w=0,v=0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n int a[1000]= {0};\n if(k%l==0 || k%m==0 || k%n==0)\n y=1;\n if(l%k==0 || l%m==0 || l%n==0)\n z=1;\n if(m%k==0 || m%l==0 || m%n==0)\n w=1;\n if(n%k==0 || n%m==0 || n%l==0)\n v=1;\n if(k==1 || l==1 || m==1 || n==1)\n sum=d;\n else if(k!=1 || l!=1 || m!=1 || n!=1)\n\n {\n b=k;\n c=l;\n e=m;\n f=n;\n if(y==0)\n {\n for(i=0; i<(d/k); i++){\n a[b-1]=1;\n b=b+k;\n }\n }\n if(z==0)\n {\n for(i=0; i<(d/l); i++){\n a[c-1]=1;\n c=c+l;\n }\n }\n if(w==0)\n {\n for(i=0; i<(d/m); i++){\n a[e-1]=1;\n e=e+m;\n }\n }\n if(v==0)\n {\n for(i=0; i<(d/n); i++){\n a[f-1]=1;\n f=f+n;\n }\n }\n\n for(i=0; i<1000; i++)\n sum+=a[i];\n }\n\n printf(\"%d\",sum);\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "61d97845bf71e204268d489515fb29e6", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int i,a,b,c,d,e;\n int count;\n scanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&e);\n for(i=1;i\nmain()\n{\n\tint i,j,sum=0,l[5],m[10001]={0};\n\tfor(i=0;i<5;i++)\n\tscanf(\"%d\",&l[i]);\n\tfor(j=0;j<4;j++)\n\t\tfor(i=1;i<4;i++)\n\t\t\tif(l[i]%l[j]==0)\n\t\t\t\tl[i]==10002;\n\tfor(j=0;j<4;j++)\n\t\tfor(i=1;i*l[j]\nint main()\n{\n int i,k,l,m,n,d,sum=0,b,c,e,f;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n int a[1000]={0};\n b=k;\n c=l;\n e=m;\n f=n;\n for(i=0;i<(d/k);i++){\n a[b-1]=1;\n b=b+k;\n\n\n }\n for(i=0;i<(d/l);i++){\n a[c-1]=1;\n c=c+l;\n\n }\n for(i=0;i<(d/m);i++){\n a[e-1]=1;\n e=e+m;\n\n }\n for(i=0;i<(d/n);i++){\n a[f-1]=1;\n f=f+n;\n }\n for(i=0;i<1000;i++){\n sum+=a[i];\n }\n printf(\"%d\",sum);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fbf1445435fbb10549f06da850ba5064", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint m,n;\nint main()\n{\n scanf(\"%d %d\",&m,&n);\n int a=0;\n int i,j;\n for(i=0;i\nmain()\n{\n\tint a,b,c=0,n,m,max;\n\twhile(scanf(\"%d %d\",&n,&m))\n\t{\n\tmax=n;\n\tif(max\nint main()\n{\n int n,m,l,count=0,i,j;\n scanf(\"%d%d\",&n,&m);\n if (n>m){\n\n l=n*n;\n }\n else {\n l=m*m;\n }\n\n for (i=0;i<=l;i++){\n for (j=0;j<=l;j++){\n if ((i*i)+j==n && i+(j*j)==m){\n count++;\n }\n }\n }\n printf(\"%d\",count);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "775b898985d13da48e3b9a892828710b", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": " #include\n int main(){\n\n int a,b,c;\n\n scanf(\"%d%d\",&a,&b);\n\n int i,m;\n int counter=0;\n for(i=0;i<=a*b;i++){\n for(m=0;m<=a*b;m++){\n if( ((i*i) + m == a) && ( i + (m*m))==b)\n counter++;\n\n }}\n printf(\"%d\",counter);\n\n\n\n\n\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ef9e55ae5dab78ec42d382304236909", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint min(int a,int b)\n{\n if(a\n\nint main() {\n int a,m,mod,t,i;\n int vis[100005];\n scanf(\"%d\",&a);\n scanf(\"%d\",&m);\n for(i=0;i\n#include \n#include \n#include \n#include \n\nint main(){\n int x, m;\n scanf(\"%d%d\", &x, &m);\n \n char s[100010] = {0};\n int r = x, yes = 0;\n do{\n if(r % m == 0){\n yes = 1;\n break;\n }else{\n if(s[r % m] == 0){\n s[r % m] = 1;\n }else break;\n }\n r += r % m;\n }while(1);\n \n puts( yes ? \"Yes\" : \"No\" );\n \n /*system(\"pause\");*/\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "82bb0358af89a319ea166480e46007d8", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nint arr[1000001];\nint main(void) {\n // your coe goes here\n int a,b,i;\n for(i=1;i<1000001;i++)\n arr[i]=0;\n while(1)\n {\n if(a%b==0)\n {\n \n printf(\"Yes\\n\");\n break;\n }\n if(arr[a%b]==1)\n {\n printf(\"No\\n\");\n break;\n }\n arr[a%b]=1;\n a=a+(a%b);\n printf(\"%d \",a);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a3866dced27b98ffc76b6d9c90cf99bb", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,m,flag=0,p,a,count[100001],i;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<=100000;i++)\n {\n count[i]=0;\n }\n a=n;\n p=n%m;\n while(count[p]!=1)\n {\n count[p]=1;\n if(p==0)\n {\n flag=1;\n break;\n }\n else\n {\n a=a+p;\n p=a%m;\n // count[p]=1;\n }\n }\n if(flag==1)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"No\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "16437b8e80bfe107c0df80aab6a594f6", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int a,m,mod,ta;\n\n scanf(\"%d %d\",&a,&m);\n\n ta=a;\n\n do\n {\n mod=ta%m;\n\n if(mod==0)\n {\n printf(\"Yes\");\n break;\n }\n\n ta=ta+mod;\n\n if(ta==m)\n {\n printf(\"Yes\");\n break;\n }\n\n mod=ta%m;\n\n if(mod==0)\n {\n printf(\"Yes\");\n break;\n }\n\n if(ta>mod)\n {\n printf(\"No\");\n break;\n }\n\n }\n\n while(mod);\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ced7e191ff5382b14cd2ad6f742df92", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nmain()\n\t{\n\t\tlong long int a,b,c,k=0,s;\n\t\tscanf(\"%d%d%d\",&a,&b,&c);\n\t\tif((a==b) && (k!=1))\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tk=1;\n\t\t\t}\t\n\t\tif((b<=0) && (c>0) && (a>0) && (k!=1))\n\t\t\t{\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tk=1;\n\t\t\t}\n\t\tif((a!=b) && (c==0) && (k!=1))\n\t\t\t{\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tk=1;\n\t\t\t}\n\t\tif((b>=0) && (c<0) && (a<0) && (k!=1))\n\t\t\t{\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tk=1;\n\t\t\t}\t\t\t\t\t\n\t\tif((a>=0) && (b>=0) && (a0) && (k!=1))\n\t\t\tif((abs(b)-abs(a))%abs(c)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif((a>=0) && (b<=0) && (a>b) && (c<0) && (k!=1))\n\t\t\tif((abs(b)+abs(a))%abs(c)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif((a<=0) && (b<=0) && (a0) && (k!=1))\n\t\t\tif((abs(b)-abs(a))%abs(c)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif((a<=0) && (b<=0) && (a>b) && (c<0) && (k!=1))\n\t\t\tif((abs(b)-abs(a))%abs(c)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif((a<=0) && (b>=0) && (a0) && (k!=1))\n\t\t\tif((abs(b)+abs(a))%abs(c)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif((a>=0) && (b>=0) && (a0) && (k!=1))\n\t\t\tif((abs(b)+abs(a))%abs(c)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif((a>=0) && (b>=0) && (a>b) && (c>0) && (k!=1))\n\t\t\tif((abs(b)-abs(a))%abs(c)==0)\t\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\tk=1;\n\t\t\t\t}\n\t\tif(k==0)\n\t\t\tprintf(\"NO\");\n\n\t}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d4ac229e755a963a63fb3eab1a6bae6", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n long long a,b,c;\n\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n if((a==b&&c==0)||( (b-a)% c == 0&&(b-a)/c >=0 ))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6eca787f3be197db8c7e551991fb36f", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{long long int a,b,c;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if(c==0)\n {\n if(a==b)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n if((b-a)%c==0)\n {\n printf(\"YES\\n\");\n }\n else printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb64080e00f97f1c8255615457fc0af5", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n main()\n {\n unsigned long long int a,b,c,d,e;\n\n while(scanf(\"%llu%llu%llu\",&a,&b,&c)!=EOF){\n e=b-a;\n if(e!=0 && c==0)\n printf(\"NO\\n\");\n else if(e==0 && c==0)\n printf(\"YES\\n\");\n else if(e%c==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n} }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05b1d5f998ebc25d64712568ffd78194", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long a,b,c,s,i,j,k,l=1;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n s=a;\n if(c>0)\n {\n for(;;)\n {\n if(s==b)\n break;\n s=s+c;\n if(s>b)\n {\n l=0;\n break;\n }\n }\n }\n else if(c==0)\n {\n if(a!=b)\n l=0;\n\n }\n else\n {\n for(;;)\n {\n if(s==b)\n break;\n s=s+c;\n if(s\n#include \nint main()\n{\n\tint n,a[37],t,k,c,h,i,j,sum;\n\tscanf(\"%d\",&n);\n\t\twhile (n--)\n\t\t{\n\t\t\tmemset(a,0,36*sizeof(int));\n\t\t\tscanf(\"%d\",&t);\n\t\t\th=(t%10-1)*4;\n\t\t\twhile(t/10!=0)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t\tt/=10;\t\n\t\t\t}\n\t\t\th++;\n\t\t\ta[h]=1;\n\t\t\tsum=0;\n\t\t\tfor (i=1;i<=9;i++)\n\t\t\t{\n\t\t\t\tif (a[k+(i-2)*4]==1) break;\n\t\t\t\tk=0;\n\t\t\t\tfor (j=1;j<=4;j++)\n\t\t\t\t{\n\t\t\t\t\tif (a[k+(i-1)*4]==1) break;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tsum+=j;\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\tprintf(\"%d\\n\",sum);\n\t\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b0e59b1f7f7c4a98f5f02092805f1b5", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\tfor(int i=0;i\nint main()\n{\n\tint n,x;\n\tscanf(\"%d\",&n);\n\tint a[40]={0,1,11,111,1111,2,22,222,2222,3,33,333,3333,4,44,444,4444,5,55,555,5555,6,66,666,6666,7,77,777,7777,8,88,888,8888,9,99,999,9999};\n\twhile(n--)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\tint i=1,cnt=0;\n\t\twhile(a[i]!=x)\n\t\t{\n\t\t\twhile(a[i]!=0)\n\t\t\t{\n\t\t\t\ta[i]=a[i]/10;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\twhile(x!=0)\n\t\t{\n\t\t\tx=x/10;\n\t\t\tcnt++;\n\t\t}\n\t\tprintf(\"%d\\n\",cnt);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d97c7a3324c6d42700a9e3db641023ff", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int t,x,sum,i,j,k,flag;\n scanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tsum=0;flag=0;\n \tscanf(\"%d\",&x);\n \tfor(i=1;i<10;i++)\n\t{\n\t\tt=i;\n\t\tfor(j=1;j<5;j++)\n\t\t{\n\t\t\tif(flag!=0) t=t*10+i;\n\t\t\tflag++;\n\t\t\tsum+=j;\n\t\t\tif(x==1) goto out;\n\t\t\telse if((t-1)/10==x) goto out;\n\t\t}\n\t}\n\tout:\n\t\tprintf(\"%d\\n\",sum);\n\t}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "25256945d54e53eadb260e93e16bcd49", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int t,x,sum,i,j,k,flag;\n while(~scanf(\"%d\",&t))\n {\n\twhile(t--)\n\t{\n\t\tsum=0;flag=0;\n \tscanf(\"%d\",&x);\n \tfor(i=1;i<10;i++)\n\t{\n\t\tt=i;\n\t\tfor(j=1;j<5;j++)\n\t\t{\n\t\t\tif(flag!=0) t=t*10+i;\n\t\t\tflag++;\n\t\t\tsum+=j;\n\t\t\tif(x==1) goto out;\n\t\t\telse if((t-1)/10==x) goto out;\n\t\t}\n\t}\n\tout:\n\t\tprintf(\"%d\\n\",sum);\n\t}\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "25283c59ea85580a95991b653194b79c", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,arr[10],tip=0,c=0,flag=0,ans=1,i;\n\n scanf(\"%d\",&n);\n\n for(i=0;i<=9;i++)\n {\n //printf(\"%d\",i);\n arr[i]=0;\n }\n\n //printf(\"%d\",n);\n i=2;\n while(n>1)\n {\n\n\n if(n%i!=0)\n {\n i++;\n }\n else\n {\n n = n/i;\n arr[i]++;\n }\n\n\n }\n while(1)\n {\n for(i=2;i<=9;i++)\n {\n if(arr[i]>1)\n tip = 1;\n }\n //printf(\"%d %d\\n\",tip,i);\n if(tip==0)\n break;\n\n for(i=2;i<=9;i++)\n {\n if(arr[i]%2!=0)\n {\n flag=1;\n arr[i]++;\n }\n arr[i]=arr[i]/2;\n }\n c++;\n tip=0;\n }\n for(i=2;i<=9;i++)\n if(arr[i]==1)\n ans*=i;\n\n if(flag==1)\n printf(\"%d %d\",ans,c+1);\n else\n printf(\"%d %d\",ans,c);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b5e7f56362dfb2b98827d564d1ba5101", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint primes[1000];\nint p_ind;\n\nunsigned char * declare_bool(int n)\n{\n\treturn (unsigned char *)(malloc(n/8+(n%8!=0)));\n}\n\nvoid assign_bool(unsigned char *array, int pos, int val)\n{\n\t int i, ii, temp;\n\ti = pos/8;\n\tii = pos-(i*8);\n\ttemp = 255;/**128 64 32 16 8 4 2 1**/\n\tif(val)\n\t{\n\t\tarray[i] = array[i]|(1<<(7-ii));\n\t}else{\n\t\ttemp = temp^(1<<(7-ii));\n\t\tarray[i] = array[i]&temp;\n\t}\n}\n\nunsigned char access_bool(unsigned char *array, int pos)\n{\n\tint i, ii;\n\ti = pos/8;\n\tii = pos-(i*8);\n\tif(array[i]&(1<<(7-ii)))\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nvoid sieve()\n{\n\tunsigned char *is_not_prime;\n\tis_not_prime = declare_bool(1001);\n\tint i;\n\tp_ind = 0;\n\tassign_bool(is_not_prime, 0, 1);\n\tassign_bool(is_not_prime, 1, 1);\n\tfor(i=2; i<1001; i++)\n\t\tassign_bool(is_not_prime, i, 0);\n\tfor(i=0; i<1001; i++)\n\t{\n\t\tif(!access_bool(is_not_prime, i))\n\t\t{\n\t\t\tprimes[p_ind++] = i;\n\t\t\tint j;\n\t\t\tfor(j=i+i; j<=1000; j+=i)\n\t\t\t{\n\t\t\t\tassign_bool(is_not_prime, j, 1);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint n, i, p_d_i, selected_i;\n\tint op, nn;\n\tscanf(\"%d\", &n);\n\tsieve();\n\top = 0;\n\tnn = 1;\n\tint *prime_divisors = malloc(p_ind*4);\n\tp_d_i = 0;\n\tfor(i=0; in)\n\t\t\tbreak;\n\t}\n\tint *exp = malloc(p_d_i*4);\n\tfor(i=0; i1)\n\t{\n\t\tif(n%prime_divisors[selected_i]==0)\n\t\t{\n\t\t\texp[selected_i]++;\n\t\t\tn/=prime_divisors[selected_i];\n\t\t}\n\t\telse\n\t\t\tselected_i++;\n\t}\n\tint max_exp;\n\tmax_exp = 0;\n\t\n\tfor(i=0; imax_exp)\n\t\t\tmax_exp = exp[i];\n\t}\n\tfor(i=0; i\n#include \n#include \n\nint primes[10000];\nint p_ind;\n\nunsigned char * declare_bool(int n)\n{\n\treturn (unsigned char *)(malloc(n/8+(n%8!=0)));\n}\n\nvoid assign_bool(unsigned char *array, int pos, int val)\n{\n\t int i, ii, temp;\n\ti = pos/8;\n\tii = pos-(i*8);\n\ttemp = 255;/**128 64 32 16 8 4 2 1**/\n\tif(val)\n\t{\n\t\tarray[i] = array[i]|(1<<(7-ii));\n\t}else{\n\t\ttemp = temp^(1<<(7-ii));\n\t\tarray[i] = array[i]&temp;\n\t}\n}\n\nunsigned char access_bool(unsigned char *array, int pos)\n{\n\tint i, ii;\n\ti = pos/8;\n\tii = pos-(i*8);\n\tif(array[i]&(1<<(7-ii)))\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nvoid sieve()\n{\n\tunsigned char *is_not_prime;\n\tis_not_prime = declare_bool(10001);\n\tint i;\n\tp_ind = 0;\n\tassign_bool(is_not_prime, 0, 1);\n\tassign_bool(is_not_prime, 1, 1);\n\tfor(i=2; i<10001; i++)\n\t\tassign_bool(is_not_prime, i, 0);\n\tfor(i=0; i<10001; i++)\n\t{\n\t\tif(!access_bool(is_not_prime, i))\n\t\t{\n\t\t\tprimes[p_ind++] = i;\n\t\t\tint j;\n\t\t\tfor(j=i+i; j<=10000; j+=i)\n\t\t\t{\n\t\t\t\tassign_bool(is_not_prime, j, 1);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint n, i, p_d_i, selected_i;\n\tint op, nn;\n\tscanf(\"%d\", &n);\n\tsieve();\n\top = 0;\n\tnn = 1;\n\tint *prime_divisors = malloc(p_ind*4);\n\tp_d_i = 0;\n\tfor(i=0; i1 && p_d_i>0)\n\t{\n\t\tif(n%prime_divisors[selected_i]==0)\n\t\t{\n\t\t\texp[selected_i]++;\n\t\t\tn/=prime_divisors[selected_i];\n\t\t}\n\t\telse\n\t\t\tselected_i++;\n\t}\n\tint max_exp;\n\tmax_exp = 0;\n\t\n\tfor(i=0; imax_exp)\n\t\t\tmax_exp = exp[i];\n\t}\n\tfor(i=0; i\n#include \n#include \n\nint primes[10000];\nint p_ind;\n\nunsigned char * declare_bool(int n)\n{\n\treturn (unsigned char *)(malloc(n/8+(n%8!=0)));\n}\n\nvoid assign_bool(unsigned char *array, int pos, int val)\n{\n\t int i, ii, temp;\n\ti = pos/8;\n\tii = pos-(i*8);\n\ttemp = 255;/**128 64 32 16 8 4 2 1**/\n\tif(val)\n\t{\n\t\tarray[i] = array[i]|(1<<(7-ii));\n\t}else{\n\t\ttemp = temp^(1<<(7-ii));\n\t\tarray[i] = array[i]&temp;\n\t}\n}\n\nunsigned char access_bool(unsigned char *array, int pos)\n{\n\tint i, ii;\n\ti = pos/8;\n\tii = pos-(i*8);\n\tif(array[i]&(1<<(7-ii)))\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nvoid sieve()\n{\n\tunsigned char *is_not_prime;\n\tis_not_prime = declare_bool(10001);\n\tint i;\n\tp_ind = 0;\n\tassign_bool(is_not_prime, 0, 1);\n\tassign_bool(is_not_prime, 1, 1);\n\tfor(i=2; i<10001; i++)\n\t\tassign_bool(is_not_prime, i, 0);\n\tfor(i=0; i<10001; i++)\n\t{\n\t\tif(!access_bool(is_not_prime, i))\n\t\t{\n\t\t\tprimes[p_ind++] = i;\n\t\t\tint j;\n\t\t\tfor(j=i+i; j<=10000; j+=i)\n\t\t\t{\n\t\t\t\tassign_bool(is_not_prime, j, 1);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint n, i, p_d_i, selected_i;\n\tint op, nn;\n\tscanf(\"%d\", &n);\n\tsieve();\n\top = 0;\n\tnn = 1;\n\tint *prime_divisors = malloc(p_ind*4);\n\tp_d_i = 0;\n\tfor(i=0; i1)\n\t{\n\t\tif(n%prime_divisors[selected_i]==0)\n\t\t{\n\t\t\texp[selected_i]++;\n\t\t\tn/=prime_divisors[selected_i];\n\t\t}\n\t\telse\n\t\t\tselected_i++;\n\t}\n\tint max_exp;\n\tmax_exp = 0;\n\t\n\tfor(i=0; imax_exp)\n\t\t\tmax_exp = exp[i];\n\t}\n\tfor(i=0; i\n#include \n\n#define SIZE 1000\n\nvoid factorization (int n, int p[], int k[], int *sz)\n{\n\tint d;\n\n\t*sz = 0;\n\n\tfor (d = 2; d * d <= n; d++)\n\t\tif (n % d == 0)\n\t\t{\n\t\t\tp[*sz] = d;\n\n\t\t\twhile (n % d == 0)\n\t\t\t{\n\t\t\t\tk[*sz]++;\n\t\t\t\tn /= d;\n\t\t\t}\n\n\t\t\t(*sz)++;\n\t\t}\n\n\tif (n != 1)\n\t{\n\t\tp[*sz] = n;\n\t\tk[(*sz)++] = 1;\n\t}\n}\n\nint is_power_of_two (int n)\n{\n\twhile (n % 2 == 0)\n\t\tn /= 2;\n\n\treturn n == 1;\n}\n\nint is_need_mult (int p[], int k[], int sz)\n{\n\tint i;\n\n\tif (is_power_of_two (k[0]))\n\t\tfor (i = 1; i < sz; i++)\n\t\t\tif (k[i] != k[i - 1])\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t\tk[i] = k[i];\n\telse\n\t\treturn 1;\n\n\treturn 0;\n}\n\nint oper (int p[], int k[], int sz)\n{\n\tint i, cnt = 0, max = 0;\n\n\tfor (i = 0; i < sz; i++)\n\t\tif (k[i] > max)\n\t\t\tmax = k[i];\n\n\ti = 0;\n\t\n\twhile (1 << i < max)\n\t\ti++;\n\n\tcnt = i;\n\n\tif (is_need_mult (p, k, sz))\n\t\tcnt++;\n\n\treturn cnt;\n}\n\nint min_num (int p[], int sz)\n{\n\tint i, min = 1;\n\n\tfor (i = 0; i < sz; i++)\n\t\tmin *= p[i];\n\n\treturn min;\n}\n\nint main()\n{\n\tint n, i, sz, oper_cnt, p[SIZE] = {0}, k[SIZE] = {0};\n\n\tscanf (\"%d\", &n);\n\n\tfactorization (n, p, k, &sz);\n\n\toper_cnt = oper (p, k, sz);\n\n\tprintf (\"%d %d\\n\", min_num (p, sz), oper_cnt);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f2cab7fe7dd36357e9dfd52c73171499", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n\nint trouve=0;\nlong long y;\nscanf(\"%I64d\",&y);\nint s;\nwhile(trouve == 0)\n{\n\t\n\twhile(y!=0)\n\t{\n\t\ty=y/10;\n\t\ts+=y%10;\n\tif(s==10)\n\t{\n\t\tprintf(\"%I64d\",y);\n\t\ttrouve=1;\n\t\tbreak;\n\t}\n\telse \n\t\ty++;\n\t}\n\n}\nreturn 1;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5602f6332b15bc11057422fadab68212", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nvoid main()\n{\n int k,i=19,s=0,a,c=0,j;\n scanf(\"%d\",&k);\n while(c!=k)\n {\n s=0;\n j=i;\n while(i>0)\n {\n a=i%10;\n s+=a;\n i=i/10;\n }\n i=j;\n if(s==10)\n {\n c++;\n i++;\n }\n else\n {\n i++;\n }\n }\n printf(\"%d\",j);\n} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "a977569388e1f9e9b15fff049da36755", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong k,i,s,j,p,a[1000];\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7ad5ca86187ee88c28c5ce595e23986e", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \nint calcul(int a){\n int k=0;\nif (a/10==0){\n return(k+a%10);\n}\nelse {\nreturn(k+(a%10)+calcul((a-(a%10))/10));}\n}\nint main(){\nlong long a,k;\nint i,c=19,t[1000];\n\nscanf(\"%d\",&k);\nfor (i=0;i<=k;i++){\n\n\nwhile(calcul(c)!=10){\n c++;\n}\nt[i]=c;\nc++;\n}\nprintf(\"%d\",t[k-1]);\n\n\n\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "23fd916036416801750cf6963d7e2837", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \nint t[1000];\nint calcul(int a){\n int k=0;\nif (a/10==0){\n return(k+(a%10));\n}\nelse {\nreturn k+(a%10)+calcul((a-(a%10))/10);}\n}\nint main(){\nint a,k;\nint i,c=19;\n\nscanf(\"%d\",&k);\nfor (i=0;i<=k;i++){\n\n\nwhile(calcul(c)!=10){\n c++;\n}\nt[i]=c;\nc++;\n}\nprintf(\"%d\",t[k-1]);\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "230960fc4fa5668177e8dbc65d6fb332", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n long long n, a, b, c, ans;\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n if(b - c >= a) {\n ans = n / a;\n } else {\n if(n < b) {\n ans = n / a;\n } else {\n ans = 0;\n while(1) {\n long long cnt = n / b;\n if(cnt == 0) {\n break;\n }\n ans += cnt;\n n = n + (c - b) * cnt;\n }\n ans += n / a;\n }\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "851609c688bbaeed9e68e64286980545", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "GNU C", "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 n, a, b, c;\n\nlong long run(long long n){\n long long x, y, z, w, res = 0;\n x = b - c;\n if (a < x || b > n) res = n / a;\n else{\n while (n >= b){\n y = n / b;\n res += y;\n n -= (y * b);\n n += (y * c);\n }\n\n z = n / a;\n res += z;\n }\n return res;\n}\n\nint main(){\n while (scanf(\"%lld\", &n) != EOF){\n scanf(\"%lld %lld %lld\", &a, &b, &c);\n long long res = run(n);\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "10a48e5cd878d48e882b18a5d63f0261", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tlong long int n,a,b,c,gla,bol,num,mon;\n\t\n\twhile(scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c) != EOF)\n\t{\n\t\t\n\t\tbol = 0;\n\t\tif( b-c > a)\n\t \tbol = n / a;\n\t\telse\n\t\t{\n\t\t\tfor(gla = 0; n >= b;)\n\t\t {\n\t\t\t gla=n / b;\n\t\t \tn=n + (c - b) * gla;\n\t\t \tbol=bol + gla;\n\t\t }\n\t\t \n\t\t bol = bol + n / a;\n\t\t \n\t\t}\n\t\tprintf(\"%I64d\\n\",bol);\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1e47f4d1979d347a5212a6f18691b588", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long max1(long long n, long long a, long long b, long long c) {\n\t\n\tlong long res = 0, t;\n\twhile (n >= b) {\n\t\tt = n / b;\n\t\tres += t;\n\t\tn = n % b + t * c;\n\t}\n\t\n\tres += n / a;\n\t\n\treturn res;\n\t\n}\n\nint main () {\n\t\n\tlong long n, a, b, c;\n\tlong long max = 0;\n\t\n\tlong long good;\n\t\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n\t\n\tgood = b - c;\n\t\n\t\n\tif (n < b) {\n\t\tmax = n / a;\n\t} else if (n < a) {\n\t\tmax = max1(n, a, b, c);\n\t} else {\n\t\t\n\t\tif (good < a) {\n\t\t\t\n\t\t\tmax = max1(n, a, b, c);\n\t\t\t\n\t\t} else {\n\t\t\tmax = n / a;\n\t\t}\n\t}\n\t\n\tprintf(\"%I64d\\n\", max);\n\t\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d67b5269885ad7080e32c53a03bda378", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong long int n,a,b,c,ans=0,x,y,r;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n\n#include \nint main() {\n\tint n, ac=0, bc=0, o=0, i, l, j;\t\n\tscanf(\"%d\", &n);\n\tint a[n];\n\tint b[n];\n\tfor(i=0; i\n#include\nvoid main ()\n{\n int r,sum=0,n,temp,i,j,k=0;\n scanf(\"%d\",&n);\n int a[n],b[n],c[5]={0},d[5]={0};\n for(i=0;i\n#include \nint main() {\n\tint n, ac=0, bc=0, o=0, i, l, j;\t\n\tscanf(\"%d\", &n);\n\tint a[n];\n\tint b[n];\n\tfor(i=0; i\n\n#define MAX_N 101\n\ntypedef struct {\n int values[6];\n} perf_count;\n\nint abs(int x) {\n return x < 0 ? -x : x;\n}\n\n// assumption: academic performance is in [1..5]\nperf_count read_academic_perf_fast(int n) {\n char line[MAX_N * 2];\n // n times: read ac.perf. (one char) + one space / final '\\n'\n fread(line, sizeof(char), n * 2, stdin);\n // \"parse\" & count:\n perf_count result = {.values = {0}};\n for (int i = 0; i < n; ++i) {\n int perf = line[i*2] - '0';\n result.values[perf] += 1;\n }\n return result;\n}\n\nint solve(perf_count a_count, perf_count b_count) {\n int sum = 0;\n for (int i = 1; i <= 5; ++i) {\n int d = abs(a_count.values[i] - b_count.values[i]);\n if (d % 2 == 1) {\n return -1;\n }\n sum += d;\n }\n return sum / 4;\n}\n\nint main(int argc, char *argv[]) {\n int n;\n scanf(\"%d\", &n);\n\n perf_count a_count = read_academic_perf_fast(n);\n perf_count b_count = read_academic_perf_fast(n);\n\n int ans = solve(a_count, b_count);\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cd372a2c75de8f71d4a2d8217ac829d6", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "/*\n \ufffd\u0202\ufffd\ufffd\u0391\ufffd\ufffd\u0202\ufffd\u0182\ufffd\ufffd\u0202\ufffdI \n*/\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define LLU unsigned long long int\n#define LL long long int\n#define LD long double\n\n#define LLUmax ULLONG_MAX\n#define LLmax LLONG_MAX\n#define dmax INT_MAX\n#define debug printf(\"asd\\n\")\n#define newline printf(\"\\n\")\n\n#define amt(a) int a;scanf(\"%d\",&a)\n#define dlld(a,b) long long int a,b;scanf(\"%I64d %I64d\",&a,&b)\n#define scd(a) int a;scanf(\"%d\",&a)\n#define sclld(a) long long int a;scanf(\"%I64d\",&a)\n#define prdlld(a,b) printf(\"%I64d %I64d\",a,b)\n#define prdd(a,b) printf(\"%d %d\",a,b)\n#define prd(a) printf(\"%d\",a)\n#define arr(a,b) int *a=(int *)malloc(n*sizeof(int))\n#define llarr(a,b) long long int *a=(long long int *)malloc(n*sizeof(long long int))\n#define st(a,b) char *a=(char *)malloc(b*sizeof(char))\n#define grav 9.8\n#define pi 3.14159265\n\nint main()\n{\n\tamt(n);\n\tint a[20000],b[20000];\n\tint c[7],d[7];\n\tfor(int i=0 ; i<6 ; i++)\n\t{\n\t\tc[i]=0;\n\t\td[i]=0;\n\t}\n\tfor(int i=0 ; i1)\n\t{\t\t\n\t\t/*for(int i=1 ; i<=5 ; i++)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\",c[i],d[i]);\n\t\t}*/\n\t\tfor(int i=1 ; i<=5 ; i++)\n\t\t{\n\t\t\twhile(c[i]!=d[i])\n\t\t\t{\n\t\t\t\tif(c[i]>d[i])\n\t\t\t\t{\n\t\t\t\t\tc[i]--;\n\t\t\t\t\td[i]++;\n\t\t\t\t}\n\t\t\t\telse if(c[i]\n#include\n\nint main(){\n\n int i=1, n, j;\n char*string;\n\n scanf(\"%d\",&n);\n string=(char*)calloc(n+1, sizeof(char));\n\n scanf(\"%s\", string);\n\n do{\n if((string[i]=='a' || string[i]=='o' || string[i]=='u' || string[i]=='e' || string[i]=='i' || string[i]=='y') && (string[i-1]=='a' || string[i-1]=='o' || string[i-1]=='u' || string[i-1]=='e' || string[i-1]=='i' || string[i-1]=='y')){\n for(j=i; j\n#include \n\nint main()\n{\n char c[50]; int n,i,j;\n scanf(\"%d\",&n);\n for(i=0;i<=n;i++)\n scanf(\"%c\",&c[i]);\n for(i=0;i\n#include \n\nvoid\tft_putchar(char c)\n{\n\twrite (1, &c, 1);\n}\n\nint\tft_is_vowel(char letter)\n{\n\tif (letter == 'a' || letter == 'e' || letter == 'i' \n\t\t|| letter == 'o' || letter == 'u' ||letter == 'y')\n\t\treturn (1);\n\telse\n\t\treturn (0);\n}\n\nchar\tft_word_correction(char *s, int size)\n{\n\tint i;\n\tint j;\n\tint flag;\n\n\ti = 0;\n\tj = 0;\n\tflag = 0;\n\twhile(i < size)\n\t{\n\t\tif (ft_is_vowel(s[i]) == 1)\n\t\t{\n\t\t\tflag += 1;\n\t\t\tif (flag < 2)\n\t\t\t\tft_putchar(s[i]);\n\t\t}\n\t\tif (ft_is_vowel(s[i]) == 0)\n\t\t{\n\t\t\tft_putchar(s[i]);\n\t\t\tflag = 0;\n\t\t}\n\t\ti++;\n\t}\n\tft_putchar('\\n');\n}\n\nint\tmain(void)\n{\n\n\tint n;\n\tchar *s;\n\t\n\tscanf(\"%d %s\", &n, s);\n\t\n\tft_word_correction(s, n);\n\treturn (0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05f67b44fa07e886e19cc81ad27a8a42", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nvoid\tft_putchar(char c)\n{\n\twrite (1, &c, 1);\n}\n\nint\tft_is_vowel(char letter)\n{\n\tif (letter == 'a' || letter == 'e' || letter == 'i' \n\t\t|| letter == 'o' || letter == 'u' ||letter == 'y')\n\t\treturn (1);\n\telse\n\t\treturn (0);\n}\n\nchar\tft_word_correction(char *s, int size)\n{\n\tint i;\n\tint j;\n\tint flag;\n\n\ti = 0;\n\tj = 0;\n\tflag = 0;\n\twhile(i < size)\n\t{\n\t\tif (ft_is_vowel(s[i]) == 1)\n\t\t{\n\t\t\tflag += 1;\n\t\t\tif (flag < 2)\n\t\t\t\tft_putchar(s[i]);\n\t\t}\n\t\tif (ft_is_vowel(s[i]) == 0)\n\t\t{\n\t\t\tft_putchar(s[i]);\n\t\t\tflag = 0;\n\t\t}\n\t\ti++;\n\t}\n\tft_putchar('\\n');\n}\n\nint\tmain(void)\n{\n\n\tint n;\n\tchar *s;\n\t\n\tscanf(\"%d %s\", &n, s);\n\t\n\tft_word_correction(s, n);\n\treturn (0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6e2ca57f2dbc9852b8a38c954ddeb2d", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",s);\n\nfor (int i=0,j=1;s[i]; j++ )\nif (!((s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='y') && (s[j]=='a'||s[j]=='e'||s[j]=='i'||s[j]=='o'||s[j]=='u'||s[i]=='y')))\n{printf(\"%c\",s[i]); i=j;}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8bfb34e32df6b6122765004c4c096f4b", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main ()\n{\n int r1,c1,r2,c2;\n int a[3];\n a[1]= 0;\n scanf(\"%d%d%d%d\",&r1,&c1,&r2,&c2);\n int t1 = r1 - r2;\n int t2= c1- c2;\n\n if( t1 < 0 )\n{\nt1 = t1*(-1); \n}\nif(t2 < 0){\n t2 = t2*(-1);\n}\n int t3 = t1;\n int t4 = t2;\n \nif(r1 == r2 || c1 == c2 ){\n a[0] = 1;\n }\n else {\n a[0] = 2;\n }\n \n if(t1 == t2){\n a[1] = 1;\n }\n else if( t1 != t2){\n if( (t1 % 2 == 0 && t2 % 2 == 0 ) && (t1 % 2 == 1 && t2 % 2 == 1)){\n a[1] = 2;\n }\n \n }\n if( t3 == t4){\n a[2] = t3;\n }\n else if ( (t3 == 0 )&& (t4 != 0)){\n a[2] = t4;\n }\n else if((t4 == 0 )&& (t3 != 0)){\n a[2] = t3;\n }\n else if( t3 != t4){\n if(t3 > t4){\n a[2] = t3;\n }\n else {\n a[2] = t4;\n }\n }\n printf(\"%d %d %d\",a[0],a[1],a[2]);\n return 0; \n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1ec14d9ba81531aca961031bfc4ff6dd", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include \nint main( ) \n{ \n int x1,y1,x2,y2;\n scanf(\"%d%d%d%d\",&x1,&y1,&x2,&y2); \n int x, y; \n x = abs(x1 - x2); \n y = abs(y1 - y2); \n if(x == 0 || y == 0) \n printf(\"1\");\n else \n printf(\"2\"); \n if(abs(x - y) % 2 != 0) \n printf(\" 0\"); \n else if(x == y) \n printf(\" 1\"); \n else \n printf(\" 2\");\n if(x < y) \n printf(\" %d\\n\",y);\n else\n printf(\" %d\\n\",x); \n} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "fe1233be9cdb50c6373a25de157a8858", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int r1,r2,c1,c2;\n scanf(\"%d%d%d%d\",&r1,&c1,&r2,&c2);\n int t1,t2,t3=0;\n if((r1==r2)||(c1==c2))\n {\n t1=1;\n if(r1==r2)\n {\n t3=abs(c2-c1);\n }\n else\n {\n t3=abs(r2-r1);\n }\n }\n else\n {\n t1=2;;\n }\n int k1,k2,k3,k4;\n k1=r1%2;\n k2=c1%2;\n k3=r2%2;\n k4=c2%2;\n if(((k1==0)&&(k2==0))||((k1==1)&&(k2==1)))\n {\n if(((k3==0)&&(k4==1))||((k3==1)&&(k4==0)))\n {\n t2=0;\n }\n else\n {\n int q;\n q=(c2-c1)/(r2-r1);\n if(abs(q)==1)\n {\n t2=1;\n }\n else\n {\n t2=2;\n }\n }\n\n }\n if(((k1==0)&&(k2==1))||((k1==1)&&(k2==0)))\n {\n if(((k3==0)&&(k4==0))||((k3==1)&&(k4==1)))\n {\n t2=0;\n }\n else\n {\n int q;\n q=(c2-c1)/(r2-r1);\n if(abs(q)==1)\n {\n t2=1;\n }\n else\n {\n t2=2;\n }\n }\n\n }\n if(t3==0)\n {\n \n int p,u;\n p=abs(r2-r1);\n u=abs(c2-c1);\n int countit=0;\n while(p!=u)\n {\n if(p>u)\n {\n p--;\n countit++;\n }\n if(u>p)\n {\n u--;\n countit++;\n }\n }\n countit=countit+u;\n t3=countit;\n }\n printf(\"%d %d %d\",t1,t2,t3);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c4fa44db906984306aef405ad0136c1", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int r1, c1, r2, c2;\n scanf(\"%d %d %d %d\", &r1, &c1, &r2, &c2);\n\n int R=0, B=0, K=0;\n\n int Dr = r1 - r2, Dc = c1 - c2;\n if(Dr < 0)\n Dr*=-1;\n if(Dc < 0)\n Dc*=-1;\n \n\n if(Dr==0 || Dc==0)\n R=1;\n else\n R=2;\n\n \n if((((r1+c1)%2 == 0) && ((r2+c2)%2 == 0)) || (((r1+c1)%2 != 0) && ((r2+c2)%2 != 0)))\n {\n int m = Dr/Dc;\n if(m == 1)\n B=1;\n else\n B=2;\n }\n\n if(Dr > Dc)\n K = Dr;\n else\n K = Dc;\n\n printf(\"%d %d %d\\n\", R, B, K); \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1d9469b3c21ebe2f152276826ab2e310", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int r1, c1, r2, c2;\n scanf(\" %d %d %d %d\", &r1, &c1, &r2, &c2);\n\n int R=0, B=0, K=0;\n\n int Dr = r1 - r2, Dc = c1 - c2;\n if(Dr < 0)\n Dr*=-1;\n if(Dc < 0)\n Dc*=-1;\n \n\n if(Dr==0 || Dc==0)\n R=1;\n else\n R=2;\n\n \n if((((r1+c1)%2 == 0) && ((r2+c2)%2 == 0)) || (((r1+c1)%2 != 0) && ((r2+c2)%2 != 0)))\n {\n int m = Dr/Dc;\n if(m == 1)\n B=1;\n else\n B=2;\n }\n\n if(Dr > Dc)\n K = Dr;\n else\n K = Dc;\n\n printf(\"%d %d %d\\n\", R, B, K); \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d300604a305ff1ebc50c67f287982c15", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n long long n,tn;\n scanf(\"%lld\",&tn);\n for(n=1;n<=tn;n++)\n {\n \n if(n*(n+1)/2==tn)\n {\n \n printf(\"YES\");\n return;\n }\n }\n \n printf(\"NO\"); \n \n \n return 0; \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "45242af6950ba43909379f3ad8beb7ca", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint n, i;\n\tscanf(\" %d\", &n);\n\tif(n<56)\n\t{\n\t\tfor(i=1; i<11; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\telse if(n<211)\n\t{\n\t\tfor(i=11; i<21; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\telse if(n<497)\n\t{\n\t\tfor(i=21; i<32; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t}\n\t}\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d4e668ddfeefb61d7880ca24649677db", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint n, i;\n\tscanf(\" %d\", &n);\n\tif(n<56)\n\t{\n\t\tfor(i=1; i<11; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t\tprintf(\"YES\");\n\t}\n\telse if(n<211)\n\t{\n\t\tfor(i=11; i<21; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t\tprintf(\"YES\");\n\t}\n\telse if(n<497)\n\t{\n\t\tfor(i=21; i<32; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "91af456d56e3209d1f5250bf0c332f54", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint n, i;\n\tscanf(\" %d\", &n);\n\tif(n<56)\n\t{\n\t\tfor(i=1; i<11; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\telse if(n<211)\n\t{\n\t\tfor(i=11; i<21; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\telse if(n<497)\n\t{\n\t\tfor(i=21; i<32; i++)\n\t\t\tif(i*(i+1)/2 == n)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "703588e15752bd1e73dfbd51b0fff08e", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint ara[78999999];\nint main()\n{\n long long int i,j,k,l,m,n,x=0;\n for(i=1,j=1;i<=500;i++,j++){\n x+=j;\n ara[x]=1;\n\n }\n\n scanf(\"%I64d\",&n);\n if(ara[n]==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5203ee7b4eff742aa012be1c1c33367c", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint CanWeStart(int tank_size, int gas_station, int endpoint);\nvoid GotoEnd(int * tank, int tank_size, int gas_station, int endpoint, int * journey, int * count);\nvoid Goto0(int * tank, int tank_size, int gas_station, int endpoint, int * journey, int * count);\n\nint main(void)\n{\n int endpoint, tank, gas_station , journey, tank_size, count;\n scanf(\"%d %d %d %d\",&endpoint, &tank, &gas_station, &journey);\n tank_size = tank;\n count = 0;\n \n if( CanWeStart(tank_size, gas_station, endpoint) == 0 )\n {\n printf(\"-1\");\n return 0;\n }\n \n while(journey>0)\n {\n GotoEnd(&tank, tank_size, gas_station, endpoint, &journey, &count);\n if(journey == 0)\n break;\n Goto0(&tank, tank_size, gas_station, endpoint, &journey, &count);\n }\n \n printf(\"%d\",count);\n \n return 0;\n}\n\nint CanWeStart(int tank_size, int gas_station, int endpoint)\n{\n if( tank_size < 2*(endpoint-gas_station) || tank_size < 2*gas_station )\n return 0;\n else\n return 1;\n}\n \n\nvoid GotoEnd(int * tank, int tank_size, int gas_station, int endpoint, int * journey, int * count)\n{\n int YN;\n *tank -= gas_station;\n if( *journey == 1)\n {\n if( (*tank -(endpoint-gas_station)) >= 0 )\n YN = 0;\n else\n YN = 1;\n }\n else\n {\n if( (*tank - 2*(endpoint-gas_station)) >=0 )\n YN = 0;\n else\n YN = 1;\n }\n if(YN == 1)\n {\n *tank = tank_size;\n *count += 1;\n }\n \n *tank -= (endpoint-gas_station);\n *journey -= 1;\n}\n\nvoid Goto0(int * tank, int tank_size, int gas_station, int endpoint, int * journey, int * count)\n{\n int YN;\n *tank -= (endpoint-gas_station);\n if( *journey == 1)\n {\n if( (*tank -gas_station) >= 0 )\n YN = 0;\n else\n YN = 1;\n }\n else\n {\n if( *tank -(2*gas_station) >=0 )\n YN = 0;\n else\n YN = 1;\n }\n if(YN == 1)\n {\n *tank = tank_size;\n *count += 1;\n }\n \n *tank -= gas_station;\n *journey -= 1;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3310b293f0979556256b8369e8b7e517", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n long long a,b,f,k,u,n,j=0;\n int i=0;\n scanf(\"%lld %lld %lld %lld\",&a,&f,&b,&k);\n u=f;\n n=a*k;\n for(;n>0;)\n {\n if(n==a*k)\n {\n if(f>=b || f>=a-b)\n {\n u-=b;\n n-=b;\n }\n else\n {\n printf(\"-1\");\n return 0;\n }\n\n }\n if(i==0)\n {\n if(n==a-b)\n {\n if(u>=a-b) break;\n else\n {\n j++;\n break;\n }\n }\n if(f<(a-b)*2)\n {\n printf(\"-1\");\n return 0;\n }\n else\n {\n if(u<(a-b)*2)\n {\n u=f;\n j++;\n }\n u-=(a-b)*2;\n n-=(a-b)*2;\n }\n if(n==b)\n {\n if(u>=b) break;\n else\n {\n j++;\n break;\n }\n }\n if(f<(b)*2)\n {\n printf(\"-1\");//there is a prob\n return 0;\n }\n else\n {\n if(u<(b)*2)\n {\n u=f;\n j++;\n }\n u-=(b)*2;\n n-=(b)*2;\n }\n\n }\n\n }\n if(j!=0) printf(\"%lld\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "17c61719dc7602d151728a3c88731b72", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n\tint a, b, f, k, j, cnt = 0, rest;\n\tscanf(\"%d %d %d %d\", &a, &b, &f, &k);\n\trest = b;\n\tfor (j = 1; j <= k; j = j + 1)\n\t{\n\t\tint d = j & 1;\n\t\tif (j < k)\n\t\t{\n\t\t\tif (d)\n\t\t\t{\n\t\t\t\tif (rest < f)\n\t\t\t\t{\n\t\t\t\t\tcnt = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (rest >= f)\n\t\t\t\t{\n\t\t\t\t\tif (rest >= (a << 1) - f)\n\t\t\t\t\t{\n\t\t\t\t\t\trest = rest - (a << 1) + f;\n\t\t\t\t\t}\n\t\t\t\t\telse if (rest < (a << 1) - f)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (b < ((a - f) << 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcnt = -1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (b >= ((a - f) << 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcnt += 1;\n\t\t\t\t\t\t\trest = b - ((a - f) << 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\telse if (d == 0)\n\t\t\t{\n\t\t\t\tif (rest < (f << 1) && b < (f << 1))\n\t\t\t\t{\n\t\t\t\t\tcnt = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (rest < (f << 1) && b >= f)\n\t\t\t\t{\n\t\t\t\t\tcnt += 1;\n\t\t\t\t\trest = b - f;\n\t\t\t\t}\n\t\t\t\telse if (rest >= (f << 1))\n\t\t\t\t{\n\t\t\t\t\trest = rest - f;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (j == k)\n\t\t{\n\t\t\tif (d)\n\t\t\t{\n\t\t\t\tif (rest < f)\n\t\t\t\t{\n\t\t\t\t\tif (b < f)\n\t\t\t\t\t\tcnt = -1;\n\t\t\t\t\telse if (b >= f)\n\t\t\t\t\t\tcnt += 1;\n\t\t\t\t}\n\t\t\t\telse if (rest >= f)\n\t\t\t\t{\n\t\t\t\t\tif (b < f)\n\t\t\t\t\t\tcnt = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (d == 0)\n\t\t\t{\n\t\t\t\tif (rest < f && b < f)\n\t\t\t\t\tcnt = -1;\n\t\t\t\telse if (rest < f && b >= f)\n\t\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "65cc73da1e9709fd82fd8b37cf1a24ad", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n int a, b, f, k;\n int sum = 0, n;\n scanf(\"%d %d %d %d\", &a, &b, &f, &k);\n n = b;\n if(k > 1) {\n if(b < 2 * (a - f) || b < f || b < 2 * f) {\n printf(\"-1\\n\");\n }\n else {\n for(int i = 1; i <= k; i++) {\n if(i % 2 == 1 && i != k) {\n n = n - f;\n if(n < 2 * (a - f)) {\n n = b;\n sum++;\n }\n n = n - (a - f);\n }\n else if(i % 2 == 0 && i != k){\n n = n - (a - f);\n if(n < 2 * f) {\n n = b;\n sum++;\n }\n n = n - f;\n }\n else if(i % 2 == 1 && i == k) {\n n = n - f;\n if(n < (a - f)) {\n n = b;\n sum++;\n }\n }\n else if(i % 2 == 0 && i == k) {\n n = n - (a - f);\n if(n < f) {\n n = b;\n sum++;\n }\n }\n }\n printf(\"%d\\n\", sum);\n }\n }\n else {\n if(b < f || b < (a - f)) {\n printf(\"-1\\n\");\n }\n else {\n n = n - f;\n if(n < (a - f)) {\n sum++;\n }\n printf(\"%d\\n\", sum);\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "64f0fec8970e8419394f3927c01c7f9e", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#include \nint main(){\nint a,b,f,k;\nscanf(\"%d%d%d%d\",&a,&b,&f,&k);\nint counter=-1;\nint position=0;\nint fuel = b;\nint wway=-1;\nint fuelcounter=0;\nint test=0;\nwhile(counter=2*(a-f)){\n }else{\n if(counter+1=a-f){\n }else{\n fuel=b;\n fuelcounter++;\n }\n }\n }\n }else{\n if(fuel>=2*f){\n }else{\n if(counter+1=f){\n }else{\n fuel=b;\n fuelcounter++;\n }\n }\n }\n\n }\n }\n if(fuel==0){\n test=1;\n break;\n }\n position += wway;\n fuel--;\n}\n\n if(test==1){\n printf(\"-1\");\n }else{\n printf(\"%d\",fuelcounter);\n }\n\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cad74c4eade34f2a87bbf1460e1b7ad0", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tint\t\t\t\tvalue;\n\tint\t\t\t\tlvl;\n}\t\t\t\t\tt_btree;\n\nt_btree\tcoada[20000000];\n\nt_btree\t*ft_create_node(int data)\n{\n\tt_btree\t*new;\n\n\tnew = (t_btree*)malloc(sizeof(t_btree));\n\tnew->left = NULL;\n\tnew->right = NULL;\n\tnew->value = data;\n\treturn (new);\n}\n\nint\t\tst, dr;\nint\t\tok, result;\n\nvoid\tbfs(t_btree *node, int m)\n{\n\tt_btree\t*new;\n\n\tif (node->value == m)\n\t{\n\t\tresult = node->lvl;\n\t\tok = 0;\n\t}\n\telse\n\t{\n\t\tnew = ft_create_node(node->value - 1);\n\t\tnew->lvl = node->lvl + 1;\n\t\tdr++;\n\t\tcoada[dr] = *new;\n\t\tnew = ft_create_node(node->value * 2);\n\t\tnew->lvl = node->lvl + 1;\n\t\tdr++;\n\t\tcoada[dr] = *new;\n\t}\n}\n\nint\t\tmain(void)\n{\n\tint\t\tn, m;\n\tt_btree\t*root;\n\n\tok = 1;\n\tscanf(\"%d %d\", &n, &m);\n\troot = ft_create_node(n);\n\troot->lvl = 0;\n\tst = dr = 1;\n\tcoada[st] = *root;\n\twhile (ok && st <= dr)\n\t{\n\t\tbfs(&coada[st], m);\n\t\tst++;\n\t}\n\tprintf(\"%d\\n\", result);\n\treturn (0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bd5fbda09c1cdbd13bc772a9589ff8cc", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n/*\n\nVasya has found a strange device. On the front panel of\na device there are: a red button, a blue button and a\ndisplay showing some positive integer. After clicking\nthe red button, device multiplies the displayed number\nby two. After clicking the blue button, device subtracts\none from the number on the display. If at some point\nthe number stops being positive, the device breaks down.\nThe display can show arbitrarily large numbers.\nInitially, the display shows number n.\n\nBob wants to get number m on the display. What minimum\nnumber of clicks he has to make in order to achieve this result?\n\nInput\nThe first and the only line of the input contains\ntwo distinct integers n and m (1 <= n, m <= 10000),\nseparated by a space.\n\nOutput\nPrint a single number \ufffd the minimum number of times one\nneeds to push the button required to get the number m out\nof number n.\n\n*/\n\ntypedef struct Pair {\n int data;\n int distance;\n} Pair;\n\nstruct QueueElem{\n Pair pair;\n struct QueueElem* next;\n};\n\nPair makePair(int f, int s){\n Pair p = {f, s};\n return p;\n}\n\ntypedef struct QueueElem Elem;\n\nstruct Queue{\n Elem *front; // sa fronta uklanjam\n Elem *rear; // na rear dodajem\n};\n\ntypedef struct Queue Queue;\n\nvoid init(Queue *q){\n q->front = NULL;\n q->rear = NULL;\n}\n\nvoid destroy(Queue *q){ // treba svaki Elem brisat jer je pravljen sa malloc\n free(q->front);\n free(q->rear);\n}\n\nint isEmpty(Queue *q){\n return (q->front == NULL && q->rear == NULL);\n}\n\n//void print(Queue *q){\n// for(Elem *curr = q->front; curr != NULL; curr = curr->next){\n// printf(\"%d \", curr->data);\n// }\n// printf(\"\\n\");\n//}\n\nvoid enqueue(Queue *q, Pair p){\n Elem *newElem = malloc(sizeof(Elem));\n newElem->pair = p;\n newElem->next = NULL;\n\n if(q->rear == NULL){\n q->front = newElem;\n q->rear = newElem;\n }\n else{\n q->rear->next = newElem;\n q->rear = newElem;\n }\n}\n\nPair dequeue(Queue *q){\n if(isEmpty(q)){\n return makePair(-10000, -10000);\n }\n Pair temp = q->front->pair;\n\n Elem *tmp = q->front;\n q->front = q->front->next;\n free(tmp);\n //tmp = NULL;\n\n if(q->front == NULL){\n q->rear = NULL;\n }\n return temp;\n}\n\nPair peek(Queue *q){\n if(q->front != NULL) return q->front->pair;\n else return makePair(-10000, -10000);\n}\n\n// a greedy BFS sounds fine, maybe for small inputs, we'll see\n// what code forces says\n\nvoid solve(){\n int n, m;\n scanf(\"%d%d\", &n, &m);\n\n Queue q1;\n Queue *q = &q1;\n init(q);\n enqueue(q, makePair(n, 0));\n\n while(!isEmpty(q)){\n Pair curr = dequeue(q);\n if(curr.data == m){\n printf(\"%d\", curr.distance);\n return;\n }\n enqueue(q, makePair(curr.data*2, curr.distance+1));\n if(curr.data-1 >= 0){\n enqueue(q, makePair(curr.data-1, curr.distance+1));\n }\n }\n}\n\nint main()\n{\n solve();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7b4e2e6672c1b00f70d9d32443dc3e79", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nstatic int arr[10001][10001];\nstatic int a,b;\nstatic int dp[10001][10001];\nint bluered(int n, int m)\n{\n if(arr[n][m]==-1)\n return 100001;\n arr[n][m]=-1;\n if(dp[n][m]!=-1)\n return dp[n][m];\n if(n==a && m==b){\n dp[n][m]=1;\n return 1;}\n\n\n if(n==m){\n dp[n][m]=0;\n return 0;}\n if(m1){\n count2=count2+(bluered(n-1,m));}\n if(n<=1){\n dp[n][m]=count1;\n return count1; }\n if(count1\n\n/**\n * The deque data structure, which is a doubly-ended queue.\n */\ntypedef struct internal_deque *deque;\n\n/* Starting */\ndeque deque_init(size_t data_size);\n\n/* Utility */\nint deque_size(deque me);\nint deque_is_empty(deque me);\nint deque_trim(deque me);\nvoid deque_copy_to_array(void *arr, deque me);\n\n/* Adding */\nint deque_push_front(deque me, void *data);\nint deque_push_back(deque me, void *data);\n\n/* Removing */\nint deque_pop_front(void *data, deque me);\nint deque_pop_back(void *data, deque me);\n\n/* Setting */\nint deque_set_first(deque me, void *data);\nint deque_set_at(deque me, int index, void *data);\nint deque_set_last(deque me, void *data);\n\n/* Getting */\nint deque_get_first(void *data, deque me);\nint deque_get_at(void *data, deque me, int index);\nint deque_get_last(void *data, deque me);\n\n/* Ending */\nint deque_clear(deque me);\ndeque deque_destroy(deque me);\n\n#endif /* CONTAINERS_DEQUE_H */\n\n\n\n/*\n * Copyright (c) 2017-2019 Bailey Thompson\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n#include \n#include \n\nstatic const int BLOCK_SIZE = 8;\nstatic const double RESIZE_RATIO = 1.5;\n\nstruct internal_deque {\n size_t data_size;\n int start_index;\n int end_index;\n int block_count;\n struct node *block;\n};\n\nstruct node {\n void *data;\n};\n\n/**\n * Initializes a deque.\n *\n * @param data_size the size of each element in the deque; must be positive\n *\n * @return the newly-initialized deque, or NULL if it was not successfully\n * initialized due to either invalid input arguments or memory\n * allocation error\n */\ndeque deque_init(const size_t data_size)\n{\n struct internal_deque *init;\n struct node *block;\n if (data_size == 0) {\n return NULL;\n }\n init = malloc(sizeof(struct internal_deque));\n if (!init) {\n return NULL;\n }\n init->data_size = data_size;\n init->start_index = BLOCK_SIZE / 2;\n init->end_index = init->start_index + 1;\n init->block_count = 1;\n init->block = malloc(sizeof(struct node));\n if (!init->block) {\n free(init);\n return NULL;\n }\n block = init->block;\n block->data = malloc(BLOCK_SIZE * init->data_size);\n if (!block->data) {\n free(init->block);\n free(init);\n return NULL;\n }\n return init;\n}\n\n/**\n * Determines the size of the deque. The size is the number of data spaces being\n * used. The size starts at zero, and every time an element is added, it\n * increases by one.\n *\n * @param me the deque to check the size of\n *\n * @return the size of the deque\n */\nint deque_size(deque me)\n{\n return me->end_index - me->start_index - 1;\n}\n\n/**\n * Determines if the deque is empty. It is empty if it has no elements.\n *\n * @param me the deque to check if empty\n *\n * @return 1 if the deque is empty, otherwise 0\n */\nint deque_is_empty(deque me)\n{\n return deque_size(me) == 0;\n}\n\n/**\n * Trims the deque so that it does not use memory which does not need to be\n * used.\n *\n * @param me the deque to trim\n *\n * @return 0 if no error\n * @return -ENOMEM if out of memory\n */\nint deque_trim(deque me)\n{\n int i;\n /* The start and end blocks are written like this because in C89 */\n /* negative integer division and modulo are implementation-defined. */\n const int start_block =\n me->start_index == -1 ? 0 : me->start_index / BLOCK_SIZE;\n const int end_block =\n me->end_index == 0 ? 0 : (me->end_index - 1) / BLOCK_SIZE;\n const int new_block_count = end_block - start_block + 1;\n void *const new_block = malloc(new_block_count * sizeof(struct node));\n if (!new_block) {\n return -ENOMEM;\n }\n for (i = 0; i < start_block; i++) {\n const struct node block_item = me->block[i];\n free(block_item.data);\n }\n for (i = end_block + 1; i < me->block_count; i++) {\n const struct node block_item = me->block[i];\n free(block_item.data);\n }\n memcpy(new_block,\n &me->block[start_block],\n new_block_count * sizeof(struct node));\n free(me->block);\n me->block = new_block;\n me->block_count = new_block_count;\n me->start_index -= start_block * BLOCK_SIZE;\n me->end_index -= start_block * BLOCK_SIZE;\n return 0;\n}\n\n/**\n * Copies the deque to an array. Since it is a copy, the array may be modified\n * without causing side effects to the deque data structure. Memory is not\n * allocated, thus the array being used for the copy must be allocated before\n * this function is called. The size of the deque should be queried prior to\n * calling this function, which also serves as the size of the newly-copied\n * array.\n *\n * @param arr the initialized array to copy the deque to\n * @param me the deque to copy to the array\n */\nvoid deque_copy_to_array(void *const arr, deque me)\n{\n int i;\n for (i = 0; i < deque_size(me); i++) {\n deque_get_at((char *) arr + i * me->data_size, me, i);\n }\n}\n\n/**\n * Adds an element to the front of the deque. The pointer to the data being\n * passed in should point to the data type which this deque holds. For example,\n * if this deque holds integers, the data pointer should be a pointer to an\n * integer. Since the data is being copied, the pointer only has to be valid\n * when this function is called.\n *\n * @param me the deque to add an element to\n * @param data the element to add\n *\n * @return 0 if no error\n * @return -ENOMEM if out of memory\n */\nint deque_push_front(deque me, void *const data)\n{\n struct node block_item;\n int block_index;\n int inner_index;\n if (me->start_index == -1) {\n block_index = -1;\n inner_index = BLOCK_SIZE - 1;\n } else {\n block_index = me->start_index / BLOCK_SIZE;\n inner_index = me->start_index % BLOCK_SIZE;\n }\n if (inner_index == BLOCK_SIZE - 1) {\n struct node *block_item_reference;\n if (block_index == -1) {\n int i;\n const int old_block_count = me->block_count;\n const int new_block_count =\n (int) (RESIZE_RATIO * me->block_count) + 1;\n const int added_blocks = new_block_count - old_block_count;\n void *temp = realloc(me->block,\n new_block_count * sizeof(struct node));\n if (!temp) {\n return -ENOMEM;\n }\n me->block = temp;\n me->block_count = new_block_count;\n memmove(&me->block[added_blocks],\n me->block,\n old_block_count * sizeof(struct node));\n block_index = added_blocks - 1;\n me->start_index += added_blocks * BLOCK_SIZE;\n me->end_index += added_blocks * BLOCK_SIZE;\n for (i = 0; i < added_blocks; i++) {\n struct node *const block_item_copy = &me->block[i];\n block_item_copy->data = NULL;\n }\n }\n block_item_reference = &me->block[block_index];\n if (!block_item_reference->data) {\n block_item_reference->data = malloc(BLOCK_SIZE * me->data_size);\n if (!block_item_reference->data) {\n return -ENOMEM;\n }\n }\n }\n block_item = me->block[block_index];\n memcpy((char *) block_item.data + inner_index * me->data_size, data,\n me->data_size);\n me->start_index--;\n return 0;\n}\n\n/**\n * Adds an element to the back of the deque. The pointer to the data being\n * passed in should point to the data type which this deque holds. For example,\n * if this deque holds integers, the data pointer should be a pointer to an\n * integer. Since the data is being copied, the pointer only has to be valid\n * when this function is called.\n *\n * @param me the deque to add an element to\n * @param data the element to add\n *\n * @return 0 if no error\n * @return -ENOMEM if out of memory\n */\nint deque_push_back(deque me, void *const data)\n{\n struct node block_item;\n const int block_index = me->end_index / BLOCK_SIZE;\n const int inner_index = me->end_index % BLOCK_SIZE;\n if (inner_index == 0) {\n struct node *block_item_reference;\n if (block_index == me->block_count) {\n int i;\n const int new_block_count =\n (int) (RESIZE_RATIO * me->block_count) + 1;\n void *temp = realloc(me->block,\n new_block_count * sizeof(struct node));\n if (!temp) {\n return -ENOMEM;\n }\n me->block = temp;\n me->block_count = new_block_count;\n for (i = block_index; i < me->block_count; i++) {\n struct node *const block_item_copy = &me->block[i];\n block_item_copy->data = NULL;\n }\n }\n block_item_reference = &me->block[block_index];\n if (!block_item_reference->data) {\n block_item_reference->data = malloc(BLOCK_SIZE * me->data_size);\n if (!block_item_reference->data) {\n return -ENOMEM;\n }\n }\n }\n block_item = me->block[block_index];\n memcpy((char *) block_item.data + inner_index * me->data_size, data,\n me->data_size);\n me->end_index++;\n return 0;\n}\n\n/**\n * Removes the front element from the deque and copies it to a data value. The\n * pointer to the data being obtained should point to the data type which this\n * deque holds. For example, if this deque holds integers, the data pointer\n * should be a pointer to an integer. Since this data is being copied from the\n * array to the data pointer, the pointer only has to be valid when this\n * function is called.\n *\n * @param data the value to copy to\n * @param me the deque to remove from\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_pop_front(void *const data, deque me)\n{\n int block_index;\n int inner_index;\n struct node block_item;\n if (deque_is_empty(me)) {\n return -EINVAL;\n }\n me->start_index++;\n block_index = me->start_index / BLOCK_SIZE;\n inner_index = me->start_index % BLOCK_SIZE;\n block_item = me->block[block_index];\n memcpy(data, (char *) block_item.data + inner_index * me->data_size,\n me->data_size);\n return 0;\n}\n\n/**\n * Removes the back element from the deque and copies it to a data value. The\n * pointer to the data being obtained should point to the data type which this\n * deque holds. For example, if this deque holds integers, the data pointer\n * should be a pointer to an integer. Since this data is being copied from the\n * array to the data pointer, the pointer only has to be valid when this\n * function is called.\n *\n * @param data the value to copy to\n * @param me the deque to remove from\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_pop_back(void *const data, deque me)\n{\n int block_index;\n int inner_index;\n struct node block_item;\n if (deque_is_empty(me)) {\n return -EINVAL;\n }\n me->end_index--;\n block_index = me->end_index / BLOCK_SIZE;\n inner_index = me->end_index % BLOCK_SIZE;\n block_item = me->block[block_index];\n memcpy(data, (char *) block_item.data + inner_index * me->data_size,\n me->data_size);\n return 0;\n}\n\n/**\n * Sets the first value of the deque. The pointer to the data being passed in\n * should point to the data type which this deque holds. For example, if this\n * deque holds integers, the data pointer should be a pointer to an integer.\n * Since the data is being copied, the pointer only has to be valid when this\n * function is called.\n *\n * @param me the deque to set the value of\n * @param data the data to set\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_set_first(deque me, void *const data)\n{\n return deque_set_at(me, 0, data);\n}\n\n/**\n * Sets the value of the deque at the specified index. The pointer to the data\n * being passed in should point to the data type which this deque holds. For\n * example, if this deque holds integers, the data pointer should be a pointer\n * to an integer. Since the data is being copied, the pointer only has to be\n * valid when this function is called.\n *\n * @param me the deque to set the value of\n * @param index the index to set at\n * @param data the data to set\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_set_at(deque me, int index, void *const data)\n{\n int block_index;\n int inner_index;\n struct node block_item;\n if (index < 0 || index >= deque_size(me)) {\n return -EINVAL;\n }\n index += me->start_index + 1;\n block_index = index / BLOCK_SIZE;\n inner_index = index % BLOCK_SIZE;\n block_item = me->block[block_index];\n memcpy((char *) block_item.data + inner_index * me->data_size, data,\n me->data_size);\n return 0;\n}\n\n/**\n * Sets the last value of the deque. The pointer to the data being passed in\n * should point to the data type which this deque holds. For example, if this\n * deque holds integers, the data pointer should be a pointer to an integer.\n * Since the data is being copied, the pointer only has to be valid when this\n * function is called.\n *\n * @param me the deque to set the value of\n * @param data the data to set\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_set_last(deque me, void *const data)\n{\n return deque_set_at(me, deque_size(me) - 1, data);\n}\n\n/**\n * Gets the first value of the deque. The pointer to the data being obtained\n * should point to the data type which this deque holds. For example, if this\n * deque holds integers, the data pointer should be a pointer to an integer.\n * Since this data is being copied from the array to the data pointer, the\n * pointer only has to be valid when this function is called.\n *\n * @param data the data to set\n * @param me the deque to set the value of\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_get_first(void *const data, deque me)\n{\n return deque_get_at(data, me, 0);\n}\n\n/**\n * Gets the value of the deque at the specified index. The pointer to the data\n * being obtained should point to the data type which this deque holds. For\n * example, if this deque holds integers, the data pointer should be a pointer\n * to an integer. Since this data is being copied from the array to the data\n * pointer, the pointer only has to be valid when this function is called.\n *\n * @param data the data to set\n * @param me the deque to set the value of\n * @param index the index to set at\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_get_at(void *const data, deque me, int index)\n{\n int block_index;\n int inner_index;\n struct node block_item;\n if (index < 0 || index >= deque_size(me)) {\n return -EINVAL;\n }\n index += me->start_index + 1;\n block_index = index / BLOCK_SIZE;\n inner_index = index % BLOCK_SIZE;\n block_item = me->block[block_index];\n memcpy(data, (char *) block_item.data + inner_index * me->data_size,\n me->data_size);\n return 0;\n}\n\n/**\n * Gets the last value of the deque. The pointer to the data being obtained\n * should point to the data type which this deque holds. For example, if this\n * deque holds integers, the data pointer should be a pointer to an integer.\n * Since this data is being copied from the array to the data pointer, the\n * pointer only has to be valid when this function is called.\n *\n * @param data the data to set\n * @param me the deque to set the value of\n *\n * @return 0 if no error\n * @return -EINVAL if invalid argument\n */\nint deque_get_last(void *const data, deque me)\n{\n return deque_get_at(data, me, deque_size(me) - 1);\n}\n\n/**\n * Clears the deque and sets it to the original state from initialization.\n *\n * @param me the deque to clear\n *\n * @return 0 if no error\n * @return -ENOMEM if out of memory\n */\nint deque_clear(deque me)\n{\n void *temp_block_data;\n int i;\n struct node *block;\n struct node *const temp_block = malloc(sizeof(struct node));\n if (!temp_block) {\n return -ENOMEM;\n }\n temp_block_data = malloc(BLOCK_SIZE * me->data_size);\n if (!temp_block_data) {\n free(temp_block);\n return -ENOMEM;\n }\n for (i = 0; i < me->block_count; i++) {\n const struct node block_item = me->block[i];\n free(block_item.data);\n }\n free(me->block);\n me->start_index = BLOCK_SIZE / 2;\n me->end_index = me->start_index + 1;\n me->block_count = 1;\n me->block = temp_block;\n block = me->block;\n block->data = temp_block_data;\n return 0;\n}\n\n/**\n * Destroys the deque. Performing further operations after calling this function\n * results in undefined behavior.\n *\n * @param me the deque to destroy\n *\n * @return NULL\n */\ndeque deque_destroy(deque me)\n{\n int i;\n for (i = 0; i < me->block_count; i++) {\n const struct node block_item = me->block[i];\n free(block_item.data);\n }\n free(me->block);\n free(me);\n return NULL;\n}\n\n\n/**************************************************************************************/\n\n\n#include \n#include \n#include \n#include \n\nstruct pair {\n\tint n;\n\tint curCost;\n};\n\nstatic int minCost(int start_n, int m)\n{\n\tstruct pair pair = { .n = start_n, .curCost = 0 };\n\tdeque d = deque_init(sizeof(struct pair));\n\tdeque_push_back(d, &pair);\n\twhile (!deque_is_empty(d)) {\n\t\tdeque_pop_front(&pair, d);\n\t\tint n = pair.n;\n\t\tint curCost = pair.curCost;\n\t\tif (n > 2 * m || n < 1) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (n == m) {\n\t\t\treturn curCost;\n\t\t}\n\t\tpair.curCost = curCost + 1;\n\t\tpair.n = n - 1;\n\t\tdeque_push_back(d, &pair);\n\t\tpair.n = 2 * n;\n\t\tdeque_push_back(d, &pair);\n\t}\n\treturn -12;\n}\n\nint main(void)\n{\n\tint n;\n\tint m;\n\tscanf(\"%d %d\", &n, &m);\n\tif (n >= m) {\n\t\tprintf(\"%d\\n\", n - m);\n\t\treturn 0;\n\t}\n\tint min = minCost(n, m);\n\tprintf(\"%d\\n\", min);\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0ebafd6e0c59457e1b454cb817526136", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nstatic int arr[10001][10001];\nstatic int a,b;\nstatic int dp[10001][10001];\nint bluered(int n, int m)\n{\n if(arr[n][m]==-1)\n return 100001;\n arr[n][m]=-1;\n if(dp[n][m]!=-1)\n return dp[n][m];\n if(n==a && m==b){\n dp[n][m]=1;\n return 1;}\n\n\n if(n==m){\n dp[n][m]=0;\n return 0;}\n if(m1){\n count2=count2+(bluered(n-1,m));}\n if(n<=1){\n dp[n][m]=count1;\n return count1; }\n if(count1\n#include\nint main()\n{\n\tlong int a,n,s=0,b,n1;\n\tint rev=0;\n\tscanf(\"%ld\",&n);\n\ta=n;\n\t//b=n;\n\twhile(a!=0)\n\t{\n\t\tn=a;\n\t\tn=n%10;\n\t\tif(n>=5&&n<=9)\n\t\t{\n\t\t\tn=9-n;\n\t\t\ts=s*10+n;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts=s*10+n;\n\t\t}\n\t\ta=a/10;\n\t}\n\twhile(s!=0)\n\t{\n\t\trev=rev*10+s%10;\n\t\ts=s/10;\n\t}\n\t\n\tprintf(\"%ld\",rev);\t\n\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "74f97cc56c0eaefc9d55ab73469dfda4", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int ara[100000000];\n long long int a,s=1,t=0,i,k=0,num;\n scanf(\"%lld\",&a);\n for(i=0; a!=0; i++)\n {\n num=a%10;\n ara[i]=num;\n a=a/10;\n t++;\n }\n for(i=0; i\n\nint main()\n{ int ara[100000000];\n int a,s=1,t=0,i,k=0,num;\n scanf(\"%d\",&a);\n for(i=0;a!=0;i++){\n num=a%10;\n ara[i]=num;\n a=a/10;\n t++;\n }\n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define maxn 10000000 + 10\n\ntypedef long long ll;\n\nint Arr[maxn];\n\nint main()\n{\n ll n, i, tmp, tot, cnt, _sum;\n int tmp1;\n while( ~scanf( \"%I64d\", &n ) )\n {\n tot = cnt = _sum = 0;\n tmp = n;\n while(tmp)\n {\n tot ++;\n tmp /= 10;\n }\n _sum = pow( (double)10, (double)tot );\n\n for( i = 1; i <= tot; i ++ )\n {\n\n tmp1 = n / ( _sum / 10 );\n\t\t\tif( i == 1 && tmp1 == 9 )\n\t\t\t{\n\t\t\t\ttmp1 = 9;\n\t\t\t}\n\t\t\telse\n\t\t\t\ttmp1 = abs( 9 - tmp1 ) < tmp1 ? abs( 9 - tmp1 ) : tmp1;\n\t\t\t//printf( \"%d\", tmp1 );\n\t\t\tArr[ cnt ++ ] = tmp1;\n \tn = n - n / ( _sum / 10 ) * ( _sum / 10 );\n \t_sum /= 10;\n }\n for( i = 0; i < cnt; i ++ )\n printf( \"%d\", Arr[i] );\n\t\tprintf( \"\\n\" );\n\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "07172861f7a6412554848f00adb4e85e", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(void)\n{\n\t\tlong long int i = 0;\n\t\tchar c;\n\t\tint count = 0;\n\n\t\twhile ((c = getchar()) == 9){\n\t\t\t\ti = (i*10) + 9;\n\n\t\twhile(c != '\\n'){\n\t\t\t\ti *= 10;\n\t\t\t\tif (c - '0' > 4 && c != '9')\n\t\t\t\t\t\ti += 9 - (c - '0');\n\t\t\t\telse\n\t\t\t\t\t\ti += (c - '0');\n\t\t\t\tc = getchar();\n\t\t}\n\t\tprintf(\"%I64d\\n\", i);\n\t\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c170377fc0deab67ef91041de4284723", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n float n,m,a;\n int h;\n scanf(\"%f%f%f\",n,m,a);\n for(n>0,m>0,a>0)\n {\n h=ceil(n/a)*ceil(m/a);\n printf(\"%d\",h);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d2f5e4b5908f7c62d1ba7064fca2f12", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tint a, b, c;\n\tcin >> a >> b >> c;\n\tlong long int ans = ((a%c == 0) ? (a / c) : (a / c + 1))*((b%c == 0) ? (b / c) : (b / c + 1));\n\tcout << ans << endl;\n\treturn 0;\n}\n \t \t \t\t\t\t\t\t\t\t \t\t\t \t\t\t\t\t \t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "3c75ae9376ea944cbf9a2f1158202b71", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n double n,m,a;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n scanf(\"%d\",&a);\n \n int x=n%a;\n int y=m%a;\n double x1,y1;\n if(x==0){\n x1=n/a;\n \n }\n else{\n x1=n/a+1;\n }\n \n if(y==0){\n y1=m/a;\n }\n else{\n y1=m/a+1;\n }\n double result=x1*y1;\n printf(\"%d\",result);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0bf524acc6ca871e532148fef900ea16", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{ \n float n,m,a;\nint h;\nscanf(\"%f%f%f\",&n,&m,&a);\nfor(n>0,m>0,a>0)\n{ \nh=ceil(n/a)*ceil(m/a);\n}\nprintf(\"%d\",h);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f7dc4da2d86c0cb131585e3b7709d7bf", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include\nint main ()\n{\n int n;\n int m;\n int a;\n\n scanf (\"%d %d %d\", &n, &m, &a);\n\n long long flagsByRow;\n \n if (n % a == 0) {\n flagsByRow = n / a;\n \n } else {\n flagsByRow = n / a;\n flagsByRow++;\n\n }\n\n long long flagsByColumn;\n \n if (m % a == 0) {\n flagsByColumn = m / a;\n \n } else {\n flagsByColumn = m / a;\n flagsByColumn++;\n\n }\n\n cout << flagsByRow * flagsByColumn << endl;\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4c94ec0d886fcaf45c13a86d87ca6fa4", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n int k,j,l,m,n,o,p,q;\n int r;\n q=0;\n scanf(\"%d\",&n);\n for(j=4;j<500;j++){\n o=0;\n p=0;\n \n for(r=j;r>0;){\n k=r%10;\n r=r/10;\n if(k==4 || k==7){\n m=k*pow(10,p);\n o=o+m;\n p++;\n if(n%o==0){\n printf(\"YES\");\n q++;\n return 0;\n }\n }\n else \n break;\n \n }\n }\n if(q==0)\n printf(\"NO\");\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7986223c982445ccbd3d2ac3baaf266", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "GNU C", "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 return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d7ec62a52d41ece55016683426acdf19", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "GNU C11", "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 while(i=0;i<14;i++)\n if(sayi%luckynumber[i]==0)\n printf(\"YES\");\n printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5163ca6f67bc43b4c1f09179382ac79", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,flag;\n scanf(\"%d\",&n);\n if(n%4==0||n%7==0) flag=1;\n else{\n if(n%47==0||n%74==0||n&44==0||n%77==0||n%444==0||n%777=0||n%474==0||n%447==0||n%744==0||n%774==0||n%477==0||n%747==0)\n flag=1;\n else\n flag=0;\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d07d89ae2e21deffe5aa3cd5aa373483", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\nint islucky(int n){\n \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 if(i=0)\n return 1;\n else\n return 0;\n}\n\nint main(){\nunsigned int n;\nscanf(\"%d\",&n);\nint i,j;\nfor(i=1;i<=n;i++){\n if(islucky(i)){\n if(n%i == 0){\n printf(\"YES\");\n return 0;}\n else{\n printf(\"NO\");\n return 0;}\n }\n}\nif(i==n+1)\nprintf(\"NO\");\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9aac54ef7a2da5ed0c4b977fb70a4d08", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char s [ 300 ] , r [ 300 ];\n int i;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9f403e811a7ee604c25c12c071f6abac", "src_uid": "46b5a1cd1bd2985f2752662b7dbb1869", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char s[200];\n gets(s);\n int l=strlen(s);\n for(int i=0;i\n#include\nint main()\n{\n char a[250];\n int n,i;\n scanf(\"%s\",&a);\n n=strlen(a);\n for(i=0;i\n \n \n \n\nint main()\n{\n char c[200];\n \n scanf(\"%s\",&c); \n \n for(int i=0; i<75; i++){\n \n if((c[i]== '-')&& (c[i+1]== '-')){\n printf(\"2\"); \n \n i++;\n }\n \n else if((c[i]== '-')&& (c[i+1]== '.')){\n printf(\"1\"); \n \n i++;\n } \n else if( c[i]== '.'){\n printf(\"0\");\n else \n break;\n \n } \n } \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cec16d4808d9da90e7c8e6e5a33f25f7", "src_uid": "46b5a1cd1bd2985f2752662b7dbb1869", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(){\t\n\tchar a[1000]={};\t\n\tscanf(\"%s\", arr);\n\t\n\tint n,i;\n\tn=strlen(a);\t\n\t\n\tfor(i=0;i\n#include\nmain()\n{\n\tint max,t,p,k1,temp,w=0,l,i,j,k;\n\tchar s[30];\n\tint a[30]={0},b[30]={0};\n\tscanf(\"%d\",&l);l++;l--;\n\tfor(i=0;i<=l;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t}\n\ts[l+1]='\\0';\n\tfor(t=1;t<=l-1;t++)\n\t{\n\t\tfor(p=1;p<=l-1;p++)\n\t\t{\n\t\t\tif (s[t]==s[p] && s[t+1]==s[p+1])\n\t\t\t{\n\t\t\t\ta[t]++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=1;i<=l-1;i++)\n\tb[i]=a[i];\n\tfor(t=1;t<=l-1;t++)\n\t{\n\t\tif (b[t]>b[t+1])\n\t\t{\n\t\t\ttemp=b[t];\n\t\t\tb[t]=b[t+1];\n\t\t\tb[t+1]=temp;\n\t\t}\n\t}\n\tmax=b[l];\n\tfor(t=1;t<=l-1;t++)\n\t{\n\t\tif (a[t]==max)\n\t\t{\n\t\t\tk=t;\n\t\t\tif (w==0)\n\t\t\t{\n\t\t\tk1=k};\n\t\t\tw++;\n\t\t}\n\t}\n\tprintf(\"%c%c\",s[k1],s[k1+1]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d28967b260da1ce4f7b23a3ea19d54dd", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#includemax){\n max=count;\n maxn =i ; }\n }\n printf(\"%c%c\",s[maxn-1],s[maxn]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "294d231adf25a4220574d4b8272e6911", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std; \n \n#define N 100 \n \nint main() \n{ \n static char cc[N]; \n static int kk[676]; \n int n, i, max, amax; \n scanf(\"%d\", &n); \n scanf(\"%s\", cc); \n max = 0; \n amax = 0; \n for (i = 1; i < n; i++) \n { \n int a = (cc[i - 1] - 'A') * 26 + (cc[i] - 'A'); \n if (max < ++kk[a]) \n { \n max = kk[a]; \n amax = a; \n } \n } \n printf(\"%c%c\\n\", amax / 26 + 'A', amax % 26 + 'A'); \n return 0; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "30c846bf7563326207d94ba11dea0cf5", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\n\nint main() {\n char s[101],ans[3];\n int n,max = 0;\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n ans[2] = '\\0'\n for(int j = 0; j <= n ; j++) {\n char a = s[j], b = s[j+1];\n int k=0;\n for (int i = 0; i <= n; ++i) {\n if (s[i] == a && s[i + 1] == b) k++;\n\n\n }\n if (k > max){\n ans[0] = a;\n ans[1] = b;\n max = k;\n }\n\n }\n\n printf(\"%s\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9587c8a592c938fde5119ce10f5ddcda", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n\tint i, j, n, num = 0, max = 0;\n\tchar string[100], subString[100][2], maxString[2];\n\tscanf(\"%d\", &n);\n\tgets(\"%s\", string);\n\tfor (i = 0; i < n; i++) {\n\t\tsubString[i][0] = string[i];\n\t\tsubString[i][1] = string[i+1];\n\t}\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tfor (j = 0; j < n; j++) {\n\t\t\tif (j != i) {\n\t\t\t\tif (strcmp(subString[i], subString[j]) == 0) {\n\t\t\t\t\tnum++;\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (num > max) {\n\t\t\tmax = num;\n\t\t\tstrcpy(maxString, subString[i]);\n\t\t}\n\t}\n\t\n\tprintf(\"%s\\n\", maxString);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fff3788016148cca64ad7a1e5a0f917c", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint main()\n{\n int m, n;\n long long int r, x, y, x1, y1, z;\n double s;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\", &r, &x, &y, &x1, &y1);\n s= sqrt( abs(x1-x)*abs(x1-x) + abs(y1-y)*abs(y1-y) );\n n= s/(2*r);\n if(n*2*r == s) \n else n++\n printf(\"%d\",n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2f63e064911d1faac060f9a19b4c4cbf", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\nlong long int r,x,y,x1,y1,res;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&r,&x,&y,&x1,&y1);\n res=ceil(((llabs(y-y1)+llabs(x-x1))/(2*r)));\nif printf(\"%I64d\",res);\n\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8c19248a035d19f842601c3c1685f312", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0} {"lang": "GNU C", "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{\n\tlong long r,x,y,x1,y1,i;\n\tint s=0;\n\tscanf(\"%lld%lld%lld%lld%lld\",&r,&x,&y,&x1,&y1);\n\ti=(long long)(pow((double)(x1-x),2.0)+pow((double)(y1-y),2.0));\n i=(long long)(sqrt((double)i));\n if(x == x1 && y == y1)\n { \n\t\tprintf(\"0\");\n }\n\t\n\telse if (x >= x1 && y >= y1)\n\t{\n\t\t\ti=i/(2*r);\n\t\t \tprintf(\"%d\",i+1);\n\t}\n\telse if(x <= x1 && y <= y1)\n\t\t{\n\t\t \n if(x == y && x1 == y1)\n\t \t{\n\t\t\t\t\n\t\t\t \t\twhile(i >= r)\n\t\t\t\t\t{\n\t\t\t\t\n\t\t\t\t\tr=r+r;\n\t\t\t\t\ts++;\n\t\t\t\t\t}\n\t\t\t\tprintf(\"%d\\n\",s);\n\t\t\t\t}\n \n\t\t\t\telse if((y1 > y && y1%r==0)||(x1 > x && x1%r==0))\n\t\t\t\t{ \n\t\t\t\twhile (i > r)\n\t\t\t\t{\n\t\t\t\tr=r+r;\n\t\t\t\t s++;\n\t\t\t\t}\n\t\t\t\tprintf(\"%d\",s);\t\n\t\t\t\t}\n\t\t\t\n\t\t\t\telse if(i > r)\n\t\t\t\t{\n\t\t\t\t\n\t\t\t \t\twhile(i >= r)\n\t\t\t\t\t{\n\t\t\t\t\n\t\t\t\t\tr=r+r;\n\t\t\t\t\ts++;\n\t\t\t\t\t}\n\t\t\t\tprintf(\"%d\\n\",s);\n\t\t\t\t}\n\t\t\t\t\telse if((x == x1 && y1 >= y)||(y == y1 && x1 >= x))\n\t\t\t\t{\n\t\t\t\t\n\t\t\t\twhile(i >= r)\n\t\t\t\t\t{\n\t\t\t\t\n\t\t\t\t\tr=r+r;\n\t\t\t\t\ts++;\n\t\t\t\t\t}\n\t\t\t\tprintf(\"%d\\n\",s+1)\n\t\t\t\t}\n\t\t \t\n\t\t\telse \n\t\t\t{\n\t\t\t\twhile ( i <= r)\n\t\t\t\t{\n\t\t\t\t r=r-r;\n\t\t\t\t \ts++;\n\t\t\t\t}\n\t\t\t\tprintf(\"%d\",s);\n\t\t\t}\n\t\t\n\t\t}\n\t\telse if ((x >= x1 && y <= y1) || (x <= x1 && y >= y1))\n\t\t{\n\t\t \ti=i/(2*r);\n\t\t \tprintf(\"%d\",i+1);\n\t\t}\n\t\n\t\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cfe2baa02d20d1ea43f5009c91a15a25", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n long int r, x1, y1, x2, y2;\n scanf(\"%ld %ld %ld %ld %ld\", &r, &x1, &y1, &x2, &y2);\n printf(\"%ld\", ceil(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/(2*r)))\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b97e2074530b3ec461ab0b3873c08787", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n float x1,y1,x2,y2,r;\n float Dis;\n int times;\n float out;\n scanf(\"%f %f %f %f %f\",&r,&x1,&y1,&x2,&y2);\n Dis = sqrt(pow(x1-x2,2) + pow(y1-y2,2));\n out = Dis/2r;\n if ((int)out == (float)out){\n times = out ;\n }\n else\n times = out+1;\n\n printf(\"%d\",times);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "253cd4ae9e4807af1c64a4b08552cd21", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \nint a[35], n, m, arr1[1<<18], arr2[1<<18];\nint idx1, idx2;\nint max(int a, int b){if (a ans) ans=tmp;\n while(arr2[j]==arr2[j+1]) j++;\n }\n while(arr1[i]==arr1[i+1]) i++;\n }\n\n printf(\"%d\\n\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b95df5e494d41ef6f40645be7c133eb9", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint a[35], n, m, arr1[1<<18], arr2[1<<18];\nint idx1, idx2;\nint max(int a, int b){if (a ans) ans=tmp;\n while(arr2[j]==arr2[j+1]) j++;\n }\n while(arr1[i]==arr1[i+1]) i++;\n }\n\n printf(\"%d\\n\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "913005fd078a91911a4f396daf152ec7", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define LL long long\n#define uLL unsigned long long\nlong ms[2000000];\nvoid print(LL *a,long size) {long i;for (i=1;isize) {e=size;}\n\t\t\tfor (j=1;(s=s;b--)\n\t\t\t{\n\t\t\t\tds[e--]=ds[b];\n\t\t\t}\n\t\t\tfor (b=1;b>1;\n}\ninline uLL bsf64(uLL a)\n{\n\tasm(\"bsfq %0,%0\":\"+r\"(a));\n\treturn a; \n}\ninline uLL bsr64(uLL a)\n{\n\tasm(\"bsrq %0,%0\":\"+r\"(a));\n\treturn a; \n}\ninline LL max(LL a,LL b) {if (b>a) {a=b;}return a;}\ninline LL min(LL a,LL b) {if (a>b) {a=b;}return a;}\nLL ans1[1000000],ans2[1000000];\nlong num[1000],num2[1000];\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tlong i,j,k,a,b,c,l,p,q,baka,r,m,n,mid;\n\tscanf(\"%ld %ld\\n\",&n,&m);\n//\tprintf(\"%ld %ld\\n\",n,m);\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%ld\",&num[i]);\n\t}\t\n\tif (n>10) {q=n>>1;} {q=n;}\n\t*ans1=(LL)1<>1;\n\t\t\tif (ans1[mid]0) {b=(ans2[i]+ans1[r])%m;baka=max(b,baka);}\n\t\tl=1;r=*ans1;a=2*m-1-ans2[i];\n\t\twhile (l<=r)\n\t\t{\n\t\t\tmid=(l+r)>>1;\n\t\t\tif (ans1[mid]0) {b=(ans2[i]+ans1[r])%m;baka=max(b,baka);}\t\t\n\t}\n\tprintf(\"%lld\\n\",baka);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "06004f30cfee14c485d6d4de967d9679", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define LL long long\n#define uLL unsigned long long\nlong ms[2000000];\nvoid print(LL *a,long size) {long i;for (i=1;isize) {e=size;}\n\t\t\tfor (j=1;(s=s;b--)\n\t\t\t{\n\t\t\t\tds[e--]=ds[b];\n\t\t\t}\n\t\t\tfor (b=1;b>1;\n}\ninline uLL bsf64(uLL a)\n{\n\tasm(\"bsfl %0,%0\":\"+r\"(a));\n\treturn a; \n}\ninline uLL bsr64(uLL a)\n{\n\tasm(\"bsrl %0,%0\":\"+r\"(a));\n\treturn a; \n}\ninline LL max(LL a,LL b) {if (b>a) {a=b;}return a;}\ninline LL min(LL a,LL b) {if (a>b) {a=b;}return a;}\nLL ans1[1000000],ans2[1000000];\nlong num[1000],num2[1000];\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tlong i,j,k,a,b,c,l,p,q,baka,r,m,n,mid;\n\tscanf(\"%ld %ld\\n\",&n,&m);\n//\tprintf(\"%ld %ld\\n\",n,m);\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%ld\",&num[i]);\n\t}\t\n\tif (n>10) {q=n>>1;} {q=n;}\n\t*ans1=(LL)1<>1;\n\t\t\tif (ans1[mid]0) {b=(ans2[i]+ans1[r])%m;baka=max(b,baka);}\n\t\tl=1;r=*ans1;a=2*m-1-ans2[i];\n\t\twhile (l<=r)\n\t\t{\n\t\t\tmid=(l+r)>>1;\n\t\t\tif (ans1[mid]0) {b=(ans2[i]+ans1[r])%m;baka=max(b,baka);}\t\t\n\t}\n\tprintf(\"%lld\\n\",baka);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "46befdbdb4036649fa2be0c469f998aa", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint a[35], n, m, arr1[1<<20], arr2[1<<20];\nint idx1, idx2;\nint max(int a, int b){if (a ans) ans=tmp;\n while(j\n#include\n\n#define si(a) scanf(\"%d\",&a);\n#define sl(a) scanf(\"%lld\",&a);\n#define ss(a) gets(a);\n#define rep(i,start,n) for(i=start;i\n\nint main()\n{\n int n,a;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n a=(n-2)/2;\n }\n else\n {\n a=(n-1)/2;\n }\n printf(\"%d\",a);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "95612ea60fad4bcc08cf6f809381df1a", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n cout<<(n-1)/2;<\nint main\n{ long int n,m;\n scanf(\"%d\",&n)\n if(n%2=0)\n m=(n/2)-1;\n else\n m=n/2;\n \n printf(\"%ld\",m);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "346d6711fb1aed8a467d537addf88fdd", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n%2==0)\nprintf(\"%d\",n/2-1);\nelse\nprintf(\"%d\",(n-1)/2);\nreturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f057cc947f2578581fe6f08a01e79da", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "/* http://codeforces.com/problemset/problem/17/A */\n#include \n#include \n#include \n#include \ninline int get_int()\n{\n\tint n=0;\n\tchar c=0;\n\twhile(c<33)\n\t\tc=getchar_unlocked();\n\twhile(c>='0'&&c<='9')\n\t{\n\t\tn=(n<<3)+(n<<1)+(c-'0');\n\t\tc=getchar_unlocked();\n\t}\n\treturn n;\n}\nint main(int argc, char const *argv[])\n{\n\n\tint primes[180] = {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};\n\tint n,k,kt=0,i,j;\n\tn=get_int();\n\tk=get_int();\n\tfor (i = 2; primes[i]\n#include \n\nint PN;\nint prime[500];\nint sp[500];\nint ptest(int);\nint main(){\n int n,k;\n int i;\n int cnt=0;\n scanf(\"%d%d\",&n,&k);\n prime[p++]=2;\n for(i=3;i<=n;i+=2){\n if(ptest(i)) prime[p++]=i;\n }\n PN=p;\n for(i=0;i=k) printf(\"YES\");\n else printf(\"NO\");\n return 0; \n}\n\nint ptest(int n){\n int i;\n for(i=2;i<=sqrt(n);i++){\n if(n%i==0) return 0;\n }\n return 1;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "29c3e9afe05c133b277991c358245263", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint prime_arr(int *arr)\n{\n int i,j,s;\n for(i=2;i<1000;i++)\n {\n s=sqrt(i);\n for(j=2;j<=s;j++)\n if(i%j==0)\n break;\n if(j>s)\n arr[c++]=i;\n }\n return c;\n}\nint main()\n{\n int i,j,n,k,p;\n int primes[1000];\n p=prime_arr(primes);\n scanf(\"%d %d\",&n,&k);\n for(i=5;i<=n;i++)\n {\n for(j=2;j \n#include\nusing namespace std; \n \nint SieveOfEratosthenes(int n) \n{ \n int a[1000],k=0,count=0;\n \n bool prime[n+1]; \n memset(prime, true, sizeof(prime)); \n \n for (int p=2; p*p<=n; p++) \n { \n // If prime[p] is not changed, then it is a prime \n if (prime[p] == true) \n { \n \n for (int i=p*p; i<=n; i += p) \n prime[i] = false; \n } \n } \n \n // Print all prime numbers \n for (int p=2; p<=n; p++){ \n if (prime[p]) {\n a[k]=p;\n k++;}\n }\n for(int i=0;i>n>>m;\n \n if(SieveOfEratosthenes(n)>=m)\n cout<<\"YES\";\n else\n cout<<\"NO\";\n \n return 0; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "c53d84f96a815c9158d9584a7abc3e38", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint n;\nint k;\nint count;\nint prime[1000];\n\nint isPrime(int x)\n{\n int i = 0;\n for (i = 2; i < (int)sqrt(x); i++)\n if (x % i == 0)\n return 0;\n return 1;\n}\n\nvoid buildPrime()\n{\n for (int i = 2; i <= 1000; i++)\n if (isPrime(i))\n {\n prime[count] = i;\n ++count;\n }\n}\n\nint main(int argc, const char * argv[]) {\n \n count = 0;\n \n scanf(\"%d %d\", &n, &k);\n \n buildPrime();\n \n int i = 0;\n int w = 0;\n int sum = 0;\n \n for (i = 0; i < count -1; i++)\n {\n sum = prime[i] + prime[i+1] + 1;\n if (sum > n)\n break;\n else\n if (isPrime(sum))\n ++w;\n }\n \n if (w >= k)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7a50420d24d17e8db21baeef6785ac34", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nusing namespace std;\nint hh, mm, a, p;\nchar sim;\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\tprintf(\"%02d:%02d\", hh, mm);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "17634ff9fb9e00a63a6e388f4890573a", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\nint hh, mm, a, k, l;\nchar c;\nint main(){\n\tcout << \"Input time hh:mm \" << endl;\n\tcin >> hh >> c >> mm;\n\tcout << \"Input time + \" << endl;\n\tcin >> a;\n\tk = hh * 60 + mm + a;\n\tmm = k % 60;\n\thh = k / 60;\n\tif (hh > 23) {\n\t\thh = hh % 24; \n\t}\n\tcout << \"Time \" << endl;\n\tif ((hh < 10)&(mm < 10)){\n\t\tcout << \"0\" << hh << c << \"0\" << mm;\n\t\treturn 0;\n\t}\n\tif((hh < 10)&(mm >= 10)){\n\t\tcout << \"0\" << hh << c << mm;\n\t\treturn 0;\t\t\n\t}\n\tif((hh >= 10)&(mm < 10)){\n\t\tcout << hh << c << \"0\" << mm;\n\t\treturn 0;\t\t\n\t}\n\tcout << hh << c << mm;\t\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1ad45ebc2de36f5e963465645710cabd", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\nint hh, mm, a, k, l;\nchar c;\nint main(){\n\tcout << \"Input time hh:mm \" << endl;\n\tcin >> hh >> c >> mm;\n\tcout << \"Input time + \" << endl;\n\tcin >> a;\n\tk = hh * 60 + mm + a;\n\tmm = k % 60;\n\thh = k / 60;\n\tif (hh > 23) {\n\t\thh = hh % 24; \n\t}\n\tcout << \"Time \" << endl;\n\tif ((hh < 10)&(mm < 10)){\n\t\tcout << \"0\" << hh << c << \"0\" << mm;\n\t\treturn 0;\n\t}\n\tif((hh < 10)&(mm >= 10)){\n\t\tcout << \"0\" << hh << c << mm;\n\t\treturn 0;\t\t\n\t}\n\tif((hh >= 10)&(mm < 10)){\n\t\tcout << hh << c << \"0\" << mm;\n\t\treturn 0;\t\t\n\t}\n\tcout << hh << c << mm;\t\nreturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "02346b7113c0a7f1d02eddf40f20ae25", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int *mn ,maj ,*h;\n std::cout<<\"donner l'horloge\"<\n\nint main()\n{\n int h, m, a;\n scanf(\"%d:%d%d\", &h, &m, &a);\n a+=h*60+m;\n printf(\"%.2d:%.2d\\n\", a/60%24, a%60);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "21f1777e5f6e0c305d38d7643bd3d98a", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0} {"lang": "GNU C11", "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 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}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "39e909a5df7ea90d8e4afd38b68a655f", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nchar* palindromo(char *duerme);\nchar *calcular(int hora, int minuto);\n\nchar * transformar(int hora, int minuto);\n\nint main ()\n\n{\n char duerme[51],*despierta;\n scanf(\"%s\",duerme);\n despierta = palindromo(duerme);\n\n\n printf(\"%s\",despierta);\n\n\n return NULL;\n}\n\nchar* palindromo(char *duerme)\n{\n char *despierta = NULL,aux_h[3],aux_m[3];\n int i,minuto,hora;\n\n for( i = 0; i<2 ;i++)\n {\n aux_h[i] = duerme[i];\n aux_m[i] = duerme[i+3];\n }\n aux_h[2]= '\\0'; aux_m[2] = '\\0';\n\n hora = atoi(aux_h);\n minuto =atoi(aux_m);\n\n despierta = calcular(hora,minuto);\n\n\n\n return despierta;\n}\n\nchar *calcular(int hora, int minuto)\n{\n int i,hora_decena, hora_unidad, minuto_decena, minuto_unidad;\n\n char *despierta = NULL, *retorno = \"00:00\";\n if(hora >= 23 && minuto > 31)\n {\n\n despierta = retorno;\n\n }\n else\n {\n\n hora_decena = (hora/10); minuto_decena = minuto/10;\n hora_unidad = (hora%10); minuto_unidad = (minuto%10);\n if( minuto < hora_decena + (hora_unidad*10 ) )\n {\n\n minuto = hora_decena + (hora_unidad*10);\n\n despierta = transformar(hora,minuto);\n\n\n return despierta;\n\n }\n if( minuto >= hora_decena + (hora_unidad*10 ))\n {\n\n hora = hora+1;\n minuto = hora/10 + ( (hora%10 )* 10);\n despierta = transformar(hora,minuto);\n return despierta;\n }\n\n }\n return despierta;\n}\n\n\nchar * transformar(int hora, int minuto)\n{\n char *despierta , aux_h[2], *aux_m[20];\n\n itoa(hora, aux_h , 10);\n\n itoa(minuto , aux_m , 10);\n\n strcat(despierta,aux_h);\n despierta[2]= ':';\n despierta[3] = '\\0';\n strcat(despierta,aux_m);\n if(despierta[0] > '9')\n {\n despierta[0] = '0';\n }\n else1\n {\n if(despierta[0] < '1')\n {\n despierta[0] = '00';\n }\n }\n\n return despierta;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e1d41c8c46c1534708f5dbf3382f24dd", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nint funcelias (char a);\n\nint main()\n{\n\tint i,j=0,k,f,l ;\n\tint aux[4];\n\tchar hora[6];\n\tint flag=0 ;\n\tscanf(\"%s\", hora) ;\n\t\n\n\tfor(i=0;'\\0'!=hora[i];i++){\n\t\t\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\twhile(flag!=1){\n\t\t\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{\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 and 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\t\t\t\n\t\t}\n\t\taux[0]=0;\n\t\t\n\t}\n\t\t\n\treturn 0 ;\n}\nint funcelias (char a)\n{\n\tint i;\n\t\n\tchar numero[]= {'0','1','2','3','4','5','6','7','8','9'}\t;\n\tfor(i=0; i<10; i++)\n\t{\n\t\t\n\t\tif(a==numero[i])\n\t\t{\n\t\t\treturn i;\n\t\t}\n\t\t\n\t}\n\treturn -1;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b539a0dcaecd707dc3f31dad81e077c4", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "GNU C", "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=60){\n printf(\"20:02\");\n return 0;}\nprintf(\"00:00\");\n\n\n\n\n\n\n\n\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d6c5198e42a00bda049107ac6126584d", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "GNU C11", "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) || hora=05 && min>50 )\n printf(\"10:01\");\n else if ((hora>=16 && hora<=19) || hora=15 && min>51 )\n printf(\"20:02\");\n else\n printf(\"00:00\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c36bccb31eb3f985155e7563c829758a", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint N,K,dp[2003][2003];\nint find(int cur,int cnt)\n{\n\tif(cnt>K)\n\t{\n\t\treturn 1;\n\t}\n\tif(dp[cur][cnt]>-1)\n\t{\n\t\treturn dp[cur][cnt];\n\t}\n\tdp[cur][cnt]=0;\n\tfor(int i=1;cur*i<=N;i++)\n\t{\n\t\tdp[cur][cnt]=(dp[cur][cnt]+find(cur*i,cnt+1))%1000000009;\n\t}\n\treturn dp[cur][cnt];\n}\nint main()\n{\n\twhile(scanf(\"%d %d\",&N,&K)==2)\n\t{\n\t\tmemset(dp,-1,sizeof(dp));\n\t\tprintf(\"%d\\n\",find(1,1));\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf4e4069207e8bea69cf26443665b4fb", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n long long int dp[2002][2002];\n long long int par(long long int n,long long int k)\n{\n if(dp[n][k]==-1)\n {\n if(k==0)\n {\n\tdp[n][k]=0;\n \treturn 0;\n }\n if(n==1)\n {\n dp[n][k]=1;\n return 1;\n }\n long long int i,num=k;\n long long int sum=0;\n for(i=1;i*i<=n;i++)\n {\n num=k;\n while(num--)\n\tsum+=par(i,num)%1000000007; \n\n }\n dp[n][k]=(sum+1)%1000000007;\n\t return (sum+1)%1000000007;\n }\n else\n return dp[n][k];\n\n}\n long long int good(long long int n,long long int k)\n{\n if(n==0)\n return 0;\n if(n==1)\n return 1;\n return good(n-1,k)%1000000007+par(n,k)%1000000007;\n }\nint main()\n{\n long long int n,k,i,j;\n scanf(\"%lld %lld\",&n,&k);\n for(i=0;i<2002;i++)\n for(j=0;j<2002;j++)\n dp[i][j]=-1;\n long long int ans=good(n,k);\n if(k==0)\n ans=0;\n int ans1=(int)ans%1000000007 \n printf(\"%d\\n\",ans1);\n return 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5f6b1eedf1e3e38e9eedc151adac431b", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n__int64 n,k,dp[2010][2010],i,j,temp,l,m;\nint main()\n{\n\twhile(~scanf(\"%I64d%I64d\",&n,&k))\n\t{\n\t\tmemset(dp,0,sizeof(dp));\n\t\tfor(i=1;i<=n;i++)\n\t\t\tdp[1][i]=1;\n\t\tfor(i=1;i\nint mod=1000000007;\nint dp[2001][2001];\nint f(int n,int k);\nint upd[2001][2001];\nint uf(int n,int k)\n{\n\tif(udp[n][k]==0)\n\t\treturn udp[n][k];\n\telse\n\treturn f(n,k)-f(n-1,k);\n}\nint f(int n,int k)\n{\n\n\tif(dp[n][k]!=0)\n\t{\n\t\treturn dp[n][k];\n\t}\n\n\tif(n==1)\n\t\tdp[n][k]=1;\n\telse if(k==1)\n\t\tdp[n][k]=n;\n\telse{\n\tint i,p=0,j=0;\n\tint div;\n\tfor(i=n/2;i>=0;i--)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tdiv=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tint non[div];\n\tfor(i=2;i=0;i--)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tdiv=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",div);*/\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3c1fe830b783d499a7d08bc02a404722", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nlong long int divn[2009][2009],en[2009],ar[2009][2009];\nint main()\n{\n\tint s=0,n,k,i,c,j,g,M=1000000007;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tc=0;\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(i%j==0)\n\t\t\tdivn[i][c++]=j;\n\t\t\ten[i]=c;\n\t\t}\n\t}\n\tfor(i=0;i<=n;i++)\n\t{\n\t\tfor(j=0;j\n#include\nint main()\n{\n int,ans;\n float n,x,y,p1;\n scanf(\"%f %f %f\",&n,&x,&y);\n p1=(x/n)*100;\n if(p1\n#include\n#include\nint main()\n{\n int n,x,y;\n double p;\n scanf(\"%d %d %d\",&n,&x,&y);\n p= (n*y)/100;\n x= int (ceil(p))-x;\n if(x>0)\n printf(\"%d\",x);\n else\n printf(\"0\");\n \n getch();\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "73e87fa0e496b43f42c1fee9df8983d5", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include \nint main()\n{int n,x,y;\nfloat c;\n scanf(\"%d %d %d\",&n,&x,&y);\n c=float (n*y)/100;\n x=int(ceil(c))-x;\n if(x>0)\n printf(\"%d\",x);\n else\n printf(\"0\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fcb302315905d19535fe7dc7b7331eb9", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n//#include\nint main()\n{\n int n,x,y,p=0;\n scanf(\"%d %d %d\",&n,&x,&y);\n while ((x+p)*100\nint main()\n{\n float ans;\n float n,x,y,p1;\n scanf(\"%f %f %f\",&n,&x,&y);\n p1=(x/n)*100;\n if(p1\n #include\n { char* out=NULL,ch,str,f=NULL;\n char k;\n \n scanf(\"%s\",ch);\n strcpy(str,ch);\n \n while(str)\n { k= toupper(str[0]);\n if!((k=='E')|| (k=='O')|| (k=='I')|| (k=='U')|| (k=='A'))\n { sprinf(out,\".%c\",k);\n strcat(f,out);\n }\n str++; \n }\n printf(\"%s\",f);\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "26b12ae10998799fd1cdfd5f96555daf", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n char str[105],str2[205];\n int j=0,i;\n scanf(\"%s\",str);\n for(i=0;i64 && str[i]<91)\n str2[j++]=str[i]+32;\n str2[j++]=str[i];\n }\n }\n str2[j]='\\0';\n printf(\"%s\",str2);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1862f5e7bd0cf45aa9db825bcabd8c32", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nmain()\n{ int z;\n\tchar s[200];\n\tchar s1[200];\n\tgets(s);\n\tint i,j;\n\tz=strlen(s);\n\tfor(i=0;i\n#include\nint main()\n{\n\t\tchar a[100];\n\t\tint l,i,j;\n\t\tget(a);\n\t\tl=strlen(a);\n\t\tstrlwr(a);\n\t\tfor(i=1;i<=l;i++)\n\t\t{\n\t\t\t\n\t\t\tif(a[i]=='a'||a[i]=='o'||a[i]=='y'||a[i]=='e'||a[i]=='u'||a[i]=='i');\n\t\t\tprintf(\".%c\",a[i]);\n\t\t\t\n\t\t\n\t\t}\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "704ae5d9a70d1a7221fd627b2c57fd39", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#define MAX 100\n#include\n#include\nint main()\n{char s[MAX];\nint i;\nscanf(\"%s\",&s);\nj=0;\nfor(i=0;i=65&&s[i]<=90)\ns[i]=s[i]+32;\n\nif(s[i]!='a'&&s[i]!='i'&&s[i]!='e'&&s[i]!='o'&&s[i]!='u'&&s[i]!='A'&&s[i]!='E'&&s[i]!='I'&&s[i]!='O'&&s[i]!='U'&&s[i]!='Y'&&s[i]!='y')\n{printf(\".%c\",s[i]);\n}\n\n}\n\nreturn 0;}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1c30a3b3b4fb9c44ecbaf01dc2a4b403", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,min=100,i,A[100],temp;\n scanf(\"%d\",&n);\n for(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 \nconst int N = 105; \nint n, num[N]; \nint gcd(int a, int b) \n{ \n if (b==0) \n\treturn a; \n return gcd(b,a%b); \n} \nint main () \n{ \n scanf(\"%d\",&n); \n for (int i=0;i\n#include \n\nconst int N = 105;\nint n, num[N];\n\nint gcd(int a, int b) {\n\tif (b == 0) return a;\n\treturn gcd(b, a % b);\n}\nint main () {\n\tint i;\n\twhile(scanf(\"%d\", &n)!=NULL){\n\tfor ( i = 0; i < n; i++) scanf(\"%d\", &num[i]);\n\tint t = num[0];\n\tfor ( i = 1; i < n; i++) t = gcd(t, num[i]);\n\tprintf(\"%d\\n\", t * n);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "22e109f3286297b8d39de17e28e787ac", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \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\nint main()\n{\n int n,d,i,j,temp,min=200,ans=200;\n scanf(\"%d%d\",&n,&d);\n int a[n];\n for(i=0;id)\n {\n min=n-j+i;\n break;\n }\n min=n+i-j-1;\n }\n if(min\n#include \n#include \n\nvoid merge(int arr[], int l, int m, int r) {\n\tint i = 0; // Initial index of first subarray\n\tint j = 0; // Initial index of second subarray\n\tint k = l; // Initial index of merged subarray\n\tint n1 = m - l + 1;\n\tint n2 = r - m;\n\n\t/* create temp arrays */\n\tint L[n1], R[n2];\n\t\n\t/* copy data to temp arrays L[] and R[] */\n\tfor (int i = 0; i < n1; i++)\n\t\tL[i] = arr[l + i];\n\tfor (int j = 0; j < n2; j++)\n\t\tR[j] = arr[m + 1 + j];\n\t\n\t/* merge the temp arrays back into arr[l..r] */\n\twhile (i < n1 && j < n2) {\n\t\tif (L[i] <= R[j]) {\n\t\t\tarr[k] = L[i];\n\t\t\ti++;\n\t\t} else {\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[] || R[], if there are any */\n\twhile (i < n1) {\n\t\tarr[k] = L[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile (j < n2) {\n\t\tarr[k] = R[j];\n\t\tj++;\n\t\tk++;\n\t}\n}\n\nvoid mergeSort(int arr[], int l, int r) {\n\tif (l < r) {\n\t\tint 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\t\t\n\t\tmerge(arr, l, m, r);\n\t}\n}\n\n\nint main(void) {\n int n, d, min[10000];\n int k = 0; // for array min[]\n scanf(\"%d %d\", &n, &d);\n int a[n];\n for (int i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n \n mergeSort(a, 0, n - 1);\n \n if (d == 0 || (a[n - 1] - a[0] =< d) || n == 1) {\n printf(\"0\\n\");\n return 0;\n }\n\n for (int i = n - 1; i >= 0; i--) {\n for (int j = i; j >= 0; j--) {\n if (a[i] - a[j] == d) {\n min[k++] = (n - 1) - (i - j + 1);\n }\n }\n }\n\n mergeSort(min, 0, k - 1);\n \n printf(\"%d\\n\", min[0] + 1);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "19950f1608892b1bc63f077d1cf2ee86", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#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 < s) return -1;\n return 0;\n}\nint main()\n{\n int n,d;\n scanf(\"%d %d\",&n,&d);\n int points[n];\n for(int i=0;i0;i--)\n {\n if(points[i]-points[0]>d)\n c1++;\n else\n break;\n }\n for(int i=0;id)\n c2++;\n else\n break;\n }if(c1>c2)\n printf(\"%d\",c2);\n else\n printf(%d,c1);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c4d5e1cf9789273bd7fa25ca63831417", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\n\nint minNumPtsRemove(int n,int d,int *p)\n{\n int cumilativeCount[100 + d]= {};\n int pts=0,maxPts=0,i=0;\n for(i=0;imaxPts)\n {\n maxPts = pts;\n }\n } \n return n-maxPts;\n}\n\nint main()\n{\n\tint n,d;\n\tscanf(\"%d %d \",&n,&d);\n\tint p[n];\n\tfor(int i=0;i\n#include\n#include\nint arr[101];\nint n,dis;\nint min(int x,int y)\n{\n\treturn x\nusing namespace std;\nint main(){\n\tint s1(0),s2(0);\n\tchar st1[101],st2[101];\n\tscanf(\"%s%s\",st1,st2);\n\tstrlwr(st1);strlwr(st2);\n\tif(strcmp(st1,st2)<0)printf(\"-1\");else printf(\"%d\",strcmp(st1,st2)?1:0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6e729da9256fc13eda76b7b842befac0", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint c,x-0,y=00,e=0;\n\tchar str[100],str2[100];\n\tscanf(\"%s\", &x);\n\tscanf(\"%s\", &y);\n\tfor (c = 0; str[c] != 0 && str2[c] != 0; c++){\n\t\tif (str[c] - str2[c]>0 )x++;\n\t\telse if (str[c] - str2[c]<0)y++;\n\t\telse e++;\n\t}\n\tif (e = c - 1) printf(\"0\");\n\telse if (y>x) printf(\"-1\");\n\telse printf(\"1\");\n\treturn(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f60b3d4e936b5ca6fadf2c92097ee0c9", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\u007f#include\n#include\nint main(){\n int i,j,k,m,z1,z2;\n m=0;\n char a[101],b[101];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n k=strlen(a);\n int c[k];\n for(i=0;ib[i]){\n c[m]=1;\n m++;\n break;\n }\n else if(a[i]\n#include\nint main()\n{\n char a[200],b[200];\n // gets(a);\n //gets(b);\n strlwr(a);\n strlwr(b);\n //if(strcmp(a,b)<0)\n printf(\"-1\");\n else if(strcmp(a,b)>0)\n printf(\"1\");\n else printf(\"0\");\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c0fec36b09e91a7d1b4cf7316844687b", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tchar a[101],b[101];\n\tint i,temp=0;\n\tfor(i=0;ib[i])\n\t {\n\t temp=1;\n\t break;\n\t }\n\t else if(a[i]\n\nint main()\n{\n int a,b;\n int fact=1,fa=1;\n scanf(\"%d%d\",&a,&b);\n while(a>=1){\n fact=fact*a;\n a--;\n }\n while(b>=1){\n fa=fa*b;\n b--;\n } \n \n }\n while(fact!=fa)\n {\n if(fact>fa){\n fact-=fa;\n }else{\n fa-=fact;\n }\n }\n printf(\"%d\",fact);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e475b3e9deb8a7461789d2c4a68564e0", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main() {\n int arr[10001]={0};\n long int a = 0, n,m, temp1;\n scanf(\"%ld\", &n);\n scanf(\"%ld\",&m);\n arr[10000] = 1;\n if(n>m)\n n=m;\n for (long int i = 2; i <= n; i++) {\n a = 0;\n for (long int j = 10000; j >= 0; j--) {\n a = a + arr[j] * i;\n arr[j] = a % 10;\n a = a / 10;\n }\n }\n for (long int k = 0; k <= 10000; k++) {\n if (arr[k] != 0) {\n temp = k;\n break;\n }\n }\n for (long int k1 = temp; k1 <= 10000; k1++)\n printf(\"%d\", arr[k1]);\n printf(\"\\n\");\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7aa1e1c42f002c743c43d1505af13a5e", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n int main()\n {\n int i,num,j,g=1,num1;\n\n scanf(\"%d %d\",&num,&num1);\n\n int f=1;\n\n for(i=1; i<=num;i++)\n f=f*i;\n for(j=1; j<=num1;j++)\n g=g*j;\n\n if(f\nint main()\n{\n int a,b,f1=1,f2=1,i;\n scanf(\"%d %d\",&a,&b);\n for(i=a,j=b;i>0,j>0;i--,j--)\n {\n f1=f1*i;\n f2=f2*i;\n }\n if(f1\n#include\n#include\nusing namespace std;\nint main()\n{\n long long n,k;\n vector ans;\n cin>>n>>k;\n for(long long i=1;i<=sqrt(n);i++)\n {\n if(n%i==0)\n ans.push_back(i);\n if(n%i==0 && i*i!=n)\n ans.push_back(n/i);\n }\n if(ans.size()>=k)\n cout<\n#include\n\nmain(){\nlong long n=4,k=4,c=0,i,arr[1000000];\n\narr[0]=-1;\n\nscanf(\"%I64d %I64d\",&n,&k);\n\n\n\tif (n\n#include\n\nconst int N = 100005;\n\nlong long v[N];\n\nint f (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main(){\n\tlong long n, k, i, count = 0;\n\tscanf(\"%lld %lld\",&n,&k);\n\tfor(i = 1; i*i<=n; i++){\n\t\tif(n%i == 0){\n\t\t\tv[count] = i;\n\t\t\tcount++;\n\t\t\tif(n/i != i){\n\t\t\t\tv[count] = n/i;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tqsort(v,count,sizeof (long long),f);\n\tif(k > count) puts(\"-1\");\n\telse printf(\"%lld\\n\",v[k-1]);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f519e89badb3505c3d5f526b1b306404", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nvoid f(long long n, long long k)\n{\n\tfor(long long i=1; i<=sqrt(n); ++i)\n\t{\n\t\tif(n%i==0)\n\t\t\t--k;\n\t\tif(k==0)\n\t\t{\n\t\t\tprintf(\"%I64d\", i);\n\t\t\treturn;\n\t\t}\n\t}\n\tfor(long long i=sqrt(n)+1; i>0; --i)\n\t{\n\t\tif(n%i==0)\n\t\t\t--k;\n\t\tif(k==0)\n\t\t{\n\t\t\tprintf(\"%I64d\", n/i);\n\t\t\treturn;\n\t\t}\n\t}\n\t\tprintf(\"-1\");\n\t}\n}\n\nint main()\n{\n\tlong long n, k;\n\tscanf(\"%I64d%I64d\", &n, &k);\n\tf(n, k);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0418193f1b0b73b6365ccfd9d922c397", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nconst int N = 100005;\n\nlong long v[N];\n\nint f (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main(){\n\tlong long n, k, i, count = 0;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tfor(i = 1; i*i<=n; i++){\n\t\tif(n%i == 0){\n\t\t\tv[count] = i;\n\t\t\tcount++;\n\t\t\tif(n/i != i){\n\t\t\t\tv[count] = n/i;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tqsort(v,count,sizeof (long long),f);\n\tif(k > count) puts(\"-1\");\n\telse printf(\"%lld\\n\",v[k-1]);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e719f4a40b6bca0bb59981df5475a03c", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int a,b,diff;\n scanf(\"%d %d\",&a,&b);\n diff=a-b;\n if(diff==1||diff==0||diff=-1)\n printf(\"yes\");\n else\n printf(\"no\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "24808421538a0ab0dffe31ba644ac927", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main ()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b||a==(b-1))\n printf(\"yes\");\n elseif(a==b==0||a>=101||b>=101)\n printf(\"no\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c48643b25ac1da76f7653c6039d0e0c", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int a,b,diff;\n scanf(\"%d %d\",&a,&b);\n diff=a-b;\n if(a==0&&b==0)\n printf(\"no\");\n else if(diff==1||diff==0||diff=-1)\n printf(\"yes\");\n else\n printf(\"no\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6779658a75c0d5de0d2b6a426ac42cfb", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a,b;\nscanf(\"%d %d\",&a,&b);\nif(a==0 && b==0)\n\t{printf(\"NO\");\nelse if(a-b==1)\n\t{printf(\"YES\");}\nelse if(a-b==-1)\n\t{printf(\"YES\");}\nelse if(a!=0 && b!=0 && a-b==0)\n\t{printf(\"YES\");}\nelse\n\t{printf(\"NO\");}\nreturn 0;\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "36dc8ac9bae66e3c766ea38dc46da687", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n int n,m;\n cin>>n>>m;\n long long s=n;\n while(n>=m)\n {\n s+=n/m;\n n=n/m+n%m;\n }\n cout<\n#include \nint main(){\n\tint n, m, i, j;\n\twhile(~scanf(\"%d%d\", &n, &m)!=EOF){\n\t\ti = m*n/(m-1);\n\t\tj=i-1;\n\t\tif(j-n = j/n)\n\t\t\ti = j\n\t\tprintf(\"%d\\n\", i);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4718ddf46d1f646343c47247a32d6d27", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n//\nint n,m,daysCnt=0,i,NewSocs,remindDays;\nscanf(\"%i%i\",&n,&m);\n\n daysCnt=n;\n NewSocs=n/m;\n remindDays=n%m;\n daysCnt= daysCnt+NewSocs;\n\n\n while (NewSocs%n!=0)\n {\n NewSocs=(remindDays+NewSocs)/m;\n remindDays=(remindDays+NewSocs)%m;\n daysCnt= daysCnt+NewSocs;\n }\n\n printf(\"%i\",daysCnt);(\"%i\",daysCnt);", "lang_cluster": "C", "compilation_error": true, "code_uid": "d038a7a097b46c517b35943e02e41dba", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "GNU C11", "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\n\nint main()\n{\n int n, m, div, mod;\n sf(\"%d%d\", &n, &m);\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\", sum);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9e38f6e4b6d819d8a94b3e9072111c85", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main() {\n int n, i, a, b, r, c, d, j;\n scanf(\"%d %d %d\", &n, &a, &b);\n r=log2(n);\n c=n/2;\n d=c;\n i=1;\n j=n;\n d=n;\n while(ic && b>c){\n r=r-1;\n c=n-((n-c)/2);\n if(a<=c && b<=c){\n n=4*c-n;\n }\n else{\n continue;\n }\n }\n else{\n break;\n }\n i=i+1;\n }\n\n if(r==log2(j)){\n printf(\"Final!\");\n }\n else{\n printf(\"%d\", r);\n }\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "99bb9cd29af171d6667bf941df4fcc58", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n , a ,b;\n int diva = 0;\n int divb = 0;\n int totalmatches=0;\n int counter=1;\n\n scanf(\"%d %d %d\" , &n , &a , &b);\n if( ((b > n/2) || (a > n/2)) && ( (b <= n/2) || (a <= n/2)) )\n {\n printf(\"Final!\");\n return 0;\n }\n int temp=n;\n while(temp!=1)\n {\n temp = temp/2;\n totalmatches++;\n }\n totalmatches--;\n if(a%2!=0)\n a = (a+1);\n if(b%2!=0)\n b = (b+1);\n while(1)\n {\n if(a > n/2)\n {\n n=n/2;\n a=a-n;\n b=b-n;\n }\n else\n n=n/2;\n if( ((b > n/2) || (a > n/2)) && ( (b <= n/2) || (a <= n/2)) )\n {\n printf(\"%d\" , totalmatches);\n return 0;\n }\n totalmatches--;\n }\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a07400f7cf5805115995aaa2948df139", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\nint n,o=0,x,y,v,cnt=0,f=0,a,p=1;\n\nscanf(\"%d%d%d\",&n,&x,&y);\nwhile(p<=n){\np=p*2;f++;\n}\nif(y>x){a=x;x=y;y=a;}\nwhile(cnt!=f-1){\n v=(n+o)/2;\n if((x>v && y<=v)){\n break;\n }\n if(x<=v){\n n=n/2;\n }else if(y>v){\n o=n/2;\n }\n cnt++;\n}\nif(cnt==0){\n printf(\"Final!\");\n}else{\nprintf(\"%d\",f-cnt-1);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c8b8518b676a89888e1829dbc13807b8", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define MAX 100005\n/*\nvoid swap(int *a,int *b){\n\tint t = *a;\t*a = *b;\t*b = t;\n}\n\nint main(){\n\tint a ,b;\n\tscanf(\"%d %d\" ,&a ,&b);\n\tif(a > b)\tswap(&a ,&b);\n\tif((b - a) % 2 == 0)\t{\n\t\tint x = (b - a) / 2;\n\t\tprintf(\"%I64d\" ,1LL*x * (x + 1));\n\t}else {\n\t\tint x = (b - a) / 2;\n\t\tint y = x + 1;\n\t\tprintf(\"%I64d\" ,1LL * x * (x + 1) / 2 + 1LL * y * (y + 1) / 2);\n\t}\n\treturn 0;\n}*/\n\nint a[257];\nvoid printArray(int a[],int n){\n\tfor(int i = 1 ; i <= n ; i++)\tprintf(\"%d \" ,a[i]);\tprintf(\"\\n\");\n}\nint main(){\n\tint n ,A ,B;\n\tscanf(\"%d %d %d\" ,&n ,&A ,&B);\n\tfor(int i = 1 ; i <= n ; i++)\ta[i] = i;\n\tint p = n ,r = 0 ,j = 1; \n\tint f = 0;\n\tif(A > B)\tswap(&A ,&B);\n\twhile(p > 1){\n\t\tprintArray(a ,n);\n\t\tr++;\tj = 1;\n\t\tfor(int i = 1 ; i <= n ; i+=2){\n\t\t\tif(a[i] == A && a[i + 1] == B){\n\t\t\t\tf = 1;\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tif(a[i] == A || a[i + 1] == A)\ta[j++] = A;\n\t\t\t\telse if(a[i] == B || a[i + 1] == B)\ta[j++] = B;\n\t\t\t\telse a[j++] = a[i];\n\t\t\t}\n\t\t}\n\t\tif(f)\tbreak;\n\t\tp /= 2;\tn/=2;\n\t\t\n\t}\n\tif(p == 2)\tputs(\"Final\");\n\telse printf(\"%d\" ,r);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cab619c725dd218b749771a9ce60844a", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tlong long int n,a,b;\n\tscanf(\"%lld %lld %lld\",&n,&a,&b);\n\tif(a>b)\n\t{\n\t\tlong long int swap=a;\n\t\ta=b;\n\t\tb=swap;\n\t}\n\tlong long int round=1;\n\twhile(n>2)\n\t{\n\t\tif(b==a+1)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",round);\n\t\t\treturn 0;\n\t\t}\n\t\ta=(a+1)/2;\n\t\tb=(b+1)/2;\n\t\t++round;\n\t\tn/=2;\n\t}\n\tprintf(\"Final!\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bf72ba3897a0fd983ce94c062a5fbc68", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\n\nint main()\n{\n long long int x,y,c;\n\n scanf(\"%lld %lld\",&x,&y);\n c=y-1;\n if(y==0 || C==0 || (x-c)<0) printf(\"No\\n\");\n else{\n\n if((x-c)%2==0) printf(\"Yes\\n\");\n\n else printf(\"No\\n\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb29d83c3404c88821ff91fb912174c4", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nusing namespace std;\n\nint main(void) {\n\tint x, y;\n\tscanf(\"%d%d\", &x,&y);\n\t(x - y + 1) % 2 == 0 ? printf(\"YES\") : printf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b621df99e8673b9f74d49f45f15cfe8e", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid f(int*,int*);\nbool g(int,int);\nmain()\n{\n\tint x,y;\n\tdo{\n\t\tscanf(\"%d %d\",&x,&y);\n\t}while (x<0 && x>(int)pow(10,9) && y<0 && y>(int)pow(10,9));\n\tif (g(x,y)) printf(\"Yes\");\n\telse printf(\"No\");\n\n}\n\n\nvoid f(int* x,int* y){\n\t*x=*x+1;\n\t*y=*y+1;\n}\n\nbool g(int x,int y){\n\tint i,j,x0=0,y0=1;\n\tfor (i=1;i\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n if(n==0 || k==0 || k-1>x){\n printf(\"No\\n\");\n }\n else if((k-1)%2==0){\n printf(\"Yes\\n\");\n }\n else{\n printf(\"No\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c4eeee3b3c5684342cdd9db21400f181", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint x,y;\nwhile(~scanf(\"%d %d\",&x,&y))\n{\n if(y==1&&x>0||y==0)\n printf(\"No\\n\");\n else\n {\n int t=y-1;\n if((x-t)%2==0&&x-t>=0)\n {\n printf(\"Yes\\n\");\n }\n else\n printf(\"No\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0654c181eb2ae73c0d86187807899d7c", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int maxi=-1;\n while(n--)\n {\n int temp;\n scanf(\"%d\",&temp);\n \n if(k%temp==0 && temp>maxi)\n {\n maxi=temp;\n }\n }\n \n printf(\"%d\\n\",k/maxi);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1d2436a44f7582c6821b93f92c5fd2ae", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{ int n,m,i,b[100],x,p=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n for(i=0;i\n#include \nint main() {\n int n, k;\n int* bucket;\n int i, input;\n int choose=0;\n scanf_s(\"%d %d\", &n, &k);\n bucket = (int*)malloc(sizeof(int) * n);\n for (i = 0; i < n; i++) {\n scanf_s(\"%d\", &input);\n bucket[i] = input;\n }\n for (i = 0; i < n; i++) {\n if (k % bucket[i]==0) {\n if (bucket[i] > choose) {\n choose = bucket[i];\n }\n }\n }\n printf(\"%d\", k / choose);\n free(bucket);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5a40fb14976ef92129381fec9d239a79", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint a, b, c, d,m,n,o,p,i,j,k,l, first[10][10], second[10][10], multiply[10][10], sum=0;\n\tprintf(\"please enter the row and column number of First matrix: \\n\");\n\tscanf_s(\"%d %d\", &m, &n);\n\tprintf(\"please enter value First matrix: \\n\");\n\n\tfor (i = 0; i < m; i++)\n\t{\n\t\tfor (j = 0; j < n; j++)\n\t\t{\n\t\t\tscanf_s(\"%d\",&first[i][j]);\n\t\t}\n\t}\n\tXXX: printf(\"please enter the row and column number of Second matrix: \\n\");\n\tscanf_s(\"%d %d\", &o, &p);\n\tif (n != o)\n\t{\n\t\tprintf(\"does not follow the matrix rules of 1st matrics column equal to 2nd metrics row\\n\");\n\t\tgoto XXX;\n\n\t}\n\telse \n\t{\n\t\tprintf(\"please enter value Second matrix: \\n\");\n\n\t\tfor (k = 0; k < o; k++)\n\t\t{\n\t\t\tfor (l = 0; l < p; l++)\n\t\t\t{\n\t\t\t\tscanf_s(\"%d\",&second[k][l]);\n\t\t\t}\n\t\t}\n\t}\n\tfor (a = 0; a < m; a++)\n\t{\n\t\tfor (b = 0; b < p; b++)\n\t\t{\n\t\t\tfor (c = 0; c < n; c++)\n\t\t\t{\n\t\t\t\tsum = sum + first[a][c] * second[c][b];\n\t\t\t}\n\t\t\tmultiply[a][b] = sum;\n\t\t\tsum = 0;\n\t\t}\n\t}\n\tprintf(\"The result matrix is: \\n\");\n\n\tfor (a = 0; a < m; a++)\n\t{\n\t\tfor (b = 0; b < p; b++)\n\t\t{\n\t\t\tprintf(\"%d\\t\", multiply[a][b]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0fe1d88839891c8e6e0946d4058b52ee", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#includ\n\nvoid main()\n{\n int max=1;\n int x,y;\n int tab[100]\n \n scanf(\"%d\"&x);\n scanf(\"%d\"&y);\n for(int i=0;imax)\n max=tab[i];\n \n }\n printf(\"%d\"y/x);\n \n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3319421a3b4f4c80b77a28910ce617bc", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nchar board[8][8];\nint rows,columns;\nint main{\n rows=0;\n columns=0;\n int i=-1,j=-1;\n for(;++i<8;scanf(\"%s\", board[i]));\n for(i=-1;++i<8;){\n int a=1;\n for(j=-1;++j<8;) if(board[i][j] == 'W')a=0;\n if(a) rows++;\n }\n for(i=-1;++i<8;){\n int a=1;\n for(j=-1;++j<8;) if(board[j][i] == 'W')a=0;\n if(a) columns++;\n }\n printf(\"%d\", (columns>rows?columns:rows)<8?columns+rows:8);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fcdf4648b44dc359a448ca7dbd233d4f", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int r=8,c=8,count=0,i,j;\n char a[100];\n for(int i=0;i\n#include \n\nbool board[8][8];\nbool newBoard[8][8];\n\nint main() {\n char buf[9];\n for(int i = 0; i < 8; i++) {\n scanf(\"%s\", buf);\n for(int j = 0; j < 8; j++) {\n if(buf[j] == 'B')\n board[i][j] = true;\n }\n }\n \n int total = 0;\n for(int i = 0; i < 8; i++) {\n int cnt = 0;\n for(int j = 0; j < 8; j++) {\n if(boar[i][j]) {\n cnt++;\n \n \n }\n }\n if(cnt == 8) {\n total++;\n for(int k = 0; k < 8; k++) {\n newBoard[i][k] = true;\n }\n \n }\n }\n for(int j = 0; j < 8; j++) {\n for(int i = 0; i < 8; i++) {\n if(board[i][j] != newBoard[i][j]) {\n total++;\n break;\n }\n }\n }\n printf(\"%d\", total);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a277b72602bd032810637e34a0d32a35", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nchar board[8][8];\nint rows,columns;\nint main{\n rows=0;\n columns=0;\n int i=0,j=0;\n for(i=0;i<8;scanf(\"%s\", board[i]), i++);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b837168c81751ec2274843c1c4d02417", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "\n#include \nchar t[9][9] , lin[9];\nint n = 8, i , j, alb,count = 0;\nint main()\n{\nfor(i = 1; i <= n; i++)\n{\n scanf(\"%s\",&lin);\n for(j = 1; j <=n;j++)\n {\n t[i][j] = lin[j-1];\n }\n}\nfor(i = 1; i <= n; i++)\n{\n alb = 0;\n for(j = 1; j <= n; j++)\n {\n if(t[i][j] == 'W') alb++;\n }\n if(alb == 0)count++;\n}\nfor(j = 1; j <= n; j++)\n{\n alb = 0;\n for(i = 1; i <= n; i++)\n {\n if(t[i][j] == 'W') alb++;\n }\n if(alb == 0)count++;\n}\nif(count < 2*n)\n{\nprintf(\"%d\",count);\n{else{\n printf(\"%d\",count/2);\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0d2c56077babad1701fdc63f1e2f804f", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n_int64 a[120];\nmain()\n{\n\t_int64 n,m,i,last;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%I64d\",&a[i]);\n\tfor(i=1,last=0;i<=n;i++)\n\t{\n\t\tif(a[i]>m)\n\t\t{\n\t\t\tlast=i;\n\t\t}\n\t}\n\tif(last==0)\n\t\tlast=n;\n\tprintf(\"%I64d\\n\",last);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "733f383cd930fae446dadd574a9cebed", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nint main (void)\n{\n\tint n, m, max, temp, last;\n\tscanf(\"%d %d\", &n, &m);\n\tfor(int i = 0; i < n; i ++)\n\t{\n\t\tscanf(\"%d\", &temp);\n\t\ttemp = temp / m + (temp % m != 0 ? 1 : 0);\n\t\tif(temp >= max){ \n\t\t\tmax = temp;\n\t\t\tlast = i;\n\t\t}\n\t}\n\tprintf(\"%d\", last + 1);\n\treturn 0;\n}\n\n\n\t\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "041204bed123e0e64a2461168836861c", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,m,loc=0,i,x;\n scanf(\"%d%d\",&n,&m);\n int a[n];\n for(i=0;imax)\n max=a[i];\n }\n x=max/m+1;\n while(x--)\n {\n for(i=0;i0)\n {\n a[i]-=m;\n loc=i;\n }\n }\n printf(\"%d\",loc+1);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b9829155a928114f55be341b83cc874", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n\tint n,m,child,a,i,max;\n\tscanf(\"%d %d\",&n,&m);\n\tint arr[n];\n\tchild=n;\n\tfor(i=0;imax)\n\t\t{\n\t\t\tmax=a;\n\t\t\tchild=i+1;\n\t\t}\n\t}\n\tprintf(\"%d\",child);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8ced37c104c57a3e467ad46e40bb9ae2", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "A. Jzzhu and Children\ntime limit per test1 second\nmemory limit per test256 megabytes\ninputstandard input\noutputstandard output\nThere are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.\n\nJzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:\n\nGive m candies to the first child of the line.\nIf this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.\nRepeat the first two steps while the line is not empty.\nConsider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?\n\nInput\nThe first line contains two integers n,\u2009m (1\u2009\u2264\u2009n\u2009\u2264\u2009100; 1\u2009\u2264\u2009m\u2009\u2264\u2009100). The second line contains n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).\n\nOutput\nOutput a single integer, representing the number of the last child.\n\nExamples\ninputCopy\n5 2\n1 3 1 4 2\noutputCopy\n4\ninputCopy\n6 4\n1 1 2 2 3 3\noutputCopy\n6\nNote\nLet's consider the first sample.\n\nFirstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.\n\nChild 4 is the last one who goes home.", "lang_cluster": "C", "compilation_error": true, "code_uid": "8c1d626f8f2cc240e5c6fab01ed94eab", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2d5b0fa07b7f7e12c2f26b403bcdde1", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nunsigned long long int A(unsigned long long int a)\n{\n\tunsigned long 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\tunsigned long long a, b;\n\n\tcin >> a >> b;\n\tif (A(a + b) == A(a) + A(b))\n\t\tcout << \"YES\" << endl;\n\telse\n\t\tcout << \"NO\" << endl;\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f77b3028aa5dd6d3546cb1af343c5f66", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main() {\n /*two integers read into a char array!*/\n char a[10];\n char b[10];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n int na=strlen(a);\n int nb=strlen(b);\n int i,j,k;\n for(k=0;knb) {\n i=na-1;\n j=nb-1;\n } else {\n i=nb-1;\n j=na-1;\n }\n \n while(1) {\n /*\u6ca1\u6709\u8fdb\u4f4d\u5c31\u53ef\u4ee5\u4fdd\u8bc1\u76f8\u540c\uff0c\u8fd9\u662f\u5728\u6709\u96f6\u7684\u60c5\u51b5\u4e0b\u6210\u7acb*/\n if(a[i]+b[j]>=10){\n more10=1;\n if(j==0) { last_more10=1; break; }\n else a[i-1]+=(a[i]+b[j])/10;\n }\n i--;\n j--;\n }\n\n if(find_zero) {\n if(more10) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }else {\n if(last_more10) {\n printf(\"NO\\n\");\n } else printf(\"YES\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1aa35c74a9284566f3ae4f9d6e876161", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n long a, b, n1, m1, n2, m2, a1, b1, t=0;\n scanf(\"%ld\",&a);\n scanf(\"%ld\",&b);\n a1=a;\n b1=b;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2acb1b43a8683d3adbebd456046a1853", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0} {"lang": "GNU C11", "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,u;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a40fb6c194203cf078c805ddd56784c9", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{ \n int n,p=0;\n char s[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(j=0;s[j]!='\\0';j++)\n {\n if(s[j]='x'&&s[j+1]=='x'&&s[j+2]=='x')\n {\n p=p+1;\n }\n }\n printf(\"%d\",p);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2da715af023d9610e87663e003c28e2f", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint i,k,j,temp,net=0,n;char s[120];int a[120]={0},b[20]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<=n;i++)\n\tscanf(\"%c\",&s[i]);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tj=i;\n\t\twhile (j<=n)\n\t\t{\n\t\t\tif (s[i]==s[j] && s[j]=='x')\n\t\t\t{\n\t\t\t\ta[i]++;j++;\n\t\t\t}\n\t\t\telse\n\t\t\tbreak;\n\t\t}\n\t}k=1;\n\tfor(j=1;j<=n-1;j++)\n\t{\n\t\tfor(i=1;i<=n-1;i++)\n\t\tif (a[i]>a[i+1])\n\t\t{\n\t\t\ttemp=a[i];a[i]=a[i+1];a[i+1]=temp;\n\t\t}\n\t}k=1;\n\tfor(j=1;j<=n;j++)\n\t{\n\t\tprintf(\"\\n%d\",a[j]);\n\t\tif (a[j]>2)\n\t\tnet++;\n\t}\n\t\n\t{\n\tprintf(\"0\");\n }\n else\n printf(\"%d\",net);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "aeee35e5deb81229bcf8e75d44f75e48", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0} {"lang": "GNU C", "source_code": "include\n#include\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int sum=0;\n int c=0;\n char str[101];\n scanf(\"%s\",&str);\n for(i=0;i=3)\n {\n sum++;\n }\n }\n else\n {\n c=0;\n continue;\n }\n }\n printf(\"%d\",sum);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "22a109c7fe4ee7db93fe9364b02ce9fc", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint tmp,l,co=0,d,co1=0;\n\tchar ch;\n\tscanf(\"%d\\n\",&l);\n\ttmp=l;\n\tfor(int i=0;i=3)\n\t\t{\n\t\t\tco1++;;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\",co1);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a004a35849e77035a6ba4a42cce3f895", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n\tint n,c=0;\n\tscanf(\"%d\",&x);\n\tchar s[n];\n\tscanf(\"%s\",s);\n\tfor(int i=0;i<=(n);i++ ){\n\t\tif(s[i]=='x'&&s[i+1]=='x'&&s[i+2]=='x'){\n\t\t\tc=c+1;\n\t\t}\n\t}\n\tprintf(\"%d\",c);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1dab5c08ea4a5bc2367032fd913ffb50", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main()\n{\nint a,b,c1,c2;\nscanf(\"%d%d\",&a,&b);\nint c,d,e,f,g,h;\nc=d=e=f=g=h=0;\nwhile(a!=0)\n{\nif(a%2==0)\n{\nc++;\na=a/2;\n}\nelse if(a%3==0)\n{\nd++;\na=a/3;\n}\nelse if(a%5==0)\n{\ne++;\na=a/5;\n}\nelse\n{\nc1=a;\nbreak;\n}\n}\nwhile(b!=0)\n{\nif(b%2==0)\n{\nf++;\nb=b/2;\n}\nelse if(b%3==0)\n{\ng++;\nb=b/3;\n}\nelse if(b%5==0)\n{\nh++;\nb=b/5;\n}\nelse\n{\nc2=b;\nbreak;\n}\n}\nif(c1!=c2)\nprintf(\"-1\\n\");\nelse\n{\nint ans=abs(c-f)+abs(d-g)+abs(e-h);\nprintf(\"%d\\n\",ans);\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "de0ee7bbef6368a71dba3164b7081cf9", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nlong long gcd(long long a,long long b)\n{\n\tif(b==0)\n\treturn a;\n\telse\n\treturn gcd(b,a%b);\n}\nlong long maxi(long long a,long long b)\n{\n\tif(a>b)\n\treturn a;\n\telse\n\treturn b;\n}\nint main()\n{\n\tlong long a,b,x,y,z,c1=0,c2=0;\n\tint f=0;\n\tscanf(\"%lld%lld\",&a,&b);\n\tx=gcd(a,b);\n\ty=a/x;\n\tz=b/x;\n\twhile(y!=1)\n\t{\n\t\tif(y%2!=0&&y%5!=0&&y%3!=0)\n\t\t{\n\t\t\t//printf(\"A %d\\n\",y);\n\t\t\tf=1;\n\t\t\tbreak;\n\t\t}\n\t\tif(y%2==0)\n\t\t{\n\t\t\tc1++;\n\t\t\ty=y/2;\n\t\t}\n\t\tif(y%3==0)\n\t\t{\n\t\t\tc1++;\n\t\t\ty=y/3;\n\t\t}\n\t\tif(y%5==0)\n\t\t{\n\t\t\tc1++;\n\t\t\ty=y/5;\n\t\t}\n\t}\n\twhile(z!=1)\n\t{\n\t\tif(z%2!=0&&z%5!=0&&z%3!=0)\n\t\t{\n\t\t\tf=1;\n\t\t\tbreak;\n\t\t}\n\t\tif(z%2==0)\n\t\t{\n\t\t\tc1++;\n\t\t\tz=z/2;\n\t\t}\n\t\tif(z%3==0)\n\t\t{\n\t\t\tc1++;\n\t\t\tz=z/3;\n\t\t}\n\t\tif(z%5==0)\n\t\t{\n\t\t\tc1++;\n\t\t\tz=z/5;\n\t\t}\n\t}\n\tif(f==1)\n\tprintf(\"-1\\n\");\n\telse\n\tprintf(\"%lld\\n\",c1);\n\tretrun 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f92049aa87a9544aac1c23d3627a2b7d", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "int oeration(int a, int b)\n{\n int op=0 ; \n int a1=-1 , a2=-1;\n if(a==b)\n {\n return 0;\n }\n while(a!=b)\n {\n if(a>b)\n {\n if(!(a%2))\n {\n a/=2;\n op++;\n }\n else if(!(a%3))\n {\n a/=3;\n op++;\n }\n else if(!(a%5))\n {\n a/=5;\n op++;\n }\n else\n {\n a1=1;\n }\n }\n if(a\n#include \n\nlong long int GCD(long long int p, long long int q)\n{\n if (p%q == 0) return q;\n return GCD(q, p%q);\n}\n\nint main()\n{\n long long int a, b, steps = 0, c, x=0;\n scanf_s(\"%lld %lld\", &a, &b);\n\n if (a == b) { printf(\"0\"); _getch(); return 0; }\n\n c = GCD(a, b);\n while (a != c){\n if (a % 2 == 0 && (a / 2) % c == 0) a /= 2;\n else if (a % 3 == 0 && (a / 3) % c == 0) a /= 3;\n else if (a % 5 == 0 && (a / 5) % c == 0) a /= 5;\n else { x=1; break; }\n steps++;\n }\n \n if (x) { printf(\"-1\"); _getch(); return 0; }\n else {\n while (b != c){\n if (b % 2 == 0 && (b / 2) % c == 0) b /= 2;\n else if (b % 3 == 0 && (b / 3) % c == 0) b /= 3;\n else if (b % 5 == 0 && (b / 5) % c == 0) b /= 5;\n else { x = 1; break; }\n steps++;\n }\n }\n\n if (x) { printf(\"-1\"); _getch(); return 0; }\n else printf(\"%lld\", steps);\n _getch();\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f0e13dc67ef1db6c9980bc017b0f3f86", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint gcd(int a, int b){\n while((a%=b)&&(b%=a));\n return a+b;\n}\nint main(){\n int a,b,tmp,cnt=0;\n scanf(\"%d%d\",&a,&b);\n tmp=gcd(a,b);\n a/=tmp,b/=tmp;\n while(!(a%2))a/=2,cnt++;\n while(!(b%2))b/=2,cnt++;\n while(!(a%3))a/=3,cnt++;\n while(!(b%3))a/=3,cnt++;\n while(!(a%5))a/=5,cnt++;\n while(!(a%5))a/=5,cnt++;\n if(a+b>2)puts(\"-1\");\n else printf(\"%d\",cnt);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e5ceaa9b4169a0b4ee56a42743d61a6d", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,a,b,c;\n scanf(\"%d %d %d %d\"&n,&a,&b,&c);\n int i=0,j=0,temp=0,flag=0;\n for(i=0;i<=n;i++)\n {\n for(j=0;j<=n;j++)\n {\n if(i*a+j*b<=n)\n {\n if((n(i*a+j*b))%c==0)\n {\n flag=i+j+(n-(i*a+j*b))/c;\n if(flag>temp && flag!=0)\n {\n temp=flag;\n }\n }\n }\n }\n }\n printf(\"%d\",temp);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c955e640aae6ca4a2b35cb19ba0935b", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n \nint main(void) \n{\nint n,a,b;\nscanf(\"%d %d %d %d\", &n, &a, &b, &c);\nint x = n/a;\nint y = n/b;\nint k;\nint max = 0;\nint temp;\nfor (int i =0; i <= x; i++)\n{\nfor (int j = 0; j <= y; j++)\n{\nk = (n -a*i - b*j) / c;\nif (a*i + b*j + k*c == n && k >= 0)\n{\ntemp = i + j +k;\nif (temp > max)\n{\nmax = temp;\n}\n}\n}\nprintf(\"%d\", max);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f4068f305e4b63af6bdd82e5f86b80ae", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,a,b,c;\n scanf(\"%d %d %d %d,&n,&a,&b,&c\");\n int i=0,j=0,temp=0,flag=0;\n for(i=0;i<=n;i++){\n for(j=0;j<=n;j++){\n if(i*a+j*b<=n){\n if((n-(i*a+j*b))%c==0){\n flag = i+j+(n-(i*a+j*b))/c;\n if(flag>temp&&flag!=0){\n temp=flag;\n }\n }\n }\n }\n }\n printf(%d,temp);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dd0bc152f153c355020c785c405879a9", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n int n, a, b, c;\n scanf(\"%d\", &n);\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n scanf(\"%d\", &c);\n\n // cout << a << b << c << std::endl;\n\n std::vector pieces;\n pieces.resize(n + 1, 0);\n pieces[a] = 1;\n pieces[b] = 1;\n pieces[c] = 1;\n for (int i = 0; i <= n; i++)\n {\n // if (i < a && i < b && i < c) continue;\n\n if (i - a >= 0 && pieces[i - a] != 0)\n pieces[i] = std::max(pieces[i], pieces[i - a] + 1);\n if (i - b >= 0 && pieces[i - b] != 0)\n pieces[i] = std::max(pieces[i], pieces[i - b] + 1);\n if (i - c >= 0 && pieces[i - c] != 0)\n pieces[i] = std::max(pieces[i], pieces[i - c] + 1);\n\n for (int i = 0; i <= n; i++)\n {\n std::cout << pieces[i] << \" \";\n }\n std::cout << std::endl;\n }\n // std::cout << pieces[n] << std::endl;\n printf(\"%d\", pieces[n]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7bc2d39fe6558e688fc0f5e84e4490dc", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n//#include \n#include \nusing namespace std;\n\nint main()\n{\n int n, a, b, c;\n scanf(\"%d\", &n);\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n scanf(\"%d\", &c);\n\n // cout << a << b << c << std::endl;\n\n std::vector pieces;\n pieces.resize(n + 1, 0);\n pieces[a] = 1;\n pieces[b] = 1;\n pieces[c] = 1;\n for (int i = 0; i <= n; i++)\n {\n // if (i < a && i < b && i < c) continue;\n\n if (i - a >= 0 && pieces[i - a] != 0)\n pieces[i] = std::max(pieces[i], pieces[i - a] + 1);\n if (i - b >= 0 && pieces[i - b] != 0)\n pieces[i] = std::max(pieces[i], pieces[i - b] + 1);\n if (i - c >= 0 && pieces[i - c] != 0)\n pieces[i] = std::max(pieces[i], pieces[i - c] + 1);\n\n /*\n for (int i = 0; i <= n; i++)\n {\n std::cout << pieces[i] << \" \";\n }\n std::cout << std::endl;\n */\n }\n // std::cout << pieces[n] << std::endl;\n printf(\"%d\", pieces[n]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f7386cf47c5b8ca987d99a3a4ae37f77", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n\n char ch[3];\n gets(ch);\n\n if((ch[1]== '8')||(ch[1]=='1'))\n {\n if((ch[0] =='a')||(ch[0] =='h'))\n {\n printf(\"3\");\n }\n else\n {\n printf(\"5\");\n }\n\n }\n else if((ch[0] =='a')||(ch[0] =='h'))\n printf(\"5\");\n else printf(\"8\");\n \n\n }\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5b246e92a408f0a97c578ab2164f8447", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char a[10];\n scanf(\"%s\",a);\n if(((a[0]=='a' || a[0]=='h')&& a[1]=='1')|| ((a[0]=='a' || a[0]=='h') && a[1]=='8')) || a==\"h8\"))\n {\n printf(\"3\");\n }\n else if((a[0]>=98 && a[0]<=103 && a[1]==1) || (a[0]>=98 && a[0]<=103 && a[1]==8))\n printf(\"5\");\n else\n printf(\"8\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ea095da4d810c3b595b18769426dad05", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char a[10];\n scanf(\"%s\",a);\n if(a==\"a1' || a==\"h1\" || a==\"a8\" || a==\"h8\")\n printf(\"3\");\n else if((a[0]>=98 && a[0]<=103 && a[1]==1) || (a[0]>=98 && a[0]<=103 && a[1]==8))\n printf(\"5\");\n else\n printf(\"8\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "02bf84254e997a8c74a7ddadaf40bf63", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char x,y;\n if(x=='a'||x=='h'&&y=='8'||y=='1')\n printf(\"3\");\n else if((x=='a'||x=='h'||y=='8'||y=='1')\n printf(\"5\");\n else\n printf(\"8\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ba13661cdbdd755af655115fce04036e", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "GNU C", "source_code": "include\n#include\nint main()\n{\nchar K[2];\nscanf(\"%s\",K);\nif(K[0]>='b' && K[0]<='g' && K[1]>='2' && K[1]<='7')\n{\nprintf(\"8\\n\");\n}\nelse if(((K[0]=='a' || K[0]=='h') && K[1]>='2' && K[1]<='7') || ((K[1]=='1' || K[1]=='8') && K[0]>='b' && K[0]<='g'))\n{\nprintf(\"5\\n\");\n}\nelse\n{\nprintf(\"3\\n\");\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bfece4560c2e0f4e6ec33285c2273fb6", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint a,b,n;\n\tscanf(\"%d%d%d\",&a,&b,&n);\n\tint i,j,count;\n\tcount=0;\n\twhile(n>=0)\n\t{\n\t\tcount++;\n\t\tif(count%2!=0)\n\t\t{\n\t\t\tif(a>n){for(j=n;j>=1;j--)if((a%j==0)&&(n%j==0))i=j;}\n\t\t\telse {for(j=1;j<=a;j++)if((a%j==0)&&(n%j==0))i=j;}\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(b>n){for(j=1;j<=n;j++)if((b%j==0)&&(n%j==0))i=j;}\n\t\t\telse {for(j=1;j<=b;j++)if((b%j==0)&&(n%j==0))i=j;}\t\n\t\t}\n\t\tn=n-i;\n\t}\n\tprintf(\"%d\",count%2);\n\treturn 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "980e6cfc9fb0761c6283c54f7501afbd", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n \nint gcd(int m, int n)\n{\n int r;\n while ((r = m % n) != 0)\n {\n m = n;\n n = r;\n }\n return n;\n}\n \nint main()\n{\n int a, b, n;\n scanf(\"%d %d %d\", &a, &b, &n);\n while (true)\n {\n n -= gcd(a, n);\n if (n == 0)\n {\n printf(\"0\");\n break;\n }\n n -= gcd(b, n);\n if (n == 0)\n {\n printf(\"1\");\n break;\n }\n }\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "6550d7d5a37720aa2f6acde18f9820af", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0} {"lang": "GNU C11", "source_code": " #include\n divisior(int a,int b)\n {\n int s,i;\n if(a>b) s=b;\n else s=a;\n for(i=s;i>=1;i--)\n {\n if(a%i==0&&b%i==0)\n {\n break;\n }\n }\n return i;\n }\nmain()\n{\n int n,a,b,k=0,c=1,d=0;\n scanf(\"%d %d %d\",&a,&b,&n);\n //for(;k==0;)\n //while(k==0)\n {\n if(n>divisior(a,n))\n {\n printf(\"%d\",c);k=1;\n }\n // else n-=divisior(a,n);\n // if(n\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 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 a,b,n;\n SC3(a,b,n);\n ll c=0,z=0;\n while(n>0)\n {\n c++;\n if (c%2==1)\n z=gcd(a,n);\n else\n z=gcd(b,n);\n n=n-z;\n }\n ll q=1;\n \n if (c%2==0)\n PF1(q)\n else\n printf(\"0\\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 gcd(int a,int n)\n{int i,gcd;\n\tfor(i=1;i<=a;i++)\n\t{\n\t\tif(a%i==0 && n%i==0)\n\t\tgcd=i;\n\t}\n\treturn gcd;\n}\nint main()\n{\n\tint i,a,b,n,win=-1;\n\tscanf(\"%d %d %d\",&a,&b,&n);\n\tfor(i=0;;i++)\n\t{\n\t\tif(i=0 && n\n#include \n#include \n#include \n\nint count[50];\n\nint minimum(int a, int b)\n{\n if (a\n#include \nint main()\n{\n\tchar s[50];\n\tint n, i, sum = 0, mini = 10000;\n\n\tscanf(\"%d\", &n);\n\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%c\", s[i]);\n\n\tfor (i = 0; i < n - 3; i++) \n\t{\n\n\t\tif (abs(s[i] - 'A')>13)\n\t\t\tsum += 26 - abs(s[i] - 'A');\n\t\telse\n\t\t\tsum += abs(s[i] - 'A');\n\n\t\tif (abs(s[i+1] - 'C')>13)\n\t\t\tsum += 26 - abs(s[i+1] - 'C');\n\t\telse\n\t\t\tsum += abs(s[i+1] - 'C');\n\n\t\tif (abs(s[i+2] - 'T')>13)\n\t\t\tsum += 26 - abs(s[i+2] - 'T');\n\t\telse\n\t\t\tsum += abs(s[i+2] - 'T');\n\n\t\tif (abs(s[i+3] - 'G')>13)\n\t\t\tsum += 26 - abs(s[i+3] - 'G');\n\t\telse\n\t\t\tsum += abs(s[i+3] - 'G');\n\n\t\tif (sum < mini) mini = sum;\n\n\t}\n\n\tprintf(\"%d\\n\", mini);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "77c768d3ca77166f56d20ced77ac7749", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n5\nZDATG int i,n,sum=0,min=50000;\n\tchar c[51];\n\tscanf(\"%d\\n\",&n);\n\tfor(i=0;i=13?26-fabs(c[i]-'A'):fabs(c[i]-'A');\n\t sum+=fabs(c[i+1]-'C')>=13?26-fabs(c[i+1]-'C'):fabs(c[i+1]-'C');\n\t sum+=fabs(c[i+2]-'T')>=13?26-fabs(c[i+2]-'T'):fabs(c[i+2]-'T');\n\t sum+=fabs(c[i+3]-'G')>=13?26-fabs(c[i+3]-'G'):fabs(c[i+3]-'G');\n\t if(sum<=min)min=sum;\n\t}\n\tprintf(\"%d\",min); \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "940eacb75cb81cefb2f62bf13c2e40a7", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int i,j,m,k,z,o,p,n,r,s,x,y,l;\n int sum[500];\n char efa[500];\n int ok;\n scanf(\"%d\",&ok);\n for(i=0; iy) x=y;}\n k++; break;\n }\n else if(k==1){\n if(efa[j]=='C') z=0;\n else{for(l=j; efa[l]!='C'; l++) z++;\n for(l=j; efa[l]!='C'; l--) o++;\n if(z>o) z=o;}\n k++; break;\n }\n else if(k==2){\n if(efa[j]=='T') p=0;\n else{for(l=j; efa[l]!='T'; l++) p++;\n for(l=j; efa[l]!='T'; l--) n++;\n if(p>n) p=n;}\n k++; break;\n }\n else if(k==3){\n if(efa[j]=='G') r=0;\n else{for(l=j; efa[l]!='G'; l++) r++;\n for(l=j; efa[l]!='G'; l--) s++;\n if(r>s) r=s;}\n k++; break;\n }\n }\n }\n}\nsum[i]=x+z+p+r;\n}\n int min=sum[0];\n for(i=1; i<(strlen(efa)-2); i++){\n if(sum[i]\n#include\nint main(){\n int temp = 0, n, A[50], C[50], T[50], G[50], i, j, ways[4];\n char p[50];\n while(scanf(\"%d\\n\", &n) != 0){\n for(i=0; iways[j]){\n temp = ways[i];\n ways[i] = ways[j];\n ways[j] = temp;\n }\n }\n }\n printf(\"%d\\n\", ways[0]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ef5b3bc9c6a4dff9938584b78bd3f013", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n #include \n#include \n\nint main()\n{\n int n,k,s=0,i;\n int tab[100];\n scanf(\"%d %d\" ,&n ,&k);\n\n for(i=0;i\nint main(){\n int i,n,x,p,q,sum=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;ix){\n break;\n } \n else{\n p=p+1;\n }\n }\n for(int j=n-1;j>=0;j--){\n if(a[i]>x){\n break;\n }\n }\n else{\n q=q+1;\n }\n sum=p+q;\n if(p==n){\n printf(\"c\");\n }\n else{\n printf(\"sum\");\n }\n}\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "2892737e7e405e93b1164b5564052a5d", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint n,k,i,j,s;\nint a[100];\ns=0;\nscanf(\"%d\",&n);\nscanf(\"%d\",&k);\nfor(i=0;i=i+1 && i\nint main()\n{\nint n,k,i,j,s;\nint a[100];\ns=0;\nscanf(\"%d\",&n);\nscanf(\"%d\",&k);\nfor(i=0;i=i+1 && i|=n-1)\n{\nj=j-1;\ns=s+1;\n}\nprintf(\"%d\",s);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2ab34bb8ecb72741273379068e14e7d2", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n,k,g,f=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for (i=0;ii;g--)\n\t{\n\t\tif (a[g]<=k)\n\t\t f++; \n\t else\n\t break;\n\t}\n\tprintf(\"%d\",f);\n\t \n\treturn 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3920566f7537780d1b90a0df4affb9a", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "{\n long long int b,count = 0,i;\n scanf(\"%lld\",&b);\n if(b==1)\n {\n printf(\"1\");\n }\n else\n {\n for(i=1;i*i \n#include \nlong long printDivisors(int n) \n{ \n long long flag=0;\n for (int i=1; i<=sqrt(n); i++) \n { \n if (n%i == 0) \n { \n flag++;\n if (n/i == i) \n \n \n else\n flag++; \n } \n } \n return flag;\n} \n \nint main() \n{ \n int b;\n scanf(\"%d\",&b);\n printf(\"%d\",printDivisors(b));\n return 0; \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "08e21190ea91d7b7fba8440c24539882", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n long long int b;\n scanf(\"lld\",&b);\n long long int count;\n for(i=1;i<=b;i++){\n if(b%i==0){\n count++;\n }\n\n }\n printf(\"lld\",count);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3b2e9c358cd4b349a6083291558e13d", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n\tdouble a,b;\n\tscanf(\"%lf\",&b);\n\tif(b==1){\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor (int i=2;i<=b;i++){\n\t\tif(b%i==0){\n\t\t\tprintf(\"%g\\n\",(log(b)/log(i))+1);\n\t\t\treturn 0;\n\t\t}\n\t}\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "a335d4e2355f1415deafd41fc82799b0", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "{\n long long int b,count = 0,i;\n scanf(\"%lld\",&b);\n if(b==1)\n {\n printf(\"1\");\n }\n else\n {\n for(i=1;i*i\nint main()\n{\n int n, c;\n n=c;\n scanf(\"%d\", &n);\n if(n%2 == 0){\n printf(\"%d\", n/2);\n }\n else if{\n c=c-1;\n c=c/2;\n c=c-n;\n printf(\"%d\",c);\n }\n return 0;\n}\n\n/* 1519483412399 */\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bca4666208f5d05bef15cf55127b874a", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{ int n;\nscanf (\"%d\",&n);\n if (n % 2 == 0)\n printf (\"%d\",n div 2);\n else\n printf (\"%d\",((n-1) div 2) -n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "44cbdcbe9fcb648ee694bb76cef68b10", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int i,n,sum=0;\n while(scanf(\"%lld\",&n)==1){\n if(n%2==0){\n printf(\"%lld\\n\",n/2);\n }\n else\n printf(\"%lld\\n\",-1*(((n+1)/2));\n }\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f38a81df057bb679bd74924a686db1c5", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "int main()\n{\n unsigned int n, fn, \n \n int i;\n \n fn = 0;\n \n \n \n scanf(\" %u\", &n);\n \n for(i = 0; i < n; i++)\n {\n if(n % 2 == 0)\n {\n fn = n/2;\n }\n else\n {\n fn = (-(n + 1))/2;\n }\n }\n printf(\"%u\\n\", fn);\n \n \n \n \n \n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "64642979715c926e57e037d07ede7c37", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nusing namespace std;\n\nint main(){\n\t\n\tlong long n;\n\tcin >> n;\n\tlong long i;\n\tlong long sum=0;\n\t\n\tfor(i=1; i<=n; i++){\n\t\t\n\t\t\n\t\tif((i%2)==0)\n\t\t\tsum+=i;\n\t\telse\n\t\t\tsum-=i;\n\t\t\n\t}\n\t\n\tcout << sum;\n\t\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d8c3d4d348ac4c33cb300bcef9f04796", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n char s[105];\n long a[6],i,j,k,l,r,b,y,g,n,m;\n while(scanf(\"%s\",s)==1)\n {\n r=y=b=g=0;\n l=strlen(s);\n for(i=0;i<=4;i++)\n a[i]=0;\n n=l/4;\n for(i=0;i0)\n if(r%4!=0)\n r=(r%4);\n else\n r=4;\n if(b>0)\n if(b%4!=0)\n b=(b%4);\n else\n b=4;\n if(y>0)\n if(y%4!=0)\n y=(y%4);\n else\n y=4;\n if(g>0)\n if(g%4!=0)\n g=(g%4);\n else\n g=4;\n for(i=0;i<4;i++)\n {\n a[i]=n-a[i];\n }\n long count1=0;\n for(i=0;i<4;i++)\n {\n if(a[i]>0)\n count1=count1+a[i];\n }\n m=a[4]-count1;\n if(r<=m)\n {\n a[0]=a[0]+1;\n }\n if(b<=m)\n {\n a[1]=a[1]+1;\n\n }\n if(y<=m)\n {\n a[2]=a[2]+1;\n }\n if(g<=m)\n {\n a[3]=a[3]+1;\n }\n for(i=0;i<4;i++)\n if(a[i]<0)\n a[i]=0;\n\n for(i=0;i<4;i++)\n {\n printf(\"%ld \",a[i]);\n }\n printf(\"\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "49a0ec2d485e3a42a6ea42358cde5986", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define N 102\nint main() {\n char s[N];\n scanf(\"%s\",s);\n int kr=0,kb=0,ky=0,kg=0;\n int n=strlen(s);\n int i;\n //1111\n //rbyg\n int count[N];\n int position[N];\n while(1){\n int find=0;\n for(i=0;i0)find=1;\n if(count['!']==1){\n if(count['R']==0){ s[position['!']]='R';kr++; }\n if(count['B']==0){ s[position['!']]='B';kb++; }\n if(count['Y']==0){ s[position['!']]='Y';ky++; }\n if(count['G']==0){ s[position['!']]='G';kg++; }\n }\n }\n if(!find)break;\n }\n printf(\"%d %d %d %d\\n\",kr,kb,ky,kg);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "89cbae3892ab2f0606348bf127d349b2", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main ()\n{\n\tint R = 0, B = 0, Y = 0, G = 0, cont = 0, dead[4];\n\tint r = 0, b = 0, y = 0, g = 0;\n\tint i = 0, j, size, aux;\n\tchar s[105];\n\tscanf (\"%s\", s);\n\tsize = strlen (s);\n\twhile (i < (size - 3)) {\n\t\tfor (j = i; j < (i+4); j++) {\n\t\t\tif (s[j] == 'R')\n\t\t\t\tR++;\n\t\t\telse if (s[j] == 'B')\n\t\t\t\tB++;\n\t\t\telse if (s[j] == 'Y')\n\t\t\t\tY++;\n\t\t\telse if (s[j] == 'G')\n\t\t\t\tG++;\n\t\t\telse if (s[j] == '!') {\n\t\t\t\tdead[cont] = j;\n\t\t\t\tcont++;\n\t\t\t}\n\t\t}\n\t\tif (cont == 1) {\n\t\t\taux = dead[0];\n\t\t\tif (R == 0) {\n\t\t\t\tr++;\n\t\t\t\ts[aux] = 'R';\n\t\t\t}\n\t\t\telse if (B == 0) {\n\t\t\t\tb++;\n\t\t\t\ts[aux] = 'B';\n\t\t\t}\n\t\t\telse if (Y == 0) {\n\t\t\t\ty++;\n\t\t\t\ts[aux] = 'Y';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tg++;\n\t\t\t\ts[aux] = 'G';\n\t\t\t}\n\t\t\tif (i < 4)\n\t\t\t\ti = 0;\n\t\t\telse\n\t\t\t\ti -= 3;\n\t\t}\n\t\telse if (cont > 1 && i == (size - 4)) {\n\t\t\tfor (j = 0; j < cont; j++) {\n\t\t\t\taux = dead[j];\n\t\t\t\tif (aux < (size - 3)) {\n\t\t\t\t\tif (s[aux + 4] == 'R') {\n\t\t\t\t\t\tr++;\n\t\t\t\t\t\ts[aux] = 'R';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux + 4] == 'B') {\n\t\t\t\t\t\tb++;\n\t\t\t\t\t\ts[aux] = 'B';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux + 4] == 'Y') {\n\t\t\t\t\t\ty++;\n\t\t\t\t\t\ts[aux] = 'Y';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux + 4] == 'G') {\n\t\t\t\t\t\tg++;\n\t\t\t\t\t\ts[aux] = 'G';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (aux > 3){\n\t\t\t\t\tif (s[aux - 4] == 'R') {\n\t\t\t\t\t\tr++;\n\t\t\t\t\t\ts[aux] = 'R';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux - 4] == 'B') {\n\t\t\t\t\t\tb++;\n\t\t\t\t\t\ts[aux] = 'B';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux - 4] == 'Y') {\n\t\t\t\t\t\ty++;\n\t\t\t\t\t\ts[aux] = 'Y';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux - 4] == 'G') {\n\t\t\t\t\t\tg++;\n\t\t\t\t\t\ts[aux] = 'G';\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 < 4)\n\t\t\t\ti = 0;\n\t\t\telse\n\t\t\t\ti -= 3;\n\t\t}\n\t\telse\n\t\t\ti++;\n\t\tR = 0;\n\t\tB = 0;\n\t\tY = 0;\n\t\tG = 0;\n\t\tcont = 0;\n\t}\n\tprintf (\"%d %d %d %d\", r, b, y, g);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1d58fe3f1b0bd66291adb3ff6150eaf", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main ()\n{\n\tint R = 0, B = 0, Y = 0, G = 0, cont = 0, dead[4];\n\tint r = 0, b = 0, y = 0, g = 0;\n\tint i = 0, j, size, aux;\n\tchar s[105];\n\tscanf (\"%s\", s);\n\tsize = strlen (s);\n\twhile (i < (size - 3)) {\n\t\tfor (j = i; j < (i+4); j++) {\n\t\t\tif (s[j] == 'R')\n\t\t\t\tR++;\n\t\t\telse if (s[j] == 'B')\n\t\t\t\tB++;\n\t\t\telse if (s[j] == 'Y')\n\t\t\t\tY++;\n\t\t\telse if (s[j] == 'G')\n\t\t\t\tG++;\n\t\t\telse if (s[j] == '!') {\n\t\t\t\tdead[cont] = j;\n\t\t\t\tcont++;\n\t\t\t}\n\t\t}\n\t\tif (cont == 1) {\n\t\t\taux = dead[0];\n\t\t\tif (R == 0) {\n\t\t\t\tr++;\n\t\t\t\ts[aux] = 'R';\n\t\t\t}\n\t\t\telse if (B == 0) {\n\t\t\t\tb++;\n\t\t\t\ts[aux] = 'B';\n\t\t\t}\n\t\t\telse if (Y == 0) {\n\t\t\t\ty++;\n\t\t\t\ts[aux] = 'Y';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tg++;\n\t\t\t\ts[aux] = 'G';\n\t\t\t}\n\t\t\tif (i < 4)\n\t\t\t\ti = 0;\n\t\t\telse\n\t\t\t\ti -= 3;\n\t\t}\n\t\telse if (cont > 1) {\n\t\t\tfor (j = 0; j < cont; j++) {\n\t\t\t\taux = dead[j];\n\t\t\t\tif (aux < (size - 3)) {\n\t\t\t\t\tif (s[aux + 4] == 'R') {\n\t\t\t\t\t\tr++;\n\t\t\t\t\t\ts[aux] = 'R';\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux + 4] == 'B') {\n\t\t\t\t\t\tb++;\n\t\t\t\t\t\ts[aux] = 'B';\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux + 4] == 'Y') {\n\t\t\t\t\t\ty++;\n\t\t\t\t\t\ts[aux] = 'Y';\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux + 4] == 'G') {\n\t\t\t\t\t\tg++;\n\t\t\t\t\t\ts[aux] = 'G';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (aux > 3){\n\t\t\t\t\tif (s[aux - 4] == 'R') {\n\t\t\t\t\t\tr++;\n\t\t\t\t\t\ts[aux] = 'R';\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux - 4] == 'B') {\n\t\t\t\t\t\tb++;\n\t\t\t\t\t\ts[aux] = 'B';\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux - 4] == 'Y') {\n\t\t\t\t\t\ty++;\n\t\t\t\t\t\ts[aux] = 'Y';\n\t\t\t\t\t}\n\t\t\t\t\telse if (s[aux - 4] == 'G') {\n\t\t\t\t\t\tg++;\n\t\t\t\t\t\ts[aux] = 'G';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i < 4)\n\t\t\t\ti = 0;\n\t\t\telse\n\t\t\t\ti -= 3;\n\t\t}\n\t\telse\n\t\t\ti++;\n\t\tR = 0;\n\t\tB = 0;\n\t\tY = 0;\n\t\tG = 0;\n\t\tcont = 0;\n\t}\n\tprintf (\"%d %d %d %d\", r, b, y, g);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "454f9b13c9b517f03bcc8183544e9afa", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define MAX 105\n#define sum 15\nint v[5];\n\nint decode(char c){\n\n if(c == 'R')\n return 1;\n if(c == 'G')\n return 2;\n if(c == 'Y')\n return 4;\n if(c == 'B')\n return 8;\n\n return 0;\n}\n\nchar repair(int d){\n\n if(d == 1){\n v[1]++;\n return 'R';\n }\n if(d == 2){\n v[4]++;\n return 'G';\n }\n if(d == 4){\n v[3]++;\n return 'Y';\n }\n if(d == 8){\n v[2]++;\n return 'B';\n }\n\n return '!';\n}\n\nint main(){\n\n char a[MAX];\n int i, n, error = 0, x, y, z, q, dif;\n scanf(\"%s\",&a);\n n = strlen(a);\n\n for(i = 0;i < n; ++i)\n if(a[i] == '!')\n ++error;\n\n v[1] = 0;\n v[2] = 0;\n v[3] = 0;\n v[4] = 0;\n\n do{\n x = decode(a[0]);\n y = decode(a[1]);\n z = decode(a[2]);\n\n for(i = 3;i < n; ++i){\n q = decode(a[i]);\n dif = sum - x - y - z - q;\n if(a[i] == '!'){\n a[i] = repair(dif);\n if(a[i] != '!')\n --error;\n }\n if(a[i - 1] == '!'){\n a[i - 1] = repair(dif);\n if(a[i - 1] != '!')\n --error;\n }\n if(a[i - 2] == '!'){\n a[i - 2] = repair(dif);\n if(a[i - 2] != '!')\n --error;\n }\n if(a[i - 3] == '!'){\n a[i - 3] = repair(dif);\n if(a[i - 3] != '!')\n --error;\n }\n\n x = y;\n y = z;\n z = q;\n }\n }while(error > 0);\n\n printf(\"%d %d %d %d\",v[1],v[2],v[3],v[4]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a97b67a260e37cf1c37e0e22e3bf2b10", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n printf(\"%d %d\",b,c);}\n else\n {\n \n printf(\"%d %d\",a,c);\n }\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cdfcfeb7c663c87430eda3703f87b47c", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int a,b,temp;\n scanf(\"%d %d\",&a,&b);\n if(a>b)\n {\n temp=a;\n a = b;\n b = temp;\n }\n b = (b-a)/2;\n printf(\"%d %d\",a,b);", "lang_cluster": "C", "compilation_error": true, "code_uid": "e2f5d99bcc0f609735f1b9b10fd898c2", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{ int a,b,t,k,w;\n scanf(\"%d %d\",&a,&b);\n if(a\n\nint main(){\n int a,b;\n int same,diff;\n\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n\n if(a%2==0 && b%2==0){\n same=(a/2)+(b/2);\n diff=0;\n }\n\n if(a%2!=0 && b%2!=0){\n same=(a/2)+(b/2);\n diff=1;\n }\n\n if((a%2!=0 && b%2==0) || (a%2==0 && b%2!=0)){\n same=(a/2)+(b/2);\n diff=0\n }\n printf(\"%d %d\",sum,diff);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fe2707bf8f8212c275c11234567bf7e2", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0} {"lang": "GNU C11", "source_code": " #include \n int main()\n { \n int a,b,i,diff_k=0,same_k=0;\n scanf(\"%d %d\",&a,&b);\n if(b<=a)\n {\n for(i=1;i<=b;i++)\n {\n diff_k++;\n }\n \n for(i=1;i<=a-diff;i++)\n { \n if(i==2*i)\n same_k++;\n }\n printf(\"%d %d\",diff_k,same_k);\n }\n else if(a\n#include\nint main()\n{\n car 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\n\nint main()\n{\n\tchar s[200];\n\tscanf(\"%s\",&s);\n\tbool f;\n\tf=false;\n\tint i;\n\tfor (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\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8befd77fb127cd97de56059c8da54e7c", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\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\n\nlong int SRoot(long int num)\n{\n long int i;\n \n if(num == 1)\n return 1;\n else\n {\n i = 1;\n do{\n i++;\n }while(i * i < num);\n \n return i;\n }\n}\n\nint main()\n{\n long int n, i, D[300]={0}, max, x, j, A[150], y, k, d;\n \n scanf(\"%ld\", &n);\n for(i=0;i max)\n max = D[i];\n \n x = max;\n \n //Determine all of the divisors of \"x\"\n j = 0;\n for(i=1;i<=x;i++)\n if(x % i == 0)\n {\n A[j] = i;\n j++;\n }\n \n //Multiply the divisors from D[] that are not present in A[];\n //thus we can get \"y\"\n y = 1;\n for(i=0;i\n\nlong int SRoot(long int num)\n{\n long int i;\n \n if(num == 1)\n return 1;\n else\n {\n i = 1;\n do{\n i++;\n }while(i * i < num);\n \n return i;\n }\n}\n\nint main()\n{\n \n scanf(\"%ld\", &n);\n for(i=0;i max)\n max = D[i];\n \n x = max;\n \n //Determine all of the divisors of \"x\"\n j = 0;\n for(i=1;i<=x;i++)\n if(x % i == 0)\n {\n A[j] = i;\n j++;\n }\n \n //Multiply the divisors from D[] that are not present in A[];\n //thus we can get \"y\"\n y = 1;\n for(i=0;i\nint main()\n{\n int n,i,d[200],max,c[200],j=0,s,maxi,f=0;\n scanf(\"%d\",&n);\n for(i=0;imax)\n max=d[i];\n }\n printf(\"%d \",max);\n for(i=0;imaxi);\n maxi=c[j];\n }\n printf(\"%d\",maxi);\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8139e350d8f451d793cf79126fec6ee", "src_uid": "868407df0a93085057d06367aecaf9be", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint N[128]={0}; \n\tint M[128]={0}; \n\tfor(int i=0;itmp){\n\t\t\ttmp=N[i];\n\t\t}\t\t\n\t}\n\tx=tmp;\n\tfor(int i=0;itmp){\n\t\t\ttmp=N[i];\n\t\t}\t\t\n\t}\n\ty=tmp;\n\t\n\tprintf(\"%d %d\",x,y);\n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c86f79733de8567c8ee1d08dd9af1e7", "src_uid": "868407df0a93085057d06367aecaf9be", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "11.cpp", "lang_cluster": "C", "compilation_error": true, "code_uid": "8acfd0799dae3434af7f7ed264712c33", "src_uid": "868407df0a93085057d06367aecaf9be", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,t,k,d;\n scanf(\"%d%d%d%d\",&n,&t,&k,&d);\n if( (d+t)<(n+k-1)/k*t)\n print(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2adff6c65000e273c6619d02b6849351", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \nint max(int n1,int n2) {\n if (n1 > n2)\n return n1;\n else\n return n2;\n}\nint main()\n{\n\n int n,t,k,d;\n scanf(\"%d%d%d%d\",&n,&t,&k,&d);\n double count1=0,count2=d;\n int x=(n+k-1)/k;\n for (int i = 0; i \n#include\nusing namespace std;\nint main()\n{\n\tint i, j, k;\n\tint n, m, t, d;\n\tint sum1=0;\n\tint sum2=0;\n\tscanf(\"%d %d %d %d\", &n, &t, &k, &d);\n\tint l = n;\n\twhile (l > 0)\n\t{\n\t\tsum1 += t;\n\t\tl -= k;\n\t}\n\tl = n;\n\twhile (l > 0)\n\t{\n\t\tsum2++;\n\t\tif (sum2%t == 0)\n\t\t{\n\t\t\tl -= k;\n\t\t}\n\t\tif (sum2 - d > 0 && (sum2 - d) % t == 0)\n\t\t{\n\t\t\tl -= k;\n\t\t}\n\t}\n\tif (sum1 > sum2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "46fcc38e1c7932f79b29a7e48d1114a9", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n\nint main()\n{\n int n,t,k,d;\n \n scanf(\"%d%d%d%d\", &n,&t,&j,&d);\n\n\n\n int req = (n * t)/k;\n\n if (t + d < req )\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3f9949e00d481447b04fe404ca16ab0", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,t,d,T1,T2;\n scanf(\"%d %d %d %d\",&n ,&t ,&k ,&d);\n T1= (n/k*t+(n%k!=0));\n T2=d+(n/2k)*t;\n if(T1>T2)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f016e84096965a5ced7e8e411fbc414b", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "include\nint main()\n{int n;\nscanf(\"%d\",&n);\n n=n-10;\n switch(n)\n {\n case 1:\n printf(\"4\\n\")\n break;\n case 2:\n printf(\"4\\n\")\n break;\n case 3\n printf(\"4\\n\")\n break;\n case 4\n printf(\"4\\n\")\n break;\n case 5\n printf(\"4\\n\")\n break;\n case 6\n printf(\"4\\n\")\n break;\n case 7\n printf(\"4\\n\")\n break;\n case 8\n printf(\"4\\n\")\n break;\n case 9\n printf(\"4\\n\")\n break;\n case 10\n printf(\"15\\n\")\n break;\n case 11\n printf(\"4\\n\")\n break;\n default:\n printf(\"0\\n\")\n}\nreturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4129f7be2b45156466b60206820a8b0b", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n\n{\n int x,n;\n scanf(\"%d\",&n);\n x=n-10;\n if(x==0||x>=12)\n printf(\"0\");\n if(x=10);\n printf(\"15\");\n else\n printf(\"4\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ba2ae3753be1cc2e762bfab8c089f706", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main() {\n\tint n;\n\twhile (cin >> n) {\n\t\tif (n <= 10) {\n\t\t\tcout << 0 << endl;\n\t\t} else if (n == 11) {\n\t\t\tcout << 8 << endl;\n\t\t} else if (n < 20) {\n\t\t\tcout << 4 << endl;\n\t\t} else if (n == 20) {\n\t\t\tcout << 15 << endl;\n\t\t} else {\n\t\t\tcout << 0 << endl;\n\t\t}\n\t}\n\treturn 0;\n}\n\t\t\t\n \t \t\t \t \t\t \t \t\t\t\t\t\t\t\t\t\t\t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "9ce54c945eb1e67fda168e468aecb995", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n int t,n,i,j,k;\n cin>>n;\n if(n<11||n>21)\n cout<<\"0\";\n else if(n>10&&n<19)\n cout<<\"4\";\n else if(n==20)\n cout<<\"15\";\n else if(n==21)\n cout<<\"4\";\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "20ecbb10a9687ec40b734bed10c28668", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "/*\nAuthor:\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%%%%%%%% LALIT KUNDU %%%%%%%% \n%%%%%%%% IIIT HYDERABAD %%%%%%%%\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n*/\n#include\n#include\n#include\n#include\n#include\n#define lld long long int\n#define llu long long unsigned int\nint compare(const void * a, const void * b){return *(lld *)a-*(lld *)b;}\nlong long int readint() {long long int n=0,count=0,counti=0; char c;while(1){c=getchar_unlocked();if(c=='-')count=1;else if((c==' '||c=='\\n'||c==EOF) && counti==1)break;else if(c>='0' && c<='9'){counti=1;n=(n<<3)+(n<<1)+c-'0';}}if(count==0)return n;else return -n;}\n#define min(a,b)(a>b?b:a)\n#define max(a,b)(a=2)\n pdn(4);\n else if(n==10)\n pdn(15);\n else if(n>10)\n {\n if(n!=11)\n pdn(0);\n else pdn(4);\n }\n return 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3b8cc7716c7e4f1796a868d18f89272b", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "a53b84a311d530469bd97f901efa7a74", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "GNU C11", "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++;a\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "430b622ed54cb5f2fdc2026c5a527a30", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(void)\n{\n\tint N, i;\n\tint flag = 0;\n\tint A[1000000000] = { 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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "21d390ac8ef2a5a9e25bd5ac6d10eedc", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\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(true)\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "9c8103d0a5aa39231c9f21aaf7ff1bc5", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "number=input()\nlength=len(number)\n\nsum=0\nx=length-1\nfirst=True\nif length%2==1:\n a=number[x]\n b=number[x-1]\n x-=2\n sum=sum+(10-int(a)+9)\n while x>0:\n a=number[x]\n b=number[x-1]\n x-=2\n sum=sum+(10-int(b))\n sum=sum+(10-int(number[0]))\nelse:\n a=number[x]\n b=number[x-1]\n x-=2\n sum=sum+(10-int(a)+9)\n while x>0:\n a=number[x]\n b=number[x-1]\n x-=2\n sum=sum+(10-int(b))\n\nprint (sum)\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a19c3bb736a1480be84da5db78bae1dd", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\nint main(){\n char b[1000];\n scanf(\"%s\",b);\n int l=strlen(b);\n set s;\n int f;\n for(int i=0;i\n#include\nchar s[100];\nint pal(int l){\n\tint t=l;\n\tfor(int i=0;i\n#include\nint main()\n{\n char s[50];\n int i=0,l,c=0,c1=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i\n#include\nint main()\n{\nchar s[50];\nscanf(\"%s\",&s);\nint n,flag=0,flag1=0;\nn=strlen(s);\nfor(i=0;i<(l/2);i++)\n{\n\tif(s[i]!=s[n-i-1])\n\t{\n\t\tflag=1;\n\t}\n\telse if(s[0]!=s[i+1])\n\t{\n\t\tflag1=1;\n\t}\n\telse\n\t{\n\t\tflag=0;\n\t}\n}\nif(flag==1)\n\tprintf(\"%d\",n);\nelse if(flag1==1)\n\tprintf(\"%d\",(n-1));\nelse\n\tprintf(\"0\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f8eac4d596a916d497f38e464266cd58", "src_uid": "6c85175d334f811617e7030e0403f706", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "\n#include\n#include\n\nusing namespace std;\n\nint main()\n{\n char s[51],x[51];\n int z=0,p=1;\n gets(s);\n strcpy(x,s);\n int l=strlen(s);\n strrev(x);\n if(strcmp(x,s)!=0)\n {\n printf(\"%d\\n\",l);\n z=1;\n }\n else\n {\n while(1)\n {\n int i;\n for(i=0;i\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "b93491177f9e97744ce0863330f772fd", "src_uid": "4ebed264d40a449602a26ceef2e849d1", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nusing namespace std;\nstring s;\nint compare(string a)\n{\n\tint o=0,z=0;\n\tfor(int i=0;i>s;\n\tif(compare(s)==1){\n\t\tcout<<1<\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\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int zero=0,one=1;\n int i=0;\n char string[n];\n while(i\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nlong long d(long long n)\n{\n long long ans=0;\n for(int i=1;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n if(i==sqrt(n))\n ans++;\n else\n ans+=2;\n }\n }\n return ans;\n}\nint main()\n{\n long long a,b,c;\n scanf(\"%lld%lld%lld\",&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+=d(i*j*k);\n sum%=1073741824;\n\n }\n\n }\n }\n printf(\"%lld\\n\",sum);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "beddf21d26c573debc635d0cfc10a9c6", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nusing namespace std;\n\ntypedef long int ld;\ntypedef long long int lld;\ntypedef float f;\ntypedef double lf;\ntypedef unsigned int u;\ntypedef unsigned long int lu;\ntypedef unsigned long long int llu;\ntypedef char C;\n\n#define sf scanf\n#define pf printf\n#define PI acos(-1.0)\n#define sq(x) (x)*(x)\n#define FOR(i,x,cases) for(i=x;i=x;i--)\n#define nn printf(\"\\n\")\n#define chk printf(\"chek\\n\")\n#define chk1 printf(\"chek1\\n\")\n#define size 1000000\n#define READ(f) freopen(f, \"r\", stdin)\n#define WRITE(f) freopen(f, \"w\", stdout)\n\n/****** start your code *******/\nint divisor[size+1];\nvoid total_divisor()\n{\n int i,j;\n for(i=1;i<=size;i++)\n for(j=i;j<=size;j+=i)\n divisor[j]++;\n}\nint main()\n{\n total_divisor();\n int num1,num2,num3,i,j,k,count,total,store;\n while(sf(\"%d%d%d\",&num1,&num2,&num3)==3)\n {\n count=0;\n for(i=1; i<=num1; i++)\n for(j=1; j<=num2; j++)\n for(k=1; k<=num3; k++)\n {\n //total=i*j*k;\n count+=divisor[i*j*k];\n //pf(\"%d %d %d count = %d\\n\",i,j,k,store);\n }\n pf(\"%d\\n\",count);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3fc0267348b6dad93d2c99af94a6ee5e", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define max 1000000\nint ar[1000000];\n \nint main()\n{\n divison ();\n int i,j,k;\n int a,b,c,sum,d;\n for(i=1;i<=max;i++)\n {\n for(j=i;j<=max;j+=i)\n {\n ar[j++]; \n }\n } \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", "lang_cluster": "C", "compilation_error": true, "code_uid": "20a66e3b575436a18f5859230da5c7e3", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define max 1000000\nint ar[1000000];\n \nint main()\n{\n int i,j,k;\n int a,b,c,sum,d;\n for(i=1;i<=max;i++)\n {\n for(j=i;j<=sqrt(max);j++)\n {\n ar[j++]; \n }\n } \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", "lang_cluster": "C", "compilation_error": true, "code_uid": "d04f866435a875820fdc3d7fe4d8a291", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "a, b, c = map(int, raw_input().split())\nd = {}\nans = 0\nd[1] = 1\nfor ai in xrange(1, a + 1):\n for bi in xrange(1, b + 1):\n for ci in xrange(1, c + 1):\n i = ai * bi * ci\n if i not in d:\n sqi = i ** 0.5\n d[i] = sum(2 if j != sqi else 1 for j in xrange(2, int(sqi) + 1) if i % j == 0) + 2\n ans += d[i]\nprint ans % 1073741824", "lang_cluster": "C", "compilation_error": true, "code_uid": "26d64687bdef4ff62891d4c00c0cdaa0", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n\nlong long int a[1000006],a1[1000006],b1[1000006],x[1000006],y[1000006];\nint main()\n{\n\tlong long int n,i,f,c;\n\tscanf(\"%I64d\",&n);\n\t\n\tfor(i=0;i\n#include \n#pragma warning(disable:4996)\n\nint* nums;\nint** index;\n\nbool checkSubMatrix(int start, int end);\n\nint main()\n{\n\tint num;\n\n\tscanf(\"%d\", &num);\n\n\n\tnums = (int*)malloc(sizeof(int)*num);\n\n\tfor (int i = 0; i < num; i++)\n\t\tscanf(\" %d\", &nums[i]);\n\n////////////////////////////////////////////////////\n\n\tif (num == 1)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\n\t\tindex = (int**)malloc(sizeof(int*)*num);\n\t\tfor (int i = 0; i < num; i++)\n\t\t\tindex[i] = (int*)malloc(sizeof(int) * 2);\n\n\t\tfor (int i = 2; i <= num; i++)\n\t\t{\n\t\t\t/* Initialization */\n\t\t\tfor (int j = 0; j < i; j++)\n\t\t\t{\n\t\t\t\tindex[j][0] = j;\n\t\t\t\tindex[j][1] = j;\n\t\t\t}\n\n\t\t\tindex[i - 1][1] = num - 1;\n\n\t\t\t/* Verification */\n\t\t\twhile (index[0][1] != num - 2)\n\t\t\t{\n\t\t\t\tint subOK;\n\t\t\t\tfor (int j = 0; j < i; j++)\n\t\t\t\t{\n\t\t\t\t\tsubOK =\tcheckSubMatrix(index[j][0], index[j][1]);\n\t\t\t\t\tif (!subOK)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (subOK)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\tprintf(\"%d\\n\", i);\n\t\t\t\t\tfor (int k = 0; k < i; k++)\n\t\t\t\t\t\tprintf(\"%d %d\\n\", index[k][0] + 1, index[k][1] + 1);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\tfor (int j = i - 1; j >= 0; j--)\n\t\t\t\t{\n\t\t\t\t\tif (index[j][0] == index[j][1])\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tindex[j][0]++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\n\n\t\t}\n\t}\n\n\t\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n\n\nbool checkSubMatrix(int start, int end)\n{\n\tint sum = 0;\n\tfor (int i = start; i <= end; i++)\n\t{\n\t\tsum += nums[i];\n\t}\n\n\tif (sum == 0)\n\t\treturn false;\n\telse\n\t\treturn true;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d33a34b4583c17facce21e5560da076", "src_uid": "3a9258070ff179daf33a4515def9897a", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "872450d37e3d16d326823d1a7848844c", "src_uid": "3a9258070ff179daf33a4515def9897a", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n//#include \"stack.h\"\n#define MAX_STACK\t100\n\n\ntypedef enum { false, true } bool;\ntypedef int Data;\n\ntypedef struct {\n\tData items[MAX_STACK];\n\tint top;\n} Stack;\n\n// Make stack empty.\nvoid InitStack(Stack *pstack);\n\n// Check whether stack is full.\nbool IsFull(Stack *pstack);\n\n// check whether stack is empty\nbool IsEmpty(Stack *pstack);\n\n// Read the item at the top.\nData Peek(Stack *pstack);\n\n// Insert an item at the top.\nvoid Push(Stack *pstack, Data item);\n\n// Remove the item at the top.\nvoid Pop(Stack *pstack);\n\nint main() {\n\tStack stack, result;\n\tint size, tmp, prev, cnt = 0;\n\tscanf(\"%d\", &size);\n\tint *arr = (int *)malloc(sizeof(int) * size);\n\tfor (int i = 0; i < size; i++)\n\t\tscanf(\"%d\", &arr[i]);\n\n\tif (size == 1 && arr[0] == 0) {\n\t\tprintf(\"NO\\n\");\n\t\tfree(arr);\n\t\treturn 0;\n\t}\n\n\tInitStack(&stack);\n\tInitStack(&result);\n\n\tfor (int i = 1; i <= size; i++) {\n\t\tif (arr[i] != 0) {\n\t\tPush(&stack, i);\n\t\tcnt++;\n\t\t}\n\t}\n\tfor (int i = 0; i < cnt; i++) {\n\t\ttmp = Peek(&stack);\n\t\tPush(&result, tmp);\n\t\tPop(&stack);\n\t}\n\t\n\tprintf(\"YES\\n\");\n\tfor (int i = 0; i < cnt; i++) {\n\t\ttmp = Peek(&result);\n\t\tif (i == 0)\n\t\t\tprintf(\"1 %d\\n\", tmp);\n\t\telse if (i != cnt - 1)\n\t\t\tprintf(\"%d %d\\n\", prev + 1, tmp);\n\t\telse\n\t\t\tprintf(\"%d %d\\n\", prev + 1, size);\n\t\tprev = tmp;\n\t\tPop(&result);\n\t}\n\n\tfree(arr);\n\treturn 0;\n}\n\n\n/************test***********\n11\n1 0 0 1 1 1 0 0 0 1 0\n\nyes\n1 3\n4 4\n5 5\n6 9\n10 11\n****************************/", "lang_cluster": "C", "compilation_error": true, "code_uid": "21178a53a7e631c5d8799ecaa4ba8b34", "src_uid": "3a9258070ff179daf33a4515def9897a", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int s2[120][2];\n int s1[120];\n int n,a,judge,i,sum,judge1,b,all;\n while(scanf(\"%d\",&n)!=EOF)\n {\n judge=0;\n i=0;\n all=0;\n for(a=1; a<=n; a++)\n {\n scanf(\"%d\",&s1[a]);\n if(s1[a]>0)all=1;\n }\n if(s1[1]==0&&s1[n]==0&&all=1)\n {\n printf(\"YES\\n\");\n printf(\"1 %d\\n\",n);\n }\n else\n {\n for(a=1; a<=n; a++)\n {\n if(s1[a]!=0)\n {\n s2[i][0]=a;\n if(a==n)\n {\n s2[i][1]=a;\n i++;\n }\n else\n {\n judge=0;\n for(b=a+1; b<=n; b++)\n {\n if(s1[b])\n {\n break;\n }\n }\n s2[i][1]=b-1;\n i++;\n a=b-1;\n }\n }\n else\n {\n sum=0;\n judge=1;\n judge1=0;\n for(b=a; b<=n; b++)\n {\n sum+=s1[b];\n if(sum!=0)\n {\n judge1=1;\n break;\n }\n }\n if(judge1==0)break;\n else\n {\n s2[i][0]=a;\n s2[i][1]=b;\n a=b;\n i++;\n judge=0;\n }\n }\n if(judge)break;\n }\n if(judge)printf(\"NO\\n\");\n else\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",i);\n for(a=0; a\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "55e01f4899755c9a32e2b31b39b1d857", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "GNU C", "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,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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1178d8c624bc507ecad818e6bc289a92", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "GNU C", "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\tint r;\n\tint b;\n\tint t = 0;\n\tint p;\n\tif(v[k] == '\\0')\n\t\treturn -1;\n\tif(s1[i] == '\\0' || s2[j] == '\\0')\n\t\treturn 0;\n\tif(res[i][j][k] >= 0)\n\t\treturn res[i][j][k];\n\tr = get(i + 1, j, k);\n\tb = get(i, j + 1, k);\n\tif(s1[i] == s2[j])\n\t{\n\t\tif(s1[i] == v[k])\n\t\t{\n\t\t\tif(v[k + 1] != '\\0')\n\t\t\t\tt = get(i + 1, j + 1, k + 1) + 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(p = map[k]; p >= 0 && s1[i] != v[p]; p = map[p]);\n\t\t\tt = get(i + 1, j + 1, p + 1) + 1;\n\t\t}\n\t}\n\tif(t > r && t > b)\n\t{\n\t\tres[i][j][k] = t;\n\t\ttake[i][j][k] = 1;\n\t}\n\telse if(r > b)\n\t\tres[i][j][k] = r;\n\telse\n\t\tres[i][j][k] = b;\n\treturn res[i][j][k];\n}\n\nvoid output(int i, int j, int k)\n{\n\tint r;\n\tint p;\n\tint b;\n\tif(s1[i] == '\\0' || s2[j] == '\\0' || v[k] == '\\0')\n\t\treturn;\n\tif(take[i][j][k] != 0)\n\t{\n\t\tputchar(s1[i]);\n\t\tif(s1[i] == v[k])\n\t\t\toutput(i + 1, j + 1, k + 1);\n\t\telse\n\t\t{\n\t\t\tfor(p = map[k]; p >= 0 && s1[i] != v[p]; p = map[p]);\n\t\t\tt = get(i + 1, j + 1, p + 1) + 1;\n\t\t\toutput(i + 1, j + 1, p);\n\t\t}\n\t}\n\telse\n\t{\n\t\tr = get(i + 1, j, k);\n\t\tb = get(i, j + 1, k);\n\t\tif(r > b)\n\t\t\toutput(i + 1, j, k);\n\t\telse\n\t\t\toutput(i, j + 1, k);\n\t}\n}\n\nint main()\n{\n\tint i, j, k;\n\tscanf(\"%s%s%s\", s1, s2, v);\n\tfor(i = 0; s1[i] != '\\0'; i++)\n\t\tfor(j = 0; s2[j] != '\\0'; j++)\n\t\t\tfor(k = 0; v[k] != '\\0'; k++)\n\t\t\t{\n\t\t\t\ttake[i][j][k] = 0;\n\t\t\t\tres[i][j][k] = -1;\n\t\t\t}\n\tmap[0] = -1;\n\tmap[1] = 0;\n\tj = 0;\n\tfor(k = 2; v[k] != '\\0';)\n\t{\n\t\tif(v[j] == v[k - 1])\n\t\t{\n\t\t\tj++;\n\t\t\tmap[k++] = j;\n\t\t}\n\t\telse if(j > 0)\n\t\t\tj = map[j];\n\t\telse\n\t\t\tmap[k++] = 0;\n\t}\n\tif(get(0, 0, 0) <= 0)\n\t\tputchar('0');\n\telse\n\t\toutput(0, 0, 0);\n\tprintf(\"\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "57e984c64f8cf77f7818f6b454fcfa92", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int x,count=0,i;\n long long int x;\n scanf(\"%lld\",&x);\n for(i=1;i<100;i++)\n {\n if(pow(2,i)>x)\n {\n i--;x=x-pow(2,i);count++;break;\n }\n }\n for(i=i;i>=0;i--)\n {\n if(pow(2,i)\nint main(){\n int n,a=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(n%2==1){\n x++;\n n--;\n }\n else{\n n/=2;\n }\n }\n printf(\"%d\",a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4a4ef88c2b8ed9aad625466ca2abe002", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int x, count, i;\n scanf(\"%d\", &x);\n while(x!=0){\n if(x%2==1){\n count++;\n x--;\n x=/2;\n } else {\n x=/2;\n }\n }\n fprintf(stdout, \"%d\", count);\n fclose(stdout);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "99e85118d413c2f7694ae8c7dc8dabfd", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int x,res=0,m;\n int ans=0;\n int po,closest_pow_oftwo,res;\n scanf(\"%d\",&x);\n if((x^(x-1))==0) // we check whether a given number is exactly a power of 2 or not by checking whether the XOR of num and num-1 =0 or not\n {\n printf(\"1\");\n }\n else\n {\n while(x > 0) {\n m = 1;\n while(2*m <= n)\n m *= 2;\n res++;\n x =x-m;\n }\n printf(\"%d\",res);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b244c0feb753768de9ee4ab0f4c01e9", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int x,y,n;\n scanf(\"%d %d %d\",&x,&y,&n);\n n=(n-1)%6;\n switch(n)\n {\n case 0:\n if(x<0)\n printf(\"%d\",(1000000007-(-x)%1000000007)%1000000007);\n else\n printf(\"%d\",x);\n return 0;\n case 1:\n if(y<0)\n printf(\"%d\",(1000000007-(-y)%1000000007)%1000000007);\n else\n printf(\"%d\",y);\n return 0;\n case 2:\n if((y-x)<0)\n printf(\"%d\",(1000000007-(x-y)%1000000007)%1000000007);\n else\n printf(\"%d\",(y-x)%1000000007);\n return 0;\n case 3:\n if(-x<0)\n printf(\"%d\"(,1000000007-(x)%1000000007)%1000000007);\n else\n printf(\"%d\",-x);\n return 0;\n case 4:\n if(-y<0)\n printf(\"%d\",(1000000007-(y)%1000000007)%1000000007);\n else\n printf(\"%d\",-y);\n return 0;\n case 5:\n if((-y+x)<0)\n printf(\"%d\",(1000000007-(y-x)%1000000007)%1000000007);\n else\n printf(\"%d\",(-y+x)%1000000007);\n return 0;\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c40231650dea18dcb86c24f31ef97ae1", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\ntypedef long long LL;\nconst int SIZE=20;\nconst LL MOD=1000000007;\n\nint main()\n{\n\tint x,y;\n\tscanf(\"%d%d\",&x,&y);\n\t\tint n;\n\t\tcin>>n;\n\t\tint a[10];\n\t\ta[1]=( (y-x)%MOD + MOD )%MOD;\n\t\ta[2]=( (-x)%MOD + MOD )%MOD;\n\t\ta[3]=( (-y)%MOD + MOD )%MOD;\n\t\ta[4]=((-y+x)%MOD + MOD )%MOD;\n\t\ta[5]=( (x)%MOD + MOD )%MOD;\n\t\ta[0]=( (y)%MOD + MOD )%MOD;\n\t\tprintf(\"%d\\n\",a[(n-2)%6]);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bc033ce9c2b5919e8feb421fd8a1ac6f", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint maini()\n{\n long long x,y,n,ans;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&n);\n int a[6]={x,y,y-x,-x,-y,x-y};\n ans=a[(n-1)%6];\n if(ans<0)ans=(ans%1000000007)+1000000007;\n printf(\"%I64d\",ans%1000000007);\n return 0;\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "790d660a736ea72d9cc9b01c3b286f05", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "\n copy \n#include \nlong long m=1000000007;\nint main(void) {\n\t// your code goes here\n\tlong long n,x,y,h,t,c;\n\tscanf(\"%lld %lld %lld\", &x,&y,&n);\n\tt=y-x;\n \n\tif(n%3==0)\n\t{ c=n/3;\n\t if(c%2==0)\n\t h=-t;\n\t else \n\t h=t;}\n \n\tif(n%3==1)\n\t{ c=n/3;\n\t if(c%2==0)\n\t h=x;\n\t else \n\t h=-x;}\n\t if(n%3==2)\n\t{ c=n/3;\n\t if(c%2==0)\n\t h=y;\n\t else \n\t h=-y;}\n\t if(h<0)\n\tprintf(\"%lld\", m-((-1*h)%m));\n\telse \n\tprintf(\"%lld\", h%m);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b6d280f4cb389de2ef1b50fa21974512", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n\n/*int cmp(const void *a, const void *b)\n{\n return(*(int *)a-*(int *)b);\n}*/\n\n/*int cmp1(const void *a ,const void * b)\n{\n return (*(double *)a>*(double * )b?1:-1);\n}*/\n/*int gcd(int a,int b)\n{\n return b ? gcd(b,a%b) : a;\n}*/\nlong long a[200000008] = {0};\nint main()\n{\n long long n,i;\n scanf(\"%I64d %I64d\",&a[1],&a[2]);\n scanf(\"%I64d\",&n);\n for(i = 3; i <= n; i++)\n {\n a[i] = a[i-1] - a[i-2];\n }\n printf(\"%I64d\",a[n] % 1000000007 > 0 ? a[n] % 1000000007:a[n] + 1000000007);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e40aff4afd1046b43951f2c38baaef21", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,x,p;\n \n if(n%2==0)\n x=(n+1);\n printf(\"%d\",x);\n else\n p=(n+1)/2;\n printf(\"%d\",p);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f1244b9054477dbece8200962f51e186", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint a,b;\nscanf(\"%d\",&a);\nif((a+1)%2==0)\n{\nb=((a+1)/2);\n}\nelse if(n==0)\n{\nb=0;\n}\nelse\n{\nb=a/2;\n}\nprintf(\"%d\",b);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0dd2549e1444aa9ee6eef015099a4fbe", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "main()\n{long long int i,k,;scanf(\"%I64d\",&i);\nk=i+1;if (k%2==0) printf(\"I64%d\",k/2);else printf(\"%I64d\",k);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7bf120653e0ad0d5d8e4ff4d30845a7f", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n, x;\n scanf(\"%d\", %n);\n if (n%2 == 0)\n {\n x = n+1;\n printf(\"%d\", x);\n }\n else\n {\n x = (n+1)/2;\n printf(\"%d\", x);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dcdc0d3081e7309677dd03a709008f97", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nlong long main()\n{\n long long n;\n scanf(\"%lld\",&n);\n if(n==0)\n {\n printf(\"%lld\",n)\n }\n else\n {\n if((n+1)%2==0)\n {\n printf(\"%lld\",(n+1)/2);\n }\n else\n {\n printf(\"%lld\",n+1);\n }\n };\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb378d55956e4ea93bd041e4150c23ea", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint verif(char *ch,char *mdp)\n{ char cha[3]; int i,a=0;\n for(i=0;i\n\nchar passwd[4], str[4];\nint main(){\n scanf(\"%s\", passwd);\n\n int T, num=0, chk=0;\n scanf(\"%d\", &T);\n while (T--) {\n scanf(\"%s\", str);\n if (str[0]==passwd[0] && str[1] == passwd[1])\n chk=4;\n else if (str[1]==passwd[0] && str[0]==passwd[1])\n chk=4;\n else if (str[0]==passwd[1]){\n if (chk<4){\n if (chk==1) chk=4;\n else chk=2;\n }\n }\n else if (str[1]==passwd[0]){\n if( chk<4) {\n if (chk==2) chk=4;\n else chk=1;\n }\n }\n }\n\n if (chk==4) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d883ff685ee4063e944de0216e9a46d", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\t\n\tint n;\n\tchar input[3];\n\tchar parola[3];\n\t\n\tscanf(\"%s\", input);\n\tscanf(\"%d\", &n);\n\t\n\t\n\t//char parole[n][3];\n\tint prima=0, seconda=0;\n\t\n\tint i;\n\tfor(i=0;i\nint main()\n{\n\tbool x=false,y=false;\n\tint i,n,flag=0;\n\tchar a[10],b[10];\n\tscanf(\"%s%d\",&a,&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%s\",&b);\n\t\tif(b[1]==a[1]&&b[0]==a[0])\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(b[0]==a[1])x=true;\n\t\tif(b[1]==a[0])y=true;\n\t\tif(x&&y)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fad1a0caabc2cae0a33cdffaf15f5d6a", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tbool x=false,y=false;\n\tint i,n,flag=0;\n\tchar a[10],b[10];\n\tcin>>a>>n;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tcin>>b;\n\t\tif(b[1]==a[1]&&b[0]==a[0])\n\t\t{\n\t\t\tcout<<\"YES\";\n\t\t\treturn 0;\n\t\t}\n\t\tif(b[0]==a[1])x=true;\n\t\tif(b[1]==a[0])y=true;\n\t\tif(x&&y)\n\t\t{\n\t\t\tcout<<\"YES\";\n\t\t\treturn 0;\n\t\t}\n\t}\n\tcout<<\"NO\";\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2f1b1cb000c25c78c77b526421642ca5", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\tint amount;\n\tscanf( \"%d\", &amount );\n\t\n\tint result;\n\t\n\tif( amount <= 0 )\n\t\tresult = 0;\n\tint d;\n\telse\n\t{\n\t\tint *array;\n\t\tarray = ( int * )malloc( amount * sizeof( int ) );\n\n\t\tint i = 0;\n\t\tfor( ; i < amount; i++ )\n\t\t{\n\t\t\tscanf( \"%d\", &array[ i ] );\n\t\t}\n\n\t\ti = 0;\n\n\t\tfor( ; i < amount; i++ )\n\t\t{\n\t\t\tif( array[ i ] == 1 )\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif( i == amount )\n\t\t\tresult = 0;\n\t\t\n\t\telse\n\t\t{\n\t\t\tresult = 1;\n\t\t\tint variants = 1;\n\t\t\tfor( ; i < amount; i++ )\n\t\t\t{\n\t\t\t\tif( array[ i ] == 0 )\n\t\t\t\t\t++variants;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tresult *= variants;\n\t\t\t\t\tvariants = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree( array );\n\t}\n\n\tprintf( \"%d\\n\", result );\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6567c13927ec6c5bc53f0824e3903caa", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main (int argc, char* argv[])\n{\n\n int s=1;\n int m=0;\n int x;\n int i,j,a;\n int* memoire = NULL;\n scanf(\"%d\",&x);\n memoire = xmalloc(x*sizeof(int));\n for (a=0,i=0;i\n\nint main()\n{\n int n,l=-1,r=0,z=0;\n scanf(\"%d\",&n);\n ll ar[n],cnt[n],scnt=0;\n for(int i=0;il;i--)\n {\n if(ar[i]==1)\n {\n r=i;\n break;\n }\n }\n if(l==-1)\n printf(\"0\");\n else\n {\n if(r==0)\n printf(\"1\");\n else\n {\n for(int i=l+1;i<=r;i++)\n {\n if(ar[i]==1)\n {\n cnt[z++]=scnt+1;\n scnt=0;\n }\n else\n scnt++;\n }\n \n ll mv=1;\n for(int i=0;i\n#include \n\nint main (int argc, char* argv[])\n{\n \n int s=1;\n int m=0;\n int x;\n int i;\n int* memoire = NULL;\n scanf(\"%d\",&x);\n memoire = malloc(x*sizeof(int));\n for (i=0;i\n#include \n#include\n\nint main (int argc, char* argv[])\n{\n int s=1;\n int m=0;\n int i;\n for (i=2;i=O)\n {s=s*m;\n m=0;}\n }printf(\"%d\",s);\n return(0);\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "52a9697798b99f968f1270f2df72e7ca", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n, m;\n scanf(\"%d%d\", &n, &m);\n if (n != 0 || m == 0)\n {\n printf(\"%d %d\\n\", (m > n ? m : n), (m != 0 ? n + m - 1 : n));\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51690064238e1ee56e9cdcbad1c7923c", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if(n){\n printf(\"%d %d\",n+(0>m-n?0:m-n),n+((0>m-1?0:m-1));\n }else{\n printf(\"Impossible\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "be6435348d51c45aece4ec1236ff4542", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,m,max,min;\n\tscanf(\"%d %d\",&n,&m);\n\tif(n==0 && m!=0)\n\tprintf(\"Impossible\");\n\telse\n\t{\n\t\tif(n>=m)\n\t\tmin=n;\n\t\telse\n\t\tmin=m;\n\t\tif(m==0)\n\t\tmax=n;\n\t\telse\n\t\tmax=n+m-1;\n\t\tprintf(\"%d %d\",mn,max);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e728391ae559cd926a76c01624f8118d", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\nint n,m;\n scanf(\"%d%d\",&n,&m);\n if(n==0)\n printf(\"Impossible\");\n else\n { if(n>=m)\n {if(m==0)\n printf(\"%d %d\",n,n)\n else \n printf(\"%d %d\",n,n+m-1);}\n else\n printf(\"%d %d\",m,n+m-1);\n }\n\n return 0;\n } ", "lang_cluster": "C", "compilation_error": true, "code_uid": "c3526f34aba7bbba266b20e976dabec3", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint\nmain (int argc, char *argv[])\n{\n\n int n, m;\n int min, max;\n\n scanf (\"%d %d\", &n, &m);\n\n\n\n if (n == 0)\n {\n if (m > 0)\n\tprintf (\"Impossible\");\n else \n\tprint (\"0 0\");\n }\n else\n {\n if (n >= m)\n\tmin = n;\n else\n\tmin = m;\n if (m > 0)\n\tmax = n + m - 1;\n else\n\tmax = n;\n printf (\"%d %d\", min, max);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "117e93e5af4964f4e721e8dc029a56a3", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,c=0,d,k;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",s);\n d=n/11;\n \n for(i=0; ic){\n printf(\"%d\\n\",c);\n }\n else if(c>=d && c!=0)\n printf(\"%d\\n\",d);\n else\n printf(\"0\\n\");\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "b3d391d78b3ce1aeea32e07d7a56e674", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint x,z,i;std::char[100] y;main(){printf(\"%d %s\",x,y);for(i=0;i\n#include\n\n\nint main()\n{\n int i,n,k,count=0;\n\n char s[1000];\n\n\n scanf(\"%d\",&n);\n\n\n\n scanf(\"%s\",s);\n if(n<11)\n {\n printf(\"0\\n\");\n }\n\n for(i=0;i<=n;i++)\n {\n if(s[i]=='8')\n count++;\n }\n k=n/11;\n\n if(count/k>1)\n {\n printf(\"%d\\n\",k);\n }\n else\n printf(\"%d\\n\",count);\n\n\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b4a2f8a6570903028c60ffa628a2021", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int flag=0,p,empty[0];\n char n,i,j;\n scanf(\"%d\",&n);\n gets(empty);\n char a[n];\n gets(a);\n p=strlen(a);\n\n for(i=0,j=n-1;i0;i++,j--)\n {\n if(a[i] == '8' || a[j] == '8')\n flag=1;\n break;\n }\n if(flag == 1 && a[0]== a[i] || a[0]==a[j])\n {\n printf(\"%d\",p/11);\n }\n else\n printf(\"0\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ca16b7deeb69b1d9caf7c2c9c8508da1", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,\n scanf(\"%d\",&n);\n if(n==4 && n==7){\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "724358a673d53ace1bdb4006f682e12f", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n\tlong long n;\n\tscanf(\"%lld\",&n);\n\twhile(n){\n\t\ts=n%10;\n\t\tn /=10;\n\t\tif(s==4 || s==7)\tc++;\n\t}\n\twhile(c){\n\t\tp=c%10;\n\t\tc /=10;\n\t\tif(p!=4 && p!=7) \tc2++;\n\t\tif(c2>0){\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "370f89a7121dc1a8398ab3bb19e9cc0c", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main(void)\n{\nlong long int k;\nint i,n,count=0,j;\nj=(int)malloc(sizeof(k));\nlong long char lucky[10000];\nscanf(\"%s\",lucky);\nn=strlen(lucky);\nfor(i=0;i\n#include \nint main()\n{\n\tchar num[19];\n\tscanf(\"%s\",&num);\n\tint len=strlen(num),i,count=0;\n\tfor(i=0 ; i\n#include\nint main (){\n int p,q,i,n;\n int c=0;\n for(i=1;i=2)\n c++\n }\n printf(\"%d\",c);\n}\nreturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "e1a31fd3810f453b3463bf0f4ca7038b", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0} {"lang": "GNU C", "source_code": "include\nint main()\n{\n\tint n,d,h;\n\tscanf(\"%d%d\",&n,&d);\n\th=8-d;\n\tswitch (n)\n\t{\n\t\tcase 1:case 3:case 5:case 7: case 8:case 10:case 12: if (\n\t\t\t(31-h)%7==0)\n\t\t\t{\n\t\t\t\tprintf (\"%d\",(31-h)/7+1);\n\t\t\t}\n\t\t\telse printf (\"%d\",(31-h)/7+2);\n\t\t\t;break;weekday of the first date of this month (\n\t\t\tcase 2: if ((28-h)%7==0)\n\t\t\t{\n\t\t\t\tprintf (\"%d\",(28-h)/7+1);\n\t\t\t}\n\t\t\telse printf (\"%d\",(28-h)/7+2);\n\t\t\tbreak;\n\t\t\tcase 4:case 6:case 11: if ((30-h)%7==0)\n\t\t\t{\n\t\t\t\tprintf (\"%d\",(30-h)/7+1);\n\t\t\t}\n\t\t\telse printf (\"%d\",(30-h)/7+2);\n\t\t\tbreak;\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ef903e2accfea8f0357d3e1998cde40a", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,d,h;\n\tscanf(\"%d%d\",&n,&d);\n\th=8-d;\n\tswitch (n)\n\t{\n\t\tcase 1:case 3:case 5:case 7: case 8:case 10:case 12: if (\n\t\t\t(31-h)%7==0)\n\t\t\t{\n\t\t\t\tprintf (\"%d\",(31-h)/7+1);\n\t\t\t}\n\t\t\telse printf (\"%d\",(31-h)/7+2);\n\t\t\t;break;weekday of the first date of this month (\n\t\t\tcase 2: if ((29-h)%7==0)\n\t\t\t{\n\t\t\t\tprintf (\"%d\",(29-h)/7+1);\n\t\t\t}\n\t\t\telse printf (\"%d\",(29-h)/7+2);\n\t\t\tbreak;\n\t\t\tcase 4:case 6:case 11: if ((30-h)%7==0)\n\t\t\t{\n\t\t\t\tprintf (\"%d\",(30-h)/7+1);\n\t\t\t}\n\t\t\telse printf (\"%d\",(30-h)/7+2);\n\t\t\tbreak;\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3f9b74edb6b48dc6e80b46a2b46815ee", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#incude\nint main()\n{\n int a[20]={0,31,28,31,30,31,30,31,31,30,31,30,31};\n int n,m,sum = 0;\n scanf(\"%d%d\",&n,&m);\n a[n] -= fabs(m-8);\n if(a[n]%7!=0)\n sum++;\n printf(\"%d\\n\",sum+a[n]/7+1);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5acb022cd9417f101bf7c97a736e8bda", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n \n int m,d;\n scanf(\"%d%d\",m,d);\n int mday=0;\n switch(d)\n {\n case 1:mday=31;break;\n case 2:mday=28;break;\n case 3:mday=31;break;\n case 4:mday=30;break;\n case 5:mday=31;break;\n case 6:mday=30;break;\n case 7:mday=31;break;\n case 8:mday=31;break;\n case 9:mday=30;break;\n case 10:mday=31;break;\n case 11:mday=30;break;\n case 12:mday=31;break;\n }\n prinf(\"%d\",(d-1)+mday%7==0? (d-1)+mday/7:((d-1)+mday/7)+1);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e66f0557de48e933a202991b719d082d", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nstruct year {\n\tint days;\n};\nint main(void)\n{\n\tstruct year month[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };\n\tint m, d,t,out;\n\n\tscanf_s(\"%d%d\", &m, &d);\n\tt = month[m].days-(7 - d + 1);\n\tif (t % 7 == 0)\n\t\tprintf(\"%d\", t / 7 + 1);\n\telse\n\t\tprintf(\"%d\", t / 7 + 2);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a67c5714c2a5d1c22dfbe3e346a1efb3", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0} {"lang": "GNU C", "source_code": "puts(25);\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "285965dc55d9d99a6a6bfcd96a949781", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n x=25\n printf(\"%d\",x);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1a0a82102a4575aa7ccee7dea472aad9", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n char aj[100];\n long long int x,y,b;\n scanf(\"%lld\",&x);\n if(x==1)\n t=5\n else\n {\n y=pow(5,x);\n t=y+1\n}\nsprintf(aj,\"%d\",t);\nb=strlen(aj);\nprintf(\"%c%c\",aj[b-2],aj[b-1]);\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "07cabe8bfb4b41715b7778d453783d5f", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nint main()\n{\nlong long int n,k,k1,k2;\nscanf(\"%lld\",&n);\nk=pow(5,n);\nif(k<=25)\n printf(\"%lld\\n\",(k+1);\nelse\n{\n k1=k%10;\n k=k/10;\n k2=k%10;\n k=(k2*10)+k1;\n printf(\"%lld\\n\",(k+1);\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8a8d97b065c8fff94c3ee8ac581183e0", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{ \n int n,s;\n scanf(\"%d\",&n);\n s = pow(5,n);\n printf(\"%d\",s);\n return o;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9de1a531ae93768241592dfcd6f75f2c", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n int main()\n{\n int i,j=0,n;\n char s[50];\n scanf(\"%d\",&n);\n scanf(\"%s\",&s)\n for(i=0;i\nint main() {\n char katar[50];\n int sayac=0,i;\n gets(katar);\n while(strstr(katar,\"RR\") || strstr(katar,\"GG\") || strstr(katar,\"BB\")) {\n sayac++;\n katar+=1;\n }\n printf(\"%d\",sayac);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c84f47b68d32ffd0b5f3d915813431d", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nvoid main()\n{\n int n,count=0;\n scanf(\"%d\",&n);\n char s[];\n scanf(\"%s\",&s);\n for(int i=0;i\nint main(){\n int t,c=0,i;\n char a[50];\n scanf(\"%d\",&t);\n scanf(\"%s\",a);\n for(i=0;i\n#include\nint main() {\n int n,i;\n scanf(\"&d\\n\",&n);\n char s[n];\n for(i=0;i\nint main()\n{\n int d,sumTime,minTime=0,maxTime=0;\n scanf(\"%d %d\",&d,&sumTime);\n int a[d],b[d];\n for(int i=0;iminTime)\n {\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "089c9cdc12386a0197a466ef0954dca1", "src_uid": "f48ff06e65b70f49eee3d7cba5a6aed0", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int d,sum,min[30],max[30],avail[30],allot[30],i,summ=0; \n scanf(\"%d %d\",&d,&sum); \n int toallot=sum,alloted=0;\n for(i=0;i=0)\n{\nallot[i]=max[i];\nalloted=alloted-min[i]+max[i];\ntoallot=toallot+min[i]-max[i];\n}\nelse\n{\nallot[i]+=toallot;\n}\ni++;\n} \nprintf(\"YES\\n\"); \nfor(i=0;i\n#include\n\nint main(int argc, char const *argv[])\n{\n int d;\n int a=0;\n int sumtime ;\n scanf(\"%d %d\",&d&sumtime);\n int outln2[d];\n int maxtime[d];\n int mintime[d];\n int verdict = 1;\n for(int i = 0;i\nmain()\n{\n\tfflush(stdout);\n\tint d,sumtime;\n\tscanf(\"%d %d\",&d,&sumtime);\n\tint mintime[d],int maxtime[d];\n\tfor(int i=0;imaxsum)\n\t{\t\n\t\tprintf(\"NO\\n\");\n\t\tfflush(stdout);\n\t}\n\telse\n\t{\n\t\tint hours[d];\n\t\tfor(int i=0;i0)\n\t\t{\n\t\t\tif(sumtime>=(maxtime[i]-mintime[i]))\n\t\t\t{\n\t\t\t\thours[i]+=maxtime[i]-mintime[i];\n\t\t\t\tsumtime=sumtime-(maxtime[i]-mintime[i]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\thours[i]+=sumtime;\n\t\t\t\tsumtime=0;\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i\n#define SIZE 30\n\nint main ()\n{\n int d, sum, min [SIZE], max [SIZE], a [SIZE], count = 0, flag;\n scanf (\"%d %d\", &d, &sum);\n for (int i = 0 ; i < d; i ++)\n {\n scanf (\"%d %d\", &min [i], &max [i]);\n a [i] = min [i]\n count += min [i];\n }\n if (count > sum)\n printf (\"NO\");\n else\n {\n flag = 0;\n for (int i = 0; i < d; i ++)\n {\n if (count - min [i] + max [i] >= sum)\n {\n flag = 1;\n a [i] += sum - count;\n break;\n }\n else\n {\n a [i] = max [i];\n count += max [i] - min [i];\n }\n }\n if (flag)\n {\n for (int i = 0; i < d; i ++)\n printf (\"%d \", &a [i]);\n }\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "684bb03702c7be627d39788ae14f8e47", "src_uid": "f48ff06e65b70f49eee3d7cba5a6aed0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint cmpfun(const void*a,const void*b)\n{\n\treturn(*(int*)a-*(int*)b);\n}\nint main()\n{\n\tint i,j,k,l,m,z=0,w=0,n;int x[10000];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\ncmpfun(const void*a,const void*b)\n{\n\treturn(*(int*)a-*(int*)b);\n}\nint main()\n{\n\tint i,j,k,l,m,z=0,w=0,n;int x[10000];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\ncmpfun(const void*a,const void*b)\n{\n\treturn(*(int*)a-*(int*)b);\n}\nint main()\n{\n\tint i,j,k,l,m,z=0,w=0,n;int a[10000];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n\nint compare (const void * a, const void * b)\n{\n\t return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n],i,j;\n\tfor(i=0;i\n#include\n\n#define MAX_TESTS 100\n\nint num[MAX_TESTS];\nint numTests;\nint min = 0;\nint max = 0;\nint minIndex = 0;\nint maxIndex = 0;\n\nvoid swap(int i, int j){\n\tif(i == j){\n\t\treturn;\n\t}\n\tnum[i] = num[i] ^ num[j];\n\tnum[j] = num[i] ^ num[j];\n\tnum[i] = num[i] ^ num[j];\n}\n\nint compare(const void* x, const void* y){\n\treturn *((int*)x) - *((int*)y);\n}\n\nint main(void){\n\tfscanf(stdin,\"%d\",&numTests);\n\tfscanf(stdin,\"%d\",num);\n\tmin = max = num[0];\n\n\tfor(int i = 1; i < numTests; i++){\n\t\tfscanf(stdin,\"%d\",num + i);\n\t\tif(min > num[i]){\n\t\t\tmin = num[i];\n\t\t\tminIndex = i;\n\t\t}else if(max < num[i]){\n\t\t\tmax = num[i];\n\t\t\tmaxIndex = i;\n\t\t}\n\t}\n\n\tswap(0, maxIndex);\n\tswap(numTests - 1, minIndex);\n\n\tqsort(num + 1, numTests - 2, sizeof(int), &compare);\n\n\tfor(int i = 0; i < numTests - 1; i++){\n\t\tfprintf(stdout,\"%d \",num[i]);\n\t}\n\tfprintf(stdout,\"%d\\n\",num[numTests - 1]);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4aaa65fc99aff5ee2d77d58dce82d108", "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \nint main(int argc, char const *argv[])\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\tfor (int i = 2; i < d; ++i)\n\t{\n\t\tif(a%i == 0){\n\t\t\tprintf(\"%d\",i );\n\t\t\t\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4c533d6c34554c67fbc8f9b97aac4761", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int num, i;\n scanf(\"%d\", &num);3\n for(i = 2;i < num;i++){\n if(num % i == 0){\n printf(\"%d%d\\n\", i, num/i);\n break;\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d91a6b894c4e1391b26f9cabebed6462", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==35)\n {\n printf(\"57\\n\");\n }\n if(n==57)\n {\n printf(\"319\\n\");\n }\n if(n==391)\n {\n printf(\"1723\\n\");\n }\n if(n==1723)\n {\n printf(\"35\\n\")\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2a2dbab517427f101b499f42da9d4a6c", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \nvoid main()\n{\n int n;\n scanf (\"%d\",&n);\n for (int i=2;i<=n;i++)\n {\n if (n%i==0)\n {\n printf(\"%d%d\",i,n/i);\n break;\n }\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2dd837f7e1a9f791bf74f9c355579312", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n\nint main(void)\n{\n int x, i = 2;\n \n scanf(\"%d\", &x);\n \n while(1) if(!(x%i++)) printf(\"%d%d\\n\", i-1, x/(i-1));\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4307d9bc8762b2776a25edc5564b5502", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nlong long int a,b;\nscanf(\"%lld\",&a);\nb=(n*(n+1))/2;\nif(b%2==0)\n{\nprintf(\"1\");\n}\nelse\n{\nprintf(\"0\");\n}\nreturn 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "70f4993df7ef89c5fb796b82dfa04309", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n int sum (int k)\n {\n int sum=0;\n sum=(k*(k+1))/2;\n if(sum%2==0)\n { \n return 0;\n else\n return 1;\n}\n\n int main()\n int k,n;\n scanf(\"%d\",&k);\n n=sum(k);\n printf(\"%d\",n);\n return 0;\n\t\t\t \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4433400698835e29af951235d9b313c8", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "include \n\nint main()\n{\n#ifdef _DEBUG\n>---//freopen(\"input.txt\", \"r\", stdin);\n>---//freopen(\"output.txt\", \"w\", stdout);\n#endif\n>---int n;\n>---scanf(\"%d\", &n);\n>---n %= 4;\n>---if (n == 0 || n == 3)\n>--->---printf(\"0\");\n>---else\n>--->---printf(\"1\");\n>---return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8e8a5d1e317e28900ecaf73b45cca6b", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "include int main(){ int i, j, k; long int n; scanf(\"%ld\", &n); long int sum = 0; sum = n*(n+1)/2; if(sum%2 == 1) printf(\"1\"); if(sum%2 == 0) printf(\"0\"); return 0; }", "lang_cluster": "C", "compilation_error": true, "code_uid": "efce8caa3f9195b3a9dcbdcb08def2c6", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main(){ \nint i, j, k; \nlong int n; \nscanf(\"%ld\", &n); \nlong float sum = 0; sum = n*(n+1)/2;\nif(sum%2 == 1) printf(\"1\");\nif(sum%2 == 0) printf(\"0\"); \nreturn 0; }", "lang_cluster": "C", "compilation_error": true, "code_uid": "acf2c73f81c1801628cc251d77133d71", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nusing namespace std;\nint main()\n{\n int n;\n cin >> n;\n for (int i = 20; i >= 0; i--)\n {\n if (n & (1 << i)) cout << i + 1 << \" \";\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ba9cbd54edb2e431a9fed65bc587a80", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\ntypedef long long ll;\nll x[100005];\nint main()\n{\n\tll top = -1, n;\n\tcin >> n;\n\twhile (n--)\n\t{\n\t\tx[++top] = 1;\n\t\twhile (top >= 0 && x[top - 1])\n\t\t{\n\t\t\t++x[top - 1];\n\t\t\ttop--;\n\t\t}\n\t}\n\tcout << x[1];\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51db79302fd4cb3ed1aacfaaf6e0a5bb", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int za, cvp = 1, x = 0;\n scanf(\"%d\",&za);\n while(n){\n cvp = 1;\n x = 0;\n while(cvp<=za){cvp*=2;x++;}cvp/=2;x--;\n\n\n\n\n\n printf(\"%d \",x+1);\n n-=cvp;\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eeb97a89e62d85cf3ccb1cb97dc82c49", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define inf 0xffffffffff\nint a[inf];\nint n;\nvoid work(){\n\tint i;\n\tint x=n;\n\tint count=0;\n\tint m=1;\n\twhile(x){\n\t\tif(x%2){count++;a[m]=1;}\n\t\tx/=2;\n\t\tm++;\t\n\t}\n\tfor(i=m;i>0;i--){\n\t\tif(count>1&&a[i]){printf(\"%d \",i);count--;}\n\t\telse if(a[i]){printf(\"%d\\n\",i);break;}\n\t}\n\treturn ;\n}\nint main(){\n\twhile(~scanf(\"%d\",&n)){\n\t\tmemset(a,0,sizeof(a));\n\t\twork();\t\n\t}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f02e82ed0b321cd930303e510fa962e7", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n//using namespace std;\nlong highestPO2(long n)\n{\n for(int i=0;1==1;i++)\n {\n if(pow(2,i+1)>n)\n {\n return i;\n }\n }\n return -1;\n}\nint main()\n{\n long n;\n cin>>n;\n while(n)\n {\n int t = highestPO2(n);\n cout<\n\nusing namespace std;\n\nint main()\n{\n int l,i,cnt=0,a[100],j=0,grp=0,n;\n char s[105];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0; i0)\n {\n a[j]=cnt;\n j++;\n grp++;\n }\n cnt=0;\n }\n }\n if(cnt>0)\n {\n grp++;\n a[j]=cnt;\n }\n else\n j--;\n printf(\"%d\\n\",grp);\n if(j>=0)\n {\n for(i=0; i\nmain()\n{\n int n,i,j,t,g[100]={0};\n \n char s[105];\n \n j=t=outer=0;\n \n scanf(\"%d\",&n);\n \n for(i=0;i\nmain()\n{\n char a;\n int n,i,j=0,k=0,d[100];\n scanf(\"%d\",&n);\n for(i=0;i\n#include \n\nchar dizi[100];\nint counter=0;\n\nint main(){\n\tscanf(\"%s\",dizi);\n\tfor(int i=0;i\n#include \nint cur=0;\nint data[100]={0};\nint count;\nvoid add(int num){\n\tdata[cur]=num;\n\tcur++;\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar str[105]={'W','W'};\n\tscanf(\"%s\",str+2);\n\tstr[n+2]='W';\n\tstr[n+3]='W';\t\n\tchar prech='W',ch;\n\tbool in=false;\n\tfor(int i=1;i\nint main(){\nchar s[4][5];\nint i,j;\nfor(i=0;i<4;i++) {\nscanf(\"%s\",s[i]);\n\uff5d\n \nint find=0;\n for(i=0;i<3 && !find;i++) {\n for(j=0;j<3 && !find;j++) {\nint dot=0;\nint pound=0;\n if(s[i][j]=='.') dot++;\n else pound++;\n if(s[i+1][j]=='.') dot++;\n else pound++;\n if(s[i][j+1]=='.') dot++;\n else pound++;\n if(s[i+1][j+1]=='.') dot++;\n else pound++;\nif(dot>2 || pound>2) {\nfind=1;\n }\n }\nif(find)printf(\"YES\\n\");\nelse printf(\"NO\\n\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ccbe9ef43eabaecc4faedebedd4ee6df", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main (\uff09 \uff5b\n char s[4][5];\n int i,j;\n for(i=0;i<4;i++){\n scanf(\"%s\",s[i]);\n \uff5d\n int find=0;\n for(i=0;i<3 && !find;i++) {\n for(j=0;j<3 && !find;j++) {\n int dot=0;\n int pound=0;\n if(s[i][j]=='.') dot++;\n else pound++;\n if(s[i\uff0b1][j]=='.') dot++;\n else pound++;\n if(s[i][j+1]=='.') dot++;\n else pound++;\n if(s[i+1][j+1]=='.') dot++:\n \n else pound++;\n if(dot>2 || pound>2) find=1;\n }\n }\n if(find)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "a41f2e1149240369e7da40e304e57bba", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "GNU C", "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 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 ", "lang_cluster": "C", "compilation_error": true, "code_uid": "49fcdc9b4d7302ca9a396478517f685a", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main() {\n char s[4][5];\n int i,j;\n for(i=0;i<4;i++) {\n scanf(\"%s\",s[i]);\n }\n int find=0;\n for(i=0;i<3 && !find; i++) {\n for(j=0;j<3 && !find; j++) {\n int dot=0;\n int pound=0;\n if(s[i][j]=='.') dot++;\n else pound++;\n if(s[i+1][j]=='.') dot++;\n else pound++;\n if(s[i][j+1]=='.') dot++;\n else pound++;\n if(s[i+1][j+1]=='.') dot++;\n else pound++;\n if(dot>2 || pound>2) find=1;\n }\n if(find) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fdc05b1b48205e923ac2873a013d9dc3", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bd937a4972515c6abd38461562f1e3a2", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0} {"lang": "GNU C", "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 \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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c735d651c886aecae62b93792bde313", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "/* In THe name of ALLAH\n == Muhammad Tanvir == */\n\n#include \n\nint main(){\n int n, m;\n scanf(\"%d%d\",&n,&m);\n if(n !=1){\n printf(\"%d\",(m-1 >= n-m ? m-1 : m+1));\n }\n else\n printf(\"1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "632c90b1d061a45b311ab5e2c7aa96d3", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "/* In THe name of ALLAH\n == Muhammad Tanvir == */\n\n#include \n\nint main(){\n int n, m;\n scanf(\"%d%d\",&n,&m);\n if(n != 1){\n printf(\"%d\",(m-1 >= n-m ? m-1 : m+1));\n }\n else\n printf(\"1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ee41d3804904a2c7e487088fbac3a048", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "76b42c1f5fcf32df265dcd800e66ca3d", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tfloat n,t,m;\n\tint a,temp,temp2;\n\ttemp=n;\n\ttemp2=m;\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(temp==((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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3dfa3ebd4443ba896ecaa7b75c3a11a7", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint check(int a, int b, int c)\n{\n\tint ok1 = 1; int ok2 = 1; int ok3 = 1;\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\n\treturn (ok1 && ok2) && ok3f;\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\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\n\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\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "420d2997dee7a301229a286dac597e55", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#inculde \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||a+c>d||a+d>c||c+d>a||b+c>d||b+d>c||c+d>b) printf(\"TRIANGLE\");\n else if(a+b=c\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5304160997e67758c968bdac502b5d41", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include//a\n\nint main(){\n int in[4];\n for(int i=0;i<4;i++){\n scanf(\"%d\",in+i);\n }\n \n sort(in,in+4);\n \n if(in[0]+in[1]>in[2]||in[1]+in[2]>in[3]) printf(\"TRIANGLE\\n\");\n else if(in[0]+in[1]==in[2]||in[1]+in[2]==in[3]) printf(\"SEGMENT\\n\");\n else printf(\"IMPOSSIBLE\\n\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a0a3db1aad84e1fc04d42d0b5cba80b0", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#inculde \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||a+c>d||a+d>c||c+d>a||b+c>d||b+d>c||c+d>b) printf(\"TRIANGLE\");\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) printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d616fa09651134febc27be0eaf9cd368", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \nint n,u[5],a[7],ton[10];\nbool b;\nvoid dfs(int i){\n if(i>3){\n if(u[1]\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint c[n],count[n];\n\n\tfor (int i = 0; i < n; ++i)\n\t{ count[i]=1;\n\t\tscanf(\"%d\",&c[i]);\n\t}\n\tfor (int i = 0; i < n; ++i)\n\t{\t\n\t\tfor (int j = i+1; j < n; ++j)\n\t\t{\n\t \tif(c[i]==c[j])\n {\n \tcount[i]++;\n }\n }\n\n\t}\n\n\tint max=count[0];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t if(count[i]>max)\n\t\t{max=count[i];}\n\t}\n\tprintf(\"%d\\n\",max);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "df7952f8fcb0b9b068a46cf0084f1382", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int i, j, nbrCoins, count_same_value = 1, value_already_present = 0;\n scanf(\"%d\", &nbrCoins);\n \n int *coin_value = (int *)malloc(nbrCoins * sizeof(int));\n \n for (i = 0; i < nbrCoins; i++)\n {\n scanf(\"%d\", &(*(coin_value + i)));\n \n value_already_present = 0\n for (j = 0; j < i; j++)\n {\n if (*(coin_value + i) == *(coin_value + j))\n {\n value_already_present++;\n }\n }\n \n if (value_already_present > 0)\n {\n count_same_value += value_already_present\n }\n }\n \n printf(\"%d\\n\", count_same_value);\n \n free(coin_value);\n return 0;\n}\n// End of main", "lang_cluster": "C", "compilation_error": true, "code_uid": "262efdb76d4de6f76cefbf1d32ff4607", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n,t;\n scanf(\"%d\",&n);\n int a[100];\n for(int i=0;im)\n m=a[t];\n }\n printf(\"%d\\n\",m);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e0cb27c8bd63c666977be707061c25af", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n=0;\n scanf(\"%d\",&size);\n int arr[size];\n for(int i=0;i=max){\n max=freq[i];\n }\n }\n printf(\"%d\",max);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8f2e0e31b56fa32deab86a6b68729e7", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#define PROB \"a\"\nusing namespace std;\nint dau[105]={0};\nint maxx=0;\nint n;\n\nvoid Nhap()\n{\n int tmp;\n scanf(\"%d\",&n);\n for(int i=0; imaxx) maxx=dau[tmp];\n }\n printf(\"%d\",maxx);\n}\n\nint main()\n{\n //init();\n Nhap();\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5abaa792954a9ebe240a30aca751aa08", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nvoid search_min(int min[], int length, int sum);\nvoid search_max(int max[], int length, int sum);\n\nint main(void)\n{\n int length, sum, k, i;\n scanf(\"%d %d/n\", &length, &sum);\n int max[length], min[length];\n \n if (length* 9 < sum && (length > 1 && sum == 0)) {\n printf(\"-1 -1\");\n return 0;\n }\n \n search_min(min, length, sum);\n printf(\" \");\n search_max(max, length, sum);\n \n return 0;\n}\n\nvoid search_min(int min[], int length, int sum)\n{\n int i, k = length;\n for (i = 0; length > 0; length--) {\n if (length == 1) min[i] = sum;\n if (length == 2) {\n if (sum >= 10) {\n min[i++] = 9, sum -= 9, length--;\n min[i] = sum;\n }\n else {\n min[i++] = sum - 1, sum = 1, length--;\n min[i] = sum;\n }\n }\n if (length > 2) {\n if (sum >= 10) min[i++] = 9, sum -= 9;\n else if (sum > 1) {\n min[i++] = sum - 1, sum = 1, length--;\n min[i] = sum;\n }\n else min[i] = sum;\n }\n }\n for ( ; i >= 0; i--) printf(\"%d\", min[i]);\n}\n\nvoid search_max(int max[], int length, int sum) \n{\n int i;\n for (i = 0; length > 0; length--) {\n if (length == 1) max[i] = sum;\n if (length == 2) {\n if (sum >= 10) {\n max[i++] = 9, sum -= 9, length--;\n max[i] = sum;\n }\n else {\n max[i++] = sum, sum = 0, length--;\n max[i] = sum;\n }\n }\n if (length > 2) {\n if (sum >= 10) max[i++] = 9, sum -= 9;\n else if (sum > 0) max[i++] = sum, sum = 0;\n else max[i++] = sum;\n }\n }\n for (i = 0; i <= k - 1; i++) printf(\"%d\", max[i]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "123c492244cdbf7abee9a955ead5725d", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint a[100],b[100];\nint main()\n{\n int m,s,i,x;\n scanf(\"%d %d\",&m,&s);\n if(m>1&&s==0||s>9*n) printf(\"-1 -1\");\n else\n {\n a[0]=1;x=s-1;\n for(i=m-1;i>=0;i--)\n {\n if(x>=9)\n {\n x-=9;\n a[i]+=9;\n }\n else\n {\n a[i]+=x;\n x=0;\n }\n }\n x=s;\n for(i=0;i=9)\n {\n x-=9;\n b[i]+=9;\n }\n else\n {\n b[i]+=x;\n x=0;\n }\n }\n for(i=0;i\n#include\n#include\nint so(int n , int s1)\n{\n\tif(s1<=9)\n\t{\n\t\tif(n!=1)\n\t\t{\n\t\t\tif(s1-1<0)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s1-1;\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(s1>1)\n\t\t\t\treturn s1;\n\t\t\telse\n\t\t\t\treturn 1;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn 9;\n\t}\n}\nint main()\n{\n\tint m , s , n, s1;\n//\tFILE *f;\n//\tf = fopen(\"1400.inp\",\"rt\");\n//\tfscanf(f,\"%d\",&m);\n//\tfscanf(f,\"%d\",&s);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&s);\n\tint a[m];\n\tn=m;\n\ts1=s;\n\tif(s==0 && m==1)\n\t{\n\t\tprintf(\"%d\\t%d\",0,0);\n\t}\n\telse if (s < 1 || (m*9)< s )\n\t{\n\t\tprintf(\"%d\\t%d\",-1,-1);\n\t}\n\telse\n\t{\n\t\tfor(int i =m-1 ; i>=0; i--)\n\t\t{\n\t\t\ta[i]=so(n,s1);\n\t\t\tn -=1;\n\t\t\ts1-=a[i];\n\t\t}\n\t\tif(a[m-1]==9 || a[m-1]==0)\n\t\t{\n\t\t\tif (s<2)\n\t\t\t{\n\t\t\t\tfor(int kk =0 ; kk=9)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tttt -=9;\n\t\t\t\t\t\t\tprintf(\"%d\",9);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(s>0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"%d\",ttt)\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\tprintf(\"%d\",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\t}\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint ttt = 0;\n\t\t\tfor(int kk =0 ; kk\n#include\nint so(int n , int s1)\n{\n\tif(s1<=9)\n\t{\n\t\tif(n!=1)\n\t\t{\n\t\t\tif(s1-1<0)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s1-1;\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(s1>1)\n\t\t\t\treturn s1;\n\t\t\telse\n\t\t\t\treturn 1;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn 9;\n\t}\n}\nint main()\n{\n\tint m , s , sodu , songuyen , n , s1 ;\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&s);\n\tint a[m];\n\tint b[m];\n\tn=m;\n\ts1=s;\n\tfor(int i =m-1 ; i>=0; i--)\n\t{\n\t\ta[i]=so(n,s1);\n\t\tb[i]=a[i];\n\t\tn -=1;\n\t\ts1-=a[i];\n\t}\n\tfor(int j =0 ; j\n#include\n\nint main(){\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint max= 0,clo=m;\n\t\n\tfor(int i=0;i=9){\n\t\t\tmax+= 9*pow(10,n-i-1);\n clo-=9;\n }\n else{\n max+= clo*pow(10,n-i-1);\n clo-=clo;\n break;\n }\n\t}\n if(clo!=0 || m==0){\n printf(\"-1 -1\");\n return 0;\n }\n int min=max,r=0;\n while (min != 0)\n {\n r = r * 10;\n r = r + min%10;\n min = min/10;\n }\n if(r==1){r?=10;}\n\tprintf(\"%d %d\",r,max);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c9801e57291a76711bf22b40cfac132f", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main ()\n\n{\n int i,l1,l2,c=0;\n char s1[120],s2[120];\n scanf(\"%s\",s1);\n scanf(\"%s\",s2);\n l1=strlen(s1);\n l2=strlen(s2);\n if(l1!=l2)\n printf(\"NO\");\n break;\n else {\n for(i=0;i\n\nint main() {\n #include \n#include \nint main() {\n int i,j,ctr=0,len1,len2;\n char s[1001].t[1001];\n scanf(\"%s\",&s);\n scanf(\"%s\",&t);\n len1=strlen(s);\n len2=strlen(t);\n for(i=len1-1,j=0;i>=0&&j\n#include\nint main() {\n char s1[100],s2[100];\n scanf(\"%s\",s1);\n scanf(\"%s\",s2);\n int c=0,l1=strlen(s),l2=strlen(t);\n for(i=0,j=12-1;i\n#include\nint main()\n{\n char a[10000],b[10000];\n scanf(\"%s%s\",a,b);\n if(strrev(a)==b)\n printf(\"YES\");\n else\n printf(\"NO\");\n printf(strrev(a))\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a0db5e784d1d0f32fffffff4368bc15b", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n char st[101],ss[101];\n scanf(\"%s%s\",&st,&ss);\n int i,x,c=0;\n x=strlen(st);\nint j;\nj=x-1\n for(i=0;i\nint main()\n{\n int i,j,n,m,r=0,c=0,s;\n\tscanf(\"%d%d\",&n,&m);\n\tchar a[n][m+1];\n\tint arr[m]={0};\n\tfor(i=0;i\n#include \nint main()\n{\n\tint r,c;\n\tcin>>r>>c;\n\tchar a[r][c];\n\tchar b[r],d[c],f[c];\n\tfor(int i=0;i\n#include \n\nint main(){\nint n,m;\nscanf(\"%d %d\",&n,&m);\nchar a[n][m];\nint i,j;\nfor(i=0;i\n#include\n#include\nchar s[10][10];\nint map[10][10];\nint main()\n{\n int n,m;\n int flag,count;\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n count=0;\n memset(map,0,sizeof(0));\n for(int i=0;i\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n==2)\n{\nprintf(\"2\");\n}\nelse\n{\nprintf(\"1\");\n}\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "47b11e27a0785b3e0322de0f3601a1fb", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\t\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "55ecd9ea210a6e53090c7b561bcc4b37", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(void) {\n\tint n;\n\tscanf(\"%d\",&n);\n n=n-(n-1);\n printf(%d\",&n);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "72a1014661c5cf5de0ce7482f22efb08", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n cout << \"Hello world!\" << endl;\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e14d3cdac74db88f833fdb5e8abd5d4e", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "8ca5a505b9e9c80a5b1dabd20c6360f6", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n long long n,i;\n scanf(\"%I64d\",&n);\n i=1;\n while(n-i>0)\n {\n n-=i;\n i++;\n }\n printf(\"%I64d\",n)\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d0b429420972ebe0ee0e358ef5775379", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n#define ll long long int\n#define ull unsigned long long int\n#define inf (INT_MAX/10)\n#define linf (LLONG_MAX/10LL)\n#define sc(a) scanf(\"%d\",&a)\n#define sc2(a,b) scanf(\"%d%d\",&a,&b)\n#define sc3(a,b,c) scanf(\"%d%d%d\",&a,&b,&c)\n#define sc4(a,b,c,d) scanf(\"%d%d%d%d\",&a,&b,&c,&d)\n#define fl(c,i,n) for(i=c;i\n#define pll pair< ll , ll >\n#define pcs(a) printf(\"Case %d: \", a)\n#define nl puts(\"\")\n#define endl '\\n'\n#define dbg(x) cout<<#x<<\" : \"< inline T bigmod(T p,T e,T M){ll ret = 1;for(; e > 0; e >>= 1){if(e & 1) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}\ntemplate inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}\ntemplate inline T modinverse(T a,T M){return bigmod(a,M-2,M);} // M is prime}\ntemplate inline T bpow(T p,T e){ll ret = 1;for(; e > 0; e >>= 1){if(e & 1) ret = (ret * p);p = (p * p);}return (T)ret;}\n\nint toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}\nint toLlint(string s){long long int sm;stringstream ss(s);ss>>sm;return sm;}\n\n\n///int mnth[]={-1,31,28,31,30,31,30,31,31,30,31,30,31}; //Not Leap Year\n///int dx[]={1,0,-1,0};int dy[]={0,1,0,-1};//4 direction\n///int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction\n///int kdx[]={2,1,-1,-2,-2,-1,1,2};int kdy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction\n///int dx[]={-1,+1,0,1,0,-1}; // Hexagonal Direction **\n///int dy[]={-1,+1,1,0,-1,0}; // *#*\n/// **\nconst double eps=1e-9;\n\n#define M 1000005\n#define MD 1000000007LL\n#define MX 100005\n\nint ts,kk=1;\n\n#define intx(i,j,k,l) ((a[i]*b[j]-b[i]*a[j])*(a[k]-a[l])-(a[i]-a[j])*(a[k]*b[l]-b[k]*a[l]))/((a[i]-a[j])*(b[k]-b[l])-(b[i]-b[j])*(a[k]-a[l]))\n#define inty(i,j,k,l) ((a[i]*b[j]-b[i]*a[j])*(b[k]-b[l])-(b[i]-b[j])*(a[k]*b[l]-b[k]*a[l]))/((a[i]-a[j])*(b[k]-b[l])-(b[i]-b[j])*(a[k]-a[l]))\n#define dst(u,v,x,y) sqrt((x*1.0-u*1.0)*(x*1.0-u*1.0)+(y*1.0-v*1.0)*(y*1.0-v*1.0))\n#define area(i,j,k) ((ll)x[i]*y[j]+(ll)x[j]*y[k]+(ll)x[k]*y[i]-(ll)y[i]*x[j]-(ll)y[j]*x[k]-(ll)y[k]*x[i])\n\nll n,x;\n\nint main()\n{\n int t,i,j,k,l;\n\n cin>>n;\n\n for(x=1;x\n\nusing namespace std;\n\nint main()\n{\n int i;\n long long n;\n i=1;\n cin>>n;\n while(n-i>0)\n {\n n-=i;\n i++;\n }\n cout<\n#define MAX 100000000000\nint main(){\n\tint n;\n\tint i;\n\tscanf(\"%d\",&n);\n\tint g=1;\n\tint f=0;\n\tint arr[MAX]={0};\n\twhile(g!=1000){\n\t\tfor(i=1;i<=g;i++)\n\t\t{\n\t\t\tarr[f]=i;\n\t\t\tf++;\n\t\t}\n\t\tg++;\n\t}\n\tprintf(\"%d\",arr[n-1]);\n\t\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "adc15b89cd797a5903f1556649002f86", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\n\nvoid main (){\n long long n,i=1;\n scanf(\"%lld\",&n);\n while ((i*(i+1))/2 < n){\n i++;\n \n \n \n }\n i--;\n printf (\"%lld\", n- ((i*(i+1))/2) )\n \n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7f556a501f32f3baea861158fd66552c", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\n\ntypedef long long ll;\n\nint main()\n{\n ll ax, ay, bx, by, cx, cy;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&ax,&ay,&bx,&by,&cx,&cy);\n\n if( ay==bx && by==cx && cy==ax) printf(\"Yes\");\n else\n printf(\"No\");\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1c08ee1041c0aa0669062618c7766c6", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#define tor 0.00000001\n\n//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05b8\ufffd\ufffd\ufffd\u0123\ufffd\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u03f8\ufffd\ufffd\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\u00fb\ufffd\ufffd\u00a9\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03a7(\ufffd\ufffd\ufffd\u03a1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03a1\ufffd\u02b5\ufffd\u0361\ufffdfabs\ufffd\ufffdabs\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd)\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd(int64=at least one int64* others)\ufffd\ufffd\u00fb\ufffd\u0433\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ub862\ufffd\ufffd\ufffd\ufffd\ufffd\u03a7\ufffd\ufffd\u00fb\ufffd\u0433\ufffd\ufffd\ufffd\n\nint main()\n{\n long ax,ay,bx,by,cx,cy;\n double k1,k2,dx,dy;//dx,dy:double!!!\n bool vis1,vis2;\n scanf(\"%ld%ld%ld%ld%ld%ld\",&ax,&ay,&bx,&by,&cx,&cy);\n if (ax==cx && ay==cy)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if (ax+cx==bx*2 && ay+cy==by*2)\n {\n printf(\"No\\n\");\n return 0;\n }\n vis1=true;\n vis2=true;\n if (cx-ax!=0)\n k1=1.0*(cy-ay)/(cx-ax);\n else\n vis1=false;\n dx=1.0*(ax+cx)/2;\n dy=1.0*(ay+cy)/2;\n if (fabs(bx-dx)>tor)\n k2=1.0*(by-dy)/(bx-dx);\n else\n vis2=false;\n\n if ((vis1==false && vis2==true && fabs(k2-0)\n\n#define sq(A) ((A)*(A))\n\nint main(){\n\tint i, x[3], y[3];\n\tfor(i=0;i<3;++i) scanf(\"%d %d\", x+i, y+i);\n\tif(sq(x[0]-x[1])+sq(y[0]-y[1])==sq(x[2]-x[1])+sq(y[2]-y[1]) || \n\t\tsq(x[2]-x[1])+sq(y[2]-y[1])==sq(x[0]-x[2])+sq(y[0]-y[2]) || \n\t\tsq(x[0]-x[1])+sq(y[0]-y[1])==sq(x[0]-x[2])+sq(y[0]-y[2])) puts(\"Yes\");\n\telse puts(\"No\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e9baa5ec06bcddaf02ac1aeda88325dc", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(void)\n{\n\tlong long int ax,ay,bx,by,cx,cy,d1,d2,d3;\n\tdouble a,b,c;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&ax,&ay,&bx,&by,&cx,&cy);\n\td1=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);\n\ta=sqrt(d1);\n\td2=(cx-bx)*(cx-bx)+(cy-by)*(cy-by);\n\tb=sqrt(d2);\n\td3=(cx-ax)*(cx-ax)+(cy-ay)*(cy-ay);\n\tc=sqrt(d3);\n\tif(a==b) {\n\t\tif((ax==bx && ax==cx) || (ay==by && ay==cy))\n\t\t\tprintf(\"No\");\n/*\t\tif(d1+d2==d3)\n\t\t\tprintf(\"Yes\");\n\t\telse if(a==c)\n\t\t\tprintf(\"Yes\");*/\n\t\telse\n\t\t\tprintf(\"Yes\");\n\t}\n\telse\n\t\tprintf(\"No\");\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b956184d6f403acefc266c4eb39f3d46", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "{ \n long long x1,y1,x2,y2,x3,y3,k1,k2,d1,d2; \n scanf(\"%lld%lld%lld%lld%lld%lld\",&x1,&y1,&x2,&y2,&x3,&y3); \n d1=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); \n d2=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3); \n if(d1!=d2) \n { \n printf(\"No\\n\"); \n return 0; \n } \n if((x2-x3)*(y1-y2)==(x1-x2)*(y2-y3)) \n { \n printf(\"No\\n\"); \n } \n else \n printf(\"Yes\\n\"); \n return 0; \n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "60161f7ecdb5c259c98892fbc750e95f", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n if(n>0){cout<<\"The number is postisve\"<\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\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#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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2bbb1c9c3e36529344fef382090ccae6", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n int m,j,k,n,w;\n scanf(\"%d%d%d\", &k,&n,&w);\n for(int m=1;m<=w;m++)\n {\n j+=n-k*m;\n n-=k*m;\n }\n if(a<0) printf(\"%d\", -n);\n else printf(\"%d\", n);\n\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a2e3793497188369c1cb6cbe36d95c19", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "GNU C11", "source_code": " #include \n \n int main() {\n int k,n,w,borrow;\n int cost=0,rate;\n scanf(\"%d%d%d\",&k,&n,&w);\n for(i=0;i\n#include\nint main()\n{\n long long int k,n,w,i,a=0,s;\n scanf(\"%lld %lld %lld\",&k,&n,&w);\n for(i=1;i<=w;i++)\n {\n a+=(i*k);\n }\n s=a-n;\n if(a<=w)\n printf(\"0\");\n else\n printf(\"%lld\",s);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ad7bf596893e55e71baa32021aa6b226", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a==c){\n printf(\"0\")\n }\n else{\n d=b-c;\n printf(\"%d\",d);}\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f6e903b5307ac7f3956487e547db1491", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n\tint i;\n\tint j;\n\tint a;\n\tint b;\n\tint c;\n\tint d;\n\tint e;\n\tint f;\n\tint g;\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\tscanf(\"%d\", &c);\n\tfor (i=1;i<=c;i++)\n\t{\n\t d=i*c\n\t}\n\tprintf(\"%d\", d);\n\treturn 0;\t\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3c0a8742c3000dd3868d413a4fb4adc1", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nchar str[101];\nint main()\n{\n scanf(\"%s\", str);\n int len = 1, index = 0, result = 0;\n while(str[index++]) {\n if (str[index] == str[index - 1]) {\n len++;\n } else {\n if (len % 2 == 0)\n result++;\n len = 1;\n }\n }\n printf(\"%d\\n\",result);\n}\n~", "lang_cluster": "C", "compilation_error": true, "code_uid": "90251621cae6ff03822a0672e0e75ae8", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \"string.h\"\n#include \"stdio.h\"\nusing namespace std;\n\nint main(){\n char s[101];\n int i, j, len, numA=0, toAdd=0;\n\n scanf(\"%s\", s);\n\n len = strlen(s);\n\n for(i = 0; i < len; i++){\n numA = 0;\n for(j = i; s[i] == s[j]; j++){\n numA++;\n }\n i = j - 1;\n if(!(numA % 2)){\n toAdd++;\n }\n }\n printf(\"%d\\n\", toAdd);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5ee0d262d0d5473a327c98d412e0d19a", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "GNU C", "source_code": "\n#include \nint k=0;\nint main()\n{\n char arr[1000];\n scanf(\"%s\",arr);\n int i,j=0,counter=0;\n\n for(i=0;arr[i+1]!='\\0';i++)\n {\n if(arr[i]!=arr[i+1])\n {\n\n j=(i+1)-k;\n\n\n if(j%2==0)\n {\n\n\n counter++;\n\n\n }k=i+1;\n }\n }\n printf(\"%d\",counter);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "079da82fedf45bd85e822ac7b4d6f5d4", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n=0,cnt=1,no=0;\n char ch,ch1='1';\n while((ch=getchar())!='\\n')\n {\n if(ch1!='1')\n {\n if(ch==ch1)\n cnt++;\n else{\n ch1=ch;\n if(cnt%2==0 && cnt!=1)\n no++;\n cnt=1;\n n++;\n }\n }\n else{\n ch1=ch;\n n++;\n }\n\n }\n if(n%2==0)\n printf(\"%d\\n\",no);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "000d770dab885d6b00744e67b748e565", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\n\nvoid main() {\n\tchar *s = (char*)malloc(sizeof(char)*101);\n\tscanf(\"%[^\\n]\",s);\n\tint result = 0;\n\tint i=0,j=0;\n\twhile(s[i]!='\\0') {\n\t\tj=i+1;\n\t\tint count = 1;\n\t\twhile(s[j]!='\\0' && s[i]==s[j]) {\n\t\t\tcount++;\n\t\t\tj++;\n\t\t}\n\t\tif(count%2==0) {\n\t\t\tresult++;\n\t\t}\n\t\tif(j=='\\0') {\n\t\t\tbreak;\n\t\t}\n\t\ti=j;\n\t}\n\tprintf(\"%d\",result);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8313fcbd5c20e09b5d3dda8a11ff60ab", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n//#include \n\nint main()\n{\n int n,t;\n char c[n];\n\n scanf(\"%d %d\",&n,&t);\n\n for(int i=0; i\nvoid main{\n int n,t;\n scanf(\"%d %d\",&n,&t);\n char queue[n];\n char temp;\n for(int k=0;k\nint main()\n{\n int n,t,i,j;\n char s[52];\n scanf(\"%d%d\",&n,&x);\n scanf(\"%s\",s);\n for(j=0; j\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); \n\tchar c[m];\n\tint a=0;\n\tbool cek[m];\n\tfor(int 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); \n\tchar c[m];\n\tint a=0;\n\tbool cek[m];\n\tfor(int i=0;i\nint gcd(long long int a,long long int b);\nint main()\n{\n long long int a,b,x,y,w,h,i=0;\n scanf(\"%lli%lli%lli%lli\",&a,&b,&x,&y);\n w=x/gcd(x,y);\n h=y/gcd(x,y);\n\n\n\n for(i=1;w*i<=a&&h*i<=b;i++);\n\n\n\nprintf(\"%lli\",i-1);\n}\nint gcd(long long int a, long long int b)\n{\n long long int t;\n if(a>b)\n {\n a=a+b;\n b=a-b;\n a=a-b;\n }\n while(b%a!=0)\n {\n t=a;\n a=b%a;\n b=t;\n }\n return a;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1e0551112c5fd533c897872ed994917d", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main(){\n\tlong long a,b,x,y,count=0,m,n,l,k,gcd;\n\tscanf(\"%I64d %I64d %I64d %I64d\",&a,&b,&x,&y);\n\tm=x;n=y;\n\twhile(m!=n)\n\t{\n\t\tif(m>n)\n\t\tm=m-n;\n\t\t\n\t\tif(n>m)\n\t\tn=n-m;\n\t}\n\tgcd=m;\n\ty=y/m;\n\tx=x/m;\n\n\tif(a/x>b/y)\n\tprintf(\"%I64d\",b/y);\n\telse \n\tprintf(\"%I64d\",a/x);\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7230133aa8f62778ba25e642f4e13f92", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nunsigned long long int gcd(unsigned long long int a,unsigned long long int b)\n{\n\t// long long int f=-1;\n\tif(a==0)\n\t\treturn b;\n\telse if(b==0)\n\t\treturn a;\n\telse if(a==1 || b==1)\n\t\treturn 1;\n\telse if (a>b)\n\t\treturn gcd(b,a%b);\n\telse if (ab)\n\t// \ta=a%b;\n\t// else if (ay)\n\t\tprintf(\"%llu\\n\",r1);\n\telse\n\t\tprintf(\"%llu\\n\",r2);\n\t// for(i=1;x*i<=a && y*i<=b;i++)\n\t// {\n\t// \tcnt++;\n\t// }\n\n\t// printf(\"%lld\\n\",cnt );\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bdcb2a5665ec45a761d88ad1ef5c5860", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nunsigned long long int gcd(unsigned long long int a,unsigned long long int b)\n{\n\t// long long int f=-1;\n\tif(a==0)\n\t\treturn b;\n\telse if(b==0)\n\t\treturn a;\n\telse if(a==1 || b==1)\n\t\treturn 1;\n\telse if (a>b)\n\t\treturn gcd(b,a%b);\n\telse if (ab)\n\t// \ta=a%b;\n\t// else if (ay)\n\t\tprintf(\"%llu\\n\",r1);\n\telse\n\t\tprintf(\"%llu\\n\",r2);\n\t// for(i=1;x*i<=a && y*i<=b;i++)\n\t// {\n\t// \tcnt++;\n\t// }\n\n\t// printf(\"%lld\\n\",cnt );\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bbb0b323c1498a221ff3bf164f83519b", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nlong long int gcd(long long int a,long long int b)\n{\n\t// long long int f=-1;\n\tif(a==0)\n\t\treturn b;\n\telse if(b==0)\n\t\treturn a;\n\telse if(a==1 || b==1)\n\t\treturn 1;\n\telse if (a>b)\n\t\treturn gcd(b,a%b);\n\telse if (ab)\n\t// \ta=a%b;\n\t// else if (ay)\n\t\tprintf(\"%d\\n\",r1);\n\telse\n\t\tprintf(\"%d\\n\",r2);\n\t// for(i=1;x*i<=a && y*i<=b;i++)\n\t// {\n\t// \tcnt++;\n\t// }\n\n\t// printf(\"%lld\\n\",cnt );\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bdb4e6dffb439190f90cb57d3d18e617", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0} {"lang": "GNU C11", "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,total=0,r,d;\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(\"%lld\\n\",total);\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "57bf9822880b629ed507e29b3aea48b0", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main() {\n\tlong long n,n2;\n\tlong long ans=0;\n\n\tscanf_s(\"%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\n\t\n\tprintf(\"%I64d\", ans);\n\tsystem(\"pause\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d292a9453b13c8f8d3cd519cfadf1ad5", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main() {\n\tlong long n,n2;\n\tlong long ans=0;\n\tscanf_s(\"%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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "00a129e0c0570866b44a0aef9309461e", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nusing namespace std;\n\nint main(){\n long long int n,sum=0,x,y;\n scanf(\"%lld\",&n);\n \n if(n==0)\n cout<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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5a97018995c8525e69ac4ec53572cc2b", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "GNU C11", "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,total=0,r,d;\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(\"%lld\\n\",total);\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4c6d8b2aa13229b93da1460f696923b9", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n \n char ar[105];\n scanf(\"%s\", ar);\n \n int n = strlen(ar);\n\n int i , count= 0, count1 = 0;\n if ( ar[0] >= 'A' && ar[0] <= 'Z' ){\n for ( i = 1 ; i < n ; i++){\n if ( ar[i] >= 'A' && ar[i] <= 'Z')\n count1++;\n else \n break;\n }\n }\n if ( count1 == n - 1 ){\n printf( \"%s\" , ar);\n }\n \n \n if( ar[0] >= 'a' && ar[0] <= 'z'){\n for ( i = 1 ; i < n ; i++){\n if ( ar[i] >= 'A' && ar[i] <= 'Z' )\n count++;\n else\n break;\n }\n }\n if ( count == n - 1){\n ar[0] = 'A' + (ar[0] -'a');\n for (i = 1; i < n ; i++ )\n ar[i] = 'a' + ( ar[i] - 'A');\n printf(\"%s\", ar);\n }\n else\n break;\n\n \n else\n printf(\"%s\",ar);\n \n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3fadff84d974faf40d56c1f1def28c3", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nusing namespace std;\nint main()\n{\n string s;\n int counts=0,countb=0,len,countfs=0,countfb=0;\n getline(cin, s);\n vectorv;\n v.push_back(s);\n for(int i=0;i='A' && v[0][i]<='Z' && i!=0) {\n countb++;\n }\n if(v[0][i]>='a' && v[0][i]<='z' && i!=0) {\n counts++;\n }\n if(v[0][0]>='A' && v[0][0]<='Z') {\n countfb++;\n }\n if(v[0][0]>='a' && v[0][0]<='z') {\n countfs++;\n }\n }\n if((countfb>0 && countb>0 && counts==0) || (countfs>0)) {\n for(int i=0;i='a' && v[0][0]<='z') {\n v[0][0]=v[0][0]-32;\n }\n if(v[0][i]>='A' && v[0][i]<='Z' && i!=0) {\n v[0][i]=v[0][i]+32;\n }\n }\n }\n cout<\n#include \nint main()\n{\n char string[1000];\n int i;\n gets(string);\n strlwr(str);\n\tif( isupper(string[0]) )\n\t{\n\tprintf(\"%c\", string[0] );\n\t}\n\telse\n\t{\n\tprintf(\"%c\", string[0]-32 );\n\t}\n\tfor(i = 1; i < strlen(string); i++ )\n\t{ \n\t\tprintf(\"%c\", string[i] );\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c9fa3d20301573a03a7403557ac010a", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nint main(){\n int l,i,c=0;\n char str[i];\n scanf(\"%s\",str);\n l=strlen(str);\n for(i=1;i\n#include\nint main()\n{\n char s[100000000000],\n fgets(s,sizeof (s),stdin);\n int count=0,l=0;\n\n l=strlen(s);\n for(int i=0;i=65 && s[i]<=90)\n count++;\n }\n\n if(count==l-1)\n {\n for(int i=0;i=97)\n {\n for(int i=1;i\nint main()\n{\n int n,sum=0,r;\n scanf(\"%d\",&n);\n while(n>0)\n {\n r=n%10;\n n=n/10;\n sum=sum+r;\n }\n if(sum%4==0)\n printf(\"%d\",n);\n else\n {\n n++;\n }\n printf(\"%d\",n);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bd7d6b4da9149995665c5293e373ba0a", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint testingMethod(int interest) {\n\tint test;\n\n\tif (interest < 4)\n\t\ttest = 4 - interest;\n\telse if (interest < 8)\n\t\ttest = 8 - interest;\n\telse if (interest < 12)\n\t\ttest = 12 - interest;\n\telse if (interest < 16)\n\t\ttest = 16 - interest;\n\telse if (interest < 20)\n\t\ttest = 20 - interest;\n\telse if (interest < 24)\n\t\ttest = 24 - interest;\n\telse if (interest < 28)\n\t\ttest = 28 - interest;\n\telse if (interest < 32)\n\t\ttest = 32 - interest;\n\n\treturn test;\n}\n\nint main() {\n\n\tchar str[5];\n\tint arr[4];\n\tgets_s(str);\n\tint i, j = 0, n;\n\tint interest = 0, test = 0, carry;\n\n\tfor (n = 0; str[n]; ++n);\n\tfor (i = n - 1, j = 3; j >= 0 ; --i, --j) {\n\n\t\tif (i < 0)\n\t\t\tarr[j] = 0;\n\t\telse\n\t\t\tarr[j] = str[i] - 48;\n\t}\n\n\tfor ( ; ; ) {\n\n\t\tfor (j = 0; j < 4; ++j) {\n\t\t\tinterest += arr[j];\n\t\t}\n\n\t\tif (interest % 4 == 0)\n\t\t\tbreak;\n\n\t\ttest = testingMethod(interest);\n\t\tif (arr[3] + test < 10) {\n\t\t\tarr[3] += test;\n\t\t}\n\t\telse {\n\t\t\tarr[3] = 0;\n\t\t\tcarry = 1;\n\t\t\tfor (i = 2; carry; --i) {\n\t\t\t\tif ((arr[i] + carry) > 9)\n\t\t\t\t\tarr[i] = 0;\n\t\t\t\telse {\n\t\t\t\t\tarr[i] += carry;\n\t\t\t\t\tcarry = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tinterest = 0;\n\t}\n\tif (arr[0] > 0)\n\t\t++n;\n\n\tfor(i = 4 - n; n > 0; ++i, --n)\n\t\tprintf(\"%d\", arr[i]);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dcb46d2e36c2882d0c2f837a542c38fc", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nbool check(int x) {\n int cnt = 0;\n while (x) {\n cnt += x % 10;\n x /= 10;\n }\n return cnt % 4 == 0;\n}\n\nint main() {\n int a;\n scanf(\"%d\", &a);\n int ans = a;\n while (!check(ans)) \n ans++;\n printf(\"%d\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "994713fc8b8deb0f66b72d44b88ba75d", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main\n{\n int i,j,sum,k;\n scanf(\"%d\",&i);\n k=i;\n while(i!=0)\n {\n j=i%10;\n sum=sum+j;\n i=i/10;\n }\n if(sum%4==0)\n printf(\"%d\",k);\n else if(sum%4==1)\n printf(\"%d\",k+3);\n else if(sum%4==2)\n printf(\"%d\",k+2);\n else if(sum%4==3)\n printf(\"%d\",k+1);\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "727484d87408b90ae45a6af5808bf815", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint sum(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 \n}\nint main()\n{\n int i,j,k;\n scanf(\"%d\",&i);\n while(sum(i)%4!=0)\n {\n i++;\n }\n printf(\"%d\",i);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "01f50022551fc52a764117971999f46f", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n\n// for Fast IO\nint readint()\n{\n int cc = getchar_unlocked();\n for (;cc < '0' || cc > '9';)\n cc = getchar_unlocked();\n int ret = 0;\n for (;cc >= '0' && cc <= '9';)\n {\n ret = ret * 10 + cc - '0';\n cc = getchar_unlocked();\n }\n return ret;\n}\n// \n\nint main(void)\n{\n int i, j, n, arr[100001], premax, max;\n\n scanf(\"%d\",&n);\n for(i=0; i arr[j])\n {\n int temp = arr[j];\n arr[j] = arr[i];\n arr[i] = temp;\n }\n\n max = arr[n-1];\n for(i=n-2; i>=0; i--)\n if(arr[i] != max)\n {\n premax = arr[i];\n break;\n }\n\n if(premax*2 <= max)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bde01772156b144fd918a19b4b543d93", "src_uid": "ab003ab094931fc105384df9d144131e", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#define mian main\n#define inf 1061109567\nint min(int a,int b){return a>b?b:a;}\nint max(int a,int b){return a=right)\n\t\treturn ;\n\tint l=left,r=right,x=a[(right+left)/2];\n\twhile(lx)r--;\n\t\tif(la[r])\n\t\t\t{\n\t\t\t\tint t=a[l];\n\t\t\t\ta[l]=a[r];\n\t\t\t\ta[r]=t;\n\t\t\t}\n\t\t\telse l++;\n\t\t}\n\t\t\n\t}\n\tjust(a,left,l-1);\n\tjust(a,l+1,right);\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i,j,k;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tjust(a,1,n);\n\tint x,y,z;\n\tfor(i=1;iy&&x!=y)//x-z\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n \n\n\n \n\n\n\n\n\nby IneedAC\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "228df9263dd44d45e746cfde8742bd32", "src_uid": "ab003ab094931fc105384df9d144131e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \nint a[100000], n;\nint cmp(const void *x, const void *y) \n{\n\tif(*(int*)x < *(int*)y) return -1;\n\tif(*(int*)x > *(int*)y) return 1;\n\treturn 0;\n}\nint main()\n{\n\tint flag = 1;\n\tscanf(\"%d\", &n);\n\tfor(int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", a + i);\n\t}\n\tqsort(a, n, sizeof(int), cmp);\n\tfor(int i = 0; i < n - 1; i++) {\n\t\tif(2 * a[i] > a[i + 1]) {\n\t\t\tflag = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(flag? \"NO\" : \"YES\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "41de0b3afc1a7e7a08d34c72b9dd9bd1", "src_uid": "ab003ab094931fc105384df9d144131e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nint main(void)\n{\n int i, j, n, arr[100001];\n\n scanf(\"%d\",&n);\n for(i=0; i arr[j])\n {\n int temp = arr[j];\n arr[j] = arr[i];\n arr[i] = temp;\n }\n\n if(arr[n-2]*2 <= arr[n-1])\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bfb91e73e3991ac67ee9bca5de4e77df", "src_uid": "ab003ab094931fc105384df9d144131e", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#define mian main\n#define inf 1061109567\nint min(int a,int b){return a>b?b:a;}\nint max(int a,int b){return a=right)\n\t\treturn ;\n\tint l=left,r=right,x=a[(right+left)/2];\n\twhile(lx)r--;\n\t\tif(la[r])\n\t\t\t{\n\t\t\t\tint t=a[l];\n\t\t\t\ta[l]=a[r];\n\t\t\t\ta[r]=t;\n\t\t\t}\n\t\t\telse l++;\n\t\t}\n\t\t\n\t}\n\tjust(a,left,l-1);\n\tjust(a,l+1,right);\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i,j,k;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tjust(a,1,n);\n\tint x,y,z;\n\tfor(i=1;iy&&x!=y)//x-z\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n \n\n\n \n\n\n\n\n\nby IneedAC\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9b52a397ac2c1965047a8cd1cfdcbd02", "src_uid": "ab003ab094931fc105384df9d144131e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint poww(int m, int n)\n{\n int t = 1;\n int i;\n \n if(n == 0) \n return 1;\n else \n for(i = 1; i <= n; i++)\n t *= m;\n \n return t;\n}\n\nint main()\n{\n char hour[6];\n char minu[6];\n int h, m;\n int hmax, mmax;\n int min, max;\n int left;\n int flag;\n int i, j;\n char c;\n int hflag, mflag;\n \n i = 0;\n while(1) {\n c = getchar();\n if(c != ':') {\n hour[i] = c;\n i++;\n }\n else {\n hour[i] = 0;\n break;\n }\n }\n\n i = 0;\n while(1) {\n c = getchar();\n if(c != '\\n') {\n minu[i] = c;\n i++;\n }\n else {\n minu[i] = 0;\n break;\n }\n }\n \n h = strlen(hour);\n m = strlen(minu);\n \n i = 0;\n while(hour[i] == '0') {\n h--;\n i++;\n }\n hflag = i;\n \n i = 0;\n while(minu[i] == '0') {\n m--;\n i++;\n }\n mflag = i;\n \n if(m == 1 && h == 1)\n if(hour[hflag] >= '0' && hour[hflag] <= '9' || hour[hflag] <= 'N' && hour[hflag] >= 'A') {\n printf(\"-1\\n\");\n return 0;\n } \n if(m == 0 && h == 0) {\n printf(\"-1\\n\");\n return 0;\n } \n \n hmax = 2;\n for(i = hflag; i < hflag + h; i++) {\n if(hour[i] <= '9' && hour[i] >= '0')\n hmax = hmax > (hour[i] - '0' + 1) ? hmax : (hour[i] - '0' + 1);\n else \n hmax = hmax > (hour[i] - 'A' + 11) ? hmax : (hour[i] - 'A' + 11);\n }\n \n mmax = 2;\n for(i = mflag; i < mflag + m; i++) {\n if(minu[i] <= '9' && minu[i] >= '0')\n mmax = mmax > (minu[i] - '0' + 1) ? mmax : (minu[i] - '0' + 1);\n else\n mmax = mmax > (minu[i] - 'A' + 11) ? mmax : (minu[i] - 'A' + 11);\n }\n \n hmax = hmax > mmax ? hmax : mmax;\n mmax = hmax;\n min = hmax;\n \n if(h == 1)\n hmax = -1;\n else {\n flag = 0;\n while( 1 ) {\n left = 23;\n for(i = hflag + h - 1, j = 0; i >= hflag; i--, j++) {\n if(hour[i] <= '9' && hour[i] >= '0')\n left -= (hour[i] - '0') * poww(hmax, j); \n else\n left -= (hour[i] - 'A' + 10) * poww(hmax, j);\n }\n \n if(left >= 0) {\n flag = 1;\n hmax++;\n }\n else if(flag == 0) {\n printf(\"0\\n\");\n return 0;\n }\n else {\n hmax--;\n break;\n }\n }\n }\n \n if(m == 1)\n mmax = -1;\n else {\n flag = 0;\n while( 1 ) {\n left = 59;\n for(i = mflag + m - 1, j = 0; i >= mflag; i--, j++) {\n if(minu[i] <= '9' && minu[i] >= '0')\n left -= (minu[i] - '0') * poww(mmax, j); \n else\n left -= (minu[i] - 'A' + 10) * poww(mmax, j);\n }\n \n if(left >= 0) {\n flag = 1;\n mmax++;\n }\n else if(flag == 0) {\n printf(\"0\\n\");\n return 0;\n }\n else {\n mmax--;\n break;\n }\n }\n }\n \n if(hmax != -1 && mmax != -1)\n max = hmax > mmax ? mmax : hmax;\n else\n max = mmax == -1 ? hmax : mmax;\n \n for(i = min; i <= max; i++) {\n if(i == max) \n printf(\"%d\\n\", i);\n else\n printf(\"%d \", i);\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a734bd0ddc8ab80510af7873a79f4f95", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint value(char c){\n if(c>='0' && c<='9') return c-'0';\n else if(c>='A' && c<='Z' ) return c-'A'+10;\n else {\n printf(\"Error radix\\n\");\n return -1;\n }\n}\nint valueR(char* num,int radix){\n int i;\n int rt=0;\n for(i=0;imax) max= value(num[i]);\n }\n }\n num1[c]='\\0';\n \n check=0;\n c=0;\n i++;\n for(;num[i]!='\\0';i++){\n if(num[i]!='0') check=1;\n if(check==1) {\n num2[c++]=num[i];\n if(value(num[i])>max) max= value(num[i]);\n }\n }\n num2[c]='\\0';\n\n //printf(\"\\n%s:%s %d\\n\",num1,num2,max);\n \n //caculate\n if(strlen(num1)==1&&strlen(num2)==1) printf(\"-1\\n\");\n else{\n i=max+1;\n check=0;\n while(1){\n //check radix i\n if(valueR(num1,i)<24 && valueR(num2,i)<60){\n printf(\"%d \",i);\n check=1;\n }else{\n if(check==0) printf(\"0\");\n break;\n }\n i++;\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bea9c69dbcb3e677e4c39dd68120e258", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n//#include\n//using namespace std;\nint a[5],b[5];\nchar t[50];\n\nmain()\n{\n int i,j,k,n,r,h,m,sizea,sizeb,max=1,flag1=0,flag2=0,p,power;\n scanf(\"%s\",t);\n i=0;\n sizea=0;\n\n while(t[i]!=':')\n {\n if(t[i]>='0'&&t[i]<='9')\n {\n a[i]=t[i]-'0';\n }\n if(t[i]>='A'&&t[i]<='Z')\n {\n a[i]=t[i]-'A'+10;\n }\n if(a[i]>max)\n max=a[i];\n\n i++;\n sizea++;\n }\n j=i+1;\n sizeb=0;\n while(t[j]!='\\0')\n {\n if(t[j]>='0'&&t[j]<='9')\n {\n b[sizeb]=t[j]-'0';\n }\n if(t[j]>='A'&&t[j]<='Z')\n {\n b[sizeb]=t[j]-'A'+10;\n }\n if(b[sizeb]>max)\n max=b[sizeb];\n //printf(\"%d\\n\",b[sizeb]);\n j++;\n sizeb++;\n\n }\n for(i=0;i=0;i--)\n {\n h+=a[i]*power;\n power=power*p;\n //printf(\"%d\\n\",h);\n }\n power=1;\n for(j=sizeb-1;j>=0;j--)\n {\n m+=b[j]*pow(p,sizeb-j-1);\n power=power*p;\n\n //printf(\"%d\\n\",m);\n }\n // printf(\"\\n%d %d\\n\",h,m);\n\n if(h<=23)\n {\n if(m<=59&&h<24)\n\n printf(\"%d \",p);\n\n\n }\n\n else\n break;\n }\n if(p==max+1)\n printf(\"0\\n\");\n else\n printf(\"\\n\");\n return 0;\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d106bb14198d928546ecce58c2df30c7", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint poww(int m, int n)\n{\n int t = 1;\n int i;\n \n if(n == 0) \n return 1;\n else \n for(i = 1; i <= n; i++)\n t *= m;\n \n return t;\n}\n\nint main()\n{\n char hour[6];\n char minu[6];\n int h, m;\n int hmax, mmax;\n int min, max;\n int left;\n int flag;\n int i, j;\n char c;\n int hflag, mflag;\n \n i = 0;\n while(1) {\n c = getchar();\n if(c != ':') {\n hour[i] = c;\n i++;\n }\n else {\n hour[i] = 0;\n break;\n }\n }\n\n i = 0;\n while(1) {\n c = getchar();\n if(c != '\\n') {\n minu[i] = c;\n i++;\n }\n else {\n minu[i] = 0;\n break;\n }\n }\n \n h = strlen(hour);\n m = strlen(minu);\n \n i = 0;\n while(hour[i] == '0') {\n h--;\n i++;\n }\n hflag = i;\n \n i = 0;\n while(minu[i] == '0') {\n m--;\n i++;\n }\n mflag = i;\n \n if(m == 1 && h == 1)\n if(hour[hflag] >= '0' && hour[hflag] <= '9' || hour[hflag] <= 'N' && hour[hflag] >= 'A') {\n printf(\"-1\\n\");\n return 0;\n } \n if(m == 0 && h == 0) {\n printf(\"-1\\n\");\n return 0;\n } \n \n if(h > 0) {\n hmax = 2;\n for(i = hflag; i < hflag + h; i++) {\n if(hour[i] <= '9' && hour[i] >= '0')\n hmax = hmax > (hour[i] - '0' + 1) ? hmax : (hour[i] - '0' + 1);\n else \n hmax = hmax > (hour[i] - 'A' + 11) ? hmax : (hour[i] - 'A' + 11);\n }\n }\n else\n hmax = -1;\n \n if(m > 0) {\n mmax = 2;\n for(i = mflag; i < mflag + m; i++) {\n if(minu[i] <= '9' && minu[i] >= '0')\n mmax = mmax > (minu[i] - '0' + 1) ? mmax : (minu[i] - '0' + 1);\n else\n mmax = mmax > (minu[i] - 'A' + 11) ? mmax : (minu[i] - 'A' + 11);\n }\n }\n else\n hmax = -1;\n \n min = hmax > mmax ? hmax : mmax;\n mmax = mmax == -1 ? mmax : min;\n hmax = hmax == -1 ? hmax : hmax;\n \n if(h == 1)\n hmax = -1;\n else if(hmax != -1) {\n flag = 0;\n while( 1 ) {\n left = 23;\n for(i = hflag + h - 1, j = 0; i >= hflag; i--, j++) {\n if(hour[i] <= '9' && hour[i] >= '0')\n left -= (hour[i] - '0') * poww(hmax, j); \n else\n left -= (hour[i] - 'A' + 10) * poww(hmax, j);\n }\n \n if(left >= 0) {\n flag = 1;\n hmax++;\n }\n else if(flag == 0) {\n printf(\"0\\n\");\n return 0;\n }\n else {\n hmax--;\n break;\n }\n }\n }\n \n if(m == 1)\n mmax = -1;\n else if(mmax != -1) {\n flag = 0;\n while( 1 ) {\n left = 59;\n for(i = mflag + m - 1, j = 0; i >= mflag; i--, j++) {\n if(minu[i] <= '9' && minu[i] >= '0')\n left -= (minu[i] - '0') * poww(mmax, j); \n else\n left -= (minu[i] - 'A' + 10) * poww(mmax, j);\n }\n \n if(left >= 0) {\n flag = 1;\n mmax++;\n }\n else if(flag == 0) {\n printf(\"0\\n\");\n return 0;\n }\n else {\n mmax--;\n break;\n }\n }\n }\n \n if(hmax != -1 && mmax != -1)\n max = hmax > mmax ? mmax : hmax;\n else\n max = mmax == -1 ? hmax : mmax;\n \n for(i = min; i <= max; i++) {\n if(i == max) \n printf(\"%d\\n\", i);\n else\n printf(\"%d \", i);\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6694c8cad7c4cb80f16374c3783ec060", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){ \n char n[15];\n scanf(\"%s\",n);\n int i,sp=1;\n char t='\\0';\n for(i=0;i'n')){sp=0;}\n if(n[i]!=':'&&t60){\n sys=t-65+11;\n }else{\n sys=t-47;\n }\n int sum=0,tp=0,f=sys;\n \n for(;;sys++){\n for(i=0;n[i]!=':';i++){\n if(n[i]>60){\n tp=n[i]-65+10;\n }else{\n tp=n[i]-48;\n }\n sum=sum*sys+tp;\n }\n if(sum>23){\n if(sys==f){puts(\"0\");}\n return 0;\n }sum=0;\n for(i=i+1;i60){\n tp=n[i]-65+10;\n }else{\n tp=n[i]-48;\n }\n sum=sum*sys+tp;\n }\n if(sum>59){\n if(sys==f){puts(\"0\");}\n return 0;\n }\n sum=0;\n printf(\"%d \",sys);\n }\n \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "30efd09d54a2f144a144607230faf77c", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nusing namespace std;\nint n,a,b,sum;\nvoid dfs(int x,int y,int count,int now)\n{\n\tif(x>4||y>2||count>=sum)return ;\n\tif(x==4&&y==2)\n\t{\n\t\tsum=min(sum,count);\n\t\treturn ;\n\t}\n\tif(now-a>=0)\n\t\tdfs(x+1,y,count,now-a);\n\telse\n\t\tdfs(x+1,y,count+1,n-a);\n\tif(now-b>=0)\n\t\tdfs(x,y+1,count,now-b);\n\telse\n\t\tdfs(x,y+1,count+1,n-b);\n\n}\nint main()\n{\n\twhile(scanf(\"%d %d %d\",&n,&a,&b)==3)\n\t{\n\t\tsum=0x7fff;\n\t\tdfs(0,0,1,n);\n\t\tprintf(\"%d\",sum);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d8f1afc2699a18a8a64b4fa95985d0ca", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n int length,vertical,upper,i;\n scanf(\"%d%d%d\",&length,&vertical,&upper);\n int count=0;\n if (vertical>length/2||upper>length/2){\n if (vertical>length/2){\n if(length-vertical>=upper){\n if(length-vertical>=2*upper)count+=4;\n else if(length-vertical>=upper&&length-vertical<2*upper)count+=4;\n }\n if(length-vertical=2*upper)count+=5;\n else if(length>=upper&&length<2*upper)count+=6;\n }\n printf(\"%d\\n\",count);\n continue;\n }\n if(upper>length/2){\n if(length-upper>=2*vertical)count+=2;\n else if(length-upper=4*vertical)count+=3;\n if(length<4*vertical&&length>=2*vertical)\n count+=4;\n if(2*vertical>length)count+=6;\n }\n else if(length-upper>=vertical&&length-upper<2*vertical){\n if(2*vertical<=length)\n count+=3;\n if(2*vertical>length)\n count+=4;\n }\n printf(\"%d\\n\",count);\n continue;\n }\n }\n else{\n if(length>=(2*vertical+upper)*2){\n printf(\"1\\n\");\n continue;\n }\n if(length>=2*vertical+upper){\n printf(\"2\\n\");\n continue;\n }\n if(length>=vertical+upper){\n count+=2;\n if(length-vertical-upper=2*vertical)count+=1;\n else if(length>=vertical&&length<2*vertical)count+=2;\n }\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf71be941beec9d8c45aaae82b3b1da4", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint n,a,b,sum;\nvoid dfs(int x,int y,int count,int now)\n{\n\tif(x>4||y>2||count>=sum)return ;\n\tif(x==4&&y==2)\n\t{\n\t\tsum=min(sum,count);\n\t\treturn ;\n\t}\n\tif(now-a>=0)\n\t\tdfs(x+1,y,count,now-a);\n\telse\n\t\tdfs(x+1,y,count+1,n-a);\n\tif(now-b>=0)\n\t\tdfs(x,y+1,count,now-b);\n\telse\n\t\tdfs(x,y+1,count+1,n-b);\n\n}\nint main()\n{\n\twhile(scanf(\"%d %d %d\",&n,&a,&b)==3)\n\t{\n\t\tsum=0x7fff;\n\t\tdfs(0,0,1,n);\n\t\tprintf(\"%d\",sum);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d65f7ba12b1008e67a83cef1eda8d9e4", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nusing namespace std;\nint n,a,b,sum;\nvoid dfs(int x,int y,int count,int now)\n{\n\tif(x>4||y>2||count>=sum)return ;\n\tif(x==4&&y==2)\n\t{\n\t\tsum=min(sum,count);\n\t\treturn ;\n\t}\n\tif(now-a>=0)\n\t\tdfs(x+1,y,count,now-a);\n\telse\n\t\tdfs(x+1,y,count+1,n-a);\n\tif(now-b>=0)\n\t\tdfs(x,y+1,count,now-b);\n\telse\n\t\tdfs(x,y+1,count+1,n-b);\n\n}\nint main()\n{\n\twhile(scanf(\"%d %d %d\",&n,&a,&b)==3)\n\t{\n\t\tsum=0x7fff;\n\t\tdfs(0,0,1,n);\n\t\tprintf(\"%d\",sum);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5ae3a057ab8e7065149b92301a08ff1", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\nint main()\n{\n int length,vertical,upper,i;\n scanf(\"%d%d%d\",&length,&vertical,&upper);\n int count=0;\n if (vertical>length/2||upper>length/2){\n if (vertical>length/2){\n if(length-vertical>=upper){\n if(length-vertical>=2*upper)count+=4;\n else if(length-vertical>=upper&&length-vertical<2*upper)count+=4;\n }\n if(length-vertical=2*upper)count+=5;\n else if(length>=upper&&length<2*upper)count+=6;\n }\n printf(\"%d\\n\",count);\n continue;\n }\n if(upper>length/2){\n if(length-upper>=2*vertical)count+=2;\n else if(length-upper=4*vertical)count+=3;\n if(length<4*vertical&&length>=2*vertical)\n count+=4;\n if(2*vertical>length)count+=6;\n }\n else if(length-upper>=vertical&&length-upper<2*vertical){\n if(2*vertical<=length)\n count+=3;\n if(2*vertical>length)\n count+=4;\n }\n printf(\"%d\\n\",count);\n continue;\n }\n }\n else{\n if(length>=(2*vertical+upper)*2){\n printf(\"1\\n\");\n continue;\n }\n if(length>=2*vertical+upper){\n printf(\"2\\n\");\n continue;\n }\n if(length>=vertical+upper){\n count+=2;\n if(length-vertical-upper=2*vertical)count+=1;\n else if(length>=vertical&&length<2*vertical)count+=2;\n }\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d1cd9e8feb1e512672cc7f72d6a27be", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0} {"lang": "GNU C", "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);\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a94ac5f11548ab32572e0ae7e48fb50b", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nlong long int n,c;\nvoid dot(long long int i, int l);\nint main (){\n scanf(\"%I64d\",&n);\n do(2520,1);\n printf(\"%I64d\",c);\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f38781a9677e90fe5a06bc64edc95775", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n \n #include\nlong long int n,c;\nvoid do(long long int i, int l):\nint main (){\n scanf(\"%I64d\",&n);\n do(2520,1);\n printf(\"%I64d\",c);\n}\nvoid do(long long int i,int l){\n i*=l;\n if(i<=n){\n c++;\n do(i,2);\n do(i,3);\n do(i,5);\n do(i,7);\n if(l!=2){\n do(i,4);\n if(l!=3){\n do(i,6);\n do(i,9);\n }\n if(l!=4){\n do(i,8);\n }\n if(l!=5){\n do(i,10);\n }\n }\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5e252b0b704cfa1a8991079467347537", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nint main ()\n{\n long long (\"%lli\",&n);\n n=n/25200;\n printf(\"%lli\",n);\n return 0 ;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d5d7207aefb98579b0c853caee309ae", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n#include \n#include \nusing namespace std; \nint main() \n{ \n __int64 a; \n while(scanf(\"%I64d\",&a)!=EOF) \n { \n printf(\"%I64d\",a/2520); \n } \n return 0; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "b657eac2af0b4a89c8b273b18f05e51e", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nvoid main()\n{\n\tint k,r,i;\n\tscanf(\"%d%d\",&k,&r);\n\tfor (i=1;i<=10;i++)\n\t{\n\t\tif ((((i*k))%10) == 0)||(((i*k-r))%10) == 0))\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\",i);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7c5d8ef3b9c1bdf6c5360d887206e72f", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nusing namespace std;\n\nint cost, coin;\n\nint solve()\n{\n int i=1;\n bool flag = true;\n while(flag)\n {\n if (i*cost%10==coin||\n i*cost%10==0) return i;\n i++;\n }\n}\n\nint main(void)\n{\n cin >> cost >> coin;\n cout << solve() << endl;\n //scanf(\"%d%d\",&cost,&coin);\n //printf(\"%d\\n\",solve());\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "23351b80f3a22c2f63990518475567f2", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "GNU C11", "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\",);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6732d9457918675a43248a7a017d0da4", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "GNU C11", "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 else if(t%2==0 && r%2==0) break;\n else (s!=r ){i=1;break;}\n }\n printf(\"%d\",i);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7cccfd13b27eaf3d9bd62896be1dae3", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "71a3a273de53c8087c2fba059461f6aa", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main(void)\n{\n long n,i,m,r,j; long sum=0;\n scanf(\"%ld\",&n);\n for (i=2;i\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{count /= i;\np/= i;}\n\t}\n\tprintf(\"%d / %d\",count,(n-2));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "05a296af232f888711e8301ad5cbcc8e", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0} {"lang": "GNU C11", "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 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 = cmmdc(numarator, numitor);\n printf(\"%d/%d \", numarator / dc, numitor /dc);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "10e955ea6601b9d90a0b247f90cf8780", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint h(a,b)\n{\nreturn b;\nh(b,a%b):a;\n}\nint main()\n{\n int a,s=0,i,j,z;\n scanf(\"%d\",&a);\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;\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 a=(t/i);\n }\n }\n hcf=gcd(s,a-2);\n printf(\"%d/%d\",(s/hcf),((a-2)/hcf));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a9eb3674d379790bf704c7c7b9dbd136", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint n,m,s,k;\nint main()\n{\n\tscanf(\"%d%d\",&n,&m);\n\tm=240-m;\n\tk=5;\n\twhile (m-k>=0) s++,m-=k,k+=5;\n\tif (s>n) s=n;\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "973cfcf7a1095430132cd4d0be6a4c4f", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main(){\n\t\n\tint n,k;\n\tcin>>n>>k;\n\tint rTime = 240 -k;\n\tint i,count=0;\n\tint a[10];\n\tfor(i=0;i<10;i++)\n\t{\n\ta[i]=5*(i+1);\n\t\n}\n\n\tint totalTime = 0;\n\ti=0;\n\twhile(rTime>=a[i] && count \nusing namespace std;\nint main(){\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++){\n k+=5*i;\n if(k>240){\n i--;\n break;}\n }\n printf(\"%d\\n\",i);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "eef4070e9416f0b8c1aa197a614ac61d", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int n=0, k=0;\n int rest=0;\n int num=0;\n int l=0,h=0,mid=0,time=0;\n \n scanf(\"%d, %d\",&n,&k);\n \n rest=240-k;\n if(rest <5)\n {\n num=0;\n }\n else\n {\n l=0;\n h=n;\n while( l+1rest)\n {\n h=mid;\n }\n else l=mid;\n }\n \n time = 5*h(h+1)/2;\n if(time\n\nint main(){\n int a[10]={5,15,30,50,75,105,140,180,225,275};\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n if(n==10)\n n=n-1;\n if(a[n-1]>k )\n printf(\"%d\",n);\n else{\n k=240-k;\n\n\n\n\n\n for(i=0;i<10;i++){\n if(k\n#include \n#include \n\nint n, m, a[11], b[11], c[11], d[11], A[1001][11]; \n\nint vai (int massa, int posi) {\n int pode = 80000;\n int i, valor;\n if (posi >= 10) {\n if (posi != 0)\n pode = a[posi] / b[posi];\n if (n / c[posi] < pode)\n pode = n / c[posi];\n \n valor = 0;\n for (i = 0; i < pode; i++){\n if (A[massa - i * c[posi]][ posi +1] == -1) {\n valor = max (valor, vai (massa - i * c[posi], posi +1) + d[posi] * i);\n A[massa - i * c[posi]][ posi +1] = valor;\n }\n else\n return A[massa - i * c[posi]][ posi +1];\n }\n return valor;\n }\n else\n return 0;\n}\n\nint main () {\n\n int valor, i, j;\n \n for(i = 0; i < 1001; i++)\n for(j = 0; j < 11; j++)\n A[i][j] = -1;\n\n scanf(\"%d%d%d%d\", &n, &m, &c[0], &d[0]);\n a[0] = 1;\n b[0] = 0;\n\n for(i = 1; i <= m; i++) {\n scanf(\"%d\", &a[i]);\n scanf(\"%d\", &b[i]);\n scanf(\"%d\", &c[i]);\n scanf(\"%d\", &d[i]);\n }\n\n valor = vai(n,0);\n\n printf(\"%d\", valor);\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0d78a94c78837bdfe0d685e608c55185", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#define max(a,b) (((a)>(b)) ? (a) : (b))\n\nint main()\n{\n\tint n, m, c0, d0, i, j, t;\n\tscanf(\"%d %d %d %d\",&n,&m,&c0,&d0);\n\tint arr[m+1][4];//[0] ai,[1] bi, [2] ci, [3] di\n\tint max_num[m+1];\n\tfor(i = 0; i < m;i++){\n\t\tscanf(\"%d %d %d %d\",&arr[i][0],&arr[i][1],&arr[i][2],&arr[i][3]);\n\t}\n\tarr[m][2] = c0;arr[m][3] = d0;\n\tfor(i = 0;i < m; i++){\n\t\tmax_num[i] = arr[i][0] / arr[i][1];\n\t}\n\tmax_num[m] = n / c0;\n\tint dp[n+1];\n\tfor(i=0;i= arr[i][2];t--){\n\t\t\t\tdp[t] = max(dp[t], dp[t-arr[i][2]] + arr[i][3]);\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", dp[n]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "170bde661f983c5c89481e09134d4e95", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint n, m, a[11], b[11], c[11], d[11], A[1001][11]; \n\nint max (int i, int j) {\n if (i > j)\n return i;\n return j;\n}\n\nint vai (int massa, int posi) {\n int pode = 80000;\n int i, valor;\n if (posi <= 10) {\n if (posi != 0)\n pode = a[posi] / b[posi];\n if (n / c[posi] < pode)\n pode = n / c[posi];\n \n valor = 0;\n for (i = 0; i < pode; i++){\n if (A[massa - i * c[posi]][ posi +1] == -1) {\n valor = max (valor, vai (massa - i * c[posi], posi +1) + d[posi] * i);\n A[massa - i * c[posi]][ posi +1] = valor;\n }\n else\n valor = A[massa - i * c[posi]][ posi +1];\n }\n return valor;\n }\n else\n return 0;\n}\n\nint main () {\n\n int valor, i, j;\n \n for(i = 0; i < 1001; i++)\n for(j = 0; j < 11; j++)\n A[i][j] = -1;\n\n scanf(\"%d%d%d%d\", &n, &m, &c[0], &d[0]);\n a[0] = 1;\n b[0] = 0;\n\n for(i = 1; i <= m; i++) {\n scanf(\"%d\", &a[i]);\n scanf(\"%d\", &b[i]);\n scanf(\"%d\", &c[i]);\n scanf(\"%d\", &d[i]);\n }\n\n valor = vai(n,0);\n\n printf(\"%d\", valor);\n \n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9e4b75c40f0adfa95bdfed76d0acd3fd", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint dp[1001][1000];\n\nint main(void){\n int i,j,k,n,m,c0,d0,a,b,c,d;\n scanf(\"%d%d%d%d\",&n,&m,&c0,&d0);\n for(i=0;i=0;a-=b){\n dp[0][k]=0;\n for(j=1;j<=n;j++){\n dp[j][k]=dp[j][k-1];\n if(c<=j&&(dp[j-c][k-1]+d>dp[j][k])){\n dp[j][k]=dp[j-c][k-1]+d;\n }\n }\n k++;\n }\n }\n i=1;\n while(i){\n i=0;\n dp[0][k]=0;\n for(j=1;j<=n;j++){\n dp[j][k]=dp[j][k-1];\n if(c0<=j&&(dp[j-c0][k-1]+d0>dp[j][k])){\n dp[j][k]=dp[j-c0][k-1]+d0;\n i=1;\n }\n }\n k++;\n }\n printf(\"%d\\n\",dp[n][k-1]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cc2e8f45c17d6ab16a0d6a36e7982bf2", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint CalculaMax (int tipo, int tot[][4], int massa);\n\nint main (){\n\tint tot[11][4], i, max;\n\n\tscanf (\"%d %d %d %d\", &tot[0][0], &tot[0][1], &tot[0][2], &tot[0][3]);\n\tfor (i = 1; i <= tot[0][1]; i++)\n\t\tscanf (\"%d %d %d %d\", &tot[i][0], &tot[i][1], &tot[i][2], &tot[i][3]);\n\n\tmax = CalculaMax (0, tot, tot[0][0]);\n\n\tprintf (\"%d\\n\", max);\n\treturn 0;\n\n}\n\nint CalculaMax (int tipo, int tot[][4], int massa){\n\tint maxpaes, i, totalparcial, total = 0;\n\n\tif (tipo > tot[0][1])\n\t\treturn 0;\n\t\n\n\tmaxpaes = massa/tot[tipo][2];\n\tif (tipo != 0)\n\t\tif (tot[tipo][0]/tot[tipo][1] < maxpaes)\n\t\t\tmaxpaes = tot[tipo][0]/tot[tipo][1];\n\t\t\n\tfor (i = maxpaes; i >= 0; i--){\n\t\ttotalparcial = i*tot[tipo][3] + CalculaMax (tipo+1, tot, massa-(i*tot[tipo][2]));\n\t\tif (totalparcial > total)\n\t\t\ttotal = totalparcial;\n\t}\n\n\treturn total;\n\n\n}\n\n\n\t\t\t\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ccf699f98e2ff75c3ce557c13a84104", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": " 1 include\n 2 include\n 3 int main()\n 4 {\n 5 int j,a,b,i;\n 6 int t=0;\n 7 long n;\n 8 \n 9 scanf(\"%ld\",&n);\n 10 t=(int)sqrt(n);\n 11 \n 12 for(i=t;i>0;i--)\n 13 {\n 14 a=i;\n 15 for(j=t;j<=n;j++)\n 16 {\n 17 b=j;\n 18 if(a*b==n)\n 19 { t=1;\n 20 printf(\"%d %d\",a,b);\n 21 }\n 22 }\n 23 if(t==1)\n 24 break;\n 25 }\n 26 \n 27 return 0;\n 28 }\n 29 \n~ \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3806ffa2b589253b201ab9d906ae4caa", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint n, a, b, i, x;\n\tscanf(\"%d\", &n);\n\tx = sqrt(double(n));\n\tfor(i = 1; i <= x; i++)\n\t{\n\t\tif(n % i == 0)\n\t\t{\n\t\t\ta = i;\n\t\t\tb = n / a;\n\t\t}\n\t}\n\tprintf(\"%d %d\\n\", a, b);\n\treturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "302ca26a74e3528f84b59f6d2939639b", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nint main(){\n\tint n, k, a, b;\n\tscanf(\"%d\", &n);\n\tk = trunc(sqrt(n));\n\tfor(int i = k; i >= 1; i --)\n\t\tif (n % i == 0){\n\t\t\ta = i;\n\t\t\tbreak;\n\t\t}\n\tprintf(\"%d %d\", a, n / a);\n\treturn 0;\n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ead48b9df2338366e7502c15f6ae0513", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "GNU C", "source_code": " 1 #include\n 2 #include\n 3 int main()\n 4 {\n 5 int j,a,b,i;\n 6 int t=0;\n 7 long n;\n 8 \n 9 scanf(\"%ld\",&n);\n 10 t=(int)sqrt(n);\n 11 \n 12 for(i=t;i>0;i--)\n 13 {\n 14 a=i;\n 15 for(j=t;j<=n;j++)\n 16 {\n 17 b=j;\n 18 if(a*b==n)\n 19 { t=1;\n 20 printf(\"%d %d\",a,b);\n 21 }\n 22 }\n 23 if(t==1)\n 24 break;\n 25 }\n 26 \n 27 return 0;\n 28 }\n 29 \n~ ", "lang_cluster": "C", "compilation_error": true, "code_uid": "4e73d91d00dc962ff74d07206a7de5f6", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{ lon long i,n,a,b;\n\nscanf(\"%lld\",&n);\nfor(i=1;i<=n;i++)\n{if(n%i==0)\n\n{ a=i;\nb=n/i;\nif(a<=b && (b-a)<10)\n {printf(\"%lld%lld\\n\",a,b);}\n}\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1f5cd3db638ed9e65f7ce7ac70205db7", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main(void){\n char s[50];\n int n,i,a=0,b=0;\n scanf(\"%s\",&s);\n n=strlen(s);\n for(i=0;i\n\nint main()\n{freopen(\"input.txt\",\"r\",stdin);\nfreopen(\"output.txt\",\"w\",stdout);\nchar a[51]={0}; int i,m=0,n=0;\nscanf(\"%s\",a);\nfor(i=0;a[i]!='\\0';i++)\n {if(a[i]=='4')\n m++;\n if(a[i]=='7')\n n++;\n }\nif(m==n && m!=0 && n!=0)\n printf(\"4\");\nif(m>n)\n printf(\"4\");\nif(m\n#include \n\n\nmain() {\n int i = 0, a = 0, b = 0;\n char s[50]; char ch;\n\n scanf(\"%s\", s);\n while (s[i] != '\\0') {\n if (s[i] == '4') a++;\n if (s[i] == '7') b++;\n i++;\n }\n\n if (a && a >= b) { printf(\"%d\", 4); return; }\n if (b && a < b) { printf(\"%d\", 7); return; }\n printf(\"%d\", -1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a946eba54b2a55243ffa79db239e9272", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint count4=0,count7=0;\n\tchar ch;\n\tscanf(\"%c\",&ch);\n\twhile (ch!='\\n')\n\t{\n\t\tif (ch=='4')\n\t\t\tcount4++;\n\t\tif (ch=='7')\n\t\t\tcount7++;\n\t\tscanf(\"%c\",&ch);\n\t}\n\tif (count4==0&&count7==0)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%c\\n\"count4>=count7?'4':'7');\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c9ddfaffab9dc6140c5302331669c2d6", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n char s[50]; int i=0,j=0,k=0;\n puts(s);\n while(s[i]!='\\0')\n {\n if(s[i]=='4')\n j++;\n else if(s[i]=='7')\n k++;\n i++;\n }\n if(j == 0 && k == 0)\n printf(\"-1\");\n else if(j>=k)\n printf(\"4\");\n else\n printf(\"7\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "00abd2c8731208ddf51cfe31b98bc93d", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "include\nint main()\n{\n int n,m,k;\n scanf(\"%d %d %d\",&n,&m,&k);\n printf(\"%s\",((n<=m)&&(n<=k))?\"Yes\":\"No\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "18080d8c37035806def38b7c37c5317b", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#define ll long long\nmain()\n{\n ll n,m,k;\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n ll smalle=m>k?k:m;\n if(larger>=n)\n {\n printf(\"Yes\");\n }\n else\n {\n printf(\"No\");\n }\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dd992ff65bc5cf6d140b3ae44c17abd0", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int x,z,y;\n scanf(\"%d %d %d\",&x,&z,&y);\n if (zy)\n {\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4174e05fe4233f48f4e952cf54cf5878", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint a,b,c;\nscanf(\"%d %d %d\",&a,&b,&c);\nif(a<=b&&a<=c)\nprintf(\"Yes\")\nelse\nprintf(\"No\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9716363d568d313900016846c2a52f89", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tif(m>=n && k>=n)\n\t\tprintf(\"Yes\");\n\telse\n\t\tprintf(\"No\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7649fefc816eb3f06090491c495cfa84", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int n,d;\n scanf(\"%d%d\",&n,&d);\n \n int arr[n];\n \n for(int i=0;i=1)\n time+=(n-1)*10;\n \n for(int i=0;i\nint main()\n\n{\n\n\tint n, d,a[10005]\n\n\tint i,total,left,sum\n\n\tscanf(\"%d %d\", &n, &d)\n\n\ttotal = 0;\n\n\tfor (i = 0; i < n; i++)\n\n\t{\n\n\t\tscanf(\"%d\", &a[i]);\n\n\t\ttotal += a[i];\n\n\t\ttotal += 10;\n\n\t}\n\n\ttotal -= 10;\n\n\tif (total>d)\n\n\t{\n\n\t\tprintf(\"-1\\n\");\n\n\t}\n\n\telse\n\n\t{\n\n\t\tleft = d - total;\n\n\t\tsum = left / 5;\n\n\t\tsum += 2 * (n - 1);\n\n\t\tprintf(\"%d\\n\", sum);\n\n\t}\n\n\treturn 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d4ada4977860489e8e6164bfd79804a4", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nint main(){\n int n, d, x, sum = 0;\n \tscanf(\"%d %d\", &n, &d);\n for(i = 0; i < n; i++){\n \t\tscanf(\"%d\", &x);\n \t\tsum += x;\n \t}\n \tif(sum + (n - 1) * 10 > d){\n \t\tprintf(\"-1\\n\");\n \t}\n \telse\n \t\tprintf(\"%d\\n\", (d - sum)/5);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cf93418cf5a68c6f687d76ebafff7d95", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,d,i,a[10000],sum=0,temp,mp;\n scanf(\"%d%d\",&n,&d);\n for(i=0;i\nint main()\n{\n int n,d,i,a[10000],sum=0,temp,mp;\n scanf(\"%d%d\",&n,&d);\n for(i=0;i\nint main()\n{\n int n,d,i,a[10000],sum=0,temp,mp;\n scanf(\"%d%d\",&n,&d);\n for(i=0;id)\n {\n printf(\"-1\\n\");\n\n }\n else\n {\n mp=((n-1)*2+1);\n printf(\"%d\\n\",mp);\n }\n return 0;\n}\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0711595208fd7ccb7d27415f1066c095", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int k,n,d,i,l,sum;\n sum=0;\n scanf(\"%d %d\",&n,&d);\n int ara[10000];\n for(i=0; id){\n printf(\"-1\");\n }\n else\n {\n l=d-sum;\n printf(\"%d\",l/5);\n\n }\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "55dd76ad94151b5742f5252a017ed433", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \nint max(int a,int b){if(a>b) return a;else return b;}\nint main(){\n int k;\n scanf(\"%i\",k);\n int mx=0;\n while (k--){\n int a;\n scanf(\"%i\",a);\n mx = max(mx,a);\n }\n if (mx>25)\n mx-=25;\n else\n mx=0;\n printf(\"%i\",mx)\n return 0-0-0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "54cd30e1c9fa67c0725a3c4b24c10083", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\n\n int x;\n scanf(\"%d\",&x);\n\n int max = INT_MIN;\n for(int i=0; it){\n max = t;\n }\n }\n\n if(max - x < 0){\n printf(\"0\");\n }\n else{\n printf(\"%d\",max-x);\n }\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e647d49a0c1062b78226867ea046ab0f", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\n\n int x;\n scanf(\"%d\",&x);\n\n int max = INT_MIN;\n for(int i=0; i\nint main()\n{\n\tint N;\n\tscanf(\"%d\",&N);\n\tint A[N]={0},m=0;\n\tfor(int i=0;i>A[i];\n\t\tscanf(\"%d\",&A[i]);\n\t\tif(A[i]>m)m=A[i];\n\t}\n\tif(m-25>0)printf(\"%d\\n\",m-25);\n\telse printf(\"0\\n\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9a067a429a9ffa85c35c744a87e18178", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint max,n,ele;\n\tscanf(\"%d\",&n);\n\tint max = 0;\n\twhile(n--)\n\t{\n\t\tscanf(\"%d\",&ele);\n\t\tif(ele > max)\n\t\tmax = ele;\n\t}\n\tif(max > 25)\n\tprintf(\"%d\",max-25);\n\telse\n\tprintf(\"0\");\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "98adf0996ebe95413a9e6543e19d573f", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n int a, b, c, d, i, j, t1, t2, t3, kol = 0, var = 0, z1, z2;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n int mas[a][b];\n for (i = 0; i < a; i++)\n for (j = 0; j < b; j++)\n mas[i][j] = 0;\n \n for (i = 0; i < c; i++) {\n scanf(\"%d %d\", &t1, &t2);\n mas[t1 - 1][t2 - 1] = 1;\n }\n for (i = 0; i < a; i++) {\n for (j = 0; j < b; j++)\n printf(\"%d\", mas[i][j]);\n printf(\"\\n\");\n }\n for (i = 0; i < a; i++) {\n for (j = 0; j < b; j++) {\n // kol = 0;\n for (t1 = i; t1 < a; t1++)\n for (t2 = j; t2 < b; t2++) {\n for (z1 = i; z1 <= t1; z1++) {\n for (z2 = j; z2 <= t2; z2++) {\n if (mas[z1][z2] == 1) {\n kol++;\n }\n }\n }\n if (kol == d) {\n var++;\n printf(\"var new = %d\\n\", var);\n }\n kol = 0;\n }\n }\n kol = 0;\n }\n if (d < c)\n var++;\n printf(\"var = %d\", var);\n return 0;\n}\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "6eda08c862ea799c6bb6f0ccd63d022c", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tint i, i1, j1, i2, j2, r, c, n, k, cnt, rectcnt;\n\tstatic int x[10], y[10];\n\n\tscanf(\"%d%d%d%d\", &r, &c, &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d\", &x[i], &y[i]);\n\trectcnt = 0;\n\tfor (i1 = 0; i1 < r; i1++)\n\t\tfor (j1 = 0; j1 < c; j1++) {\n\t\t\tcnt = 0;\n\t\t\tfor (i2 = 0; i2 <= i1; i2++)\n\t\t\t\tfor (j2 = 0; j2 <= j1; j2++)\n\t\t\t\t\tfor (i = 0; i < n; i++)\n\t\t\t\t\t\tif (x[i] - 1 == i2 && y[i] - 1 == j2)\n\t\t\t\t\t\t\tcnt++;\n\t\t\tif (cnt >= k)\n\t\t\t\trectcnt++;\n\t\t\tcnt = 0;\n\t\t\tfor (i2 = r - 1; i2 > i1; i2--)\n\t\t\t\tfor (j2 = 0; j2 <= j1; j2++)\n\t\t\t\t\tfor (i = 0; i < n; i++)\n\t\t\t\t\t\tif (x[i] - 1 == i2 && y[i] - 1 == j2)\n\t\t\t\t\t\t\tcnt++;\n\t\t\tif (cnt >= k)\n\t\t\t\trectcnt++;\n\t\t\tcnt = 0;\n\t\t\tfor (i2 = 0; i2 <= i1; i2++)\n\t\t\t\tfor (j2 = c - 1; j2 > j1; j2--)\n\t\t\t\t\tfor (i = 0; i < n; i++)\n\t\t\t\t\t\tif (x[i] - 1 == i2 && y[i] - 1 == j2)\n\t\t\t\t\t\t\tcnt++;\n\t\t\tif (cnt >= k)\n\t\t\t\trectcnt++;\n\t\t\tcnt = 0;\n\t\t\tfor (i2 = r - 1; i2 > i1; i2--)\n\t\t\t\tfor (j2 = c - 1; j2 > j1; j2--)\n\t\t\t\t\tfor (i = 0; i < n; i++)\n\t\t\t\t\t\tif (x[i] - 1 == i2 && y[i] - 1 == j2)\n\t\t\t\t\t\t\tcnt++;\n\t\t\tif (cnt >= k)\n\t\t\t\trectcnt++;\n\t\t}\n\tprintf(\"%d\\n\", rectcnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4033ba814e1bf453980ec56500152687", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n int a, b, c, d, i, j, t1, t2, t3, kol = 0, var = 0, z1, z2;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n int mas[a][b];\n for (i = 0; i < a; i++)\n for (j = 0; j < b; j++)\n mas[i][j] = 0;\n \n for (i = 0; i < c; i++) {\n scanf(\"%d %d\", &t1, &t2);\n mas[t1 - 1][t2 - 1] = 1;\n }\n\n for (i = 0; i < a; i++) {\n for (j = 0; j < b; j++) {\n // kol = 0;\n for (t1 = i; t1 < a; t1++)\n for (t2 = j; t2 < b; t2++) {\n for (z1 = i; z1 <= t1; z1++) {\n for (z2 = j; z2 <= t2; z2++) {\n if (mas[z1][z2] == 1) {\n kol++;\n }\n }\n }\n if (kol == d) {\n var++;\n // printf(\"var new = %d\\n\", var);\n }\n kol = 0;\n }\n }\n kol = 0;\n }\n if (d < c)\n var++;\n printf(\"%d\", var);\n return 0;\n}\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "e01a07b35b576168f205aafe38fbdabf", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int arr[11][11];\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n int w,r,m;\n for(w=0;w=d)\n cnt++;\n sum=0;\n\n }\n }\n }\n }\n printf(\"%d\",cnt);\n\n\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c8d24423b4d921c5f061523c9e1e6c43", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint a, b, c, d, e, f, g, h, i, j;\n\tint ZA[10][10];\n\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tfor (e = 0; e < a * b; ++e)\n\t\tZA[e / b][e % b] = 0;\n\tfor (e = 0; e < c; ++e) {\n\t\tscanf(\"%d%d\", &f, &g);\n\t\tZA[f - 1][g - 1] = 1;\n\t}\n\tfor (e = 0; e < a; ++e)\n\t\tfor (f = 0; f < b; ++f)\n\t\t\tZA[e][f] += (e > 0 ? ZA[e - 1][f] : 0) + (f > 0 ? ZA[e][f - 1] : 0) - (e > 0 && f > 0 ? ZA[e - 1][f - 1] : 0);\n\ti = 0;\n\tfor (e = 0; e < a; ++e)\n\t\tfor (f = 0; f < b; ++f)\n\t\t\tfor (g = 0; g < a; ++g)\n\t\t\t\tfor (h = 0; h < b; ++h) {\n\t\t\t\t\tj = ZA[g][h] - (e > 0 ? ZA[e - 1][h] : 0) - (f > 0 ? ZA[g][f - 1] : 0) + (e > 0 && f > 0 ? ZA[e - 1][f - 1] : 0);\n\t\t\t\t\tif (j >= d)\n\t\t\t\t\t\ti += 1;\n\t\t\t\t}\n\tprintf(\"%d\\n\", i);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "162ba0ca1f32323502c7e6ba191271af", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main(void)\n{\n\tint n, m, z;\n\n\tscanf_s(\"%d%d%d\", &n, &m, &z);\n\n\tprintf(\"%d\", z / (n*m));\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f93322def8489bbedec9f11f247bf011", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n llong long int a,b,c,l,k;\n while(scanf(\"%lld %lld %lld\",&a,&b,&c)==3)\n {\n l=a*b;\n k=c/l;\n printf(\"%lld\\n\",k);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a99784e69ee92fee97c2d1f5efdc5bd1", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nint gcd(int a,int b){return (b>0) ? gcd(b,a%b) : a;}\nint main(){\n\tint n,m,z;\n\twhile(cin >> n >> m >> z){\n\t\tint cnt=0;\n\t\tint x=n/gcd(m,n)*m;\n\t\tfor(int i=1;i<=z;i++){\n\t\t\tif(i%x==0)\n\t\t\tcnt++;\n\t\t}\n\t\tcout << cnt << endl;\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "87ae7e6d6b44306914d813691e7efb13", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nusing namespace std;\nint main()\n{\n int a[3],k,l;\n while(scanf(\"%d %d %d\",&a[0],&a[1],&a[2])==3)\n {\n sort(a,a+3);\n l=a[2]-a[1];\n k=a[2]-a[0];\n printf(\"%d\\n\",k+l);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "257e7acf176032b028eb55332057339b", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main () {\n\tprintf(\"m,n,z:\");\n\tint m,n,z,i,t;\t\n\tscanf(\"%d %d %d\",&m,&n,&z);\n\ti=1;\n\tt=m*i;\n\twhile ((t%n)!=0) {\n\t\ti++;\n\t\tt=m*i;\n\t}\n\telse\n\t\tprintf(\"%d\",z/t);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1c42073b485bbe04403adeb4890c6a36", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\nint a[2], b[2], i=0;\nwhile(i<2) {\nscanf(\"%d:%d\", &a[i], &b[i]);\ni++;\n}\na[0]-=a[1];\nb[0]==b[0];\nif(b[0]<0) { b[0]+=60; a[0]--;}\nif(a[0]<0) a[0]+=24;\nprintf(\"%02d:%02d\\n\", a[0], b[0]);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1f191bbd2c057934dda835301a1b6582", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nmain()\n{\n int a,b,c,d,e=0,f=0,g,h=0;\n scanf(\"%d:%d\",&a,&b);\n scanf(\"%d:%d\",&c,&d);\n if(b-d>=10)\n e=(b-d);\n else if((b-d)>=0)\n f=(b-d);\n else{\n g=60-abs(b-d);\n if(g>=10)\n e=g;\n else if((b-d)>0)\n f=g;\n h++;\n } \n if((a-c-h)>=10)\n printf(\"%d:\",a-c-h);\n else if((a-c-h)>=0&&(a-c-h)<10)\n printf(\"0%d:\",a-c-h);\n else if((a-c-h)<0)\n printf(\"%d:\",24-abs(a-c-h)); \n if(e!=0)\n printf(\"%d\",e);\n else\n printf(\"0%d\",f);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1b2137e7f41c1a505a75a41c31231d8", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n char input1[5],input2[5];\n scanf(\"%s\",input1);\n scanf(\"%s\",input2);\n int h1 = ((int)input1[0])*10+((int)input1[1]);\n int m1 = ((int)input1[3])*10+((int)input1[4]);\n int h2 = ((int)input2[0])*10+((int)input2[1]);\n int m2 = ((int)input2[3])*10+((int)input2[4]);\n int a1,a2;\n if(m1\nvoid time()\n{\nchar s[6],d[6],r[6];\nscanf(\"%s %s\",s,d);\nint m1,m2,h1,h2 ,rm,rh;\nm1=convert(s[3],s[4]);\nm2=convert(d[3],d[4]);\nif(s[0]=='0'&&s[1]=='0')\n h1=24;\nelse\n h1=convert(s[0],s[1]);\n\nif(d[0]=='0'&&d[1]=='0')\n h2=24;\n else\n h2=convert(d[0],d[1]);\n rm=m1-m2;\n rh=h1-h2;\n if(rm<0)\n {\n rm=rm+60;\n rh--;\n }\n if(rh<9&&rm>9)\n printf(\"0%d:%d\",rh,rm);\n else if(rh>9&&rm<9)\n printf(\"%d:0%d\",rh,rm);\n else if(rh<9&&rm<9)\n printf(\"0%d:0%d\",rh,rm);\n if(rh>9&&rm>9)\n printf(\"%d%d\",rm,rh);\n}\nint convert(char a[],char b[])\n{\n int i,j,k;\n i=(int)a;\n i=i-48;\n j=b;\n j=j-48;\n k=10*i+j;\n return k;\n}\nint main()\n{\n time();\n return 0;\n}\n#include\nvoid time()\n{\nchar s[6],d[6],r[6];\nscanf(\"%s %s\",s,d);\nint m1,m2,h1,h2 ,rm,rh;\nm1=convert(s[3],s[4]);\nm2=convert(d[3],d[4]);\nif(s[0]=='0'&&s[1]=='0')\n h1=24;\nelse\n h1=convert(s[0],s[1]);\n\nif(d[0]=='0'&&d[1]=='0')\n h2=24;\n else\n h2=convert(d[0],d[1]);\n rm=m1-m2;\n rh=h1-h2;\n if(rm<0)\n {\n rm=rm+60;\n rh--;\n }\n if(rh<9&&rm>9)\n printf(\"0%d:%d\",rh,rm);\n else if(rh>9&&rm<9)\n printf(\"%d:0%d\",rh,rm);\n else if(rh<9&&rm<9)\n printf(\"0%d:0%d\",rh,rm);\n if(rh>9&&rm>9)\n printf(\"%d%d\",rm,rh);\n}\nint convert(char a[],char b[])\n{\n int i,j,k;\n i=(int)a;\n i=i-48;\n j=b;\n j=j-48;\n k=10*i+j;\n return k;\n}\nint main()\n{\n time();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fea63807c44934b627cd875d2186f737", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "GNU C", "source_code": "//emre\n#include \nint main()\n{\n int a,b,c,d,x,y,z,t,emre;\n char f;\n scanf(\"%d%c%d\",&a,&f,&b);\n scanf(\"%d%c%d\",&c,&f,&d);\n if(a==0)\n {\n a=24;\n }\n if((b-d)=>0)\n {\n x=b-d;\n }\n else\n {\n x=60+b-d;\n a--;\n }\n \n \n if((a-c)>0)\n {\n y=a-c;\n }\n else\n {\n y=24+a-c;\n }\n \n if(y<9)\n {\n printf(\"0%d:\",y);\n }\n else if (y==24)\n {\n printf(\"00:\");\n }\n else\n {\n printf(\"%d:\",y);\n }\n \n \n \n if(x<9)\n {\n printf(\"0%d\",x);\n }\n else if (x==60)\n {\n printf(\"00\");\n }\n else\n {\n printf(\"%d\",x);\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f37c4d19a99b11bd464d633d165dc579", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int n,k,x,a[20],i=0,j,d=0,p=1;\n scanf(\"%lld %lld\",&n,&k);\n x=n;\n while(x!=0)\n {i++;\n a[i]=x%10;\n x=x/10;\n }\n for(j=i;j>=1;j--)\n {if(a[j]!=0)\n {break;}\n d++;\n }\n if(d>=k)\n {printf(\"%lld\",n);}\n else\n {i=1;\n for(j=1;j<=k;j++)\n {p=p*10;}\n while((p*i)%n!=0)\n {i++;}\n printf(\"%lld\",p*i);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e3c60cc162c5aafa4984117c2814e6e8", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint no_p(int n,int p)\n{\n\tint i=0;\n\twhile(n%p==0)\n\t{i++;\n\t\tn=n/p;\n\t\t\n\t}\n\treturn i;\n}\n\nint main()\n{\n\tlong long int i,j,k,l,n,n5,n2,m,r=1;\n\t\n\tn5=no_p(n,5);\n\t\n\tn2=no_p(n,2);\n\tprintf(\"%lld %lld\\n\",n5,n2);\n\tif (n5\n#include \nusing namespace std;\n\n/**\n * http://codeforces.com/contest/861/problem/A\n * */\nlong gcd(long a, long b) {\n long mod = a % b;\n while(mod > 0) {\n a = b;\n b = mod;\n mod = a % b;\n }\n return b;\n}\n\nlong round(long n, long k) {\n long kk = 1;\n while(k > 0) {\n kk *= 10;\n k--;\n }\n long g = gcd(n, kk);\n return n * kk / g;\n}\n\nint main() {\n long n, k;\n scanf(\"%ld %ld\", &n, &k);\n// printf(\"%ld\\n\", round(n, k));\n cout << round(n, k);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6835826deecd1f2d2862929ee09c8ead", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long int power(int osn, int pok);\n\n\nint main()\n{\n long long int n2, n5, n, k, i, j, otv, c2 = 0, c5 = 0, ost, razn5, razn2;\n scanf(\"%lld%lld\", &n, &k);\n n2 = n;\n n5 = n;\n for(i = 0; i < k+1; i++)\n {\n if(n2%2 == 1)break;\n else\n {\n n2 = n2/2;\n c2++;\n }\n }\n for(i = 0; i < k+1; i++)\n {\n if(n5%5 == 0)\n {\n n5 = n5/5;\n c5++;\n }\n else\n {\n break;\n }\n }\n if(k>=c5) razn5 = k - c5;\n else{razn5 = 0;}\n if(k>=c2) razn2 = k - c2;\n else{razn2 = 0;}\n \n \n n = n*power(2, razn2)*power(5, razn5);\n \n \n printf(\"%lld\", n);\n return 0;\n}\n\nint power (int osn, int pok)\n{ int temp = osn, temp1;\n int i;\nif(pok == 0)return 1;\nelse{\n if(pok == 1)return osn;\n for (i = 1;i < pok; i++)\n {\n temp1 = temp;\n temp = temp1 * osn;\n }\n}\n return temp;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fa5501bfdbc0990bb84e6def7c6c5746", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \nusing namespace std;\n\n/**\n * http://codeforces.com/contest/861/problem/A\n * */\nlong gcd(long a, long b) {\n long mod = a % b;\n while(mod > 0) {\n a = b;\n b = mod;\n mod = a % b;\n }\n return b;\n}\n\nlong round(long n, long k) {\n long kk = 1;\n while(k > 0) {\n kk *= 10;\n k--;\n }\n long g = gcd(n, kk);\n return n * kk / g;\n}\n\nint main() {\n long n, k;\n scanf(\"%ld %ld\", &n, &k);\n cout << round(n, k);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "98d8d32197ed2db06f11e2b63efebef6", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tchar a;\n\tchar nam[6000099999000];\n\tscanf(\"%c\",&a);\n\tscanf(\"%s\",nam);\n\n\tif(a>96){\n\t\tprintf(\"%c\",a-32);\n\t\tprintf(\"%s\",nam);\n\t}\n\telse{\n\t\tprintf(\"%c\",a);\n\t\tprintf(\"%s\",nam);\n\t}\n\t\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ff1f4c26dc2283077f10d056822ea30d", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n long long int n;\n scanf(\"%lld,&n\")\n char ch[n];\n scanf(\"%s\",&ch);\n int i=0;\n if(ch[i]>='a' && ch[i]<='z'){\n ch[i]=ch[i]-32;\n }\n printf(\"%s\",ch);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0266c686b8bd0cf6e875eafd93534a6d", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char str[1000];\n scanf(\"%s\",str[0]);\n if(str[0]>=97 && str[0]<=122)\n str[0]=90-32;\n else\n break;\n printf(\"%s\",str[0]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3e5e9479a93c9f98ee65edd204670f10", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n string s;\n int i;\n getline(cin,s);\n if(s[0]>=97&&s[0]<=122)\n {\n s[0]=s[0]-32;\n }\n cout<\n#include\nint main(){\n int i,l;\n char s[101];\n scanf(\"%s\",s);\n l=strlen(s);\n for(int i=0;i=97&&s[0]<=122)\n s[0]=s[0]-32;\n printf(\"%s\",str);\n }\nreturn 0; \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "01160f2f12d1714394ae54e8ff13a922", "src_uid": "29e0fc0c5c0e136ac8e58011c91397e4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint ndogs;\nchar colors[100];\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}\nvoid main(void)\n{\n\tscanf(\"%d\", &ndogs);\n\tscanf(\"%s\", colors);\n\tif (test(colors))\n\t\tprintf(\"Yes\");\n\telse printf(\"No\");\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f85d977f09a07e58cc1a12e284cb1c53", "src_uid": "6b22e93f7e429693dcfe3c099346dcda", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint ndogs;\nchar colors[100];\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}\nvoid main(void)\n{\n\tscanf_s(\"%d\", &ndogs);\n\tscanf_s(\"%s\", colors, ndogs + 1);\n\tif (test(colors))\n\t\tprintf(\"Yes\");\n\telse printf(\"No\");\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "854e1f0cfa6bb74aad3457eb35ad4965", "src_uid": "6b22e93f7e429693dcfe3c099346dcda", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tchar a[2000001];\n\tint n, i, j, p=0;\n\t\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",a);\n\t\n\tfor(i=0; i\nusing namespace std;\n \n#define INIT(x) memset(x,0,sizeof(x))\n#define eps 1e-8\n \ntypedef long long ll;\nconst int inf = 0x3f3f3f3f;\nconst int maxn = 200005;\n \ninline void read(int &x)\n{\n int f=1;x=0;char s=getchar();\n while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}\n while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}\n x*=f;\n}\n \ninline void print(int x)\n{\n if(x<0){ putchar('-'); x=-x;}\n if(x>9) print(x/10);\n putchar(x%10+'0');\n}\n \ninline void caltime(int tt) {\n\ttt = clock() - tt;\n cerr << (double)tt/CLOCKS_PER_SEC << \" seconds!\" << endl;\n}\n \nint n;\nstring s;\nint a[100];\n \nint main()\n{\n\tcin>>n>>s;\n\tfor(int i=0;i=2) {\n\t\t\tans++;\n\t\t}\n\t}\n\tif(ans||n==1) {\n\t\tcout<<\"Yes\"<\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<=n;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#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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2e3a085cf5275070ef00b36d39a6f43d", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\ntypedef long long ll;\nusing namespace std;\nll n,ans=0;\nint main()\n{\n\tscanf(\"%I64d\",&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(\"%I64d\",ans);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cf68b188e7d53fa4aab790ac168294e0", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0} {"lang": "GNU C", "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 }", "lang_cluster": "C", "compilation_error": true, "code_uid": "78b65bc4958395570468edb862f371db", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\ntypedef long long ll;\nusing namespace std;\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "4340da150d9e73ba7200a717f8b8555f", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int num=0;\n char s[100];\n gets(s);\n int d=strlen(s);\n for(int i=0;i64||s[i]<91)\n num++;\n }\n if(num>d/2)\n {for(int i=0;i96||s[i]<123)\n s[i]=s[i]-32;\n }}\n else\n {\n if(s[i]>64||s[i]<91)\n s[i]=s[i]+32;\n }\n printf(\"%s\",s);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b835100f5091ff90b0fcbf0a04c3c3fb", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n int n,c=0,c1=0;\n char a[100];\n scanf(\"%s\",a);\n n=strlen(a);\n for(i=0;i= 'a' && a[i] <= 'z'){\n c++;\n }\n if(a[i] >= 'A' && a[i] <= 'Z'){\n c1++;\n }\n}\nif(c>=c1){\n for(i=0;i= 'A' && a[i] <= 'Z'){\n a[i]=a[i]+32;\n }\n }\n}\n else{\n \n for(i=0;i= 'a' && a[i] <= 'z'){\n a[i]=a[i]-32;\n \n}\n}\n}\nprintf(\"%s\",a);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d7b44ae3b640e147d2f3c560ee0995e2", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "GNU C11", "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 printf(\"%s\",str.toupper());\n }\n else\n printf(\"%s\",str.tolower());\n \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bcadf9820fa84fce30cd971fa861b47d", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "GNU C11", "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 a[i]=a[i]+32;}\n else if(k>j){\n a[i]=a[i]-32;}\n else if(j=k){\n a[i]=a[i]-32;}}\n printf(\"%s\\n\",s);\n return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9c13c585197535500b8b3de461fc0dc2", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "GNU C", "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;ilw)\n\tprintf(\"%s\",strupr(a));\n\telse\n\tprintf(\"%s\",strlwr(a));\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a71c93f12d237395aa79dcadd7d9aa8d", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nusing namespace std;\nint main()\n{\n int i;\n char a[1000],b[1000];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n for(i=0;i\n#include \nint main() {\n char s1[100],s2[100];\n scanf(\"%s%s\",s1,s2);\n int c=strlen(a);\n for(int i=0;i\n#include\n#include\n#include\n \nint main()\n{\n long long int i,j,l,m,n,a[1000],b[1000],sum=0;\n char a[1000],b[1000];\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n l=strlen(a);\n for(i=0;i\nint main()\n{\n int i=0;\n char a[101],b[101],c[101];\n scanf(\"%s%s\",a,b);\n while(a[i]!=0)\n {\n a[i]==b[i]?c[i]=0:c[i]=1;\n i++;\n }\n printf(\"%s\",c);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4d807e091ebe45a86e8397d59c95dc48", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{int i, a[100],b[110]; \nchar c;\nfor(i=0;(c=getchar())!='\\n';i++)\na[i]=c-'0';\nfor(i=0;(c=getchar())!='\\n';i++)\nb[i]=c-'0';\nc=int(i);\nfor(i=0;i\n\nint main() {\n\tint a, b;\n\tscanf_s(\"%d%d\", &a, &b);\n\tif (a == 9 && b == 1) {\n\t\tprintf(\"%d %d\", a, b * 10);\n\t}\n\telse if (a == b) {\n\t\tprintf(\"%d %d\", a * 10, b * 10 + 1);\n\t}\n\telse if (a + 1 == b) {\n\t\tprintf(\"%d %d\", a, b);\n\t}\n\telse printf(\"%d\", -1);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "86fa122d3582254bf65c3ee66bf7ff91", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "GNU C11", "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.);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "91a5487b09978418efee8e44dc9c60e9", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "37d1db9c82d5bc6d8edb1447b239bc7d", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nmain() {\n \n char s[50];\n gets(s);\n char *numbers;\n strtok_r(s, \" \", &numbers);\n int a = atoi(s);\n int b = atoi(numbers);\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "43028508c2af3b91e319cd0a51cfea73", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f82231c602c279d1cfaed76a1d314ecc", "src_uid": "3eff6f044c028146bea5f0dfd2870d23", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n,s1=0,s2=0\nint x,y;\n scanf(\"%d\",&n);\n \n for(int i = 0; i < n; ++i)\n{\n scanf(\"%d%d\",&x,&y);\ns1=s1+x;\ns2=s2+y;\n}\nif(s2\nint main()\n{\n int i,j,n,c;\n scanf(\"%d\",&n);\n int a[n],b[n];\n for(i=0;i=sum1)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"No\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2cdda1a7597eaac4c6dda4ac6f5791b8", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n],b[n],x=0,y=0;\n for(i=0;i=y)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7600a513eebe918df7f493f9937e17dc", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int n,sum1=0,sum2=0,i,j,k;\n scanf(\"%d\",&n);\n int p1[n],p2[n];\n for(i=0;i=sum2) printf(\"Yes\");\n else printf(\"No\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1d823c4df2746c8476ac5b2791277db7", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int x[n];\n int y[n];\n\nfor(i=0;i \n#include \n#include \n\nvoid get (char **number);\nvoid one_digit(char *number);\nint two_digit(char *number);\nint three_digit(int number);\n\nint main()\n{\n\t// Get input\n\tchar **number = (char **)malloc(sizeof(char *));\n\t*number = (char *)calloc(101, sizeof(char));\n\tget(number);\n\t// Find number of digits\n\tint length = strlen(*number);\n\t///////////////////////////////////////////////////////\n\tint result = 0;\n\t\n\t// For 1 digit\n\tif (length == 1)\n\t\tif (one_digit(*number))\n\t\t\treturn 0;\n\n\t// For 2 digits\n\tif (length == 2)\n\t\tif (two_digit(*number))\n\t\t\treturn 0;\n\t\n\t// For 3 & more digits\n\tif (length >= 3)\n\t{\n\t\tfor (int i = 0; number[0][i] != '\\0'; i++)\n\t\t{\n\t\t\tfor (int j = i + 1; number[0][j] != '\\0'; j++)\n\t\t\t{\n\t\t\t\tfor (int z = j + 1; number[0][z] != '\\0'; z++)\n\t\t\t\t{\n\t\t\t\t\tchar number_3_digits[4] = \"\";\n\t\t\t\t\tstrncat(number_3_digits, &number[0][i], 1);\n\t\t\t\t\tstrncat(number_3_digits, &number[0][j], 1);\n\t\t\t\t\tstrncat(number_3_digits, &number[0][z], 1);\n\n\t\t\t\t\tint n = atoi(number_3_digits);\n\n\t\t\t\t\tif (three_digit(n))\n\t\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"NO\");\n\treturn 0;\n}\n\nint function(int number)\n{\n\tint third = number % 10;\n\tint second = (number % 100 - third) / 10;\n\tint first = (number - second - third) / 100;\n\n\tif ((third + 2 * second + 4 * first) % 8 == 0)\n\t\treturn 1;\n\treturn 0;\n}\n\nvoid get(char **number)\n{\n\tscanf(\"%s\", number[0]);\n}\n\nvoid one_digit(char *number)\n{\n\tif (number[0] == '8' || number[0] == '0')\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%s\", number);\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nint two_digit(char *number)\n{\n\tint int_number = atoi(number);\n\tint second = int_number % 10;\n\tint first = (int_number - second) / 10;\n\tif (int_number % 8 == 0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\", int_number);\n\t\treturn 1;\n\t}\n\tif (second % 8 == 0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\", second);\n\t\treturn 1;\n\t}\n\tif (first % 8 == 0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\", first);\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nint three_digit(int number)\n{\n\tif (number % 8 == 0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\", number);\n\t\treturn 1;\n\t}\n\telse if (function(number))\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\", number);\n\t\treturn 1;\n\t}\n\telse\n\t\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "48a8d646252c8de881254c06fd7901e2", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tshort int arr[100];\n\tchar str[100];\n\tscanf(\"%s\", str);\n\tint ch, cnt = 0;\n\twhile ((ch = str[cnt]) != '\\0') {\n\t\tarr[cnt++] = ch - '0';\n\t\tif (arr[cnt-1] == 0 || arr[cnt-1] == 8) {\n\t\t\tprintf(\"YES\\n%d\", arr[cnt-1]);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tfor (int i = cnt-1; i >= 2; i--) {\n\t\tif (arr[i] % 2 == 0) {\n\t\t\tfor (int j = i-1; j >= 1; j--) {\n\t\t\t\tif ((arr[j]*10 + arr[i]) % 4 == 0) {\n\t\t\t\t\tfor (int k = j-1; k >= 0; k--) {\n\t\t\t\t\t\tshort int x = arr[k]*100 + arr[j]*10 + arr[i];\n\t\t\t\t\t\tif (x % 8 == 0) {\n\t\t\t\t\t\t\tprintf(\"YES\\n%d\", x);\n\t\t\t\t\t\t\treturn 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\tfor (int i = cnt-1; i >= 1; i--) {\n\t\tfor (int j == i-1; j >= 0; j--) {\n\t\t\tif ((arr[i] + arr[j]*10) % 8 == 0) {\n\t\t\t\tprintf(\"YES\\n%d\", arr[i] + arr[j]*10);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a74f924d0f56ef4afe8aae3bc7dec437", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \"convert.h\"\n#include \n#include \n#ifndef H_CONVERT\n#define H_CONVERT\n\n#define KIA Str \n#define PXFUAODT template \n#define JNKEV scanf \n#define EIQUTJ Lprime \n#define OGF num \n#define PBI cur \n#define GDSQ puts \n#endif\n\nint main()\n{\n char KIA[101];\n char PXFUAODT[3];\n int i, j, L;\n JNKEV(\"%s\", KIA);\n L = strlen(KIA);\n for(i = 0; i < 1000; i += 8) {\n memset(PXFUAODT, -1, sizeof(PXFUAODT));\n int EIQUTJ = 0;\n int OGF = i;\n do {\n PXFUAODT[EIQUTJ++] = OGF % 10 + '0';\n OGF /= 10;\n } while(OGF != 0);\n int PBI = L - 1;\n for(j = 0; j < EIQUTJ; ++j) {\n while(PBI >= 0 && KIA[PBI] != PXFUAODT[j]) {\n if(--PBI < 0) {\n break;\n }\n }\n if(PBI < 0) {\n break;\n }\n --PBI;\n }\n if(j == EIQUTJ) {\n GDSQ(\"YES\");\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n GDSQ(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0c710f4554eb49282a8d7dd891817d36", "src_uid": "0a2a5927d24c70aca24fc17aa686499e", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#define pl(n) cout< vi;\ntypedef vector vs;\ntypedef vector vl;\n \nint main(){\n string str;\n cin>>str;\n int l = str.size();\n if(l<3){\n if(l==1){\n int n = str[0]-'0';\n if(!n%8){\n pl(\"YES\");\n cout<2;i--)\n {\n \n int n = str[i]-'0'+(str[i-1]-'0')*10+(str[i-2]-'0')*100+(str[i-3]-'0')*1000;\n if(n%8==0)\n {\n pl(\"YES\");\n cout<\n#include\nint main()\n{\n int i,j,k,flag=0,flag1=0,num;\n char a[101];\n scanf(\"%s\",a);\n int l=strlen(a);\n if(l<=3)\n {\n if(l==1)\n {\n if(a[0]%8==0)\n {\n printf(\"YES\\n\");\n printf(\"%s\\n\",a);\n }\n else\n printf(\"NO\\n\");\n\n\n }\n if(l==2)\n {\n if(((a[0]-48)*10+a[1]-48)%8==0)\n {\n\n printf(\"YES\\n\");\n printf(\"%s\\n\",a);\n }\n else\n {\n if((a[0]-48)%8==0||(a[1]-48)%8==0)\n {\n if((a[0]-48)%8==0)\n {\n \n printf(\"YES\\n\");\n printf(\"%c\\n\",a[0]);\n }\n else\n {\n\n printf(\"YES\\n\");\n printf(\"%c\\n\",a[1]);\n }\n }\n else\n printf(\"NO\\n\");\n\n }\n \n }\n if(l==3)\n {\n num=(a[l-3]-48)*100+(a[l-2]-48)*10+a[l-1]-48;\n if(num%8==0)\n {\n printf(\"YES\\n\");\n printf(\"%s\\n\",a);\n }\n else\n {\n for(i=0;i\nint main()\n{\nint n,i,x=0,a=2,d=4;\nlong long int k;\nscanf(\"%d %d\",&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 if(i==50)\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a65185ec4e4fe1acccc38301bea778e5", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\n#define INF (1LL << 55)\n#define MOD (1000 * 1000 * 1000 + 7)\n#define maxn 200111\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\n\n#include \n#include \n\nll pot (ll a , ll b){\n\tll x = 1LL;\n\tfor (int i = 0; i < b ; i++)\n\t\tx = x * a;\n\n\treturn x;\n}\n\n\n\n\nint main (){\n\tll n, a;\n\tscanf (\"%lld\",&n);\n\tscanf (\"%lld\",&a);\n\tint x = 1;\n\n\n\tfor (int i = n; i >= 2; i--){\n\t\tll k = a - pot(2, i - 1);\n\t\tll l = pot(2, i);\n\t\t\n\t\tif (k % l == 0){\n\t\t\tx = i;\n\t\t\tbreak;\n\t\t}\t\n\t}\n\tprintf(\"%d\\n\", x);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "127c6fdd2201f0fecb55f22d55d88ded", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#incude\nint main()\n{\n long long n,k,i,t=1;\n scanf(\"%I64d %I64d\",&n,&k);\n for(i=0;i=0;i--)\n {\n if(k%t!=0)\n {\n t=t/2;\n }\n else break;\n }\n printf(\"%I64d\",i+1);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ea73ecbd70239adc65d9f476930798b0", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "// luogu-judger-enable-o2\n#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);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51573e6a866e5f657e65da12f9f7b346", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint n,k;\nscanf(\"%d%d\",&n,&k);\nif(k%2==1)\nprintf(\"1\");\nelse\n{\nint c=1;\nwhile(k!=0 && k%2==0)\n{\nc++;\nk=k/2;\n}\n}\nprintf(\"%d\",c);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a8153764cb1b6cc48049615f92fc306e", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "/* .................... compiled by alankar....................\n*/\n\n//......................SHORTCUTS..............................\n\n#include\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(\"%llu\",&x);\n#define p(x) printf(\"%d\\n\",x);\n#define pl(x) printf(\"%llu\\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\nint pwr(int a,int b){\n if(b==0)\n return 1;\n int 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\ninline 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//.......................................................\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.................................................................\nint a[101]={0},b[101]={0};\n\nint main()\n{ int i,j,k,t,n,d;\na[0]=b[0]=1;\n s(n)\n s(k)\n s(d)\n FOR(i,1,n+1)\n {\n FOR(j,1,k+1)\n {\n if(i-j>=0)\n {\n a[i]=(a[i]+a[i-j])%MOD;\n }\n }\n }\n FOR(i,1,n+1)\n {\n FOR(j,1,d)\n {\n if(i-j>=0)\n {\n b[i]=(b[i]+b[i-j])%MOD;\n }\n }\n }\n p((a[n]-b[n]+MOD)%MOD)\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2f5831916bb6a6470f34dcee97fb7869", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nint modMax = 1000000007;\nint tsize = 101;\nlong long int sumWOD[tsize];\nlong long int sumWD[tsize];\n\nint n, d, k;\n\nvoid computeSumWOD(int size) {\n sumWOD[0] = 1;\n sumWOD[1] = 1;\n for(int i = 2; i < size; i++) {\n for(int j = 0; j<=k && i-j>0; j++) {\n sumWOD[i] += sumWOD[i-j];\n sumWOD[i] %= modMax;\n }\n }\n}\n\nvoid computerSumWD(int size) {\n for(int i = 1; i < size; i++) {\n if(i >= d) \n sumWD[i] += sumWOD[i-d];\n for(int j = 1; j <=k && i-j>0; j++) {\n if(j == d)\n continue;\n sumWD[i] += sumWD[i-j];\n sumWD[i] %= modMax;\n }\n }\n}\n\nint main () {\n //get n, k, d\n int n,k,d;\n scanf(\"%d%d%d\", &n, &k, &d);\n computerSumWOD(n+1);\n computerSumWD(n+1);\n printf(\"%I64d\", sumWD[n]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "562a319d12f4148fc54f282148533302", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nconst int modMax = 1000000007;\nconst int size = 101;\nlong long int sumWOD[size];\nlong long int sumWD[size];\n\nint n, d, k;\n\nvoid computeSumWOD(long long int *arr, int size) {\n arr[0] = 1;\n arr[1] = 1;\n for(int i = 2; i < size; i++) {\n for(int j = 0; j<=k && i-j>0; j++) {\n arr[i] += arr[i-j];\n arr[i] %= modMax;\n }\n }\n}\n\nvoid computerSumWD(long long int *arr, int size) {\n for(int i = 1; i < size; i++) {\n if(i >= d) \n arr[i] += sumWOD[i-d];\n for(int j = 1; j <=k && i-j>0; j++) {\n if(j == d)\n continue;\n arr[i] += arr[i-j];\n arr[i] %= modMax;\n }\n }\n}\n\nint main () {\n //get n, k, d\n int n,k,d;\n scanf(\"%d%d%d\", &n, &k, &d);\n computerSumWOD(sumWOD, n+1);\n computerSumWD(sumWD, n+1);\n printf(\"%I64d\", sumWD[n]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "45234be576cb673dc27d9fb0ee88c2f6", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nconst int modMax = 1000000007;\nconst int size = 101;\nlong long int sumWOD[size];\nlong long int sumWD[size];\n\nint n, d, k;\n\nvoid computeSumWOD(long long int arr, int size) {\n arr[0] = 1;\n arr[1] = 1;\n for(int i = 2; i < size; i++) {\n for(int j = 0; j<=k && i-j>0; j++) {\n arr[i] += arr[i-j];\n arr[i] %= modMax;\n }\n }\n}\n\nvoid computerSumWD(long long int arr, int size) {\n for(int i = 1; i < size; i++) {\n if(i >= d) \n arr[i] += sumWOD[i-d];\n for(int j = 1; j <=k && i-j>0; j++) {\n if(j == d)\n continue;\n arr[i] += arr[i-j];\n arr[i] %= modMax;\n }\n }\n}\n\nint main () {\n //get n, k, d\n int n,k,d;\n scanf(\"%d%d%d\", &n, &k, &d);\n computerSumWOD(sumWOD, n+1);\n computerSumWD(sumWD, n+1);\n printf(\"%I64d\", sumWD[n]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "63704f9931e2c74a9657f42fae7006b4", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nlong long dp[100][2];\n\nvoid add(long long &a, long long b)\n{\n a += b;\n a %= 1000000007;\n}\n\nint main()\n{\n int n, k, d, i, j;\n scanf(\"%d %d %d\", &n, &k, &d);\n dp[0][0] = 1;\n dp[0][1] = 0;\n \n for(i = 1 ; i <= n ; ++i)\n {\n dp[i][0] = dp[i][1] = 0;\n \n for(j = 1 ; j <= k ; ++j)\n {\n if(i-j < 0) break;\n \n if(j < d)\n {\n add(dp[i][0], dp[i-j][0]);\n add(dp[i][1], dp[i-j][1]);\n }\n else\n {\n add(dp[i][1], dp[i-j][0]);\n add(dp[i][1], dp[i-j][1]);\n }\n }\n }\n printf(\"%I64d\\n\", dp[n][1]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "631d65fe54644c3a31bc4dff08001544", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3205d9b0efd4ba09316a6a9bb2912f9", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int l,r,a;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4d489a36233c4679c27234eb0eeb6312", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0} {"lang": "GNU C11", "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 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "7018436182caee8aa497c9397c1d7101", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int l,r,a;\n \n scanf(\"%d%d%d\", &l,&r,&a);\n\n int t = l+r+a;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f1cb3ad60435f80aa4bae245b6caef58", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\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>l>>r>>a\n\tcout<\nint main(){\n int n,k,sum=0,con=0;\n scanf(\"%d\\n\",&n);\n k=n/2;\n for(;n!=k;n--){\n if(n%10!4&&n%10!=7){printf(\"NO\");return 0;}\n sum+=n%10;\n n/=10;\n }\n for(;n!=0;n--){\n if(n%10!4&&n%10!=7){printf(\"NO\");return 0;}\n con+=n%10;\n n/=10;\n }\n if(con!=sum)printf(\"NO\");\n else{printf(\"YES\");}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1f48a1e8287231b4c941975c4297426e", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int n,i,sum=0,flag=0;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",a);\n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nbool isLuckyTicket(const string& _Src) {\n int m = _Src.size() >> 1;\n string l = _Src.substr(0, m);\n string r = _Src.substr(m, m);\n int numl = 0, numr = 0;\n auto lit = l.begin(), rit = r.begin();\n while (lit != l.end() && rit != r.end()) {\n if (*lit == '4' || *lit == '7')\n numl += int(*lit - '0');\n else return false;\n if (*rit == '4' || *rit == '7')\n numr += int(*rit - '0');\n else return false;\n ++lit, ++rit;\n }\n return (numl == numr);\n}\n\nint main() {\n int n;\n string ticket;\n cin >> n >> ticket;\n if (isLuckyTicket(ticket))\n cout << \"YES\" << endl;\n else cout << \"NO\" << endl;\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e5bc2dce1731bbd48d4ca8ab4ad014db", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tlong double a, x, m, m1;\n\t int sum = 0, sum1 = 0;\n\tscanf(\"%Lf\", &x);\n\tscanf(\"%Lf\", &a);\n\tm = x / 2;\n\tfor (int i = 0; i < m; i++){\n\t\tm1 = a % 10;\n\t\ta = a / 10;\n\t\tif (m1 == 4 || m1 == 7)sum = sum + m1;\n\t}\n\tfor (int j = 0; j < m; j++){\n\t\tm1 = a % 10;\n\t\ta = a / 10;\n\t\tif (m1 == 4 || m1 == 7)sum1 = sum1 + m1;\n\t}\n\n\tif (sum == sum1)printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb05bd40a1d4c0e53b190399515b2bf0", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{int i,a=0,s=0,t=0,n,c;\nscanf(\"%d\",&n);\nfor(i=1;i<=n;i++)\n{ scanf(\"%d\",&c);\n if (c!=4 && c!=7)\n a++;\n else\n i>n/2?s+=c:t+=c;}\n if(s==t) \nprintf(a==0?\"YES\":\"NO\");\nelse\nputs(\"NO\");\nreturn 0;}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e6671b6145ca9d58faeae1856001ff80", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "/* 20160803 JJA Codeforces */\n#define _CRT_SECURE_NO_WARNINGS\n\n#include \n#include \nint main() {\n\tint n, c;\n\tint *arrP;\n\tint *arrT;\n\tint Limak=0;\n\tint Radewoosh=0;\n\tint t;\n\tscanf(\"%d %d\", &n, &c);\n\tarrP = (int*)malloc(sizeof(int)*n);\n\tarrT = (int*)malloc(sizeof(int)*n);\n\tfor (int i = 0; i < n; i++) scanf(\"%d\", &arrP[i]);\n\tfor (int i = 0; i < n; i++) scanf(\"%d\", &arrT[i]);\n\tt = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tt += arrT[i];\n\t\tLimak += max(0,arrP[i] - (t*c));\n\t}\n\tt = 0;\n\tfor (int i = n - 1; i >= 0; i--) {\n\t\tt += arrT[i];\n\t\tRadewoosh += max(0, arrP[i] - (t*c));\n\t}\n\tif (Limak > Radewoosh) printf(\"Limak\");\n\telse if (Limak < Radewoosh) printf(\"Radewoosh\");\n\telse printf(\"Tie\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ecbcabf88d674f522e23e1a6151a25fb", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "47a6501bb08bef72e614de2e105d328c", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint max(int a, int b){\n\tif(a > b)\n\t\treturn a;\n\telse\t\n\t\treturn b;\n}\n\nint main (void){\n\tint n, c, t[1010], p[1010], score_l = 0, score_r = 0, i, j, timeR = 0, timeL = 0;\n\n\t\n\tscanf(\"%d %d\", &n, &c);\n\t\n\tfor(i = 0; i < n; i++)\n\t\tscanf(\"%d\", &p[i]);\n\t\n\tfor(i = 0; i < n; i++)\n\t\tscanf(\"%d\", &t[i]);\n\t\n\tfor(i = 0, j = n-1; i < n; i++, j--){\n\t\t//printf(\"pb : l : %d, r : %d\\n\", p[i],p[j]);\n\t\t//printf(\"c*p l : %d, c*p r : %d\\n\",p[i]-(c*t[i]),p[j]-(c*t[j]));\n\t\ttimeL += t[i];\n\t\ttimeR += t[j];\n\t\tscore_l += max(0, p[i]-c*timeL);\n\t\tscore_r += max(0, p[j]-c*timeR);\n\t}\n\t\n\t//printf(\"l : %d\\n r : %d\\n\", score_l, score_r);\n\tif(score_l > score_r)\n\t\t\tprintf(\"Limak\\n\");\n\t\t\n\telse if(score_l < score_r)\n\t\t\tprintf(\"Radewoosh\\n\");\n\t\t\n\telse\n\t\t\tprintf(\"Tie\");\n\t\n\tfclose(infp);\n\nreturn 0;}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c8b811a75620935e3c85a51b82f21e88", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nusing namespace std;\n#define maxD 51\n\nint maxim(int a,int b)\n{\n if(a>b) return a;\n return b;\n}\n\nint main()\n{\n\n int i,n,c,p[maxD],t[maxD],L,R;\n L=R=0;\n scanf(\"%d%d\",&n,&c);\n\n for(i=0;i=0;--i)\n {\n timp+=t[i];\n R+=maxim(0,p[i]-c*timp);\n }\n\n if(L>R)\n printf(\"Limak\");\n else if(L==R)\n printf(\"Tie\");\n else\n printf(\"Radewoosh\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cf684af89efa7d9bdc27ca1a8ff309e2", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "A. Bear and Reverse Radewoosh.c", "lang_cluster": "C", "compilation_error": true, "code_uid": "8434c51f6582340e71da8440eb4e8e23", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main() {\n char kelime[1000]; int i;\n gets(kelime);\n for(i=0;i\n#include \n#include \nint main() {\n char text[1000],fi[600],t[500];\n int i,j,n,c=0;\n scanf(\"%s\",&text);\n n=strlen(text);\n while(i\n#include\nusing namespace std;\nint main(){\n string a;\n\tint i;\n cin>>a;\n for(int i=0;i\n#include \n#include\n\nint main()\n{\n char s[201];\n int i,n;\n printf(\"donner l chine \");\n scanf(\"%s\",s);\n n=strlen(s);\n for (i=0 ; i<=n ; i++){\n if (s[i]=='W' && s[i+1]=='U' && s[i+2]=='B'){\n s[i]=' ';\n s[i+1]=' ';\n s[i+2]=' ';}\n }\n printf(\"%s\",s);\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "970afd935094767decc334a1cc0467f2", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nchar a[200],b[200];\nint gets(a);\nint strlen(a);\nint i,j=0,k=0;\nint len=strlen(a);\nfor(i=0;i0){\nb[j]=\u2019 \u2018;\nj++;\n}\nb[j]=a[i];\nk=2;\nj++;\n}\n}\nb[j]=\u2019\\0\u2019;\nputs(b);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7fabd43c9dc62bd414f0a7a87b99abe9", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define N 100\n\n\nint main()\n{\n __int64 n, k, ans = 0, sum = 0;\n long i;\n scanf(\"%I64d%I64d\", &n, &k);\n if ((k + 2) * (k-1) / 2 - k + 2 < n){\n puts(\"-1\");\n return 0;\n }\n for (i=k; i>1; i--){\n ans++;\n sum += i;\n if (sum>=n){\n printf(\"%I64d\", ans);\n return 0;\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ef1ff9eb1d632c0fc1f796d2953f32b6", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef unsigned long long int LL;\nLL highval(LL k, int digits) {\n LL sum = 0;\n for (int i = 0; i < digits; i++) {\n sum += k-i;\n }\n return sum-digits+1;\n}\n//LL lowval(LL k, int digits) {\nLL lowval(int digits) {\n LL sum = 0;\n for (int i = 0; i < digits; i++) {\n sum += i+2;\n }\n return sum-digits+1;\n}\n\nLL cal(LL val, LL k) {\n int lo=0, hi=k; //val = [2..k]\n while (hi-lo > 1) {\n //printf(\"SHIT\\n\");\n //printf(\"%d %d\\n\", lo, hi);\n int mid = (hi+lo)/2;\n LL u = highval(k, mid);\n if (val > u)\n lo = mid;\n else\n hi = mid;\n }\n return (val >= lowval(hi) && val <= highval(k, hi)) ? hi : -1;\n}\n\nint main() {\n LL n, k;\n scanf(\"%llu %llu\", &n, &k);\n printf(\"%llu\\n\", cal(n, k));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2baad13ce1c71821cd2b594c1ca73e90", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\n_int64 sum(_int64 t);\n_int64 n,k;\nint main()\n{\n\twhile(scanf(\"%I64d %I64d\",&n,&k)!=EOF)\n\t{\n\t\t_int64 left=0,right=k-1;\n\t\tint flag=0;\n\t\tif(sum(k)n)\n\t\t\t\t\tright=mid;\n\t\t\t\telse if(term=k-t;i--)\n\t\tsum+=i;\n\treturn sum;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e849348319842ee3b95aa9de8f99059c", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n __int64 n, k, ans = 0, sum = 0;\n long i;\n scanf(\"%I64d%I64d\", &n, &k);\n if ((k + 2) * (k-1) / 2 - k + 2 < n){\n puts(\"-1\");\n return 0;\n }\n if (k==999999999&&n=1000000000){\n puts(\"2\");\n return 0;\n }\n sum = sqrt(k * k - k - 2 * n + 2.25) + 1.5;\n if ( k * k - sum * sum + 3 * sum >= 2 * n){\n printf(\"%I64d\", k - sum + 1);\n }\n else {\n printf(\"%I64d\", k - sum + 2);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "858260ecf790d677624989b00fa6e2a0", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n long long n, k, s, l, r, m;\n scanf(\"%I64d%I64d\", &n, &k);\n --n, --k;\n s = k * (k + 1) / 2;\n if (n > s)puts(\"-1\");\n else {\n for (l = 0, r = k ; l < r - 1 ;){\n m = (l + r) / 2;\n if (m * (m + 1) / 2 == s - n){\n l = m;\n break;\n }\n else if (m * (m + 1) / 2 < s - n)l = m;\n else r = m;\n }\n printf(\"%I64d\\n\", k - l);\n }\n scanf(\" \");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "84cd8ac74e94af7bac01a6ade3f80e1e", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0} {"lang": "GNU C11", "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/12345;\n for(i=0;i<=a;i++)\n for(j=0;j<=b;j++)\n if((n-(i*1234567+j*12345)%1234==0)\n w=1;\n if(w)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "223f03775c9836ad6f287a0e6ce0c729", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tint n,i,jsum,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)\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "e67477956a5019885c4b6b0859f1ecff", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0} {"lang": "GNU C", "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 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "f1a0e487ce2508483897b537ba58965d", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0} {"lang": "GNU C", "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\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint main()\n{\n\tint n;\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}\n\tputs(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "247c08b2a80b1fd46428fef1ff10a530", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint pow(int a,int b)\n{\n long long x=1;\n for(int i=1;i<=b;i++)\n x*=a;\n return x;\n\n}\nint n,m,s,t;\nint main()\n{\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n\n for(int i=0;i<30;i++)\n for(int j=0;j<25;j++){\n t=pow(2,i)*pow(3,j\n if(t>=n && t<=m) s++;\n if(t>m) break;\n }\n printf(\"%d\",s);\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ef8625b44ee3e6f85abf00ffc8224464", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint MAXN=1e5+10;\nint a[MAXN];\nint main()\n{\n\tlong long i,j,k,l,r,m,n,ll,rr,lll,rrr,ans;\n\n\tscanf(\"%I64d%I64d\",&m,&n);\n\tm--;\n\tans=0;\n\tl=m;\n\tr=n;\n\tll=log2(l)+1;\n\trr=log2(r)+1;\n\tll=1<<(ll-1);\n\trr=1<<(rr-1);\n\tlll=0;\n\twhile (ll>0)\n\t{\n\t\tlll+=log2(m)/log2(3)+1;\n\t\tll>>=1;\n\t}\n\trrr=0;\n\twhile (rr>0)\n\t{\n\t\trrr+=log2(n/rr)/log2(3)+1;\n\t\trr>>=1;\n\t}\n\tans=rrr-lll;\n\tprintf(\"%I64d\",ans);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "15c53afc17ccb980658444cc557dfd3d", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\n#include\n\nint main(){\n\n\tint l, r;\n\tscanf(\"%d %d\", &l, &r);\n\tint count = 0;\n\tfor (int i = 0; i <= 30; i++){\n\t\tfor (int j = 0; j <= 30; j++){\n\t\t\tll ans = (ll)pow(2, i)*(ll)pow(3, j);\n\t\t\tif (ans >= l&&ans <= r)\n\t\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\n\n//\treturn (0);\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "90663e9ab9686f1c3717d287d0b03bc1", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\ntypedef long long LL;\n\nsets;\nvectorv;\n\nvoid settable()\n{\n\ts.insert(1);\n\tset::iterator iter=s.begin();\n\tint count=1;\n\tLL temp=*iter;\n\twhile(temp<=2e9){//\ufffd\u02f4\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\t\tLL t=*iter;\n\t\ts.insert(t*2);\n\t\ts.insert(t*3);\n\t\ttemp=t*3;\n\t\titer++;\n\t}\n\titer=s.begin();\n\twhile(iter!=s.end()){\n\t\tv.push_back(*iter++);\n\t}\n/*\tfor(int i=0;i<10;i++){\n\t\tprintf(\"%d \",v[i]);\n\t}\n\tprintf(\"\\n\");*/\n}\n\n\nint main()\n{\n\tsettable();\n\tint l,r;\n\tscanf(\"%d%d\",&l,&r);\n\tint num=upper_bound(v.begin(),v.end(),r)-lower_bound(v.begin(),v.end(),l);\n\tprintf(\"%d\\n\",num);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "413670f1952fbb67e766b5114c2757e7", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nusing namespace std;\n\ntypedef long long int ll;\n\nconst double pi = 3.1415926535897932384626433832795;\nconst double eps = 1e-10;\nconst int inf = 1e9;\nconst int mod = 1e9 + 7;\n\nint lg(ll x,ll y)\n{\n int an =0;\n while(x >= y)\n {\n x/=y;\n an++;\n }\n return an;\n}\n\nint f(int k)\n{\n int ans = 0,i;\n for(i = 0;(ll)(1LL<\n#include\nint main()\n{\n int a,b,c,i,j,q;\n char bu[199];\n int bi[199];\n scanf(\"%d%d\",&a,&b)\n\n getchar();\n memset(bi,0,sizeof(bi));\n scanf(\"%s\",bu);\n for(i=0;i=b)\n {\n for(q=i-b;q\nint f(char a[],int x,int jici,int n,int d);\nint main(){\n\tint n,d;\n\tint char s[101];\n\tscanf(\"%d%d\",&n,&d);\n\tscanf(\"%s\",s);\n\tprintf(\"%d\",f(s,1,0,n,d));\n\treturn 0;\n}\nint f(char a[],int x,int jici,int n,int d){\n\tif(x==n)return jici;\n\n\tint i;\n\tif(a[x-1]=='1')\n\tfor(i=n;i>=1;i--){\n\t\tif(a[i-1]=='1'&&(i-x<=d)f(a,x+i-x,jici+1,n,d);\n\n\t}\n\treturn jici;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "21acd22cda50102ba5946bb059bf68a3", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\n\nchar array[101];\nint arr[101];\n\nint main()\n{\n\tint n,d;\n\tscanf(\"%d%d\",&n,&d);//cin>> n>>d;\n\tint i,j;\n\tfor(i = 0 ; i < n ; i++)\n\t\tscanf(\"%s\",array);\n\tfor(i=0;i\nusing namespace std;\n\nchar array[101];\nint arr[101];\n\nint main()\n{\n\tint n,d;\n\tscanf(\"%d%d\",&n,&d);//cin>> n>>d;\n\tint i,j;\n\tfor(i = 0 ; i < n ; i++)\n\t\tscanf(\"%s\",array);\n\tfor(i=0;i\n\nint main()\n{\n\tint n,m,i=0,j,x,y,len,num=0,d;\n\tchar s[102],ch;\n\tscanf(\"%d%d\",&n,&d);\n\tgetchar();\n\tgets(s);\n for(j=i+d;j>=i;j--)\n {\n \tif(j>=n-1)\n \t{num++;break;}\n \telse if(s[j]=='1'&&j!=i)\n \t{\n\t \ti=j;\n\t \tj=i+d+1;\n\t \tnum++;\n\t }\n\t else if(j==i)\n\t {\n \t\tprintf(\"-1\");\n \t\tbreak;\n \t}\n }\n if(j!=i)\n printf(\"%d\",num);\n \n\t\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "2b3d96e81dcfb6516ac8b3878612bc55", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nlong long int max(long long int a ,long long int b)\n{\n return a>b?a:b;\n}\nint main()\n{\n int n,i;\n long long int ans=1s;\n scanf(\"%d\",&n);\n if(n==1)\n ans=1;\n else if(n==2)\n ans=2;\n else if (n==3)\n ans=6;\n else if(n%2==0)\n {\n for(i=1;i<=50 ;i++)\n {\n if(n%(n-i)==0)\n continue;\n ans=max(ans,n*(n-1)*(n-i));\n }\n }\n else\n ans=(n)*(n-1)*(n-2);\n printf(\"%lld\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b86959364765c8abf572c1b914aa6b50", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int n;\n long long int ans;\n scanf(\"%d\",&n);\n if(n=<2)\n ans=n;\n else if (n==3)\n ans=6;\n else if(n%2==0)\n ans=(n-1)*(n-2)*(n-3);\n else if(n%3==0)\n ans=(n)*(n-1)*(n-2);\n else\n asn=(n)*(n-1)*(n-3);\n printf(\"%lld\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "449573fa9e0e2a77859876e741d80806", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n<3)\n {\n printf(\"%d\\n\",n);\n }\n else if(n%2==0)\n {\n if(((n-3)%2)!=0 || (n%3)!=0)\n {\n printf(\"%d\\n\",(n)*(n-1)*(n-3)); \n }\n else \n {\n printf(\"%d\\n\",(n-1)*(n-2)*(n-3))\n }\n }\n else\n {\n printf(\"%d\\n\",(n)*(n-1)*(n-2));\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "54991dc36e5e93e0ea31cd88f3137929", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nlong long int hcf(long long int i,long long int j){\n long long int k=1,l;\n while(k!=0){\n l=j;k=i%j;i=j;j=k;\n }\n return l;\n}\nlong long int max(long long int i,long long int j){\n if(i>j) return i;\n return j;\n}\nint main(){\n long long int n,i,j,k,l;\n scanf(\"%I64d\",&n);\n if(n<=2){\n printf(\"%I64d\",n);\n }\n else if(n%2==1){\n l=n*(n-1)*(n-2);\n printf(\"%I64d\",l);\n }\n else{\n i=n*(n-1);l=n-2;k=l/2;\n //printf(\"%lld\\t\",i);printf(\"%lld\\n\",l);\n while(l>(n-2)/2){\n j=hcf(i,l);\n //printf(\"%lld\\n\",j);\n if(j==1){\n k=l;break;\n }\n l--;\n }\n l=k*i;\n j=(n-1)*(n-2)*(n-3);\n l=max(l,j);\n printf(\"%I64d\",l);\n }\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ebf623a3611f438b66fdccc95bfc228b", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint gcd(int a , int b);\nint main(void)\n{\nint i=1,n,a,b,x,y;\n\nscanf(\"%d\",&n);\na=n;\nb=(n-1>0)?n-1:1;\nx=(n-1>0)?n-1:1;\ny=(n-2>0)?n-2:1;\nif(!(n-1)) b=1;\nfor(i=n-2;i>0;i--)\n{\nif(gcd(a,i)==1&&gcd(b,i)==1)\nbreak;\n}\nfor(int j=n-3;j>0;j--)\n{\nif(gcd(x,i)==1&&gcd(y,j))\nbreak;\n}\nj=(j>0)?j:1;\ni=(i>0)?i:1;\nlong long int ans;\nif(i>j)\nans=a*b*i;\nelse\nans=x*y*j\nprintf(\"%lld\",ans);\nreturn 0;\n}\nint gcd(int a , int b)\n{\nlong long int r = (a%b==0)?b:gcd(b,a%b);\nreturn r;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "85896c38d6b7d4470203569c770935c3", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "main()\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/5b)\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 h,m,s,a,b;\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 if ( (h>=a) && (m>=5*a) && (s>5*a) && (h<=b) && (m<=5*b) && (s<5*b))\n {\n printf(\"YES\");\n found=1;\n }\n if (((h>=b)||(h<=a)) && ((m>=5*b)||(m<=5*a)) && ((s>5*b)||(s<5*a)) )\n {\n printf(\"YES\");\n found=1;\n }\n else (found==0)\n printf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0b18f0e67c4ca08d6331f112f64d3c45", "src_uid": "912c8f557a976bdedda728ba9f916c95", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \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) || ((a==m1 && b>=s1 && b>=h)))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0899391e53a17225eafa90ab55d30cc6", "src_uid": "912c8f557a976bdedda728ba9f916c95", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int h,m,s,a,b,m1,s1,i,max,min,k=1;\n scanf(\"%d %d %d %d %d\",&h,&m,&s,&a.&b);\n m1=m/5;\n s1=s/5;\n max=a;\n min=b;\n if (a\n#include \nint zero(int n){\n int tab[5]={0,1,2,2,1,0};\n return tab[tab%6];\n}\nint one(int n){\n int tab[5]={1,0,0,1,2,2};\n return tab[tab%6];\n}\nint two(int n){\n int tab[5]={2,2,1,0,0,1};\n return tab[tab%6];\n}\n\nint main()\n{\n\tint n,x;\n\tscanf(\"%d %d\",&n,&x);\n if(zero(n)==x) printf(\"0\");\n if(one(n)==x) printf(\"1\");\n if(two(n)==x) printf(\"2\");\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f590a2aa8597a834ba0f00bdd5b640c8", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "shellGame.c", "lang_cluster": "C", "compilation_error": true, "code_uid": "23b9dce8970b8612df107efa636a5dd5", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint zero(int n){\n int tab[5]={0,1,2,2,1,0};\n return tab[tab%6];\n}\nint one(int n){\n int tab[5]={1,0,0,1,2,2};\n return tab[tab%6];\n}\nint two(int n){\n int tab[5]={2,2,1,0,0,1};\n return tab[tab%6];\n}\n\nint main()\n{\n\tint n,x;\n\tscanf(\"%d %d\",&n,&x);\n if(zero(n)==x) printf(\"0\");\n if(one(n)==x) printf(\"1\");\n if(two(n)==x) printf(\"2\");\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f71b6864f48e3ca8e6d1f8fe651e5585", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int n;\n int x,f,temp1,temp2,a,b,c;\n scanf(\"%lld%d\",&n,&f);\nif(f==0)\n {\n a=1;\n b=0;\n c=0;\n }\nelse if(f==1)\n {\n a=0;\n b=1;\n c=0;\n }\nelse\n {\n a=0;\n b=0;\n c=1;\n }\n if(n%2==0)\n x=n%6;\n else\n x=6-(n%6);\n switch()\n {\n case(1)\n temp1=b;\n b=c;\n c=temp1;\n break;\n \n case(2)\n temp1=b;\n b=c;\n c=temp1;\n a=temp2;\n a=c;\n c=temp2;\n break;\n case(3)\n temp1=a;\n a=c;\n c=temp1;\n break;\n case(4)\n temp1=b;\n b=a;\n a=temp1;\n temp2=c;\n c=a;\n a=temp2;\n break;\n case(5)\n temp1=a;\n a=b;\n b=temp1;\n break;\n case(6)\n ;\n break;\n default\n ;\n \n }\n if(a==1)\n printf(\"0\");\n else if(b==1)\n printf(\"1\");\n else if(c==1)\n printf(\"2\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4083bd97049656ab99ae0805d020436d", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3933fd86c23f5cb145d7b7c2c1630a1a", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n unsigned int n;\n char c;\n scanf(\"%d%c\",&n,&c);\n char string[1024];\n int numbers[100];\n gets(string);\n char * cp;\n int i=0;\n cp=strtok(string,\" \");\n while (cp != NULL)\n {\n sscanf(cp,\"%d\",&numbers[i]);\n i++;\n cp = strtok(NULL,\" \");\n }\n int phase=0;\n for (i=0;inumber[i+1]) phase=3;\n }\n if (phase==3)\n {\n if(numbers[i]>number[i+1]) phase=3;\n else phase=4;\n \n }\n if (phase==4) break;\n }\n \n if(phase==2 || phase==3)\n {\n printf(\"yes\");\n }\n else\n {\n printf(\"no\");\n }\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "39a553311131d409a0f5b5aa2806730d", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n unsigned int n;\n char c;\n scanf(\"%d%c\",&n,&c);\n char string[1024];\n int numbers[100];\n gets(string);\n char * cp;\n int i=0;\n cp=strtok (string,\" \");\n while (cp != NULL)\n {\n sscanf(cp,\"%d\",&numbers[i]);\n i++;\n cp = strtok (NULL, \" \");\n }\n int phase=0;\n for (i=0;inumber[i+1]) phase=3;\n }\n if (phase==3)\n {\n if(numbers[i]>number[i+1]) phase=3;\n else phase=4;\n \n }\n if (phase==4) break;\n }\n \n if(phase==2 || phase==3)\n {\n printf(\"yes\");\n }\n else\n {\n printf(\"no\");\n }\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "81948479c5f4b4cf3b4f22ef7996cc8c", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint um(int s[],int k){\nint main(){\n\tint n,i;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;i0){\n\tc=c+1;\t\n\t}}\n\telse{\n\tif(s[j]==0){\n\tif(s[j+1]==0||s[j+1]>0){\n\tc=c+1;\n\t}}\n\telse{\t\n\tif(s[j+1]>0){\n\tc=c+1;\n\t}}}}\n\tif(c==k-1){\n\t\treturn 1;\n\t}\n\telse{\n\t\treturn 0;\n\t}\n} }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d5dabaf33465b628c0c987fe92149f6", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(int argc, char **argv)\n{\n\tint k,,p,n,i;\n\tscanf(\"%d\",&n);\n\tint ar[n];\n\tp=n-1;\n\tfor(i=0;i0)\n\t\tp--;\n\tif(k>=p)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "002b57d088dda43c6cfc14a7ed8c4471", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int n, i, p=1;\n scanf(\"%d\", &n);\n int a[n];\n for (i=0; ia[p-1])\n {\n p++; \n }\n while(a[p]== a[p-1]) \n {\n p++;\n }\n while(a[p]\nint main()\nint x;\nscanf(\"%d\",&x);\nwhile(x>=10 && x<=999)\n{\nif(x%2==0)\n{\nprintf(\"0\");\n}\nif(x%2==1)\n{\nprintf(\"1\");\n}\nbreak;\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "56aba34251116f8af06cbbb279ddef01", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "403baf4a9eb07f59ff5dd1b1f8381083", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int n;scanf(\"%d\",&n);if(n%2==0)printf(\"0\")else printf(\"1\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "231c09590120fc475ab2ebf2263006da", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "GNU C", "source_code": "include\nint main()\n{\n int a;\n printf(\"Enter the number :\");\n scanf(\"%d\",&a);\n \n \n if(a%2==0)\n printf(\"0\");\n if(a%2!=0)\n printf(\"1\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0f01fdbd60cfa372fd98955b30927c69", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#inlcude\nint main()\n{\nint i,j,x,y,a,b,sum,n;\nwhile(scanf(\"%d\",&n)==1)\n{\nfor(j=1;j<=n;j++)\n{\nscanf (\"%d%d\",%a,%b);\nsum=0;\nif(a%2==0)\na=a+1;\nif(b%2==0)\nb=b-1;\nfor(i=a;i<=b;i=i+2)\nsum=sum+i;\nprinft(\"case %d: %d\\n\",j,sum);\n}\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b6734e7684d52ffba1da4ae1bf38f69d", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e5d383053a5ed4da8afb4553b7670cc", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "342899f3da304239dca4cdd69b2c5267", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "15f52aa0961fb04a57e2c36ec62fd237", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "77a1cc36470150a6e2e7af8cc43b411b", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0} {"lang": "GNU C", "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 \n else if(n-m>1&&(h=1||y=1))\n printf(\"Incorrect\");\n \n else if(n-m==1&&(flag1!=1||flag2!=1))\n printf(\"Incorrect\\n\");\n\n\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0d8c4501ef675145ddd19ef139ef7efa", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long int NOD(long long int n1, long long int n2)\n{\n long long int div;\n if (n1 == n2) return n1;\n long long int d = n1 - n2;\n if (d < 0) {\n d = -d; div = NOD(n1, d);\n } else\n div = NOD(n2, d); \n return div;\n}\n\nlong long int NOK(long long int n1, long long int n2) \n{ \n return n1*n2 / NOD(n1, n2); \n}\n\n\nint main()\n{\n long long int x, y, a, b, res = 0;\n scanf (\"%I64d %I64d %I64d %I64d\", &x, &y, &a, &b);\n n = NOK(x, y);\n while (a % n != 0) a++;\n while (b % n != 0) b--;\n res = (b - a) / n + 1; \n printf(\"%I64d\", res);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7f2fefc85a6208f1ea8933b906c9bb7e", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nint main(){\nlong long x,y,a,b,count=0;\nscanf(\"%I64d\",&x);\nscanf(\"%I64d\",&y);\nscanf(\"%I64d\",&a);\nscanf(\"%I64d\",&b);\nfor(long long i = a ; i <= b ; i++)\n{\n // printf(\"i %d\\n\",i);\n if( (i%x == 0) && (i%y == 0) )\n {\n //printf(\"1\");\n count = count + 1;\n }\n}\nprintf(\"%I64d\",count);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "307232f91a835493c54ed62e7856ab8e", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \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, a;\n scanf(\"%d%d%d%d\", &x, &y, &a, &a);\n printf(\"%d\", solve(x, y, b) - solve(x, y, a - 1));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fa780d671ddefa224755b167df67bba8", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "GNU C", "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; i++){\n if(mcm%x == 0 && mcm%y == 0){\n break;\n }\n }\n \n for(i=a; i<=b, i++){\n if(i%mcm == 0)\n break;\n }\n \n for(; i<=b; i+mcm)\n c++;\n \n printf(\"%d\", c);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e82417a51e00edc57fcd9fff9ebf06de", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#define M 1500000\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int i,j,n;\n bool 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 100 || (numCard%2) != 0)\n {\n return;\n }\n\n for (i = 0; i < numCard; i++)\n {\n // printf(\"\\n Nhap a[%d]:\", i);\n scanf(\"%d\", &a[i]);\n\n if (a[i] < 1 || a[i] > 100)\n {\n return;\n }\n }\n\n for (i = 0; i < numCard; i++)\n {\n sum += a[i];\n // printf(\"\\n sum: %d\", sum);\n }\n\n numPerson = numCard>>1;\n\n if (sum % numPerson != 0)\n {\n return;\n }\n sumForPerson = sum/numPerson;\n\n // printf(\"\\n numPerson: %d\", numPerson);\n\n while(coupleIdx < numPerson)\n {\n // printf(\"\\n start: %d...\", start);\n if (a[start] == -1)\n {\n start++;\n }\n\n for (i = start + 1; i < numCard; i++)\n {\n if (a[i] != -1 && a[start] != -1 &&(a[start] + a[i]) == sumForPerson)\n\n if (a[start] > a[i])\n {\n printf(\"\\n %d %d\", i+1, start+1);\n }\n else\n {\n printf(\"\\n %d %d\", start+1, i+1);\n }\n\n a[i] = -1;\n start++;\n coupleIdx++;\n // printf(\"\\n Start: %d, couple: %d\", start, coupleIdx);\n\n break;\n }\n }\n }\n\n\n\n\n return;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f1da69f6ccb2f5336cc8697c05523bc", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n int n,i,j,tmp,k,var;\n scanf(\"%d\",&n);\n int a[n+1],y[n+1];\n for(k=1;k<=n;k++)\n {\n scanf(\"%d\",&a[k]);\n }\n for(m=1;m<=n;m++)\n {\n y[m]=m;\n }\n \n for(i=1;i<=n;i++)\n {\n for(j=1;ja[j])\n {\n tmp=a[i];\n a[i]=a[j];\n a[j]=tmp;\n var=y[i];\n y[i]=y[j];\n y[j]=var;\n }\n }\n }\n for(i=1;i<=(n/2);i++)\n {\n printf(\"%d %d\\n\",y[i],y[n-i+1]);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "46b1ce8cf156d25a69ef1f4cafddf522", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nvoid main()\n{ int n,i,j;n=scanf(\"%d\",&n);int s=0;\n int arr[100];\n for(i=0;i=0)&&(arr[i]>=0))\n {printf(\"%d %d\",i,j);\n arr[i]=-1;arr[j]=-1;break;\n\t }}\n }getch();\t \n\t }\n\t \n\t \n \n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ce3a23c96e9fb8f5d82fcaeb0835299e", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int s[111],i,j,sum,ave,n;\n bool vis[111];\n while(scanf(\"%d\",&n)!=EOF)\n {\n sum=0;\n memset(vis,false,sizeof(vis));\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&s[i]);\n sum+=s[i];\n }\n ave=sum/n*2;\n\n for(i=1;i<=n;i++)\n {\n if(vis[i]==false)\n {\n for(j=i+1;j<=n;j++)\n if(s[i]+s[j]==ave&&vis[j]==false)\n {\n printf(\"%d %d\\n\",i,j);\n vis[j]=true;\n vis[i]=true;\n break;\n }\n }\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ddfffe0aa4dee86911cf219a26b3e2f7", "src_uid": "6e5011801ceff9d76e33e0908b695132", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a[100],n,i,j,k=0,l,c,s=0;\n scanf(\"%d\",&n);\n for(i=0;i\n\nlong long int power(int base,int exponent)\n{\n int i;\n long long int res=1;\n for(i=0;i0){\n ans += n%10;\n n/=10;\n }\n return ans;\n}\n\nvoid function(int a,int b,int c)\n{\n int i,count=0,s;\n long long int res;\n int arr[100]={0};\n for(i=1;i<=72;i++){\n res = power(i,a);\n res *=b;\n res += c;\n if((res<=0)||(res>1000000000))\n continue;\n s = sum(res);\n if(s==i){\n arr[count] = (int)res;\n count +=1;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i\n\nlong long int cons=1000000000;\n\nlong long int power(long long int a, long long int b)\n{\n long long int i,t=1;\n\tfor(i=0;i0)\n\t{\n\t\ti+=a%10;\n\t\ta/=10;\n\t}\n\treturn i;\n}\n\nint main() {\n\tlong long int a,b,c,n,i,j=0,t=0,arr[100],k=0;\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tfor(i=1;i<=72;i++)\n\t{\n\t\tt=(b*power(i,a))+c;\n //printf(\"%lld %lld %lld\\n\",i,a,power(i,a));\n\t\tif((t<=cons)&&(t>=0))\n\t\t{\n\t\t\tif(dsum(t)==i)\n\t\t\t{\n\t\t\t\tarr[k]=t;\n\t\t\t\tj++;\n\t\t\t\tk++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",j);\n\tfor(i=0;i\nlong long int arr[1000250];\nint main()\n{\n long long int n,a,b,c,s,num,p,p1,i,d,sum=0,flag=0,k,ctr=0;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n for(s=1;s<=82;s++)\n {\n num=1;\n for(i=1;i<=a;i++)\n {\n num=num*s;\n }\n p=b*num+c;\n //printf(\"%d \\n\",p);\n p1=p;\n sum=0;\n while(p1>0)\n {\n d=p1%10;\n sum+=d;\n p1=p1/10;\n\n }\n if(sum==s){flag=1;arr[ctr++]=p;\n //printf(\"%I64d \",p);\n\n }}\nprintf(\"%d\\n\",ctr);\nfor(k=0;k\n\ntypedef __int64 LL_t;\n\nLL_t Pow(LL_t i, LL_t n)\n{\n LL_t ret = 1;\n while(n--)\n {\n ret *= i;\n }\n return ret;\n}\n\nLL_t Fun(LL_t Num)\n{\n LL_t ret = 0;\n while(Num)\n {\n ret += Num%10;\n Num /= 10;\n }\n return ret;\n}\n\nint main()\n{\n LL_t A, B, C, i, Cnt;\n LL_t Data[100];\n scanf(\"%I64d %I64d %I64d\", &A, &B, &C);\n for(Cnt=0, i=1; i<82; ++i)\n {\n if(Fun(Pow(i, A)*B+C) == i)\n {\n Data[Cnt++] = Pow(i, A)*B+C;\n }\n }\n printf(\"%I64d\\n\", Cnt);\n for(i=0; i\n#include\n/*interface implementation*/\nlong long power(long long x,int a) {\n int i;\n long long prod=1;\n for(i=0; i0) {\n sum+=(n%10);\n n=n/10;\n }\n return sum;\n}\n/*client*/\nint main() {\n //\u56e0\u4e3ax\u662f1\u523010^9\u4e4b\u95f4\u7684\u6574\u6570\uff0c\n //\u6240\u4ee5s(x)\u7684\u6700\u5c0f\u503c\u662f1\uff0c\u6700\u5927\u503c\u662f9*8\n long long a,b,c;\n scanf(\"%Ld%Ld%Ld\",&a,&b,&c);\n int rn=0;\n int record[9*8+1];\n long long sx;\n for(sx=1; sx<=9*8; sx++) {\n //\u53d6\u6d88\u5bf9pow\u7684\u4f7f\u7528\uff01\n long long x=b*power(sx,a)+c;\n if(x<1000000000) {\n if(s(x)==sx) {\n //if(fabs(s(x)-sx)<0.0000001) {\n //printf(\"s(%Ld)=%Ld=%d\\n\",x,sx,s(x));\n //\u8fd9\u91cc\u4e0d\u8bb0\u5f5510^9\u4ee5\u4e0a\u7684\uff0c\u6211\u7684\u5224\u65ad\u662f\u5bf9\u7684\uff01\n record[rn]=x;\n rn++;\n }\n }\n }\n}\nprintf(\"%d\\n\",rn);\nint i;\nfor(i=0; i\nint main()\n\t { int x[100],y[100],l[100],t,i,j;\n\t\t for(i=0;i<3;i++)\n\t\t\t scanf(\"%d%d\",&x[i],&y[i]);\n\t\t t=0;\n\t\t for(j=0;j<13;j++)\n\t\t\t { if(j!=0 && j<4)\n\t\t\t\t { x[j-1]--;\n\t\t\t\t\t if(j>1)\n\t\t\t\t\t x[j-2]++; }\n if(j>3 && j<=6 )\n\t\t\t\t { x[j-2]++;\n\t\t\t\t\t y[j-4]--;\n\t\t\t\t\t if(j>4)\n\t\t\t\t\t\t y[j-5]++; }\n if( j>6 && j<=9) \n { y[j-5]++;\n\t\t\t\t\t\t y[j-7]++;\n if(j>7)\n y[j-8]--; }\n\n if(j>9) \n { x[j-8]++;\n\t\t\t\t\t y[j-9]--;\n if(j>10)\n x[j-11]--; }\n\n \t l[0]=(x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0]);\n\t l[1]=(x[2]-x[1])*(x[2]-x[1]) + (y[2]-y[1])*(y[2]-y[1]); \n \t l[2]=(x[2]-x[0])*(x[2]-x[0]) + (y[2]-y[0])*(y[2]-y[0]);\t \n if(l[0]!=0 && l[1]!=0 && l[2]!=0 )\n { if (l[0] + l[1]==l[2]) \n\t\t t=1;\n\t\t\n if (l[1] + l[2]==l[0])\n\t\t t=1;\n\t\t\n if (l[0] + l[2]==l[1])\n\t\t\t t=1;\n\t\t\n if(t==1 && j==0)\n\t\t\t{printf(\"RIGHT\");\n\t\t\t\tbreak; }\n\t\t if(t==1)\n\t\t {printf(\"ALMOST\",);\n\t\t\t \n\t break; }\n\t }\t \n\n\t\t\t }\n\n\t\t if(t==0)\n\t\t\t printf(\"NEITHER\");\n\n\t\t return 0; }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4cd2abdbd85da867ee575e4eb3601340", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nusing namespace std;\nint a[3],b[3],c[3],d[3],e[3],f[3],g[3],h[3],i[3],j[3],k[3],l[3],m[3];\nint main()\n{\n int x1,y1,x2,y2,x3,y3;\n while(~scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3))\n {\n a[0]=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);\n a[1]=(x2-x3)*(x2-x3)+(y3-y2)*(y3-y2);\n a[2]=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);\n b[0]=(x1-x2-1)*(x1-x2-1)+(y1-y2)*(y1-y2);\n b[1]=(x2-x3)*(x2-x3)+(y3-y2)*(y3-y2);\n b[2]=(x1-1-x3)*(x1-1-x3)+(y1-y3)*(y1-y3);\n c[0]=(x1-x2)*(x1-x2)+(y1-y2-1)*(y1-y2-1);\n c[1]=(x2-x3)*(x2-x3)+(y3-y2)*(y3-y2);\n c[2]=(x1-x3)*(x1-x3)+(y1-y3-1)*(y1-y3-1);\n d[0]=(x1-x2+1)*(x1-x2+1)+(y1-y2)*(y1-y2);\n d[1]=(x2-x3-1)*(x2-x3-1)+(y3-y2)*(y3-y2);\n d[2]=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);\n e[0]=(x1-x2)*(x1-x2)+(y1-y2+1)*(y1-y2+1);\n e[1]=(x2-x3)*(x2-x3)+(y3-y2+1)*(y3-y2+1);\n e[2]=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);\n f[0]=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);\n f[1]=(x2-x3+1)*(x2-x3+1)+(y3-y2)*(y3-y2);\n f[2]=(x1-x3+1)*(x1-x3+1)+(y1-y3)*(y1-y3);\n g[0]=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);\n g[1]=(x2-x3)*(x2-x3)+(y3-y2)*(y3-y2);\n g[2]=(x1-x3)*(x1-x3)+(y1-y3+1)*(y1-y3+1);\n h[0]=(x1-x2+1)*(x1-x2+1)+(y1-y2)*(y1-y2);\n h[1]=(x2-x3)*(x2-x3)+(y3-y2)*(y3-y2);\n h[2]=(x1-x3+1)*(x1-x3+1)+(y1-y3)*(y1-y3);\n i[0]=(x1-x2)*(x1-x2)+(y1-y2+1)*(y1-y2+1);\n i[1]=(x2-x3)*(x2-x3)+(y3-y2)*(y3-y2);\n i[2]=(x1-x3)*(x1-x3)+(y1-y3+1)*(y1-y3+1);\n j[0]=(x1-x2-1)*(x1-x2-1)+(y1-y2)*(y1-y2);\n j[1]=(x2-x3+1)*(x2-x3+1)+(y3-y2)*(y3-y2);\n j[2]=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);\n k[0]=(x1-x2)*(x1-x2)+(y1-y2-1)*(y1-y2-1);\n k[1]=(x2-x3)*(x2-x3)+(y3-y2-1)*(y3-y2-1);\n k[2]=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);\n l[0]=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);\n l[1]=(x2-x3-1)*(x2-x3-1)+(y3-y2)*(y3-y2);\n l[2]=(x1-x3-1)*(x1-x3-1)+(y1-y3)*(y1-y3);\n m[0]=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);\n m[1]=(x2-x3)*(x2-x3)+(y3-y2+1)*(y3-y2+1);\n m[2]=(x1-x3)*(x1-x3)+(y1-y3-1)*(y1-y3-1);\n sort(a,a+3);sort(b,b+3);sort(c,c+3);sort(d,d+3);sort(e,e+3);sort(f,f+3);sort(g,g+3);\n sort(h,h+3);sort(i,i+3);sort(j,j+3);sort(k,k+3);sort(l,l+3);sort(m,m+3);\n if(a[0]+a[1]==a[2])\n puts(\"RIGHT\");\n else if((b[0]+b[1]==b[2])||(c[0]+c[1]==c[2])||(d[0]+d[1]==d[2])||(e[0]+e[1]==e[2])||(f[0]+f[1]==f[2])||(g[0]+g[1]==g[2])||(h[0]+h[1]==h[2])||(i[0]+i[1]==i[2])||(j[0]+j[1]==j[2])||(k[0]+k[1]==k[2])||(l[0]+l[1]==l[2])||(m[0]+m[1]==m[2]))\n puts(\"ALMOST\");\n else\n puts(\"NEITHER\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e5e7d08d8218022d5318fac92c6c702d", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef struct p{\n\tint x, y;\n}ponto;\n\n// retorna o angulo no v\u00e9rtice \"a\"\nfloat isRightAngle(ponto a, ponto b, ponto c){\n\tif( (a.x == b.x && a.y == b.y) ||\n\t\t(p1.x == c.x && p1.y == c.y) ||\n\t\t(b.x == c.x && b.y == c.y) ){\n\t\treturn 0;\n\t}\n\n\tint del_x1 = (b.x - a.x),\n\t\tdel_x2 = (c.x - a.x),\n\t\tdel_y1 = (b.y - a.y),\n\t\tdel_y2 = (c.y - a.y);\n\n\treturn (del_x1*del_x2 + del_y1*del_y2) == 0;\n}\n\n// triangulo, t, \u00e9 um vetor de pontos\nint check(ponto *t){\n\tif(isRightAngle(t[0], t[1], t[2]) ||\n\t\tisRightAngle(t[1], t[0], t[2]) ||\n\t\tisRightAngle(t[2], t[1], t[0]))\n\t\treturn 0;\n\n\tint i;\n\tponto triangulos[12]; // cont\u00e9m as 4 configura\u00e7\u00f5es poss\u00edvels para o triangulo em cada ponto\n\t// circula os inteiros vizinhos, come\u00e7ando \u00e0 esquerda, sentido antihor\u00e1rio\n\tfor (i = 0; i < 3; i++){\n\t\ttriangulos[4*i] = t[i]; triangulos[4*i].x -=1;\n\t\ttriangulos[4*i+1] = t[i]; triangulos[4*i+1].y -=1;\n\t\ttriangulos[4*i+2] = t[i]; triangulos[4*i+2].x +=1;\n\t\ttriangulos[4*i+3] = t[i]; triangulos[4*i+3].y +=1;\n\t}\n\n\tfor(i=0; i<4; i++){\n\t\tif(isRightAngle(triangulos[i], t[1], t[2]) ||\n\t\t\tisRightAngle(t[1], triangulos[i], t[2]) ||\n\t\t\tisRightAngle(t[2], t[1], triangulos[i]))\n\t\t\treturn 1;\n\t\tif(isRightAngle(t[0], triangulos[i+4], t[2]) ||\n\t\t\tisRightAngle(triangulos[i+4], t[0], t[2]) ||\n\t\t\tisRightAngle(t[2], triangulos[i+4], t[0]) )\n\t\t\treturn 1;\n\t\tif(isRightAngle(t[0], t[1], triangulos[i+8]) ||\n\t\t\tisRightAngle(t[1], t[0], triangulos[i+8]) ||\n\t\t\tisRightAngle(triangulos[i+8], t[1], t[0]) )\n\t\t\treturn 1;\n\t}\n\n\treturn -1;\n\n}\n\nvoid main(){\n\tponto p[3], origem;\n\tscanf(\"%d %d %d %d %d %d\", &p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y);\n\tif( (p[0].x == p[1].x && p[0].y == p[1].y) ||\n\t\t(p[0].x == p[2].x && p[0].y == p[2].y) ||\n\t\t(p[1].x == p[2].x && p[1].y == p[2].y) ){\n\t\tprintf(\"NEITHER\\n\");\n\t\treturn;\n\t}\n\n\n\tswitch(check(p)){\n\t\tcase 0:\n\t\t\tprintf(\"RIGHT\\n\");\n\t\tbreak;\n\t\tcase 1:\n\t\t\tprintf(\"ALMOST\\n\");\n\t\tbreak;\n\t\tcase -1:\n\t\t\tprintf(\"NEITHER\\n\");\n\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"NEITHER!\\n\");\n\t}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7af562e64108ac996b64bf8beb6a1989", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(){\n float x[3],y[3],f=0,k;\n char i,j;\n scanf(\"%f %f %f %f %f %f\",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);\n for(i=0;i<3;i++)if((x[i%3]==x[(i+1)%3]&&y[(i+2)%3]==y[(i+1)%3])||!((x[i%3]-x[(i+1)%3])/(y[i%3]-y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3])/(y[(i+2)%3]-y[(i+1)%3])+1))f=1;\n for(j=0;j<3&&!f;j++)for(k=0;k<4;k++){\n x[j]+=sin(M_PI/2*k),y[j]+=cos(M_PI/2*k);\n printf(\"%.0f %.0f %.0f %.0f %.0f %.0f\\n\",x[0],y[0],x[1],y[1],x[2],y[2]);\n for(i=0;i<3;i++)if((x[i%3]==x[(i+1)%3]&&y[(i+2)%3]==y[(i+1)%3])||!((x[i%3]-x[(i+1)%3])/(y[i%3]-y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3])/(y[(i+2)%3]-y[(i+1)%3])+1))f=2;\n x[j]-=sin(M_PI/2*k),y[j]-=cos(M_PI/2*k);\n }\n puts(!f?\"NEITHER\":f-1?\"ALMOST\":\"RIGHT\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f5b713d9b318de7a4a682b064c94257d", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tint i,j,k,l,n,m,a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a[0],&a[1],&a[2],&a[3]);\n\tmerge(a,b,0,3);\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c69513621a52b01b0eb727bdc66d465a", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n)\n\tif (n == 1) printf (\"YES\");\n\tif (n * (n + 1) / 2 % 2 == 1){\n\t\tprintf (\"NO\");\n\t}else{\n\t\tprintf(\"YES\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2926ec42aa2d232708526e3f4969d573", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint buocnhay(int a, int b,int n);\nint main(){\n int d=0,a=0,b=0,n=0,i=0;\n\tint c[10000];\n\tscanf(\"%d\",&n);\n\t a=1;\n\t b=1;\n\t c[b]=-2;\n\tfor (a=1;an) return a+b-n;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "81866af595aa3bb1209a8c26f1ca17ac", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n int n;\n scanf(\"%d\", &n);\n printf(\"%s\", n&(n-1) : \"YES\" ? \"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "176f3599aea5f37dc143a36f290ab258", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n int main(){\n\t int i,j,n;\n\n\t scanf(\"%d\"&n);\n\n\t n&(n - 1) ? printf(\"N0\") : printf(\"YES\");\n\n\t return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "072242ed3264eb155c8980d7bbfb0230", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%s\", n&(n-1) : \"YES\" ? \"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cc0552db597358d25c2a00d7233eff09", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int m,i,v=0,temp;\n char ch[120];\n gets(ch)\n temp=0;\n m=strlen(ch);\n if(m==1){\n printf(\"0\\n\");\n }\n else if(m>1){\n for(i=0;i\n#define max(x,y) x>y?x:y\n\nint main(void) {\n\tchar a[100+10];\n\tscanf(\"%s\",a);\n\tint count=0;\n\tint mx;\n\tint i,j;\n\tfor(i=0;a[i]!=0;i++){\n\t\tif(a[i]=='V'&&a[i+1]=='K'){\n\t\t\tcount++;\n\t\t}\n\t}\n\tmx=count;\n\tfor(i=0;a[i]!=0;i++){\n\t\tcount=0;\n\t\ta[i]= 'V'+'K' - a[i];\n\t\tfor(j=0;a[j]!=0;j++){\n\t\t\tif(a[j]=='V'&&a[j+1]=='K'){\n\t\t\t\tcount++;\n\t\t\t}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3315dfe2c701421015a874fcc591e4b0", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#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\nusing namespace std;\n\ntypedef long long lolo;\ntypedef pair pii;\n\nconst int maxn = 100005;\nconst int inf = 0x3f3f3f3f;\n\nint main() {\n char s[110];\n scanf(\"%s\",s);\n int len=strlen(s);\n int cnt=0,l[2]={0,0};\n bool use=true,oc[2]={false,false};\n if(len==1) {\n printf(\"0\\n\");\n return 0;\n }\n if(len==2&&s[0]==s[1]) {\n printf(\"1\\n\");\n return 0;\n }\n for(int i=0;i2) {\n cnt+=use;\n use=false;\n }\n } else {\n l[1]++;\n l[0]=0;\n if(l[1]>2) {\n cnt+=use;\n use=false;\n }\n }\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6e846406feda55cce6f6ebed0024dba4", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#define N 1000\nint a,b,c,d,n,m,turn=0,x,y,pAnt=-1;\nchar mat[N][N];\n\nint esPosible(int iActual,int jActual,int p){\n\tif(p==0){\n\t\tx=-1;y=0;\n\t}\n\telse if(p==3){\n\t\tx=0;y=-1;\n\t}\n\telse if(p==1){\n\t\tx=0;y=+1;\n\t}\n\telse if(p==2){\n\t\tx=+1;y=0;\n\t}\n\tif((iActual+x>=0&&jActual+y>=0&&iActual+x\n#include \n\nint main()\n{\n int a[100],i,j,count,flag;\n gets(a);\n l=strlen(a);\n if(l==2 && a[0]=='V')\n {\n count++;\n }\n else if(l==2 && a[0]=='K')\n {\n count++;\n }\n else\n {\n for(i=0;i\n\nint main(void) {\n\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tprintf(\"%d\", 3*a - b > 0 : 0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "473f249c94baee81c3d2543d65d076dc", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n, k;\n scanf(\"%d%d\", &n, &k);\n printf(\"%d\\n\", k <= n * 3 ? n * 3 - k : 0);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ab97c118e7261b3bc21d9cd80480bbe5", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "examen.c", "lang_cluster": "C", "compilation_error": true, "code_uid": "55c79898117beea261278f549359c01e", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\ninline int scanInt() {\n register int d,retVar=0;\n while((d=getchar())<'0');\n do {\n retVar = (retVar<<3) + (retVar<<1) + d - '0';\n } while((d=getchar())>='0');\n return retVar;\n}\nint main()\n{\n int n,k,a;\n n=scanInt();\n k=scanInt();\n a=k-2*n;\n if(a\nint main(){\n int n, k;\n scanf(\"%d %d\", &n, &k);\n if(k/n > 2)\n print(\"0\\n\");\n else if(k/n < 1)\n printf(\"%d\", n);\n else \n printf(\"%d\", n - k % n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e8fade6e43c645833d5657729a00edc1", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "ll find_min(int n, int l){\n\t\n\tll x = n-l + 1;\n\tll ans = x ;\n\tll base = 2;\n\tfor(ll i = x ; i < n ; i++){\n\t\tans += base;\n\t\tbase *= 2;\n\t}\n\treturn ans;\n}\n \nll find_max(int n, int r){\n\t\n\tll ans = 0;\n\tll base = 1;\n\tfor(ll i = 1 ; i <= n ; i++){\n\t\tans += base;\n\t\tif(i < r)\n\t\t\tbase *= 2;\n \n\t}\n\t\n\treturn ans;\n}\n \nint main()\n{\n\tint n , l , r;\n\tscanf(\"%d%d%d\",&n,&l,&r);\n\t\n\tll mn = find_min(n,l);\n\tll mx = find_max(n,r);\n \n\tprintf(\"%lld %lld\\n\",mn,mx);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9709b4097328787207ceead949ea4724", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\nconst ll INF=0x3f3f3f3f;\nll k,kmax,kmin,t,m,i,j,l,n,x,y,z;\nchar a[100000+5],b[100000+5],o[2000];\nint main()\n{\n scanf(\"%lld%lld%lld\",&x,&y,&z);\n ll sum=0;\n t=0;\n ll g=1;\n ll j=1;\n for(i=1;; i*=2)\n {\n sum+=i;\n if(j==y)\n break;\n j++;\n }\n sum+=x-y;\n ll min1,max2;\n min1=sum;\n sum=0;\n j=1;\n for(i=1;; i*=2)\n {\n sum+=i;\n if(j==z)\n break;\n j++;\n }\n sum+=(x-z)*i;\n max2=sum;\n printf(\"%lld %lld\\n\",min1,max2);\n}\n\n\t \t\t \t \t \t \t \t\t\t \t \t \t \t", "lang_cluster": "C", "compilation_error": true, "code_uid": "8127ef7a3756cb969c08b9eaf46abc11", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n\nint main()\n{\n int n,l,r;\n scanf(\"%d %d %d\",&n,&l,&r);\n //int max[1000],min[1000];\n int p=1,ndiff=1;\n int mins=0,maxs=0;\n for(int i=0;i\nint main()\n{\n int n,l,r,i,j,sum=0,sub;\n scanf(\"%d%d%d\",&n,&l,&r);\n int ara[n];\n for(i=1;i<=l-1;i++){\n sum+=2;\n }\n sub=n-l+1;\n int min=sum+(sub);\n sum=0;\n sub=0;\n j=1;\n for(i=1;i<=r;i++){\n sum=sum+j;\n j=j*2;\n }\n sub=(n-r)*(j/2);\n int max=sum+sub;\n printf(\"%d %d\\n\",min,max);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "61b46688bbfa28b9a6dce0cf219b2cb5", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n long long n,l,r,min=0,max=1,dif=1,x=0;\n scanf(\"%lld %lld %lld\",&n,&l,&r);\n y:{ dif=1;\n for(;x\nint main(){\nint n,i,t;\nint f=-1;\nscanf(\"%d%d\",&n,&t);\nif(t==10){if(n==1){printf(\"-1\");}\nelse{for(i=0;i\nint main() {\n int n;\n scanf(\"%d\", &n);\n int t;\n scanf(\"%d\", &t);\n if(t == 10) {\n if(n == 1){\n printf(\"-1\\n\");\n }\n else{\n for(i = 0; i < n-1;i++){\n printf(\"1\\n\");\n }\n printf(\"0\\n\");\n }\n }\n else {\n for(int i = 0; i < n;i++){\n printf(\"%d\\n\", t);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "efcd48e326796d3a3687066c81de0362", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int i, cif, a, b;\n long long nr;\n scanf(\"%d%d\", &a, &b);\n if(a > 4 && a != 100 && a != 20 && a != 31;)\n {\n cif= a - 4;\n nr = 2520;\n for(i = 1; i <= cif; i++)\n {\n nr = nr * 10;\n }\n printf(\"%I64d\", nr);\n }\n if(a == 4)\n {\n nr = 2520;\n printf(\"%I64d\", nr);\n }\n if(a == 3)\n {\n if(b == 8)\n {\n nr = 168;\n printf(\"%I64d\", nr);\n }\n if(b == 4)\n {\n nr = 168;\n printf(\"%I64d\", nr);\n }\n if(b == 2)\n {\n nr = 168;\n printf(\"%I64d\", nr);\n }\n if(b == 9)\n {\n nr = 504;\n printf(\"%I64d\", nr);\n }\n if(b == 3)\n {\n nr = 504;\n printf(\"%I64d\", nr);\n }\n if(b == 6)\n {\n nr = 504;\n printf(\"%I64d\", nr);\n }\n if(b == 5)\n {\n nr = 505;\n printf(\"%I64d\", nr);\n }\n\n if(b == 7)\n {\n nr = 336;\n printf(\"%I64d\", nr);\n }\n }\n if(a == 2)\n {\n if(b == 8)\n {\n nr = 48;\n printf(\"%I64d\", nr);\n }\n if(b == 4)\n {\n nr = 48;\n printf(\"%I64d\", nr);\n }\n if(b == 2)\n {\n nr = 48;\n printf(\"%I64d\", nr);\n }\n if(b == 9)\n {\n nr = 18;\n printf(\"%I64d\", nr);\n }\n if(b == 3)\n {\n nr = 18;\n printf(\"%I64d\", nr);\n }\n if(b == 6)\n {\n nr = 18;\n printf(\"%I64d\", nr);\n }\n if(b == 5)\n {\n nr = 55;\n printf(\"%I64d\", nr);\n }\n if(b == 7)\n {\n nr = 14;\n printf(\"%I64d\", nr);\n }\n }\n if(a == 1 && b < 10)\n {\n printf(\"%d\", b);\n }\n if(a == 1 && b == 10)\n {\n nr = -1;\n printf(\"%I64d\", nr);\n }\n if(a == 100 && b == 5)\n {\n printf(\"5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555\");\n }\n if(a == 20)\n {\n printf(\"33333333333333333333\");\n }\n If(a == 31)\n {\n printf(\"4444444444444444444444444444444\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f0b661647031dbd574ff1604e563c4e4", "src_uid": "77ffc1e38c32087f98ab5b3cb11cd2ed", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,t,i;\n scanf(\"%d%d\",&n,&t);\n if(t==10)\n {\n if(n==1)\n {printf(\"-1\");\n return 0;}\n printf(\"1\");\n for(i=1;i\nusing namespace std;\n\nint main()\n{\n int n,t,j;\n cin>>n>>t;\n\n if(t>=2 && t<=9){\n while(1){\n for(j=1;j<=n;j++){\n cout<\nint main()\n{\n int n,a,b,c,sum=0,min;\n scanf(\"%d\\n%d\\n%d\\n%d\\n\",&n,&a,&b,&c);\n min=a;\n if(b\nint main()\n{\n int n,a,b,c,sum=0,min;\n scanf(\"%d\\n%d\\n%d\\n%d\\n\",&n,&a,&b,&c);\n min=a;\n if(b\n#include \n\n\nint main(void)\n{\n int n, r2o, o2e, e2r;\n \n scanf(\"%d %d %d %d\", &n, &r2o, &o2e, &e2r);\n \n if((n+2)%3==0)\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3);\n }\n else if(n+2)%3==1)\n {\n if(r2o>o2e)\n {\n if(o2e>e2r)\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+e2r);\n }\n else\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+o2e);\n }\n }\n else\n {\n if(r2o>e2r)\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+e2r);\n }\n else\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+r2o);\n }\n }\n }\n else // /(n+2)%3==2\n {\n if(r2o>o2e)\n {\n if(o2e>e2r) // r2o>o2e>e2r\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+e2r);\n }\n else\n {\n if(r2o>e2r) // r2o>e2r>o2e\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+o2e);\n }\n else // e2r>r2o>o2e\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+o2e);\n }\n }\n }\n else\n {\n if(r2o>e2r) // o2e>r2o>e2r\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+e2r);\n }\n else\n {\n if(e2ro2e>r2o\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+r2o);\n }\n else // o2e>e2r>r2o\n {\n printf(\"%d\", (r2o+o2e+e2r)*n/3+r2o);\n }\n }\n }\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cc1fdd3b6af33a4bcd46ab9fb657323e", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,a,b,c,sum=0,min,found=0;\n scanf(\"%d\\n%d\\n%d\\n%d\\n\",&n,&a,&b,&c);\n min=a;\n if(b\nint main()\n{\n int n,a,b,c,sum=0,min;\n scanf(\"%d\\n%d\\n%d\\n%d\\n\",&n,&a,&b,&c);\n min=a;\n if(b\nvoid main()\n{\n int n, m;\n scanf(\"%d\", &n);\n scanf(\"%d\", &m);\n \n n = n % 2 == 1 : n - 1;\n \n if(m<(n/2))\n {\n printf(\"%d\",m);\n return;\n }\n \n int left = n - m;\n \n printf(\"%d\",m);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "42ef20450c63c14c767f2c3899dd7e8f", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\n\n int n,m,e,h;\n scanf(\"%d%d\",&n,&m);\n e=n-m;\n h=m;\n if (m==0||m==1)\n {\n printf(\"1\");\n\n }\n else if (m==n)\n {\n\n printf(\"0\");\n }\n else if (n!=0&&m>=n/2)\n {\n printf(\"%d\",e);\n }\n else\n {\n printf(\"%d\",h);\n }\n\n\n\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc880992a23e515f21ea398da9f76b5a", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n, m;\n scanf(\"%d%d\",&n ,&m);\n if(!m)\n printf(\"%d\\n\",1);\n N\n else if((n/2)>=m)\n printf(\"%d\\n\",m);\n else\n printf(\"%d\\n\",n-m);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "84a3abaef6bfbf2a5e62c87a609b1bea", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,m;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n n>m;\n if(n==m)\n {\n printf(\"%d\",0);\n }\n else if (m==0||m==1)\n {\n printf(\"%d\",1);\n }\n else if((n-m)>=m)\n {\n printf(\"%d\",m);\n }\n else if((n-m)<=m) {\n printf (\"%d\",n-m);\n }\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "9f5cef25b992efaedaf3b8f120f57184", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\n int n,m,e,h;\n scanf(\"%d%d\",&n,&m);\n e=n-m;\n h=m;\n if (m==0||m==1)\n {\n printf(\"1\");\n\n }\n else if (m==n)\n {\n\n printf(\"0\");\n }\n else if (n!=0&&m>=n/2)\n {\n printf(\"%d\",e);\n }\n else\n {\n printf(\"%d\",h);\n }\n\n\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "c634bd36c218a3b5ea4e11ee025f93ca", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#define N 15\nint sum=0;\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nvoid sort(int *a, int n) {\n int i,j;\n for(i=0;i=x && sum>=r){counter++;\n \uff5d\n dfs(i,deep+1);\n b[deep]=0;\n sum-=c[i];\n }\n }\n }\n \nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0;i\n#define N 15\nint sum=0;\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nvoid dfs(int start,int deep) {\n int i;\n if(deep==0) {\n for(i=0;i=x && sum>=r) {\n counter++;\n \uff5d\n dfs(i,deep+1);\n b[deep]=0;\n sum-=c[i];\n }\n }\n }\n \nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0;i\n#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#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 counter++;\n /*printf(\"counter = %d\\n\",counter);\n print(b,nb);\n */\n }\n }\n if(deep==n) return;\n else {\n int i;\n for(i=start+1; i\nint main(){\n\n long long int n,k,t,d=0,f=0,i,m=0;\n scanf(\"%lld %lld %lld\",&n,&k,&t);\n if(k>=t){\n printf(\"%lld\",t);\n }\n else if(n<=t&&t\nint main(){\n \tint n,k,t;\n \tscanf(\"%d%d%d\",&n,&k,&t);\n \tif(t<=k) pirntf(\"%d\\n\",t);\n \telse if(t>k&&t<=n) printf(\"%d\\n\",k);\n \telse printf(\"%d\\n\",k-(t-n)); \n \treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ebc2d41c2585c3a03d227b4d7000cdf0", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main(){\n\tlong int n, k, t;\n\tcin>>n>>k>>t;\n\tif(t<=k){\n\t\tcout<k && t<=n){\n\t\tcout<n){\n\t\tcout<\nint main()\n{\n long long int n,k,t;\n scanf(\"%lld %lld %lld\",&n,&k,&t);\n if(t<=k)\n printf(\"%lld\\n\",t);\n else if(t<=2*k)\n printf(\"%lld\\n\",k);\n else\n printf(\"%lld\\n\",(3*k)-t);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e78edf7c301ce9bdd5b29ddc54bd5daa", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n int i, n,k,t;\n scanf(\"%d %d %d\", &n, &k, &t);\n if(tk && t<=n){\n printf(\"%d\\n\", k);\n }else{\n printf(\"%d\\n\", k-(t-n));\n } \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b92862b9948288593a9d4fd10d72c2fa", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint rev(int a)\n{\n int r,sum=0;\n while(a>0){\n r=a%10;\n a/=10;\n sum=sum*10+r;\n }\n return sum;\n}\n\n\nint main()\n{\n int a1,a2;\n\n scanf(\"%d %d\",&a1,&a2);\n //printf(\"%d\",rev(1234));\n printf(\"%d\",a1+revl(a2));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c14b60bdcf6de15de00bdee5fb696797", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "int func(int a, int b)\n{\n\tint result;\n\tint b1 = 0;\n\twhile(b>0)\n\t{\n\t b1 = b1*10 + b%10;\n\t b /= 10;\n\t}\n\tresult = a + b1;\n\treturn result;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "43f161c955b696324e09c4c0ec8c1bed", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "int main(int a, b)\n{\n int result;\n int b1 = 0;\n while(b>0)\n {\n b1 = b1*10 + b%10;\n b /= 10;\n }\n result = a + b1;\n return result;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6bd240c6bc43132466ef99a3eb75356f", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "\n#include\n#include\n#include\nint main()\n{\n\tint m,a;\n\tchar n[10];\n\tscanf(\"%d %s\",m,n);//reverse n\n\tstrrev(n);\n\ta=m+itoa(n);\n\tprintf(\"%d\\n\",a);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3c65a97f9805f834b7025551f814cd80", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nint main(){\n long long a,b;\n scanf(\"%lld %lld\",&a,&b);\n long long c=0;\n while(b){\n c*=10;\n c+=(b%10);\n b/=10;\n }\n printf(\"%lld\\n\",a+c);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6996e560034a4b4d6dbbd284246e85ce", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "/*\n * P4.c\n *\n * Created on: Feb 1, 2017\n * Author: mar2h\n */\n\nvoid p4(void){\n\tint n;\n\tscanf(\"%d\",&n);\n\tswitch (n){\n\tcase 0 :\n\t\tprintf(\"I'm too stupid to solve this problem\");\n\t\tbreak;\n\tcase 1:\n\t\tprintf(\"1 0 0\");\n\t\tbreak;\n\tcase 2:\n\t\tprintf(\"1 1 0\");\n\t\tbreak;\n\t}\n\tint arr[n];\n\tarr[0]=0;\n\tarr[1]=1;\n\tint i;\n\n\tfor(i=2;1;i++){\n\t\tarr[i]=arr[i-1]+arr[i-2];\n\t\tif(arr[i] == n){\n\t\t\tprintf(\"%d %d %d\",arr[i-1],arr[i-3],arr[i-4]);\n\t\t\treturn;\n\t\t}\n\t}\n}\nint main(void){\n p4();\n return 0;\n}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "50b3ac13a605e134ebb45c400009d11f", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\n\nint i,j,n,m,k,l;\nscanf(\"%d\",&n);\n int a[1000000000];\na[0]=0;\na[1]=1;\nfor(i=2;i\n\nvoid main(){\n double k0,k1,k2,k3,k4,a;\n scan(\"%f\",&a);\n if(a==0 || a==1 || a==2)\n {\n printf(\"I'm too stupid to solve this problem\");\n }\n else\n {\n for(k2=1,k3=2;k4!=a;)\n {\n k0=k1;\n k1=k2;\n k2 = k3;\n k3=k4;\n k4=k2+k1;\n }\n \n printf(\"%.0f %.0f %.0f\",k0,k1,k3);\n }\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b4e259d04b6517f9791671a0f3faded4", "src_uid": "db46a6b0380df047aa34ea6a8f0f93c1", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint i,x,*arr,memo[3];\nint choose(int sum,int z)\n{\n int d;\n if(z==3&&sum==x) return 1;\n if(z>2&&sum!=x) return 0;\n for(int j=0;j\n\nint min3 (int a,int b,int c){\n int min =a;\n if (bb) return b;\n else return a;\n}\nint main(){\n int k2, k3, k5, k6 ;\n do {\n scanf(\"%d%d%d%d\",&k2,&k3,&k5,&k6);\n } while ( k2<0 || c2>5*1e6 || k3<0 || c3>5*1e6 || k6<0 || k6>5*1e6 || k5<0 || k5>5*1e6);\n int so256 = min (k2,k5,k6);\n k2 -= so256;\n if (k2<0) k2=0;\n int so32 = min(k2,k3);\n int tong = so256 *256 + so32 *32;\n pritnf(\"%d\",tong);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "94e1f1e65c3dedac4f8573254b3887e1", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nusing namespace std;\nint main(){\n int t2,t3,t5,t6;\n int s[10];\n int a[10];\n int sum = 0;\n int k = 0;\n scanf(\"%d%d%d%d\",&t2,&t3,&t5,&t6);\n s[0] = t2;\n s[1] = t5;\n s[2] = t6;\n sort(s,s+3);\n sum = s[0]*256;\n k = t2 -s[0];\n if(k > 0){\n a[0] = k;\n a[1] = t3;\n sort(a,a+2);\n sum += a[0]*32;\n }\n printf(\"%d\",sum);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "da8b2300cdbe021994eb60de082af561", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int k2,k3,k5,k6,sum=0;\n scanf(\"%d %d %d %d\",&k2,&k3,&k5,&k6);\n if(k2<=k5 && k2<=k6){\n sum = sum+(k2 * 256);\n k5 = k5-k2;\n k6 = k6-k2;\n k2 = 0;\n }else{\n if(k5<=k2 && k5<=k6){\n sum = sum+(k5 * 256);\n k2 = k2-k5;\n k6 = k6-k5;\n k5 = 0;\n }else{\n if(k6<=k2 && k6<=k5){\n sum = sum+(k6 * 256);\n k2 = k2-k6;\n k5 = k5-k6;\n k6 = 0;\n }\n }\n }\n if(k2 != 0){\n if(k2\nint main()\n{\n\tintk2,k3,k5,k6;\n\tcin>>k2>>k3>>k5>>k6;\n\tint sum=0;\n\twhile(k2!=0&&k3!=0;k5!=0)\n\t{\n\tsum=sum+256;\n\tk2--;k5--;k6--;}\n\t\n\twhile(k2!=0;k3!=0){\n\t\tsum=sum+32;\n\t\tk2--;\n\t\tk3--;\n\t}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1cdf08bff9f5790a77a2413f6437022b", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "//CodeForces Problem Set 734B\n\n#include\n\nint min(int num1, int num2);\n\nint main()\n{\n\tint k2, k3, k5, k6;\n\tscanf(\"%d %d %d %d\", &k2, &k3, &k5, &k6);\n\tint no256, no32, ans = 0;\n\tno256 = min(min(k5, k6,), k2);\n\tk2 -= no256;\n\tno32 = min(k2, k3);\n\tans = 32*no32 + 256*no256;\n\tprintf(\"%d\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb2e4cad682df71c9bef6e38338b8a88", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tlong long float x,y;\n\tscanf(\"%llf\",&x);\n\tscanf(\"%llf\",&y);\n\tlong long double result1= pow(x,y);\n\tlong long double result2= pow(y,x);\n\tif(result1>result2)\n\t\tprintf(\">\");\n\telse if(result1\n#include\nint main()\n{\n long x,y;\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n float logx = y*(log10(x));\n float logy = x*(log10(y));\n float diff = logx-logy;\n if(x == y)\n printf(\"=\")l\n if(diff > 0)\n printf(\">\");\n else\n printf(\"<\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d261d74973040b64a6aa24140d741d7a", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n int x,y;\n scanf(\"%d%d\",&x,&y);\n if(x*log(y)>y*log(x))\n {\n printf(\">\");\n break;\n }\n else\n (x*log(y)\n\nint main() {\n\tlong int x,y;\n\tscanf(\"%ld %ld\",&x,&y);\n\tif(x==y)\n\t printf(\"=\");\n\telse if((x==2)&&(y==3))\n\t printf(\"<\");\n\telse if((x==3)&&(y==2))\n\t printf(\">\");\n\telse if(((x==2)&&(y==4))||((x==4)&&(y==2)))\n\t printf(\"=\");\n\telse if(x==1)\n\t printf(\"<\");\n\telse if(y==1)\n\t printf(\">\")\n\telse if(x\");\n\telse\n\t printf(\"<\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1c90fab05348c21955e234423ef2014f", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n long x,y;\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n float logx = ylog(x);\n float logy = xlog(y);\n if(logx>logy)\n printf(\">\");\n else if(logx \nint main() \n{\n\tint t;\n\tscanf(\"%d\",&t); \n\twhile(t--) {\n\t int n;\n\t scanf(\"%d\",&n); \n\t\tif(a[i]>=12||a[i]==3||a[i]==6||a[i]==7||a[i]==9||a[i]==10)\n\t\t printf(\"YES\\n\"); \n\t\telse \n\t\tprintf(\"NO\\n\");\t\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "804a59022eb3142d6975a46693c710bc", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint chunk(int x){\n if(x%a == 0 || x%b == 0 )\n return 1;\n if(x>7)\n return chunk(x-7);\n else\n return 0;\n}\n\nint main(){\n int t;\n scanf(\"%d\",&t);\n while(t--){\n int x;\n scanf(\"%d\",&x);\n int c = chunk(x);\n if(c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ba6284fddf322ad0980f27ce4f6cdb27", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int n,i;\n scanf(\"%d\",&n);\n for(int j = 1;j <= n;j++){\n scanf(\"%d\",&i);\n for(int k = 1;k <= i;k++){\n for(int l = 1;l <= i;l++){\n if(i%3 == 0||i%7 == 0||i == 7k+3l){\n printf(\"YES\\n\");\n }\n }\n }\n else\n printf(\"NO\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e78aa852485988b4125d44d4654807cd", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0} {"lang": "GNU C", "source_code": "include \nint main() \n{\n\tint t;\n\tscanf(\"%d\",&t); \n\twhile(t--) {\n\t int n;\n\t scanf(\"%d\",&n); \n\t\tif(n == 1||n == 2 || n == 4 || n == 5 || n == 8)\n\t\t printf(\"NO\\n\"); \n\t\telse \n\t\tprintf(\"YES\\n\");\t\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "985b178cb1ac5a33b3d4e0345aa9e56a", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0} {"lang": "GNU C", "source_code": "\n#include \n#include \n\nint main() {\n int T scanf(\"%d\\n\", &T);\n for(int ti = 0, tn = T ; ti < tn ; ++ti) {\n int X; scanf(\"%d\\n\", &X); bool found = false;\n for(int i = 0 ; 7*i <= X && !found ; ++i)\n found = ((X - 7*i) % 3 == 0);\n printf(\"%s\\n\", found ? \"YES\" : \"NO\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8a80ff8361f1f7a71fb218fbe46ad849", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n\tint n,k,a,b,i,j,t;\n \tunsigned long long sum=0;\n\tscanf(\"%d%d%d%d\",&n,&k,&a,&b);\n\twhile(n>1){\n\t\tif(n%k==0){\n\t\t\tif((n-n/k)*a>b){\t\n\t\t\t\tsum+=b;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsum+=a*(n-n/k);\n\t\t\t}\n\t\t\tn/=k;\n\t\t}\n\t\telse{\n\t\t\tif(n/k){\n\t\t\t\tsum+=a*(n%k);\n\t\t\t\tn-=n%k;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsum+=a*(n-1);\n\t\t\t\tn=1;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\",sum);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "23329e6c9c8ba20f75471a41aa59ee91", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#pragma warning(disable:4996)\n#include \n\n#define CONTINUE 0\n\nint main(void)\n{\n\tlong long n, k, A, B;\n\tlong long cost = 0;\n\n#if CONTINUE\n\twhile (1)\n\t{\n#endif\n\t\tscanf(\"%I64d\", &n);\n\t\tscanf(\"%I64d\", &k);\n\t\tscanf(\"%I64d\", &A);\n\t\tscanf(\"%I64d\", &B);\n\t\tcost = 0;\n\n\t\tif (k > 1)\n\t\t{\n\t\t\twhile (n > 1)\n\n\t\t\t{\n\t\t\t\tif ((n > k) && (n % k))\n\t\t\t\t{\n\t\t\t\t\tcost = cost + A * (n % k);\n\t\t\t\t\tn = n - n % k;\n\t\t\t\t}\n\t\t\t\tif (n >= k)\n\t\t\t\t{\n\t\t\t\t\tif (B <= A * (n - n / k))\n\t\t\t\t\t{\n\t\t\t\t\t\tcost += B;\n\t\t\t\t\t\tn /= k;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcost += A * (n - n / k));\n\t\t\t\t\t\tn /= k;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcost += A * (n - 1);\n\t\t\t\t\tn = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcost = A * (n - 1);\n\t\t}\n\t\tprintf(\"%I64d\\n\", cost);\n#if CONTINUE\n\t}\n#endif\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "818314a3c2fa500274f7c253de01aa61", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#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 n,d;\n scanf(\"%d %d\",&n,&d);\n int countold=0;\n int *arr=malloc(sizeof(int )*n);\n for(int k=0;kcountold)\n countold=count;\n }\n printf(\"%d\",countold);\n return 0;\n}\n*/\nint main()\n{\n long long n,k,cost=0,a,b;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n\n if(k>n)\n printf(\"%I64d\",a*(n-1));\n printf(\"%I64d\",n%k);\n else if(n/k<2 && n/k>1)\n printf(\"%I64d\",a*(n-k)+b);\n else if(b>a*(n-1))\n printf(\"%I64d\",a*(n-1));\n else if(n==1)\n printf(\"0\");\n else\n if(n==2 )\n {\n if(k==2 &&b\n#include \n\nint main()\n{\n long long n,k,cost=0,a,b;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n\n if(k>n)\n printf(\"%I64d\",a*(n-1));\n printf(\"%I64d\",n%k);\n else if(n/k<2 && n/k>1)\n printf(\"%I64d\",a*(n-k)+b);\n else if(b>a*(n-1))\n printf(\"%I64d\",a*(n-1));\n else if(n==1)\n printf(\"0\");\n else\n if(n==2 )\n {\n if(k==2 &&b\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "82ffec1a8a2414a74a3cb483e641203f", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\nchar s[100],length;\n scanf(\"%s\",s);\n length = strlen(s);\n for(int i=0;is[j+2]){\n swap(s[j],s[j+2]);\n }\n }\n }\n printf(\"%s\",s);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "05c124313af397710059f785e5017326", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n int main()\n {char ch[101];\n char out[101];\n out=NULL;\n scanf(\"%s\",ch);\n while(strchr(ch,'3'))\n {\n while(strchr(ch,'2'))\n {\n while(strchr(ch,'1'))\t\n {\n strcat(out,\"+1\");\n strncpy(strchr(ch,'1'),\"+\",1); \n} \n strcat(out,\"+2\");\n strncpy(strchr(ch,'2'),\"+\",1);\n }\n strcat(out,\"+3\");\n strncpy(strchr(ch,'3'),\"+\",1);\n}\n printf(\"%s\",out+1);\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "2069aea6a4e4e78735f6caca40f2eec0", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "int main()\n{\n int i;\n \n char string [100];\n \n gets(string);\n \n for(i=0;i<=100;i=i+2)\n \n { if(string[i]<=string[i+2])\n \n {string[i]=string[i];}\n \n else \n {string[i]=string[i+2]}\n }\n \n printf(\"%s\",string);\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8fbc646f14cd3c8defeb0b0e0dff0ed1", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char str[100],a;\n scanf(\"%s\",str);\n int i=0,j;\n while(str[i]!=0)\n {\n while(str[j]!=0)\n {\n j=i+2;\n if(str[j]\nusing namespace std;\nint main()\n{\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n char s[100];\n cin>>s;\n int i,j,d,t;\n d=strlen(s);\n for(i=0;i<=d-3;i+=2)\n {\n for(j=i+2;j<=d-1;j+=2)\n {\n if(s[i]>s[j]&&s[i]!='+'&&s[j]!='+')\n {\n t=s[i];\n s[i]=s[j];\n s[j]=t;\n }\n }\n }\n cout<\n#define MAXN 1519999999\nchar ciur[MAXN];\nint n;\n\nvoid ciurul(){\n\n int i, j;\n for(i = 0;i < n; ++i)\n ciur[i] = 0;\n\n for(i = 2;i <= n; ++i){\n if(ciur[i] == 0)\n for(j = 2;i * j <= n; ++j)\n ciur[i * j] = 1;\n }\n}\n\nint main(){\n\n int i, total = 1, m;\n scanf(\"%d\",&n);\n ciurul();\n m = n;\n while(m > 1){\n if(ciur[n] == 0){\n m = m - n;\n n = m;\n ++total;}\n else\n --n;\n }\n printf(\"%d\",total);\n\n\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "22404193b5dfc57aade422f77a7cc5de", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\nusing namespace std;\nbool is_prime(long long n)\n{\n if(n==2||n==3)return 1;\n for(long long i=2;i<=sqrt(n);++i)\n {\n if(n%i==0)\n return 0;\n }\n return 1;\n}\nint main()\n{\n long long x;\n scanf(\"%Ld\",&x);\n if(x<=1)\n {\n printf(\"1\\n\");\n return 0;\n }\n if(is_prime(x))printf(\"1\\n\");\n else\n {\n if(x%2==0)printf(\"2\\n\");\n else \n {\n if(is_prime(x-2))printf(\"2\\n\");\n else \n printf(\"3\\n\");\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c8d058f5a19ba4e262951fd49d63938a", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\nbool isprime(int n) {\n if(n < 2)\n return false;\n for(int i = 2; i * i <= n; i++) \n if(n % i == 0)\n return false;\n return true;\n}\nint main() {\n int n;\n cin >> n;\n if(isprime(n)) \n cout << 1 << endl;\n else \n if(n % 2 == 0) \n cout << 2 << endl;\n else \n if(isprime(n - 2))\n cout << 2 << endl;\n else\n cout << 3 << endl;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "523e45436f11b217080d138b7473cfad", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint n;\nbool prime();\nbool p[2000000010];\nint main(){\n int i,j,t;\n scanf(\"%d\",&n);\n t=2000000010;\n p[0]=p[1]=false;\n for(i=2;i\n#include\nint isPrime(unsigned long num)\n{\n \n unsigned long limit;\n limit = sqrt(num);\n for(div = 3 ; div <= limit ; div++)\n if(num % div == 0)\n break;\n if(div > limit) return 1;\n else return 0;\n \n}\nint main()\n{\n unsigned long num ;\n scanf(\"%lu\" , &num);\n if(num == 2)\n printf(\"1\");\n else if( num % 2 == 0 )\n printf(\"2\");\n else if( isPrime(num) == 1)\n printf(\"1\");\n else if( isPrime(num -2 ) == 1)\n printf(\"2\");\n else\n printf(\"3\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3447dd268598f2bfa5c12b8b6cf4ed69", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int x,y,a=0,b;\n scanf(\"%d %d\",&x,&y);\n for(int i=1;i<7;i++)\n {\n if(i>=x&&i>=y)\n a++;\n }\n if(a==6)\n printf(\"1/1\");\n else if (a<=3)\n {\n b=6/a;\n printf(\"1/%d\",b);\n }\n else if (a==4)\n {\n printf(\"2/3\");\n \n }\n else\n printf(\"5/6\");\n \n return(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0904bea00917d9fe2bab86e9ebe74d03", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bda2acf8a373b38accf3eeda306d7e70", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main() {\n\tint y,w;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "05aa976d196347869d9e2c4d9dd40dd1", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "using namespace std;\n\n\n\nint main()\n{\n int yako,wako,result;\n cin>>yako>>wako;\n if(yako == 6 || wako == 6){\n cout<<\"1/6\";\n }\n else if(yako == 1 && wako == 1){\n cout<<\"1\";\n }\n else if(yako > wako){\n result = 6 - (yako - 1);\n if(result % 2 == 0 && result>= 2){\n result = result /2;\n cout<=3){\n result = result / 3;\n cout<= yako){\n result = 6 - (wako - 1);\n if(result % 2 == 0 && result>= 2){\n result = result /2;\n cout<=3){\n result = result / 3;\n cout<\n\nusing namespace std;\n\n\n\nint main()\n{\n int yako,wako,result;\n cin>>yako>>wako;\n if(yako == 6 || wako == 6){\n cout<<\"1/6\";\n }\n else if(yako == 1 && wako == 1){\n cout<<\"1\";\n }\n else if(yako > wako){\n result = 6 - (yako - 1);\n if(result % 2 == 0 && result>= 2){\n result = result /2;\n cout<=3){\n result = result / 3;\n cout<= yako){\n result = 6 - (wako - 1);\n if(result % 2 == 0 && result>= 2){\n result = result /2;\n cout<=3){\n result = result / 3;\n cout<\n#include\nusing namespace std;\nint main()\n{\n\tint n,a,b;\n\tcin>>n>>a>>b;\n\tint t[n];\n\tfor(int i=0;i>t[i];\n\t}\n\tfor(int i=0;ib) s+=b;\n\t\t\telse s+=a;\n\t\t}\n\t}\n\tfor(int i=0;ib) s+=(2*b);\n\t\t\telse s+=(2*a);\n\t\t}\n\t\telse if(t[i]==2||t[n-i-1]==2)\n\t\t{\n\t\t\tif(t[i]==0||t[n-i-1]==0) s+=a;\n\t\t\telse s+=b;\n\t\t}\n\t}\n\tcout<\nint main()\n{\n int n,w,b,i,t=0;\n scanf(\"%d %d %d\",&n,&w,&b);\n int a[n];\n for(i=0;i=b?(t=t+b):(t=t+w);\n\t\t\t\t}\n\t\t\t\tw>=b?(t=t+b):(t=t+w);\n }\n else\n {\n if(a[i]!=a[n-i-1])\n {\n a[i]==1?t=t+b:t==t;\n a[i]==0?t=t+w:t==t;\n a[n-i-1]==1?t=t+b:t=t;\n a[n-i-1]==0?t=t+w:t=t;\n }\n }\n }\n }\n printf(\"%d\\n\",t);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "30b40c454b278ca57b19db4674c02a98", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,w,b,i,t=0;\n scanf(\"%d %d %d\",&n,&w,&b);\n int a[n];\n for(i=0;i=b?t=t+b:t=t+w;\n\t\t\t\t}\n\t\t\t\tw>=b?t=t+b:t=t+w;\n }\n else\n {\n if(a[i]!=a[n-i-1])\n {\n a[i]==1?t=t+b:t=t;\n a[i]==0?t=t+w:t=t;\n a[n-i-1]==1?t=t+b:t=t;\n a[n-i-1]==0?t=t+w:t=t;\n }\n }\n }\n }\n printf(\"%d\\n\",t);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ff044e965db4160a172469520e8fbbd4", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "\t{\n\tfor(int i=0;i\n\nint main(){\nint n,a,b,i;\nscanf(\"%d\",&n);\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\ngetchar_unlocked();\nint po[n];\nfor(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., 5ytu1 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 y,b,r,total=0,least;\n\tscanf(\"%d%d%d\",&y,&b,&r);\n\tleast=9999;\n\tif(least>y)\n\t{\n\t\tleast=y;\n\t}\n\tif(least>b)\n\t{\n\t\tleast=b;\n\t}\n\tif(least>r)\n\t{\n\t\tleast=r;\n\t}\n\t\n\t\n\tif(least==y)\n\t{\n\t\tif((y==b && y==r) || (y==r && b>r))\n\t\t{\n\t\t\ttotal=(r*3)-3;\n\t\t\tprintf(\"%d\",total);\n\t\t\t\n\t\t}\n\t\telse if(y==b && br)\n\t\t{\n\t\t\ttotal=(r*3)-3;\n\t\t\tprintf(\"%d\",total);\n\t\t}\n\t\telse {\n\t\t\ttotal=(y*3)+3;\n\t\t\tprintf(\"%d\",total);\n\t\t\t\n\t\t}\n\t}\n\t\t\t\n\tif(least==b && least!=y)\n\t{\n\t\tif(r>b)\n\t\t{\n\t\t\ttotal=(b*3);\n\t\t\tprintf(\"%d\",total);\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\t\ttotal=(r*3)-3;\n\t\t\t\tprintf(\"%d\",total);\n\t\t\t\t\n\t\t\t}\n\t}\n\tif(least==r && least!=y)\n\t{\n\t\ttotal=(r*3)-3;\n\t\tprintf(\"%d\",total);\n\t}\n\treturn 0;\n}\n\t\n\t\n\t\t\n\t\n\t\n\t\t\n\t\n\t\t\n\t\n\t\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "07ef1c2241f03d6bb398bb75ab820a8f", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nusing namespace std;\n\nint main()\n{\n int p,q,r;\n scanf(\"%d %d %d\",&p,&q,&r);\n int c = min(p,min(q,r));\n printf(\"%d\\n\",c+(c-1)+(c+1));\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5871483a1f491ac10477fc1f93f5508c", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{ int y,b,r,s;\n scanf(\"%d\",&y);\n scanf(\"%d\",&b);\n scanf(\"%d\",&r);\n y++;\n r--;\n s=3*min(int y,int b,int r);\n printf(\"%d\",&s);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4cf80adb7a00d1636a96099e98b7e988", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint r,y,b;\nscanf(\"%d\",r);\nscanf(\"%d\",b);\nscanf(\"%d\",y);\nif (b>=r&&y>=b)\n{\nb=r-1;\ny=b-1;\nprintf(\"%d\",r+b+y);\n}\nelse if(b\nint min(int a,int b) {\n if(a\n#include\n#include\nint main()\n{\n\tint n,i,j,k,l,flag=1;\n\tscanf(\"%d\",&n);\n\tchar x[n+1],y[n+1];\n\tint c[n];\n getchar();\n\tgets (x);\n\tfor (i=0;i='a' && x[i]<='z') {\n\t\t\tflag=1;\n\t\t\ty[k]=x[i];\n\t\t\tfor (l=0;l='A' && x[i]<='Z') {\n\t\t\tj++;\n\t\t\tc[j]=0;\n\t\t\tk=0;\n\t\t}\n\t}\n\tint max=0;\n\tfor (i=0;i\n#include\nint main()\n{\nint n,m,a[1000],max,sum,o;\nchar str[1000];\nwhile(scanf(\"%d\",&n)!=EOF)\n{\ngetchar();\ngets(str);\n max=0,sum=0;\n for(i=0;i='A'&&str[i]<='Z')\n\t\t{\n\t\t\tmemset(a,0,sizeof(a));\n sum=(sum>max)?sum:max;\n max=0;\n }\n\t\telse\n if(a[str[i]]==0)\n\t\t\t{\n a[str[i]]=1;\n max++;\n }\n }\n sum=(sum>max)?sum:max;\n printf(\"%d\\n\",sum);\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a32c505a17e8f0c71d6a5c612f3f7cc1", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#define max(a,b) a>b?a:b;\n#define min(a,b) (a>b?b:a)\nint main()\n{\n int T;\n while(scanf(\"%d\",&T)!=EOF)\n {\n \twhile(T--)\n \t{\n \t\tint n,sum,k,w[110],v[110],dp[110][35],a[35],b[35];\n \t\tmemset(dp,0,sizeof(dp));\n \t\tmemset(a,0,sizeof(a));\n \t\tmemset(b,0,sizeof(b));\n \t\tscanf(\"%d %d %d\",&n,&sum,&k);\n \t\tfor(int i=0;i=w[i];j--)\n \t\t\t{\n \t\t\t\tfor(int z=1;z<=k;z++) \n\t\t\t\t{\n\t\t\t\t\ta[z]=dp[j][z];\n\t\t\t\t\tb[z]=dp[j-w[i]][z]+v[i];\n\t\t\t\t}\n\t\t\t\tfor(int x=1,y=1,z=1;z<=k&&(x<=k||y<=k);)\n\t\t\t\t{\n\t\t\t\t\tif(a[x]>b[y])\n\t\t\t\t\t{\n\t\t \tdp[j][k]=a[x];\n\t\t x++;\n\t\t }\n\t\t else\n\t\t\t\t\t{\n\t\t dp[j][k]=b[y];\n\t\t y++;\n\t\t }\n\t\t if(dp[j][k] != dp[j][k-1])\n\t\t \tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",dp[sum][k]);\n\t}\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "87e0b62559efd748e2a93d0c22b2f949", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n\n#define max(a ,b)\t(a > b ? a : b)\n#define min(a ,b)\t(a < b ? a : b)\n#define MAX 200001\n/*\nint a[101];\nint main() {\n\tint n ,i ,x ,y;\n\tscanf(\"%d\" ,&n);\n\tfor(i = 0;i= 2*a - f)\trem -= a;\n\t\t\t\t\telse ans++ ,rem = b - (a - f);\n\t\t\t\t}else {\n\t\t\t\t\tif(rem < a - f){\n\t\t\t\t\t\tprintf(\"-1\");\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t\tif(rem >= a + f)\trem -= a;\n\t\t\t\t\telse\tans++ ,rem = b - f;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tprintf(\"%d \" ,rem);\n\t\t}\n\t\tprintf(\"\\n%d\" ,ans);\n\t}\n\treturn 0;\n}\n*/\n/*\nint a[MAX] ,p[MAX] ,c[MAX];\nint main() {\n\tint n ,i;\n\tscanf(\"%d\" ,&n);\n\tmemset(p ,-1 ,sizeof(p));\n\tfor(i = 1 ; i <= n ; i++){\n\t\tscanf(\"%d\" ,a+i);\n\t\tif(p[a[i]] == -1)\tp[a[i]] = i;\n\t\tc[a[i]]++;\n\t}\n\tint ans = 0 , r = 0;\n\tfor(i = 1;i<=n;i++){\n\t\tif(c[i] == 0){\n\t\t\tr++;\n\t\t\twhile(r <= n && c[i] == 0) {\n\t\t\t\tif(c[a[r]] > 1){\n\t\t\t\t\tif(p[a[r]] == r && a[r] < i){\n\t\t\t\t\t\tr++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tans++;\n\t\t\t\t\ta[r] = i;\n\t\t\t\t\tc[i] = 1;\n\t\t\t\t\tc[a[r]]--;\n\t\t\t\t\tr--;\n\t\t\t\t}\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\" ,ans);\n\tfor(i = 1; i <=n;i++)\tprintf(\"%d \" ,a[i]);\n\treturn 0;\n}\n*/", "lang_cluster": "C", "compilation_error": true, "code_uid": "c4164dfcfba74c51fc6c31732ce31ffe", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\nint n,m,a[1000]={0},max,sum;\nchar str[1000];\nwhile(scanf(\"%d\",&n)!=EOF)\n{\ngetchar();\ngets(str);\n max=0; sum=0;\n for(int i=0;i='A'&&str[i]<='Z')\n\t\t{\n\t\t\tmemset(a,0,sizeof(int a));\n sum=(sum>max)?sum:max;\n max=0;\n }\n\t\telse\n if(a[str[i]]==0)\n\t\t\t{\n a[str[i]]=1;\n max++;\n }\n }\n sum=(sum>max)?sum:max;\n printf(\"%d\\n\",sum);\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e0a8b658077aee46155b0e46112e3961", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint ans;\nbool zero;\n\nint main()\n{\n unsigned int n;\n int k;\n\n scanf(\"%u%d\", &n, &k);\n\n for (int i = 0; i < k; i++, n/=10)\n {\n if (n == 0)\n {\n if (zero == 1)\n {\n printf(\"%d\", i-1);\n }\n else\n {\n printf(\"%d\", i);\n }\n return 0;\n }\n if (n%10 != 0)\n {\n ans++;\n k++;\n }\n else\n {\n zero = 1;\n }\n }\n\n printf(\"%d\", ans);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1f3bd2a6a0e1562b991187f2fc3c0ffe", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,k,s,i,j,m,t,a[20];\n\twhile(~scanf(\"%d%d\",&n,&k))\n\t{\n\t\ta[20]={0};\n\t\ts=0;\n\t\tfor(i=0;n!=0;i++)\n\t\t{\n\t\t\ta[i]=n%10;\n\t\t\tn/=10;\n\t\t}\n\t\tif(k>i)\n\t\t printf(\"%d\",i-1);\n\t\telse\n\t {\n\t \tt=0;\n\t\t for(j=0;t\nint a[2000000005];\nint main(){\n\tint k,ans = 0,cnt = 0;\n\tlong long n;\n\tscanf(\"%I64d%d\",&n,&k);\n\tint n1 = n;\n\tint i = 0,judge = 0;\n\twhile(n1 >= 10){\n\t\ta[++i] = n1 % 10;\n\t\tn1 = (n1 - a[i]) / 10;\n\t\tif(a[i] == 0)\tjudge = 1;\n\t}\n\ta[++i] = n1;\n\tif(i < k){\n\t\tif(judge == 1){\n//\t\t\tprintf(\"judge = 1\\n\");\n\t\t\tprintf(\"%d\\n\",i-1);\n\t\t}\n\t\telse{\n//\t\t\tprintf(\"judge = 0\\n\");\n\t\t\tprintf(\"%d\\n\",i);\n\t\t}\n\t}else{\n\t\tfor(int j = 1;j <= i;j++){\n\t\t\tif(a[j] == 0)\tcnt++;\n\t\t\telse\tans++;\n\t\t\tif(cnt >= k)\tbreak;\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e902a6e26298d70403b08d340d5b35c5", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint huynya (int chislo, int stepen)\n{\n int t=chislo;\n int digits=0;\n int deleted=0;\n int zeros=0;\n do {\n digits++;\n t/=10;\n }while(t);\n // printf(\"%d\",digits);\n if (stepen=>digits)\n return digits-1;\n else {\n while(zeros\n#include \n\nvoid main(){\n int k;\n char s[2000001];\n\n scanf(\"%s %d\", &s, &k);\n\n int size = strlen(s) - 1;\n int i, count = 0;\n\n for(i = size; i >= 0; i--){\n if(k == 0){\n printf(\"%d\", count);\n return;\n }\n if(s[i] == '0'){\n k--;\n }else {\n count++;\n }\n }\n printf(\"%d\", size);\n return;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2147a0c5daa5717d1953009dc7934064", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0} {"lang": "GNU C", "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}\nint min(int a,int b)\n{\n\tif(a>b)\n\t\treturn b;\n\treturn a;\n}\nint swap(int *a,int *b)\n{\n\tint t=*a;\n\t*a=*b;\n\t*b=t;\n}\n\nint main()\n{\n\tint i,n,j,k;\n\tscanf(\"%d\",&n);\n\tint a[12]={31,29,31,30,31,30,31,31,30,31,30,31};\n\tint b[24],count=0;\n\tfor(i=0;i=2)\n\t{\n\t\tprintf(\"No\\n\");\n\t\treturn 0;\n\t}\n\tint val;\n\tfor(i=0;i<12;i++)\n\t{\n\t\t\n\t\tif(a[i]==b[0])\n\t\t{\n\t\t\tval=1,k=0;\n\t\t\tfor(j=i;j<12 && k<=n;j++)\n\t\t\t{\n\t\t\t\tif(a[j]==b[k])\n\t\t\t\t{\n\t\t\t\t\tk++;\n\t\t\t\t\tif(j==11)\n\t\t\t\t\t\tj = -1;\n\t\t\t\t\tif(k==n)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tval=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(val==1)\n\t\t\tbreak;\n\t}\n\tif(val==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9b21d082ca7c8baf8170f6ec96bf6c95", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int month[24],i,n,j,k=0,m=0;\n int year[]={31,28,31,30,31,30,31,31,30,31,30,31,\n 31,28,31,30,31,30,31,31,30,31,30,31,\n 31,29,31,30,31,30,31,31,30,31,30,31,\n 31,28,31,30,31,30,31,31,30,31,30,31,\n 31,28,31,30,31,30,31,31,30,31,30,31,};\n scanf(\"%d\",&n);\n for(i=0;i\nint main()\n{\n int arr[80]={31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31};\n int n;\n scanf(\"%d\",&n);\n int arr1[n];\n int i;\n for(i=0;i\nint main()\n{\n int n,p=0,d,i,j;\n int a[24];\n int b[24]={31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31}; \n int c[24]={31,29,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31};\n int f[24]={31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31};\n scanf(\"%d\",&n);\n for(i=0;i\n#include \nusing namespace std;\n\nint main()\n{\n char seq[][3] = {\"31\", \"28\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"28\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"29\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"28\", \"31\", \"30\", \"31\", \"30\", \"31\", \"31\", \"30\", \"31\", \"30\", \"31\"};\n char inp[24][3];\n int n, flag;\n cin >> n;\n for(int i = 0; i < n; i++)\n cin >> inp[i];\n for(int i = 0; i < 48; i++)\n {\n if(strcmp(inp[0], seq[i]) == 0)\n {\n flag = 0;\n for(int j = 0; j < n; j++)\n {\n if(strcmp(inp[j], seq[j + i]))\n {\n flag = 1;\n break;\n }\n }\n }\n if(!flag)\n {\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n cout << \"No\" << endl;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4674ffe9e86d36e6491587d3099a8bbe", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n\nusing namespace std;\n\nint main()\n{\n int n,i,x,sum=0;\n\n cin>>n;\n\n x = (n*2-1);\n\n for(i=x-2;i>=1;i=i-2)\n {\n sum+=i;\n }\n\n x = x + (sum*2);\n\n cout << x <\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n cout>>((n*n)+((n-1)*(n-1)));\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1d7ba1bd95f81c1003db84351d3b2cd6", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n,s=1;\n\tscanf(\"%d\",&n);\n\tint i=1;\n\twhile (i\nint main()\n{\n long long n,s=1,cur=1,j;\n scanf(\"%lld\",&n);\n for(i=2,j=1;i<=n;i++,j++)\n {\n cur=cur+4*j;\n }\n if(n!=0)\n {\n printf(\"%lld\",cur); \n }\n else\n {\n printf(\"%lld\",s);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "98d08761de70e9e34d5d2371bbe5a4df", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,sum=1;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"1\");\n else\n {\n for(i=1;i\n#include\n#include\n#include\n#include\n#include\nint arr[250]={31,29,31,30,31,30,31,31,30,31,30,31};\nint is_leap(int year){\n if ( year%400 == 0)\n return 1;\n else if ( year%100 == 0)\n return 0;\n else if ( year%4 == 0 )\n return 1;\n else\n return 0;\n return 0;\n\t\n}\nint main(){\nint leap,a,b,c,d,e,f,g; int year;\nscanf(\"%d\",&year);\n\nleap=is_leap(year);\nint i; int week=1; \n\nfor(i=year+1;;i++){\n\tweek=is_leap(i)?week=(week+2)%7:week=(week+1)%7;\n\t\n\tif(is_leap(i)==leap && week==1){\n\t\tprintf(\"%d\",i);\n\t\treturn 0;\n\t}\n\t\n}\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e016e62c487c3b3c0d6aa02b5677d974", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "int y;\n\nvoid read(void) {\n\tscanf(\"%d\", &y);\n}\n\nbool leap(int y) {\n\treturn y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);\n}\n\nint solve(void) {\n\tbool is_leap = leap(y);\n\tint d = 0;\n\tdo {\n\t\td++;\n\t\tif (leap(y)) d++;\n\t\ty++;\n\t\td %= 7;\n\t} while (d || leap(y) != is_leap);\n return y;\n}\n\nint main(void) {\n read();\n printf(\"%d\", solve());\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8476ca64088c22b2941e55f51cdb7f74", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n\nbool namnhuan(long y)\n{\n\tif((((y%4)==0)&&((y%100)!=0))||((y%400)==0)) return true;\n\treturn false;\n}\n\nmain()\n{\n\tlong y,day=0;\n\tscanf(\"%ld\",&y);\n\tbool nam=namnhuan(y);\n\tdo\n\t{\n\t\tif(namnhuan(y))\n\t\t{\n\t\t\tday+=2;\n\t\t}\n\t\telse day+=1;\n\t\ty+=1;\t\t\n\t} while(day%7!=0 || namnhuan(y)!=nam);\n\tprintf(\"%ld\",y);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "653c6362a3412764e3dcd1ac697ce46c", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "int y;\n\nvoid read(void) {\n\tscanf(\"%d\", &y);\n}\n\nbool leap(int y) {\n\treturn y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);\n}\n\nint solve(void) {\n\tbool is_leap = leap(y);\n\tint d = 0;\n\tdo {\n\t\td++;\n\t\tif (leap(y)) d++;\n\t\ty++;\n\t\td %= 7;\n\t} while (d || leap(y) != is_leap);\n return y;\n}\n\nint main(void) {\n read();\n printf(\"%d\", solve());\n return 0;\n}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "865b123e2eb1823ea4b43293dc781a0f", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint leap(int n)\n{\n if(n%4==0) \n return 1;\n else if(n%100==0)\n return 0;\n else in(n%400==0)\n return 1;\n else \n return 0;\n}\nint main()\n{\n int a,b,c,s,t,u,m,n,year;\n scanf(\"%d\",&n);\n a=n-1;\n b=n-2;\n c=n+1;\n m=leap(a);\n s=leap(b);\n t=leap(c);\n u=leap(n);\n if(m==1)\n year=n+6;\n else if(s==1)\n year=n+17;\n else if(t==1)\n year=n+22;\n else if(u==1)\n year=n+28;\n printf(\"%d\",year);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d6dbc8d7f31b62a7d523426b8cd49b83", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n char s[10000],k[10000];\n scanf(\"%s\", s);scanf(\"%s\", k);\n int a=strlen(k),t=strlen(s)-1;\n int b=0,q=0,i;\n while(s[q]!='|')q++;\n if(a+q == t-q){printf(\"%s%s\",k,s);return 0;}\n else if(q == t+a-q){printf(\"%s%s\", s,k);return 0;}\n int c = t-q-q;\n if(c<0) c*=-1;\n if(a>c && (a-c)%2==0){\n if(t-q>q){\n for(i=0;i\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "29bca88dcddc9eeb8b3ece0588912ebc", "src_uid": "917f173b8523ddd38925238e5d2089b9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "# include \n# include \n# include \n\nchar ch[1010];\nchar chh[1010];\nint abs(int a){return a>0?a:-a;}\nint main()\n{\n int flag,i,sum1,sum2,j,len;\n char c;\n\n while(~scanf(\"%s\",&ch))\n {\n len = strlen(ch);\n sum1 = sum2 = 0;\n for(i = 0;i < len;i ++)\n {\n if(ch[i] == '|')break;\n sum1 += 1;\n }\n for(i+=1;i < len;i ++)\n {\n sum2 += 1;\n }\n scanf(\"%s\",chh);\n len = strlen(chh);\n if((len-abs(sum1 - sum2))%2==0)\n {\n if(sum1 > sum2)\n {\n for(i = 0;i < (len-abs(sum1-sum2))/2;i ++)\n printf(\"%c\",chh[i]);\n for(i = 0;i < sum1;i ++)printf(\"%c\",ch[i]);\n printf(\"|\");\n for(i = (len-abs(sum1-sum2))/2;i < len;i ++)\n printf(\"%c\",chh[i]);\n for(i = 0;i < sum2;i ++)\n printf(\"%c\",ch[i+sum1+1]);\n }\n else\n {\n for(i = 0;i < len-(len-abs(sum1-sum2))/2;i ++)\n printf(\"%c\",chh[i]);\n for(i = 0;i < sum1;i ++)printf(\"%c\",ch[i]);\n printf(\"|\");\n for(i = len-(len-abs(sum1-sum2))/2;i < len;i ++)\n printf(\"%c\",chh[i]);\n for(i = 0;i < sum2;i ++)\n printf(\"%c\",ch[i+sum1+1]);\n }\n puts(\"\");\n }\n else puts(\"Impossible\");\n memset(ch,0,sizeof(ch));\n memset(chh,0,sizeof(chh);\n }\n\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf14f04dfac84d1a2a01680bc2ab38c4", "src_uid": "917f173b8523ddd38925238e5d2089b9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include \n#include \n#include \nusing namespace std;\n#define N 110\nchar f1[N],f2[N];\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int i,j,k;\n while(scanf(\"%s %s\",f1,f2)!=EOF){\n int len1=0,len2=0,len=strlen(f1),lenlen=strlen(f2);\n for(i=0;i=0 && (lenlen-cha)%2==0 ){\n k=(lenlen-cha)/2;\n if(len1>=len2){\n for(i=0;i\n#include\n#include\n#include\n\nint main(){\n char L[100];\n char R[100];\n char U[100];\n \n for(int = 0; i < 100; i++){\n L[i] = NULL;\n R[i] = NULL;\n U[i] = NULL;\n }\n \n \n scanf(\"%[^|]%\", L);\n getchar();\n scanf(\"%s\", R);\n scanf(\"%s\", U);\n int l = 0, r = 0, u = 0, diff, diff1;\n l = strlen(L);\n r = strlen(R);\n u = strlen(U);\n \n if(u == 0){\n strcpy(U, R);\n r = 0;\n u = strlen(U);\n }\n diff1 = abs(l - r);\n diff = u - abs(l - r);\n // printf(\"%d %d %d\", l, r, u);\n \n if(diff % 2 != 0 || diff < 0){\n printf(\"Impossible\");\n return 0;\n }\n \n \n for(int i = 0; i < abs(l - r); i++){\n if(l < r)\n L[l + i] = U[i];\n else\n R[r + i] = U[i];\n }\n //printf(\"%s\\n%s\\n%s\\n%d %d %d\\n\", L, R, U, l, r, u);\n \n if(l < r)\n l = l + diff1;\n else\n r = r + diff1; \n\n int i, j, k;\n for(i =diff1, j = l, k = r; i < u; i++){\n if(i % 2 == 0){\n L[j] = U[i];\n j++;\n } \n else{\n R[k] = U[i];\n k++;\n }\n }\n\n L[j] = '\\0';\n R[k] = '\\0';\n \n\n printf(\"%s|%s\", L, R);\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7978556f05eb9b62a8a8574a59e0abc3", "src_uid": "917f173b8523ddd38925238e5d2089b9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nchar a[10];\nbool flag=true;\nint main()\n{\n int i,j;\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=false;\n }\n puts(flag?\"YES\":\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9d48a507f7bae17c2ea9cfb19cf70271", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nint main(){\n bool find=true;\n int count=0;\n char str[8][8];\n while(count<8){\n scanf(\"%s\", str[count]);\n count++;\n }\n for(int i=0; i<8; i++)\n {\n for(int 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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b36857cf8d78cd484f8b88ed088c249a", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#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 return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "059d412ecab4b002f88e40e04b13e32f", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "GNU C", "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 ll long long\n#define endl printf(\"\\n\")\n#define MAX 100005\n\n\tchar a[10][10] = {\"WBWBWBWB\",\"BWBWBWBW\",\"BWBWBWBW\",\"BWBWBWBW\",\"WBWBWBWB\",\"WBWBWBWB\",\"BWBWBWBW\",\"WBWBWBWB\"}, b[10][10];\n\nint main () {\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9edea82c73b8ef49bd9ef6253b24840c", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nchar a[10];\nbool flag=true;\nint main()\n{\n int i,j;\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=false;\n }\n puts(flag?\"YES\":\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a894f9e49a11c8b348a7c57d4eea9d59", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n, i;\n unsigned int res = 1;\n \n scanf(\"%d\", &n);\n if (n & 1 || !n) {\n printf(\"0\\n\");\n return 0;\n }\n n >>= 1;\n for (i = 0; i < n; i++) {\n res *= 2;\n }\n printf(\"%d\\n\", res);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3aa7d7126c3bfbc5d048294f001d07c8", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin>>n;\n\tif (n%2==0)\n\t{\n\t\tcout<< pow(2,n/2);\n\t}\n\telse\n\t{\n\t\tcout<<0;\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "40d57d9b9817d9820d64cadf2501073d", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n int n;\n scanf(\"%d\",n);\n if(n%2 == 0)\n {\n printf(pow(2,n/2));\n }\n else\n {\n printf(0);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "593e903b6612f233a8e65ca99cef5fe5", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n \nint main(){\n int n;\n scanf(\"%d\",&n);\n (n%2==0)?printf(\"%d\",pow(2,n/2):printf(\"0\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "154697446095127c6a95fbf5a65e35ce", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"%d\",n);\n }\n else\n printf(\"0\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a6c9a4fbda8109c7791684991ff69344", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\r\n\r\n\r\n\r\nint man(){\r\n\tint x ;\r\n\tint ctr = 0 ; \r\n\tint n; \r\n\tscanf(\"%d\" , &n); \r\n\tint arr[4]; \r\n\tarr[0] = -1; \r\n\tfor(int i = 1 ; i< 4 ; i++){\r\n\t\tscanf(\"%d\" , &x); \r\n\t\tarr[i] = x ; \r\n\t}\r\n\r\n\tint num = n ; \r\n\twhile(1){\r\n\t\tif(arr[num] !=0){\r\n\t\t\tctr++ ; \r\n\t\t}\r\n\t\telse{\r\n\t\t\tbreak ; \r\n\t\t}\r\n\t\tnum = arr[num] ; \r\n\t}\r\n\t// printf(\"%d\\n\" , ctr); \r\n\tif(ctr ==2){\r\n\t\tprintf(\"YES\\n\"); \r\n\t}\r\n\telse{\r\n\t\tprintf(\"NO\\n\"); \r\n\t}\r\n\t\r\n}\r\n\r\nint main(){\r\n\tint t ; \r\n\tscanf(\"%d\" , &t); \r\n\tfor(int i = 0 ; i\r\nint main(){\r\n int k;\r\n scanf(\"%d\",&k);\r\n while(k--){\r\n int n;\r\n scanf(\"%d\",&n);\r\n int arr[3];\r\n for(int i=0;i<3;i++){\r\n scanf(\"%d\",&arr[i]);\r\n }\r\n int count=0;\r\n int tem=arr[n-1];\r\n while(tem!=0){\r\n tem=arr[n-1];\r\n count=count+1;\r\n }\r\n if (count==2){\r\n printf(\"YES\")\r\n }\r\n else{\r\n printf(\"NO\")\r\n }\r\n }\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "888c57b981a4a18000d532bd54d24988", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\nint main(){\r\n int n,k;\r\n // int sum=0;\r\n int arr[9];\r\n scanf(\"%d\",&n);\r\n for(int i=0;i0&&arr[arr[arr[p-1]]]>0){\r\n printf(\"YES\");\r\n }\r\n }\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "79f995ab055dd3848290d2b90dddf25f", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\", &t);\r\n for (int i = 0; i < t; i++)\r\n {\r\n int x, abc[3];\r\n scanf(\"%d\", &x);\r\n scanf(\"%d %d %d\", &abc[0], &abc[1], &abc[2]);\r\n\r\n int key1 = abc[x];\r\n if (abc[key1] != 0)\r\n {\r\n print(\"YES\");\r\n }\r\n else\r\n {\r\n print(\"NO\");\r\n }\r\n }\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9d762d9f4c02c69e3c9294368e643851", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t--){\r\n int x,a,b,c,f;\r\n scanf(\"%d%d%d%d\",&x,&a,&b,&c);\r\n if(x==1){\r\n if(a==2){\r\n if(b==3){\r\n f=1;\r\n }\r\n else f=0;\r\n }\r\n else if(a==3){\r\n if(c==2) f=1;\r\n else f=0;\r\n \r\n }\r\n else f=0;\r\n }\r\n else if(x==2){\r\n if(b==1){\r\n if(a==3){\r\n f=1;\r\n }\r\n else f=0;\r\n }\r\n else if(b==3){\r\n if(c==2) f=1;\r\n else f=0;\r\n \r\n }\r\n else f=0\r\n }\r\n else if(x==3){\r\n if(c==1){\r\n if(a==2){\r\n f=1;\r\n }\r\n else f=0;\r\n }\r\n else if(c==2){\r\n if(b==1) f=1;\r\n else f=0;\r\n \r\n }\r\n else f=0;\r\n }\r\n \r\n if(f==1)\r\n printf(\"YES\\n\");\r\n else printf(\"NO\\n\");\r\n \r\n }\r\n\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "44836ca11a737492d3bfad43b3ee4fb9", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint x,i,min=0,cur=0,temp=1;\nscanf(\"%d\",&x);\nif(x>0)\n{\n while(cur!=x)\n{\n if(cur+temp<=x) \n{ cur+=temp; }\nelse \n{ cur-=temp; }\n++temp;\n++min;\n}\nelse\n{\n while(cur!=x)\n{\nif(cur-temp>=x) \n{cur-=temp;}\nelse \n{cur+=temp;}\n++temp;\n++min;\n}\n}\nprintf(\"%d\",min);\nreturn 0;\n}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cdf886240adf111a9fb7924423b0e46b", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int tp,x,ans;\n while(~scanf(\"%d\",&x))\n {\n x=x<0?-x:x,ans=ceil((-1+sqrt(1+8.0*x))/2),tp=ans*(ans+1)/2-x;\n while(tp&1) ans++,tp+=ans;\n printf(\"%d\\n\",ans);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d897543e53429e0d5d6081cb0d39fce", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint x,i,min=0,cur=0,temp=1;\nscanf(\"%d\",&x);\nif(x>=0)\n{\nwhile(cur!=x)\n{\nif(cur+temp<=x) \n cur+=temp;\nelse \n cur-=temp;\n++temp;\n++min;\n}\nelse\nwhile(cur!=x)\n{\nif(cur-temp>=x) cur-=temp;\nelse cur+=temp;\n++temp;\n++min;\n}\nprintf(\"%d\",min);\n}\nelse\n printf(\"%d\",x);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7560bfdfc1321a17d3c1dc9f6783d254", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n\n long n; scanf(\"%ld\\n\", &n);\n if(n < 0){n = -n;}\n long sum(0), ans(0), p(1);\n for(p = 1; sum < n; sum += p, p++, ans++);\n long diff = sum - n; \n if(n == 0){puts(\"0\");}\n else if(diff % 2 == 0){printf(\"%ld\\n\", ans);}\n else if((diff + p) % 2 == 0){printf(\"%ld\\n\", ans + 1);}\n else{printf(\"%ld\\n\", ans + 2);}\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bff4476238cc0ef90390c5b8d8425ad6", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n<0){\n n=-n;\n }\n int count=0,jump=1,position=0;\n while(1){\n if(position==n)\n break;\n else if(position+jump>n)\n {break;}\n else{\n count++;\n position+=jump;\n jump++;\n }\n }\n if(n%2==0){\n if(position%2==0){\n if(jump%2==0)\n count+=1;\n else\n count+=2;\n }\n else\n {\n if(jump%2==0)\n count+=2;\n else\n count+=1;\n }\n }\n else\n {\n if(position%2!0){\n if(jump%2==0)\n count+=1;\n else\n count+=2;\n }\n else\n {\n if(jump%2==0)\n count+=2;\n else\n count+=1;\n }\n }\n printf(\"%d\",count);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c04a155e515882fc287f478ba1c3a291", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int i,n;\n scanf(\"%d\",&n);\n char c[k];\n scanf(\"%s\",c);\n int t=0;\n for(i=0;t+i\n#include\nmain()\n{\nint n,i,j;\nchar a[55];\nscanf(\"%d\",&n);\nprintf(\"\\n\");\nscanf(\"%s\",a);\nprintf(\"%c\",a[0]);\ni=0;\nj=0;\nwhile(a[j]!='\\0')\n{j=j+i;\nprintf(\"%c\",a[j]);\ni=i+1;\n}\n \n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "79d44ad4075b740c6dadc86641af8352", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nvoid main()\n{\n int n,i;\n scanf(\"%d,&n\");\n char s[n];\n scanf(\"%s,&s\");\n for(i=0,j=1;i\n#include\n#include\nusing namespace std;\nint main()\n{\n\tint n,k[100005],i,j,a,b;\n\tscanf(\"%d\",&n);\n for(i=0;i\nusing namespace std;\nint main()\n{\n int n,sum=0;\n char a[60];\n scanf(\"%d\\n\",&n);\n scanf(\"%s\",a);\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tsum=sum+i;\n\t\tprintf(\"%c\",a[sum-1]);\n\t} \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9878727cc86fc34778cd1edaf36d6ded", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,t=0;\n t=n;\n scanf(\"%d %d\",&n,&k);\n for(i=k;i>0;i--)\n {\n r=t%10;\n if(r!=0)\n t=t-1;\n else if(r==0)\n t=t/10;\n n=n/10;\n n=t;\n }\n printf(\"%d\",t);\n return=0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6efe65bc5345c8ad8feedff1aaf44434", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,r;\n for(i=0;i\nvoid main()\n{\n int n,k,i=0;\n clrscr();\n printf(\"n&f\");\n scanf(\"%d%d\",&n,&k);\n while(i\nint main()\n{\n int a,k;\n int temp1;\n scanf(\"%d %d\",&a,&k);\n while(k!=0)\n {\n temp1=a%10;\n if(tmep>=1)\n {\n temp1-=1;\n a=a/10+temp1;\n }\n else\n {\n a=a/10;\n }\n k--;\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7addbd8a4cf05bda8fa9f39be1f8191c", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(b!=0)\n\t{\n\t\tb--;\n\t\tif(a%10!=0) a--;\n\t\telse a/=10;\n\t}\n\tprintf(\"%d\",a);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "053c5da5eb0f0a4c7ab4b3ba964773f2", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n {\n int n;\n scanf(\"%i\" , &n);\n int mod[2] , l[2];\n int i=0;\n if(n>=0 && 99>=n)\n {\n if(n==08)\n {\n printf(\"2\");\n return 0;\n }\n while(i<2)\n {\n mod[i]=n%10;\n n/=10;\n i++;\n }\n\n i=0;\n while(i<2)\n {\n if(mod[i]==0 || mod[i]==6 || mod[i]==9)\n l[i]=2;\n \n if(mod[i]==1)\n l[i]=7 ;\n \n if(mod[i]==2)\n l[i]=2;\n \n if(mod[i]==3 || mod[i]==4)\n l[i]=3;\n \n if(mod[i]==5)\n l[i]=4;\n \n if(mod[i]==7)\n l[i]=5;\n \n if(mod[i]==8)\n l[i]=1;\n i++; \n }\n printf(\"%i\" , l[0]*l[1]);\n }\n else \n return 0;\n \n getche(); \n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8c3c9165472a25a1cfce374607f41285", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": " switch (r) {\ncase 0 :\n a=2;\n break;\ncase 1 :\n a=6;\n break;\ncase 2 :\n a=2;\n break;\ncase 3:\n a=3;\n break;\ncase 4:\n a=3;\n break;\ncase 5:\n a=4;\n break;\ncase 6:\n a=2;\n break;\ncase 7:\n a=5;\n break;\ncase 8:\n a=1;\n break;\ncase 9:\n a=2;\n break;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d160352b0f4f57e48e0ba882e3cc0009", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "0#include \nint main()\n{\n int a[10]={2,7,2,3,3,4,2,5,1,2};\n int no ,i,j;\n scanf(\"%d\",&no);\n if(no==0)\n printf(\"4\");\n else if(no<10)\n {\n printf(\"%d\",a[no]*a[0]);\n }\n else\n {\n printf(\"%d\",(a[no%10])*(a[no/10]));\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cc960febcbf05b85fcb32509ef53139a", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d551a780913fb7c931e8797f8bed484e", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,n1,n2,x,y;\n scanf(\"%d\",&n);\n n1=n%10;\n {\n if(n1==0)\n x=2;\n else if(n1==1)\n x=7;\n else if(n1==2)\n x=2;\n else if(n1==3)\n x=3;\n else if(n1==4)\n x=3;\n else if(n1==5)\n x=4;\n else if(n1==6)\n x=2;\n else if(n1==7)\n x=5;\n else if(n1==8)\n x=1;\n else if(n1==9)\n x=2;\n }\n n2=n/10;\n {\n if(n2==0)\n y=2;\n else if(n2==1)\n y=7;\n else if(n2==2)\n y=2;\n else if(n2==3)\n y=3;\n else if(n2==4)\n y=3;\n else if(n2==5)\n y=4;\n else if(n2==6)\n y=2;\n else if(n2==7)\n y=5;\n else if(n2==8)\n y=1;\n else if(n2==9)\n y=2;\n }\n printf(\"%d\"\\n,x);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "038f1d890557de53ea5fa9d40581428d", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main(){\n int h,w,u1,d1,u2,d2;\n scanf(\"%d%d%d%d%d%d\",&w,&h,&u1,&d1,&u2,&d2);\n for(int i=h;i>0;i--){\n w=w+i;\n if(i==d1)\n w=w-u1;\n else if(i==d2)\n w=w-u2;\n\n }\n printf(\"%d\",w);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9f8dc38d2ac0bd2335182f1d8ede885a", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "//https://codeforces.com/contest/1099/problem/A\n\n#include \nusing namespace std;\n\nint main()\n{\n int w,h,w1,h1,w2,h2;\n scanf(\"%d %d\",&w,&h);\n scanf(\"%d %d\",&w1,&h1);\n scanf(\"%d %d\",&w2,&h2);\n\n for(int i=h;i>0;i--){\n w=w+i;\n if(i==h1){\n w=w-w1;\n if(w<0){\n w=0;\n }\n }\n else if(i==h2){\n w=w-w2;\n if(w<0){\n w=0;\n }\n }\n else{\n continue;\n }\n }\n cout<\nint main(){\n int u,h,u1,h1,u2,h2;\n scanf(\"%d%d\",&u,&h);\n scanf(\"%d%d\",&u1,&h1);\n scanf(\"%d%d\",&u2,&h2);\n u=u+h;\n for(i=h-1;i>=0;i--){\n u=u+i;\n if(i==h1)\n u=u-u1;\n if(i==h2)\n u=u-u2;\n }\n printf(\"%d\",u);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "22c29ef7ae6731206135f875a273c4fe", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main(){\n int h,w,u1,d1,u2,d2;\n cin>>w>>h>>u1>>d1>>u2>>d2;\n for(int i=h;i>0;i--){\n w=w+i;\n if(i==d1)\n w=w-u1;\n else if(i==d2)\n w=w-u2;\n\n }\n cout<\nint main()\n{\n int w,h;\n scanf(\"%d %d\",&w,&h);\n int w1, h1;\n scanf(\"%d %d\", &w1, &h1);\n int w2, h2;\n scanf(\"%d %d\", &w2, &h2);\n while(h>0)\n {\n \tw+=h;\n \tif(h==h1)\n \t\tw-=a;\n \tif(h==h2)\n \t\tw-=b;\n \tif(w<0)\n \t\tw=0;\n \th--\n }\n printf(\"%d\",w);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "107e5ac15c3da5706a5198bb04d0bfc8", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "e \n\nint main(){\n int n;\n scanf(\"%d\", &n);\n if(n==1) printf(\"-1\\n\");\n if(n>1 && n<4) printf(\"2 2\\n\");\n else\n printf(\"%d %d\\n\", n-n%2, (n-n%2)/2);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9d0d4bbfc4c1d5c1b1041968b4123c0a", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n int n;\n printf(\"%d 2\",x-x%2);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e799e6be742575c3d8dffe64ba3d5398", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n int i,j;\n for(i=1;i<=n;i++){\n for(j=1;j<=n;j++){\n if(i % j == 0 && i * j > n && i / j < n){\n count = 1;\n break;\n }\n }\n if(count == 1){\n break;\n }\n }\n if(count == 1){\n printf(\"%d %d\\n\",i,j);\n }else{\n printf(\"-1\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d559faec84d75844d2b93a5bf5ee399", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n\tint x, a = 0, b = 0;\n\tscanf(\"%d\",&x);\n\tif(x == 1){\n\t\tprintf(\"-1\\n\");\n\t}else{\n\t\tfor(int i = x; i >=1; i--){\n\t\t\tfor(int j = i-1; j >= 1; j--){\n\t\t\t\tif(i * j > x){\n\t\t\t\t\tif(i % j == 0){\n\t\t\t\t\t\ta = i;\n\t\t\t\t\t\tb = j;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(a &% b){\n\t\t\tprintf(\"%d %d\\n\",a,b);\n\t\t}else{\n\t\t\tprintf(\"-1\\n\");\n\t\t}\n\t\t\n\t}\n\t\n\treturn(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c52def107cac2e781f909004895413bf", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"-1\");\n else\n printf(\"%d 2\",);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d0fe1903c771432ba6f7983c18a36bb6", "src_uid": "883f67177474d23d7a320d9dbfa70dd3", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n char a[11];b[11];\n int i,j;\n scanf(\"%s %s\",a,b);\n for(i=1;i<10;i++)\n {\n if(a[i]>=b[0])\n {\n for(j=0;j\nint main(){\n char ar[100],b[100];\n scanf(\"%s %s\",a,b);\n printf(\"%c\",a[0]);\n int i;\n for( i=1;ar[i]!='\\0';i++){\n if(ar[i]-'a'\nint main()\n{\nchar a[11],b[11];\nint i,j;\nscanf(\"%s %s\",a,b);\nfor(i=1;i<11;i++)\n{\nif(a[i]>=b[0])\n{\nfor(j=0;j\nint main()\n{\n\tchar esm[10];\n\tchar shohrat[10];\n\tscanf(\"%s\" , esm);\n\tscanf(\"%s\" , shohrat);\n\tfor(int i=0;;i++)\n\t{\n\t\tif(esm[i]\nint main()\n{\n int j;\n str[21];\n gets(str);\n int a;\n int i;\n for(i=1;i<21;i++)\n {\n if(str[i]== )\n a=i;\n break;\n }\n for(i=1;i<21;i++)\n {\n if(str[i]>str[a+i])\n {\n for(j=0;j\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3c56fcc9b8d1ea87c23187d6bcbc42c", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n int a, n, t = 1;\n scanf(\"%d %d\", &n, &a);\n if(a % 2 != 0) {\n while(a != 1) {\n a -= 2;\n t++;\n }\n printf(\"%d\", t);\n return 0;\n }\n else {\n while(n != a) {\n n -= 2;\n t++;\n }\n printf(\"%d\", t);\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9b8028b35b7611b58263a42cd50d9923", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{ long int n, a;\n skanf(\"%d%d\",&n,&a);\n if(0==n%2)\n printf(\"%d\",(n-a)/2+1);\n else \n printf(\"%d\",(a/2+1);\n \n \n \n \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "73eeed35cf4b4acd54fc8c283fb66700", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long n,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n%2!=0 ||n\n\nint main() {\n int a, n, b = 1, t = 1;\n scanf(\"%d%d\", &n, &a);\n if(a % 2 != 0) {\n while(a != 1) {\n a -= 2;\n t++;\n }\n printf(\"%d\", t);\n return 0;\n }\n else {\n while(n != a) {\n n -= 2;\n t++;\n }\n printf(\"%d\", t);\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2dceb7509f0584a697ea43aee3ebe305", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main(){\n\tint size, i;\n\tscanf(\"%d\", &size);\t\n\tshort *arr = malloc(sizeof *arr * size);\n\tint in;\n\tscanf(\"%d\", &in);\n\tfor(i = 0; i < size; ++i){\n\t\tarr[size - i - 1] = in % 10;\n\t\tin /= 10;\n\t}\n\tint j, isTrue = 0;\n\tfor(i = 0; i < size; ++i){\n\t\tshort key = 0;\n\t\tint counter = i;\n\t\twhile(counter != -1)\n\t\t\tkey += arr[counter--];\n\t\tj = i + 1;\n\t\twhile(j < size){\n\t\t\tshort sum = 0;\n\t\t\tint k = j;\n\t\t\twhile(sum < key && k < size)\n\t\t\t\tsum += arr[k++];\n\t\t\tif(sum == key)\n\t\t\t\tj = k;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\tif(j == size && i != size - 1){\n\t\t\tputs(\"YES\");\n\t\t\tisTrue = 1;\n\t\t\tbreak;\n\t\t}\n\n\t}\n\tif(!isTrue)\n\t\tputs(\"NO\");\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5957142d7fed103d711fea4ff53eed71", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \nint main(){\n\tint n=0;\n\tscanf(\"%d\",&n);\n\tint s=0,t=0,a[n],k=0,j=1;\n\ta[0]=getchar();\n\tfor(int i=0;is)break;\n\t\t\tif(t==s)t=0;\n\t\t\t\n\t\t}\n\t\tif(t==0)k=1;\n\t\tif(t>s){\n\t\t\ts=0;t=0;j++;continue;\n\t\t}\n\t}\n\tif(k)printf(\"YES\");else printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "51517b6762b61dfad72d8babe768dd4e", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint i,j,tot,n,a[105],sum;\nchar s[105];\nint main()\n{\n scanf(\"%d%s\",&n,s);\n for(i=1;i<=n;i++)\n {\n a[i]=s[i-1]-'0';\n sum+=a[i];\n }\n if(n>1 && sum==0)\n {\n puts(\"YES\");\n return 0;\n }\n for(i=1;isum)\n break;\n else if(tot==sum)\n tot=0,j-=1;\n else\n tot+=a[j];\n }\n if(tot!=sum || j!=n+1)\n continue;\n puts(\"YES\");\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "08d0b3ed1c9c8b114cf2b82a106c0899", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "waiwaitt", "lang_cluster": "C", "compilation_error": true, "code_uid": "59a53f914aa04f188f057e4ea879a5c1", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n\nchar li[101];\n\nint main() {\n\n\tint a, b, c;\n\tint n = 0;\n\tint tot = 0;\n\tint ct;\n\tint status = 1;\n\n\tscanf(\"%d\", &a);\n\tgetchar();\n\n\tgets_s(li);\n\n\tfor (b = 0; b < a; b++)\n\t\tli[b] = li[b] - '0';\n\n\tfor (b = 0; b < a; b++)\n\t\ttot = tot + li[b];\n\n\n\n\tfor (b = 0; b < a; b++) {\n\t\tn = n + li[b];\n\t\tif (li[b + 1] > n)\n\t\t\tcontinue;\n\t\telse break;\n\t}\n\n\tif (n == tot) {\n\t\tprintf(\"no\");\n\t\treturn 0;\n\t}\n\telse if (tot%n != 0) {\n\t\tprintf(\"no\");\n\t\treturn 0;\n\n\t}\n\n\tct = 0;\n\n\tfor (c = 0; c < a; c++) {\n\t\tct = ct + li[c];\n\n\t\tif (ct < n)\n\t\t\tcontinue;\n\t\telse if (ct == n) {\n\t\t\tct = ct - n;\n\t\t\tcontinue;\n\t\t}\n\t\telse if (ct > n) {\n\n\t\t\tstatus = 0;\n\t\t\tbreak;\n\n\t\t}\n\n\n\t}\n\n\n\n\tif (status == 0)\n\t\tprintf(\"no\");\n\telse if(status == 1 && ct==0)\n\t\tprintf(\"yes\");\n\n}\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8983ae5d5a33a3b088f35f283c13eeea", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,j,s=0;\n scanf(\"%d\",&n);\n int a[n][n];\n for(i=0;i\n#include\n \nint main()\n{\n\tint n ;int i;int d;int j;\n\tscanf(\"%d\", &n);\n\tint a[n][n];\n\td = n-1;\n\tint sum = 0;\n\tfor(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,a[10000][10000];\n for(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,a[10000][10000];\n for(i=0;i\nint main()\n{\n\tint n,a[5][5];\n\tint i,j,r,c,sum;\n\twhile(scanf(\"%d\",&n))\n\t{\n\t\tsum=0;\n\t\tfor(i=0;i\n#include \n#include \n\nint main() {\n char s[100];\n int tt, t, n;\n\n fgets(s);\n n = strlen(s);\n for (int i = 0; i < n; i++) {\n if (s[i] == 'h') {\n t = 1;\n }\n if (t == 1) {\n for (int j = i; j < n; j++) {\n if (s[j] == 'e') {\n t = 2;\n }\n if (t == 2) {\n for (int k = j; k < n; k++) {\n if (s[k] == 'l') {\n t = 3;\n }\n if (t == 3) {\n for (int l = k + 1; l < n; l++) {\n if (s[l] == 'l') {\n t = 4;\n }\n if (t == 4) {\n for (int m = l; m < n; m++) {\n if (s[m] == 'o') {\n t = 5;\n tt = 1;\n break;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n if (tt != 1) {\n printf(\"NO\");\n } else {\n printf(\"YES\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1c9593d84edfbad045dc2ba7ba1a2930", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\nint main()\n{ int i=0,cnt=0;\n char str[100]; \n scanf(\"%s\",str);\nint j,i;\n int a=strlen(str);\n for(i=0;i\n\nint main(void)\n{\n int i,j,k,l,m;\n int a=0;\n char in[31]=\"\";\n\n scanf(\"%s\",in);\n\n for(i=0;i<30;i++)\n if(in[i]!=0) a++;\n\n for(i=0;i\nint main()\n{\n char in [100] , i ,flag = 0;\n scanf(\"%s\",in);\n for(i=0;i\n#include \n#include \n\nint main()\n{\n char str[101];\n scanf(\"%s\",str);\n if(strlen(str)<=4)\n printf(\"NO\\n\");\n else\n {\n int countH,countL,countO;\n countH=countO=countL=0;\n for(i=0;i=1&&countL>=2&&countO>=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d12d9e9d8cf1bfb06dbebc95c8622e12", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n long long int n,k,i,ans;\n long long int sum=0;\n scanf(\"%lld %lld\",&n,&k);\n for(i=1;i<=n;i++)\n {sum=sum+i;\n add=n-i;\n ans=sum-add;\n if(ans==k)\n break;\n \n }\n printf(\"%lld\",i);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d1f582215c8f33d5b525a19e25abb3f", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "main(n,k){scanf(\"%d%d\",&n,&k);printf(\"%d\",n-int(sqrt(9+8*k+8*n)-3)/2);}", "lang_cluster": "C", "compilation_error": true, "code_uid": "707ef101d257e73614695c6127bf3f7b", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nvoid remp(long* t,long d, long f, long*u,long* d,long n)\n{\n long i,s;\n s=(f-d+1)/4;\n for (i=0;is)\n {\n remp(t,d,d+2*s-1,u,d,n+3);\n remp(t,d+2*s,f,u,d,n+3);\n \n }\n}\nmain()\n{\n long n,i,max,taille,*up,*down,*res,rest;\n scanf(\"%li\",&n);\n up=malloc((n+1)*sizeof(long));\n down=malloc((n+1)*sizeof(long));\n for (i=1;i<=n;i++) scanf(\"%li\",&up[i]);\n for (i=1;i<=n;i++) scanf(\"%li\",&down[i]);\n rest=n/3;\n taille=pow(2,rest+1);\n \n res=calloc(taille+1,sizeof(long));\n remp(res,1,taille,up,down,1);\n for(i=1;i<=taille;i++) printf(\"%li \",res[i]);\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5228e7ff8fa94d2b86f0e784e22e9412", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\nint main()\n{\n int n,k,e=0,i=1,x=0,box=0;\n scanf(\"%d%d\",&n,&k);\n \n do\n {\n if(box==k)\n {\n if(n==0)\n {\n break;\n }\n else\n {\n box=box+i;\n i=i++;\n }\n }\n else if(boxk)\n {\n box--;\n e++;\n }\n n=n-1;\n }while(n!=0)\n \n \n \n printf(\"%d\",e);\n}\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "964d12eade94001fbb3cdbae173ec392", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main():\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n int c = 0, t = 1;\n while(c < k)\n {\n c += t;\n t++;\n n--;\n }\n while(c - k != n)\n {\n t++;\n c += t\n n--;\n }\n print(\"%d\", n);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "952fb9a6f85625f765781baf129a4f7a", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nchar rec[105];\n\nint main()\n{\n long long ans=0, nb, ns, nc, pb, ps, pc, r, x,z,y, temp, cost;\n scanf(\"%s\", rec);\n scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d%I64d\", &nb, &ns, &nc, &pb, &ps, &pc, &r);\n\n long long bread=0 , soucage=0 , cheese = 0, i;\n\n for(i=0 ; rec[i] != '\\0' ; i++)\n {\n if(rec[i] == 'B')\n bread++;\n else if(rec[i] == 'S')\n soucage++;\n else if(rec[i] == 'C')\n cheese++;\n }\n\n cost = (bread*pb) + (soucage*ps) + (cheese*pc);\n\n if((x=nb/bread) > 0 && (y=ns/soucage) > 0 && (z=nc/cheese) > 0 )\n {\n k = MIN(MIN(x,y),z);\n k--;\n if(k!=0)\n {\n ans += k;\n nb -= k*bread;\n ns -= k*soucage;\n nc -= k*cheese;\n }\n }\n\n while((nb-bread) > 0 && (ns-soucage) > 0 && (nc - cheese) > 0)\n {\n ans += 1;\n nb-=bread;\n ns-=soucage;\n nc-=cheese;\n }\n\n while(nb > 0 || ns > 0 || nc > 0)\n {\n temp = 0;\n x = nb-bread;\n y = ns-soucage;\n z = nc-cheese;\n\n if(x < 0)\n {\n temp+=-1*x*pb;\n nb = 0;\n }\n else\n nb -= bread;\n\n if(y < 0)\n {\n temp+=-1*y*ps;\n ns = 0;\n }\n else\n ns -= soucage;\n\n if(z < 0)\n {\n temp+=-1*z*pc;\n nc = 0;\n }\n else\n nc -= cheese;\n\n\n\n if((r-temp) >= 0)\n {\n ans++;\n r -= temp;\n }\n else\n {\n printf(\"%I64d\", ans);\n return 0;\n }\n\n if(r<=0)\n {\n printf(\"%I64d\", ans);\n return 0;\n }\n }\n\n ans += r/cost;\n\n printf(\"%I64d\", ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c5587e76a16308882062cb546fcd7f59", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint main() {\n\nchar l[1000];//The sandwich components\nscanf(\"%s\",l);\nint b, //no of bread in kitchen\n\ts, //no of sausage in kitchen\n \tc, //no of cheese in kitchen\n\tbp, //price of bread piece\n\tsp, //price of sausage piece\n\tcp; //price of cheese piece\n\nlong long no=0; //no of sandwiches\nlong long m; //money\n\nscanf(\"%d %d %d\",&b,&s,&c);\nscanf(\"%d %d %d\",&bp,&sp,&cp);\nscanf(\"%I64d\",&m);\nint cn1=0,cn2=0,cn3=0;\nint len=strlen(l);\n\tfor(int i=0;i0||s>0||c>0)&&(FLAG==1))\n\t{\n\n\t\twhile((b>=cn1&&s>=cn2&&c>=cn3)&&FLAG==1)\n\t\t{\n\t\t\tb=b-cn1;\n\t\t\ts=s-cn2;\n\t\t\tc=c-cn3;\n\t\t\tno++;\n\t\t}\n\t\t\tif(b0&&b(b*-1)*bp)\n\t\t\t\t{\n\t\t\t\t\tFLAG=1;\n\t\t\t\t\tm=m-(b*-1)*bp;\n\t\t\t\t\tb=cn1;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tif(cn2>0&&s(s*-1)*sp)\n\t\t\t\t{\n\t\t\t\t\tFLAG=1;\n\t\t\t\t\tm=m-(s*-1)*sp;\n\t\t\t\t\ts=cn2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(cn3>0&&c(c*-1)*cp)\n\t\t\t\t{\n\t\t\t\t\tFLAG=1;\n\t\t\t\t\tm=m-(c*-1)*cp;\n\t\t\t\t\tc=cn3;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b>=cn1&&s>=cn2&&c>=cn3)\n\t\t\t{\n\t\t\t\tb=b-cn1;\n\t\t\t\ts=s-cn2;\n\t\t\t\tc=c-cn3;\n\t\t\t\tno++;\n\t\t\t}\n\n\t}\n\tno=no+(m/price);\n printf(\"%I64d\",no);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ef2b0a9af01e7720bc28238b2cb528ab", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\n\nint main() {\n\nstring l=\"BSC\";//The sandwich components\n//cin>>l;\nint b=100, //no of bread in kitchen\n\ts=1, //no of sausage in kitchen\n \tc=1, //no of cheese in kitchen\n\tbp=100, //price of bread piece\n\tsp=1, //price of sausage piece\n\tcp=1; //price of cheese piece\n\nlong long no=0; //no of sandwiches\nlong long m=100; //money\n\n//cin>>b>>s>>c;\n//cin>>bp>>sp>>cp;\n//cin>>m;\nint cn1=0,cn2=0,cn3=0;\nint len=l.length();\n\tfor(int i=0;i0||s>0||c>0)&&(FLAG==1))\n\t{\n\n\t\twhile((b>=cn1&&s>=cn2&&c>=cn3)&&FLAG==1)\n\t\t{\n\t\t\tb=b-cn1;\n\t\t\ts=s-cn2;\n\t\t\tc=c-cn3;\n\t\t\tno++;\n\t\t}\n\t\t\tif(b0&&b(b*-1)*bp)\n\t\t\t\t{\n\t\t\t\t\tFLAG=1;\n\n\t\t\t\t\tm=m-(b*-1)*bp;\n\t\t\t\t\tb=cn1;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tif(cn2>0&&s(s*-1)*sp)\n\t\t\t\t{\n\t\t\t\t\tFLAG=1;\n\t\t\t\t\tm=m-(s*-1)*sp;\n\t\t\t\t\ts=cn2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(cn3>0&&c(c*-1)*cp)\n\t\t\t\t{\n\t\t\t\t\tFLAG=1;\n\t\t\t\t\tm=m-(c*-1)*cp;\n\t\t\t\t\tc=cn3;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b>=cn1&&s>=cn2&&c>=cn3)\n\t\t\t{\n\t\t\t\tb=b-cn1;\n\t\t\t\ts=s-cn2;\n\t\t\t\tc=c-cn3;\n\t\t\t\tno++;\n\t\t\t}\n\n\t}\n\tno=no+(m/price);\n cout<\n#define MIN(a,b) (a 0 && (y=ns/soucage) > 0 && (z=nc/cheese) > 0 )\n {\n k = MIN(MIN(x,y),z);\n k--;\n if(k!=0)\n {\n ans += k;\n nb -= k*bread;\n ns -= k*soucage;\n nc -= k*cheese;\n }\n }\n\n while((nb-bread) > 0 && (ns-soucage) > 0 && (nc - cheese) > 0)\n {\n ans += 1;\n nb-=bread;\n ns-=soucage;\n nc-=cheese;\n }\n\n while(nb > 0 || ns > 0 || nc > 0)\n {\n temp = 0;\n x = nb-bread;\n y = ns-soucage;\n z = nc-cheese;\n\n if(x < 0)\n {\n temp+=-1*x*pb;\n nb = 0;\n }\n else\n nb -= bread;\n\n if(y < 0)\n {\n temp+=-1*y*ps;\n ns = 0;\n }\n else\n ns -= soucage;\n\n if(z < 0)\n {\n temp+=-1*z*pc;\n nc = 0;\n }\n else\n nc -= cheese;\n\n\n\n if((r-temp) >= 0)\n {\n ans++;\n r -= temp;\n }\n else\n {\n printf(\"%I64d\", ans);\n return 0;\n }\n\n if(r<=0)\n {\n printf(\"%I64d\", ans);\n return 0;\n }\n }\n\n ans += r/cost;\n\n printf(\"%I64d\", ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "713fd70827d2ea53c6938ee55620d311", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#define MIN(a,b) (a 0 && (y=ns/soucage) > 0 && (z=nc/cheese) > 0)\n {\n k = MIN(MIN(x,y),z);\n ans += k;\n nb = nb - (k*bread);\n ns = ns - (k*soucage);\n nc = nc - (k*cheese);\n }\n\n while(nb > 0 || ns > 0 || nc > 0)\n {\n temp = 0;\n x = nb-bread;\n y = ns-soucage;\n z = nc-cheese;\n\n if(x < 0)\n {\n temp+=-1*x*pb;\n nb = 0;\n }\n else\n nb -= bread;\n\n if(y < 0)\n {\n temp+=-1*y*ps;\n ns = 0;\n }\n else\n ns -= soucage;\n\n if(z < 0)\n {\n temp+=-1*z*pc;\n nc = 0;\n }\n else\n nc -= cheese;\n\n\n\n if((r-temp) >= 0)\n {\n ans++;\n r -= temp;\n }\n else\n {\n printf(\"%I64d\", ans);\n return 0;\n }\n\n if(r<=0)\n {\n printf(\"%I64d\", ans);\n return 0;\n }\n }\n\n ans += r/cost;\n\n printf(\"%I64d\", ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a33d56ca1ea7fae4400268f340735a0b", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#inlcude \nint main ()\n{\n char c;\n int n;\n scanf(\"%c\",c);\n scanf(\"%d\",&n);\n if(n%2==0)\n printf(\"0\");\n else \n printf(\"1\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bfda758eadf9bbb5c4422c65101d620a", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n\n#define MAXCHAR 1000\n#define PFS(x) printf(\"%s\\n\",x)\nint main(int argc, char const *argv[])\n{\n\t\n\tchar str[MAXCHAR];\n\tscanf(\"\\n%s\", str);\n\tint x = str[6]-'0';\n\tif(x%2==0)\n \tPFS(\"0\");\n else\n \tPFS(\"1\");\n\tprintf(\"%d\", n%2);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f2a54506353d33f017e870a413bf2e4e", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nchar A;\nint a;\nint b;\nint c;\nint d;\nint e;\nint f;\nint g;\nint main(){\n scanf(\"%c\",&A);\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 scanf(\"%d\",&g);\n if ( g==2||g==4||g==0||g==6||g==8||){\n printf(\"0\");\n \n return 0;\n }\n \n printf(\"1\");\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "856680f080a3749fafe4c645f4ead98c", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include\nint main(){\n string s;\n gets(s);\n printf(\"1\\n\");\n}\n \n \n \n \n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "97b3b847c05c798436b7fad4523a8c86", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "GNU C11", "source_code": "#inlcude \nint main ()\n{\n char c;\n int n;\n scanf(\"%c\",&c);\n scanf(\"%d\",&n);\n if(n%2==0)\n printf(\"0\");\n else \n printf(\"1\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "15aa8e7bba97c909daa780d801cf26e6", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nusing namespace std;\nint main()\n{\n string str;\n cin>>str;\n int n = str.length(), left=0, right =0 ;\n int *pos = new int[n];\n for (int i=0;i\nint main()\n{\n int a[3][3];\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n scanf(\"%d\",&a[i][j]);\n }\n }\n \n int i,j,sum;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n sum=a[i][j];\n if(i-1>=0)\n sum=sum+a[i-1][j];\n if(i+1<3)\n sum=sum+a[i+1][j];\n if(j-1>=0)\n sum=sum+a[i][j-1];\n if(j+1<3)\n sum=sum+a[i][j+1];\n printf(\"%d\",!(sum%2));\n }\n printf(\"\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "70f1bc3b9b8bcc2ea80b7e497d35e120", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\nvoid gen(int *Mgen, int n)\n{\n int i = 0;\n while (i < n && Mgen[i] == 1)\n Mgen[i++] = 0;\n Mgen[i] = 1;\n return;\n}\n\nvoid change(int a[5][5], int x, int y, int k)\n{\n int i = 0, j;\n if (k % 2 != 0)\n {\n a[x + 1][y] = (a[x + 1][y] == 0) ? 1 : 0;\n a[x][y + 1] = (a[x][y + 1] == 0) ? 1 : 0;\n a[x - 1][y] = (a[x - 1][y] == 0) ? 1 : 0;\n a[x][y - 1] = (a[x][y - 1] == 0) ? 1 : 0;\n a[x][y] = (a[x][y] == 0) ? 1 : 0;\n }\n return;\n}\n\n\nint main()\n{\n int a[5][5], x, i, j;\n for (i = 0; i < 5; i++)\n for (j = 0; j < 5; j++)\n a[i][j] = 1;\n for (i = 1; i <= 3; i++)\n for (j = 1; j <= 3; j++)\n {\n scanf(\"%d\", &x);\n change(a, i, j, x);\n }\n for (i = 1; i <= 3; i++)\n {\n for (j = 1; j <= 3; j++)\n printf(\"%d \", a[i][j]);\n printf(\"\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b3f5f299a405fa702fbb0050fcd974f4", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n printf(\"\\n\");\n int i,j,a[3][3];\n for(i=0;i<3;i++)\n {for(j=0;j<3;j++)\n {a[i][j]=1;}\n int k,l,s[3][3];\n printf(\"enter the array representing the times you have pressed the lights:\");\n for(k=0;k<3;k++)\n {for(l=0;l<3;l++)\n {\n scanf(\"%d\" ,&s[k][l]);\n if((s[k][l])%2==0){s[k][l]=0;}\n else{s[k][l]=1;}}}\n \n\n if(s[0][0]==1)\n {for(i=0;i<2;i++)\n {for(j=0;j<(2-i);j++){if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}}\n\n\n if(s[0][1]==1)\n {for(i=0;i<2;i++)\n {for(j=(0+i);j<(3-i);j++)\n {if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}}\n\n\n if(s[0][2]==1)\n {for(i=0;i<2;i++)\n {\n for(j=2;j>(0+i);j--)\n {\n if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}}\n\n\n\n if(s[1][0]==1)\n {for(i=0;i<2;i++)\n {\n for(j=0;j<(1+i);j++)\n {\n if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}\n }\n }\n if(a[2][0]==0){a[2][0]=1;}\n else{a[2][0]=0;}}\n\n\n if(s[1][1]==1)\n {for(j=1;j<3;j++){for(i=(j-1);i<(4-j);i++)\n {if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}\n if(a[1][0]==0){a[1][0]=1;}\n else{a[1][0]=0;}\n }\n\n\n if(s[1][2]==1)\n {for(i=0;i<3;i++)\n {\n for(j=2;j>(1);j--)\n {\n if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}\n }\n }\n if(a[1][1]==0){a[1][1]=1;}\n else{a[1][1]=0;}\n }\n\n\n if(s[2][0]==1)\n {for(i=2;i>0;i--)\n {for(j=0;j<(0+i);j++)\n {if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}\n }\n\n\n\n if(s[2][1]==1)\n {for(i=2;i>1;i--)\n {\n for(j=(0);j<(3);j++)\n {\n if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}\n if(a[1][1]==0){a[1][1]=1;}\n else{a[1][1]=0;}\n }\n\n\n\n if(s[2][2]==1)\n {for(i=2;i>0;i--)\n {\n for(j=2;j>(2-i);j--)\n {\n if(a[i][j]==0){a[i][j]=1;}\n else{a[i][j]=0;}}}\n }\n\n\n\nprintf(\"\\n\");\n for(i=0;i<3;i++)\n {for(j=0;j<3;j++)\n {printf(\"%d \" ,a[i][j]);}printf(\"\\n\");}\n\n return 0;\n\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ab27640e3806d8892fadeb7d64cbad4a", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint fast_int()\n{\n int n = 0;\n char c = getchar_unlocked();\n while (!('0' <= c && c <= '9'))\n {\n c = getchar_unlocked(); \n }\n while ('0' <= c && c <= '9')\n {\n n = (n<<3)+(n<<1) + c - '0';\n c = getchar_unlocked();\n }\n return n;\n}\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(l\nint main()\n{\n long long int s,n,k,b;\n scanf(\"%I64d%I64d\",&n,&k);\n if(k>=(n/2))\n {\n s=((n-1)*n)/2;\n printf(\"%I64d\",s);\n\n }\n else\n { b=n-1;\n s=((k*((2*b)-(k-1)))/2)+(n-(2*k))*k+(((k-1)*(k))/2);\n printf(\"%I64d\",s);\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "919150cf7b23aec43925b366587c6cc8", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n long long number;\n long long nap_time;\n long long messiness = 0;\n\n scanf(\"%lld\", &number);\n scanf(\"%lld\", &nap_time);\n\n if (nap_time >= (number / 2)) {\n messiness = ((number) * (number - 1)) / 2;\n printf(\"%lld\\n\", messiness);\n } else {\n for (long long i = 0; i < 2*nap_time && (number - i - 1) > 0; i++) {\n messiness += (number - i - 1);\n }\n printf(\"%lld\\n\", messiness);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2726f335a4c3f27aca7a1dbb20160578", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\ntypedef long long unsigned U;\ntypedef unsigned u;\nint main()\n{\n\tu n,q,i,j=0;U r=0;\n\tscanf(\"%u%u\",&n,&q);\n\tfor(i=n;q--;)\n\t{\n\t\tif(i>1){r+=(i<<1)-3;i-=2;}\n//\t\telse{if(j^=1)--r;else++r;}\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05c4523f5e0f192a426e5d6f34c5ad75", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\n#define N_MAX 100000\nint shed[N_MAX] = {0,};\nint messi_max = 0;\n\nlong operations = 0;\n\nvoid initialize(int n)\n{\n\tint i;\n\n\tfor(i = 0 ; i < n ; i++)\n\t\tshed[i] = i + 1;\n}\n\nint find_messiness(int n)\n{\n\tint i,j;\n\tint messiness = 0;\n\n\tfor(i = 0 ; i < n ; i++){\n\t\tfor(j = i + 1 ; j < n ; j++){\n\t\t\t//operations++;\n\t\t\tif(shed[i] > shed[j])\n\t\t\t\tmessiness++;\n\t\t}\n\t}\n\n\treturn messiness;\n}\n\n\nint GetAnswer(int n, int k)\n{\n\tint i;\n\tint p,q;\n\tint messiness = 0;\n\tint local_mess;\n\tint tmp;\n\n\tif(n == 1)\n\t\treturn 0;\n\n\tlocal_mess = find_messiness(n);\n\t//operations++;\n\n\t/*if(operations % 10 == 0)\n\t\tprintf(\"Operations: %ld\\n\",operations);*/\n\n\tif(local_mess > messi_max)\n\t\tmessi_max = local_mess;\n\n\tif(k == 0)\n\t\treturn messi_max;\n\n\t// For each pair, check if its already messed up\n\t// If not ... make move\n\t// Make move: mess, reduce timer by 1\n\t// Bactrack\n\t// Unmake move\n\tfor(p = 0 ; p < n ; p++){\n\t\tfor(q = n - 1 ; q > p ; q--){\n\t\t\tif(shed[p] <= shed[q]){\n\t\t\t\t// Not messed up\n\t\t\t\ttmp = shed[q];\n\t\t\t\tshed[q] = shed[p];\n\t\t\t\tshed[p] = tmp;\n\t\t\t\tmessiness = GetAnswer(n,k-1);\n\t\t\t\t// Unmake move\n\t \ttmp = shed[q];\n\t\t\t shed[q] = shed[p];\n\t\t\t shed[p] = tmp;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn messi_max;\n}\n\n\nint main()\n{\n\tint n, k;\n\tint answer = 0;\n\n\t/* handle the program options */\n\t//freopen(\"C:/Users/Subh/Desktop/Work/Coding/C_code/test43.txt\",\"rt\",stdin);\n\n\tscanf(\"%d %d\",&n,&k);\n\n\tinitialize(n);\n\tmessi_max = 0;\n\toperations = 0;\n\t//printf(\"Operations: %ld\\n\",operations);\n\t//printf(\"Messiness after initialization is %d\\n\",find_messiness(n));\n\n\t/* The code of your application goes here */\n\tanswer = GetAnswer(n, k);\n\n\tprintf(\"%d\\n\",answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "74b7ba679a7905649dfdb1afcc4793a5", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\n#define N_MAX 100000\nint shed[N_MAX] = {0,};\nint messi_max = 0;\n\nlong operations = 0;\n\nvoid initialize(int n)\n{\n\tint i;\n\n\tfor(i = 0 ; i < n ; i++)\n\t\tshed[i] = i + 1;\n}\n\nint find_messiness(int n)\n{\n\tint i,j;\n\tint messiness = 0;\n\n\tfor(i = 0 ; i < n ; i++){\n\t\tfor(j = i + 1 ; j < n ; j++){\n\t\t\toperations++;\n\t\t\tif(shed[i] > shed[j])\n\t\t\t\tmessiness++;\n\t\t}\n\t}\n\n\treturn messiness;\n}\n\n\n/*int GetAnswer(int n, int k)\n{\n\tint i;\n\tint p,q;\n\tint messiness = 0;\n\tint local_mess;\n\tint tmp;\n\n\tif(n == 1)\n\t\treturn 0;\n\n\tlocal_mess = find_messiness(n);\n\toperations++;\n\n\tif(operations % 10 == 0)\n\t\tprintf(\"Operations: %ld\\n\",operations);\n\n\tif(local_mess > messi_max)\n\t\tmessi_max = local_mess;\n\n\tif(k == 0)\n\t\treturn messi_max;\n\n\t// For each pair, check if its already messed up\n\t// If not ... make move\n\t// Make move: mess, reduce timer by 1\n\t// Bactrack\n\t// Unmake move\n\tfor(p = 0 ; p < n ; p++){\n\t\tfor(q = n - 1 ; q > p ; q--){\n\t\t\tif(shed[p] <= shed[q]){\n\t\t\t\t// Not messed up\n\t\t\t\ttmp = shed[q];\n\t\t\t\tshed[q] = shed[p];\n\t\t\t\tshed[p] = tmp;\n\t\t\t\tmessiness = GetAnswer(n,k-1);\n\t\t\t\t// Unmake move\n\t \ttmp = shed[q];\n\t\t\t shed[q] = shed[p];\n\t\t\t shed[p] = tmp;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn messi_max;\n}*/\n\nint GetAnswer(int n, int k)\n{\n\tint i;\n\tint local_mess = 0;\n\tint messiness = 0;\n\tint p,q;\n\tint tmp;\n\n\tif(n == 1)\n\t\treturn 0;\n\n\t// Swap maximally separated entities if it increases messiness\n\tfor(i = 0 ; i < k ; i++){\n\t\tfor(p = 0 ; p < n ; p++){\n\t\t\tfor(q = n - 1 ; q > p ; q--){\n\t\t\t\tif(shed[p] < shed[q]){\n\t\t\t\t\t// Swap and break\n\t\t\t\t\ttmp = shed[q];\n\t\t\t\t\tshed[q] = shed[p];\n\t\t\t\t\tshed[p] = tmp;\n\t\t\t\t\t//printf(\"i: %d ... messiness: %d\\n\",i+1,find_messiness(n));\n\t\t\t\t\tgoto RESULT;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nRESULT:\n p= 0 ;\n\t}\n\n\tmessiness = find_messiness(n);\n\n\treturn messiness;\n}\n\n\nint main()\n{\n\tint n, k;\n\tint answer = 0;\n\n\t/* handle the program options */\n\t//freopen(\"C:/Users/Subh/Desktop/Work/Coding/C_code/test43.txt\",\"rt\",stdin);\n\n\tscanf(\"%d %d\",&n,&k);\n\n\tinitialize(n);\n\tmessi_max = 0;\n\toperations = 0;\n\t//printf(\"Operations: %ld\\n\",operations);\n\t//printf(\"Messiness after initialization is %d\\n\",find_messiness(n));\n\n\t/* The code of your application goes here */\n\tanswer = GetAnswer(n, k);\n\n\tprintf(\"%d\\n\",answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0f31e8b2f88fe6664839249c2fbddace", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n\tchar a[51];int i,n,b=1,c=1;\n\tgets(a);\n\tn=strlen(a);\n\tfor(i=1;i\nint main()\n{\n\tint x, y, k =0, m;\n\tscanf(\"%d %d\",&x,&y);\n\tif ((2*x)%y == 0)\n\t\tk = k + (2*x)/y);\n\telse \n\t\tk = k + ((2*x)/y) + 1;\n\tif ((5*x)%y == 0)\n\t\tk = k + (5*x)/y);\n\telse \n\t\tk = k + ((5*x)/y) + 1;\n\tif ((8*x)%y == 0)\n\t\tk = k + (8*x)/y);\n\telse \n\t\tk = k + ((8*x)/y) + 1;\n\tprintf(\"%d\", k);\n\treturn 0;\n}\n\t\n\t\n\t\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bd89aeceacb5adefb01eadd770053e4b", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n register int n,k,r,blue,green,red;\n scanf(\"%d %d\",&n,&k);\n red=2*n;\n green=5*n;\n blue=8*n;\n r=red/k;\n if(red%k!=0)\n {\n r=r+1;\n }\n r=r+blue/k;\n if(blue%k!=0)\n {\n r=r+1;\n }\n r=r+green/k;\n if(green%k!=0)\n {\n r=r+1;\n }\n printf(\"%d\",r);\n \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8ddcbb29c8c15d8c7912bb63617d3b1f", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint x, y, k, z = 0;\n\tscanf(\"%d %d\",&x,&y);\n\tk = (15*x)/y;\n\tif k== 0;\n\t\tz = z + k;\n\telse \n\t\tz = z + (k+1);\n\tprintf(\"%d\",z);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "70479305474499e54bb12df13fad2b6c", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "\n\n\t#include \n\tint main()\n\t{\n\tint n,k,r,g,b,p=0;\n\tscanf(\"%d%d\",&n,&k);\n\tr=n*2;\n\tg=n*5;\n\tb=n*8;\n\tif(r%k!=0)\n\t{p=p+(r/k)+1;}\n\telse\n\tp=p+(r/k);\n\tif(g%k!=0)\n\t{p=p+(g/k)+1;}\n\telse\n\tp=p+(g/k);\n\tif(b%k!=0)\n\t{p=p+(b/k)+1;}\n\telse\n\tp=p+(b/k);\n\tprintf(\"%d\",t);\n\t}\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e54183d8eead3f49402d442d565b6b3", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint prime(int p){\n for(i=2;i<=(p/2);i++){\n if(p%i==0)\n return 1;//it is not prime \n }\n return 0;// it is prime\n}\n\nint main()\n{\n int n,m,a,j;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n\n a=prime(m);\n if(a==1)\n printf(\"NO\");\n else{\n for(j=n+1;j>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n N O T I C E !!! *** END OF WINTER QTR *** ACCOUNTS CLOSING ***\n ==============================================================\n Your ACMS account MAY be closing.\n\n For reasons accounts may be closed/suspended see:\n http://acms.ucsd.edu/students/account-status.shtml\n\n To lookup your ACMS account information see:\n https://sdacs.ucsd.edu/~icc/index.php\n ==============================================================\n\n 1) Dates for class specific accounts and storage directories\nAccount information for user: jil004\n Remaining allocation for jil004 was 301.00 units\n as of Fri Apr 29 06:55:16 2011\njil004 is connected to recharge printer (real-money) account: la046440\n la046440 balance: $1.70\n la046440 status is: active\n=============================================================\nFor details about your account resources, please use the\nAccount Lookup Tool on our website at http://acms.ucsd.edu\n=============================================================\n\n\nTo begin work for one of your courses [ cs120s cs100s ], type its name\nat the command prompt. (For example, \"cs120s\", without the quotes).\n\nTo see all available software packages, type \"prep -l\" at the command prompt,\nor \"prep -h\" for more options.\n[jil004@ieng6-201]:~:358$ ls\nCPP Notes.odt Desktop a.out jintan.c\nCSE11 ECE260b lab report final.odt cube.cpp~ net.ods\nCSE120 Lab1 report ECE260B.odt finalProject vistudy\nCreview Untitled 1.odt implement_lec1_lab-1.zip\n[jil004@ieng6-201]:~:359$ cd Creview/\n[jil004@ieng6-201]:Creview:360$ ls\na.out bubble.c nextPrime.c num1.c num1.c~\n[jil004@ieng6-201]:Creview:361$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:362$ ls\na.out bubble.c nextPrime.c num1.c num1.c~\n[jil004@ieng6-201]:Creview:363$ gcc nextPrime.c\n/tmp/ccMER0p9.o: In function `nextPrime':\nnextPrime.c:(.text+0xa5): undefined reference to `pringf'\ncollect2: ld returned 1 exit status\n[jil004@ieng6-201]:Creview:364$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:365$ gcc nextPrime.c\n\\[jil004@ieng6-201]:Creview:366$ ./a.out\nNO\nYES\n[jil004@ieng6-201]:Creview:367$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:368$ gcc nextPrime.c\nnextPrime.c: In function 'nextPrime':\nnextPrime.c:35: error: expected expression before 'else'\n[jil004@ieng6-201]:Creview:369$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:370$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:371$ ./a.out\nNO\n[jil004@ieng6-201]:Creview:372$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:373$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:374$ ./a.out\nNO\n[jil004@ieng6-201]:Creview:375$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:376$ gcc nextPrime.c\nnextPrime.c: In function 'nextPrime':\nnextPrime.c:17: error: expected expression before '=' token\n[jil004@ieng6-201]:Creview:377$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:378$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:379$ ./a.out\n[jil004@ieng6-201]:Creview:380$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:381$ ./a.out\n[jil004@ieng6-201]:Creview:382$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:383$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:384$ ./a.out\nYES\n[jil004@ieng6-201]:Creview:385$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:386$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:387$ ./a.out\nYES\n[jil004@ieng6-201]:Creview:388$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:389$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:390$ ./a.out\nYES\n[jil004@ieng6-201]:Creview:391$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:392$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:393$ ./a.out\nNO\n[jil004@ieng6-201]:Creview:394$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:395$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:396$ ./a.out\nNO\n[jil004@ieng6-201]:Creview:397$ vi nextPrime.c\n[jil004@ieng6-201]:Creview:398$ gcc nextPrime.c\n[jil004@ieng6-201]:Creview:399$ ./a.out\nYES\n[jil004@ieng6-201]:Creview:400$ vi nextPrime.c\n 4\n void nextPrime(int n, int m)\n {\n int numPrime = 0;\n int i = 0;\n int j = 0;\n int flag = 0;\n \n for(i = n+1; i <= m; 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 && i != m)\n {\n printf(\"NO\\n\");\n break;\n }\n }\n if(flag == 0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "67342dbb251a679bf525de594e279e57", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n #include \n\n void nextPrime(int n, int m)\n {\n int numPrime = 0;\n int i = 0;\n int j = 0;\n int flag = 0;\n\n for(i = n+1; i <= m; i++)\n {\n flag = 0;\n for(j = 2;( j * j) <= m; j++)\n {\n if((i%j)==0)\n {\n flag = 1;\n break;\n }\n }\n if((flag==0) &&( i != m))\n {\n printf(\"NO\\n\");\n return;\n }\n }\n if(flag == 0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "9e471acf13c25a2f1a68854ba5272302", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "include\n#include\nint main()\n{\n int a,b,i,c,j,m=0,n=0;\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++)\n { c=0;\n for(j=2;j\n#include\nint main()\n{\n int a,b,i,c,j,m=0;\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++)\n { c=0;\n for(j=2;j\nint main()\n{\n int n,i,o=0,e=0,s=0,s1,s2,f=-1;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i\n#include\n#include\n\n#define print(a) printf(\"%s = %lu\\n\",#a,a);\n\nunsigned long * arr_ptr,*arr;\nunsigned long sum = 0,tmp_sum = 0,sum_by_2,two_pow_n = 1;\nlong n;\n\n\n\nvoid distribute()\n{\n\tstatic unsigned long dead_end = 0;\n\tif( tmp_sum == sum_by_2 )\n\t{\n\t\tprintf(\"YES\");\n\t\texit(0) ;\n\t}\n\telse if( tmp_sum < sum_by_2 )\n\t{\n\t\tif( (arr_ptr - arr) >= n )\n\t\t{\n\t\t\tdead_end += 1;\n\t\t\tif( dead_end == two_pow_n )\n\t\t\t{\n\t\t\t\tprintf(\"NO\");\n\t\t\t\texit(0) ;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttmp_sum += *arr_ptr;\n\t\t\tarr_ptr += 1;\n\t\t\tdistribute();\n\t\t\tarr_ptr -= 1;\n\t\t\ttmp_sum -= *arr_ptr;\t\t\t\n\t\t\tarr_ptr += 1;\n\t\t\tdistribute();\n\t\t\tarr_ptr -= 1;\n\t\t\t\n\t\t}\n\t}\n\telse\n\t{\n\t\tdead_end += 1;\n\t\tif(dead_end == two_pow_n)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\texit(0) ;\n\t\t}\n\t}\n}\n\t\t\t\t\nint main()\n{\n \tlong iter,n200,n100;\n\tscanf(\"%lu\",&n);\n\tif( n < 2)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tarr_ptr = arr = (unsigned long*)malloc( n*sizeof(unsigned int) );\n\tmemset(arr,0,sizeof(unsigned)*n);\n\titer = n-1;\n\twhile ( iter > -1 )\n\t{\n\t\tscanf(\"%lu\",arr + iter);\n\t\tsum += arr[iter];\n\t\ttwo_pow_n *= 2;\n\t\titer -= 1;\n\t}\n\t\n\tif( sum % 200 != 0 || ( n%2==1 && n100==0 ) )\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\n\tif( /*sum already div by 200*/ n200%2==0 )\n\t{\n\t\tprintf\n\n\tsum_by_2 = sum / 2;\n\n\tdistribute();\n\n\tprintf(\"NO\");\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "625c018e7c6ef16fc9d18bdda27b66eb", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int n,x,i,s,sum=0;\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=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int j,k,l,o,p;\n for(j=1;j<=n;j++)\n {\n if(a[j]==100)\n k++;\n else\n l++;\n }\n if((k==l&&k>1)||k==2*l||{k%2==0 && k>0)||(l%2==0 && l>0))\n printf(\"YES\");\n else\n printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9fcc4d2d14bedc2582e5717b4f7e8cc4", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n \nint main(void) {\n // your code goes here\n int n,i,j,sum=0,k=0,l=0;\n scanf(\"%d\",&n);\n for(i=0;i=j){ \n k=k-j;\n i=i%200;\n else{\n i=i-k*200;\n k=0;\n }\n int p=i/100;\n if(l>=p) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "46f833cac7c00f6d280b3e5c7722a4ce", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nusing namespace std;\nint main()\n{\n long long a,b,s,ans;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n ans=abs(a)+abs(b);\n if(s>=ans&&((s%2)==(ans%2)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e2f9b367b337de8da46029df5cb6091e", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0} {"lang": "GNU C", "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\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c7b83937f38cfbcf4166bcd67a4547e8", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{int a,b,s;\nscanf(\"%d,%d,%d\",&a,&b,&s);\nif(a+b\n#include\n\nusing namespace std;\n\nint main()\n{\n\tlong long a, b, s;\n\tcin >> a >> b >> s;\n\tif (a + b > s)\n\t\tprintf(\"No\\n\");\n\telse\n\t{\n\t\tif ((s - a + b) % 2 == 0)\n\t\t\tprintf(\"Yes\\n\");\n\t\telse\n\t\t\tprintf(\"No\\n\");\n\t}\n\treturn 0;\n}\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "868b91b15196ed019466b59cd18afa6f", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "void isTrue(int a, int b, int s)\n{\n int diff = s - (a+b);\n if(diff >= 0 && diff%2==0)\n {\n print(\"yes\\n\");\n }\n else print(\"No\\n\");\n}\nint main()\n{\n int a,b,s;\n scanf(\"%d %d %d\\n\",a,b,s);\n isTrue(a,b,s);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd659448445b93dc231a6d10421c2949", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "4\n0 15 5 10#include \n\nint min(int a, int b){\n if(a > b)\n return b;\n else \n return a;\n}\nint max(int c, int d){\n if(c > d)\n return c;\n else \n return d;\n}\n\nint main(){\n int n, i, j, a[1000];\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < n - 1; i++){\n int x, y, f1 = 0, f2 = 0;\n x = min(a[i], a[i + 1]);\n y = max(a[i], a[i + 1]);\n for (j = i + 2; j < n; j++){\n if(a[j] < x || a[j] > y){\n f1 = 1;\n }\n else{\n f2 = 1;\n }\n }\n if(f1 == 1 && f2 == 1){\n printf(\"yes\\n\");\n return 0;\n }\n }\n printf(\"no\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e1eed8c485e97c9e7c2934e7cc822955", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,a[n];\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int j,k,l,o,p,q;\n if(n>3)\n {\n int m=3,t,u,x;\n for(i=2;ia[i-1] && a[i+1]a[i-1]) || (a[i]a[i] && a[i+1]=1;j--)\n {\n if(a[j]>a[i+1])\n q=a[j];\n if(a[j]a[k-1] && a[k]p)\n m++;\n else \n {u=1;\n printf(\"yes\");\n break;\n }\n }\n \n }\n else\n i++;\n if(a[i]-a[i-1]==1)\n x=1;\n if(x==1)\n printf(\"no\");\n if(t==1 && m==n)\n {\n printf(\"no\");\n break;\n }\n if(u==1)\n break;\n \n \n }\n if(i==n-1)\n printf(\"yes\");\n }\n else \n printf(\"no\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c871daa1076f2e6fc06854e3921ca2b3", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n long long int n,i,x=0,y=0,j;\n scanf(\"%lld\",&n);\n long long int a[n];\n for(i=0;ia[i]&&a[j]>a[i+1])||(a[j]\n#include\nint main()\n{\n long long int x,a[1000],i,b[1000],count=0;\n scanf(\"%lld\",&x);\n for(i=0;i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,a[n];\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int j,k,l,o,p,q;\n if(n>3)\n {\n int m=3,t,u,x;\n for(i=2;ia[i-1] && a[i+1]a[i-1]) || (a[i]a[i] && a[i+1]=1;j--)\n {\n if(a[j]>a[i+1])\n q=a[j];\n if(a[j]a[k-1] && a[k]p)\n m++;\n else \n {u=1;\n printf(\"yes\");\n break;\n }\n }\n \n }\n else if((a[i]>a[i-1] && a[i+1]a[i] && a[i+1]>a[i-1])){\n printf(\"yes\");\n break;\n \n else\n i++;\n \n if(t==1 && m==n)\n {\n printf(\"no\");\n break;\n }\n if(u==1)\n break;\n }\n if(i==n)\n printf(\"no\");\n }\n else \n printf(\"no\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5301dda0d5eb30c351816213ed11285", "src_uid": "f1b6b81ebd49f31428fe57913dfc604d", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nint min(int a,int b)\n{\n\treturn (a\n\nint main(){\n int n, i, a=0, b=0;\n scanf(\"%d\", &n);\n int arr[n];\n for(i=0;i\n#include\nint fmin(int a,int b)\n{\n\treturn (a\nint main(){\n\tint n,i,j,k,sum=0,min=720;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;i//abs\u4e3a\u6574\u5f62\uff0cfabs\u4e3afloat cf\u4e0d\u4e07\u80fd \n#include\nusing namespace std;\nint main()\n{\n\tint n,a[400];\n\tscanf(\"%d\",&n);\n\t\tint i,j1=0,j2=0;\n\t\tfor(i=0;i\n\nint main(void)\n{\n\tlong long T, S, q, start;\n\tdouble sr, loaded, track_pos;\n\t\n\tscanf(\"%lld %lld %lld\", &T, &S, &q);\n\tstart = 1;\n\ttrack_pos = 0;\n\tloaded = S;\n\twhile(loaded+0.000000000001 < T)\n\t{\n\t\tsr = loaded - track_pos;\n\t\ttrack_pos = loaded;\n\t\tloaded = loaded + sr*(q-1)/q;\n\t\tif(sr < 0.0000000000001)\n\t\t{\n\t\t\tstart++;\n\t\t\ttrack_pos = 0;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", start);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a225782807e3ca85cc09367f0ef07a35", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main ()\n{\n int t,z=0;\n double s,q,st;\n long double n;\n scanf(\"%d%lf%lf\",&t,&s,&q);\n q=(q-1)/q;\n while(s(1/8))\n {\n if(s-(int)s>0.9999)\n s=(int)s+1;\n if(s>=t)\n break;\n s=s+n;\n n=n*q;\n }\n z++;\n }\n printf(\"%d\\n\",z);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8360107e37106bbb351016136c1bd1f", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "//http://codeforces.com/contest/569/problem/A\n\n#include \n#include \n\nint main(void){\n int i,j;\n int speed;\n int dur,already;\n int meet;\n int time=0;\n scanf(\"%d %d %d\",&dur,&already,&speed);\n while(){\n time++;\n //remain=(dur-already)/(speed-1)*speed;//\ufffd\u0474X\ufffd\ufffdU\ufffd\ufffd\n meet=already*(speed/(speed-1));\n if(meet>dur){\n already=meet;\n }\n else {\n break;\n }\n }\n printf(\"%d\\n\",time);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b6cb4fab1a1127716fe7a84381d368db", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main() {\n int T,S,q,a,b,count=1;\n scanf(\"%d %d %d\",&T, &S, &q);\n T = T-S*q;\n while(T>0) {\n count++;\n S=S*q;\n T=T-S;\n }\n printf(\"%d\\n\",count);\nreturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "ec01dac7d2478df59e4fb83c94b10f6e", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tint T, S, q;\n\tint sum = 0;\n\t\tint n = 0;\n\tscanf(\"%d%d%d\", &T, &S, &q);\n\twhile (T > sum)\n\t{\n\n\t\tsum = S*q\n\t\tn++;\n\t\tS = sum;\n\t}\n\tprintf(\"%d\\n\", n);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2a0723ef16055450469b1e3e4eaf0e96", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\nint main()\n{\n\tlong long int n;\n \n cin >> n;\n if(n == 0)\n\t{\n \tcout << 1 << endl;\n }\n if(n % 4 == 1)cout << 8 << endl;\n else if(n % 4 == 2)cout << 4 << endl;\n else if(n % 4 == 3)cout << 2 << endl;\n else cout << 6 << endl;\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "32ae80a48ff89dc3bbf601722ac73176", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \nusing namespace std;\nint main()\n{\n int n,a,b,c,d;\n while(scanf(\"%d\",&n)!=EOF)\n {\n a=1;\n for(int i=0;i\nmain ()\n{\n long long int n, a, b;\n scanf(\"%I64d\", &n);\n a=n%4;\n if (a==0) printf(\"6\");\n else if (a==1) printf(\"8\");\n else if (a==2) printf(\"4\");\n else (a==3) printf(\"2\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9de7fb5e53f45c6a55b284a0fa443035", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c6f9020216ba3ef9d74726a275abadcc", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int j,k,l,m;\n for(j=1;j<=n;j+=4)\n {\n if(j==n)\n printf(\"8\");\n }\n for(k=2;k<=n;k+=4)\n {\n if(k==n)\n printf(\"4\");\n }\n for(l=3;l<=n;l+=4)\n {\n if(l==n)\n printf(\"2\");\n }\n for(m=4;m<=n;m+=4)\n {\n if(m==n)\n printf(\"6\");\n }\n if(n==0)\n printf(\"1\");", "lang_cluster": "C", "compilation_error": true, "code_uid": "0afbad42bfe197d0d724e243a6229fc8", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nint main() {\n\tchar a[51];\n\tscanf(\"%s\",a);\n\tint c=0;\n\t\n\tfor(int i=0;a[i] !='\\0';i++){\n\t if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'){\n\t c++;\n\t \t \n \n\t }\n\t else if(isdigit(a[i])&&(a[i]-'0')%2){\n\t c++;\n\t \n\t }\n\t }\n\t\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f0a81b4d4b7e480025ff7c748a1889d7", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0} {"lang": "GNU C11", "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\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 char *nexus;\n nexus= (char*)malloc(10);\n nexus={'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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e5a43105d52eab06b25ea59b0e2ff841", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0} {"lang": "GNU C", "source_code": "main.c", "lang_cluster": "C", "compilation_error": true, "code_uid": "d9cd7ed1b5a4265c2a10afae596050be", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,a,b=0;\n char na[51];\n scanf(\"%s\",&na);\n n=strlen(na);\n for(i=0;i\n#include \n\nint main()\n{\n long long int n,a,b,c,d,sol=0;\n scanf(\"%lld %lld %lld %lld %lld\",&n,&a,&b,&c,&d);\n for (long long int x=1; x<=n; x++)\n {\n long long int y=x+b-c;\n long long int z=x+a-d;\n long long int w=y+a-d;\n if (1<=y && y<=n && 1<=z && z<=n && 1<=w && w<=n) sol++;\n }\n long long int ans=sol*n;\n printf(\"%lld\",ans);\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9edecd9a24643a6bcce1737e78ce4316", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid union(int e,int f);\nint min,max;\nint main()\n{\t\nint e,f,n,a,b,c,d;\nscanf(\"%d %d %d %d %d\",&n,&a,&b,&c,&d);\nmin=1;max=n;\ne=c+1-b;f=n+c-b;\nunion(e,f);\nif(minf)\n{\nmax=f;\n}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3a846d435305a8c8e960470ddc6a2e9e", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n\nint main() \n{\n long long int n, a, b, c, d;\n scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&c,&d)\n\n long long int s = 0;\n long long int i;\n long long int x=0;\n long long int y=0;\n long long int z=0;\n for (i = 1; i <= n; i++) \n {\n x = i + b - c;\n y = i + a - d;\n z = a + y - d;\n if (1 <= x && x <= n && 1 <= y && y <= n && 1 <= z && z <= n) \n {\n s++;\n }\n }\n s=s*n;\n\n printf(\"%lld\",s);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "aac6d68fcedd1ce3cc28b35b31d72f06", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#define sqr(x) ((x)*(x))\nint mod(int x)\n{\n\tif(x>=0) return x;\n\telse return -x;\n}\nint max(int x,int y)\n{\n\tif (x>y) return x;\n\telse return y;\n}\nint res(int a, int b)\n{\n\treturn (a%b+b)%b;\n}\nint main ()\n{\n\tint n, a, b, c, d;\n\tlong long resp;\n\tscanf(\"%d %d %d %d %d\", &n, &a, &b, &c, &d);\n\tresp = max(max(mod(c-b), mod(c-b+d-a)), max(mod(d-a), mod(a+c-d-b));\n\tif(n-resp>0) printf(\"%lli\\n\", n*(n-resp));\n\telse printf(\"0\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d45ac8558a72744d4cc857458343c1e1", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid union(int e,int f);\nint min,max;\nint main()\n{\t\nint e,f,n,a,b,c,d;\nscanf(\"%d %d %d %d %d\",&n,&a,&b,&c,&d);\nmin=1;max=n;\ne=c+1-b;f=n+c-b;\nunion(e, f);\nif(minf)\n{\nmax=f;\n}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "902ccf57819b1ee1ea5dfe3b8c8ef7e7", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int a,b,j,n,x,k,i,nb[101];\n scanf(\"%d %d\",&n,&k);\n for (j=0;j\n\nint main(void){\n\n int n = 1;\n int k=4;\n\n int size[100];\n size[0]=2;\n size[1]=2;\n size[2]=2;\n size[3]=2;\n\n int fourrow = n;\n int tworow = 2*n;\n int onerow = 0;\n\n for(int i=0;i=4 && fourrow>0){\n size[i]=size[i]-4;\n fourrow=fourrow-1;\n }\n }\n\n for(int i=0;i0){\n size[i]=0;\n fourrow=fourrow-1;\n }\n }\n\n if(fourrow==0){\n for(int i=0;i0){\n size[i]=size[i]-2;\n tworow=tworow-1;\n }\n }\n if(tworow>=0){\n printf(\"YES\");\n return 0;\n } else {\n printf(\"NO\");\n return 0;\n }\n }\n\n if(fourrow>0){\n for(int i=0;i0){\n size[i]=0;\n fourrow=fourrow-1;\n onerow++;\n }\n }\n\n if(fourrow>0){\n for(int i=0;i0){\n size[i]=0;\n fourrow=fourrow-1;\n onerow++;\n }\n }\n\n for(int i=0;i0){\n onerow=onerow-1;\n size[i]=0;\n }\n }\n\n for(int i=0;i=0){\n printf(\"YES\");\n return 0;\n } else {\n printf(\"NO\");\n return 0;\n }\n }\n\n for(int i=0; i0){\n size[i]=0;\n tworow=tworow-1;\n }\n\n if(tworow==0){\n for(int i=0;i0){\n size[i]=0;\n onerow=onerow-size[i];\n }\n }\n if(onerow>=0){\n printf(\"YES\");\n return 0;\n } else {\n printf(\"NO\");\n return 0;\n }\n }\n\n for(int i=0;i0){\n size[i]=0;\n onerow=onerow-1;\n } else{\n size[i]=0;\n tworow=tworow-1;\n }\n }\n }\n\n if(tworow>=0){\n printf(\"YES\");\n return 0;\n } else {\n printf(\"NO\");\n return 0;\n }\n }\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "72f640337f4e20440d2c92cc71b010e6", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0} {"lang": "GNU C", "source_code": " #include \n #include \n #include \n #include \n using namespace std; \n int main() \n { \n int n,k; \n scanf(\"%d%d\",&n,&k); \n int ans1=0,ans2=0,ans4=0,a; \n while(k--) \n { \n scanf(\"%d\",&a); \n if(a>=4) \n { \n ans4+=a/4; \n a=a-a/4*4; \n } \n if(a>=2) \n { \n ans2++; \n a-=2; \n } \n if(a) ans1++; \n } \n int x=n*8-ans4*4-ans1*2-ans2*2; \n if(x>=0&&ans4+ans1>=n-x) \n printf(\"YES\\n\"); \n else \n printf(\"NO\\n\"); \n } ", "lang_cluster": "C", "compilation_error": true, "code_uid": "c327dbfa3529369783c37ca6e9e30eff", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint sum, n, k, i, temp, flag = 0;\n\tint four_set, two_set, one_set;\n\tscanf_s(\"%d %d\", &n, &k);\n\tsum = 0;\n\tfour_set = n;\n\ttwo_set = 2 * n;\n\tone_set = 0;\n\tfor (i = 0; i < k; i++) {\n\t\tscanf_s(\"%d\", &temp);\n\t\tif (temp >= 3) {\n\t\t\tif (temp <= four_set * 4) {\n\t\t\t\tfour_set -= temp / 4;\n\t\t\t\ttemp = temp % 4;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttemp -= four_set * 4;\n\t\t\t\tfour_set = 0;\n\t\t\t\tif (temp <= two_set * 2) {\n\t\t\t\t\ttwo_set -= temp / 2;\n\t\t\t\t\ttemp = temp % 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttemp -= two_set * 2;\n\t\t\t\t\ttwo_set = 0;\n\t\t\t\t\tif (temp <= one_set) {\n\t\t\t\t\t\tone_set -= temp;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\telse {\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}\n\t\tif (temp == 1) {\n\t\t\tif (one_set > 0)\n\t\t\t\tone_set--;\n\t\t\telse if (two_set > 0)\n\t\t\t\ttwo_set--;\n\t\t\telse if (four_set > 0) {\n\t\t\t\tfour_set--;\n\t\t\t\ttwo_set++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (temp == 2) {\n\t\t\tif (one_set > 1)\n\t\t\t\tone_set -= 2;\n\t\t\telse if (two_set > 0)\n\t\t\t\ttwo_set--;\n\t\t\telse if (four_set > 0) {\n\t\t\t\tfour_set--;\n\t\t\t\tone_set++;\n\t\t\t}\n\t\t}\n\t\tif (temp == 3) {\n\t\t\tif (one_set > 2)\n\t\t\t\tone_set -= 3;\n\t\t\telse if (four_set > 0)\n\t\t\t\tfour_set--;\n\t\t\telse if (two_set > 1)\n\t\t\t\ttwo_set -= 2;\n\t\t\telse {\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\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "34a1e7d725514509aee1c8c228f84586", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \"header.h\"\n#define min(a,b) ((a)>(b))?(b):(a)\nint a[101];\nint main(void)\n{\n\tint n, k;\n\tscanf(\"%d%d\", &n, &k);\n\tint i = 0;\n\twhile (i < k) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tint fouralined = n;\n\tint twoalined = n * 2;\n\tfor (i = 0; i < k; i++) {\n\t\tint putin = min(fouralined,a[i]/4);\n\t\tfouralined -= putin;\n\t\ta[i] -= putin;\n\t}\n\ttwoalined += fouralined;\n\tfor (i = 0; i < k; i++) {\n\t\tint putin = min(twoalined, a[i] / 2);\n\t\ttwoalined -= putin;\n\t\ta[i] -= putin;\n\t}\n\tint onealined = twoalined + fouralined;\n\tfor (i = 0; i < k; i++) {\n\t\tonealined -= a[i];\n\t}\n\tif (onealined >= 0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1550d8439278199de362e5ab5cb17604", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0} {"lang": "GNU C", "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} A\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "294f759f2fd8ce6c6c9777245d7cee7f", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "19ddd152bee3f01442a7b627e5f98dd1", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0} {"lang": "GNU C", "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\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]) || ('E'==str[i]) || ('I'==str[i]) || ('O'==str[i]) || ('U'==str[i]) || ('Y'==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", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7378693e6f6df207a97af7c7666d92a", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "61e2806377dac003d23f7ecb1b813d96", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nchar s[10][10];\nint n, k, b[10], p[10];\n\nint d = 1000000;\n\nvoid gen(int i) {\n\tif (i == k) {\n\t\tint j, m = -1, mm = -1;\n\t\tfor (j = 0; j < n; j++) {\n\t\t\tchar ss[10];\n\t\t\tint ii;\n\t\t\tfor (ii = 0; ii < k; ii++)\n\t\t\t\tss[ii] = s[j][p[ii]];\n\t\t\tss[k] = '\\0';\n\n\t\t\tint a;\n\t\t\tsscanf(ss, \"%d\", &a);\n\t\t\tif (m == -1 || a < m)\n\t\t\t\tm = a;\n\t\t\tif (mm == -1 || a > mm)\n\t\t\t\tmm = a;\n\t\t}\n\n\t\tif (mm - m < d)\n\t\t\td = mm - m;\n\n\t\treturn;\n\t}\n\n\tint j;\n\tfor (j = 0; j < k; j++)\n\t\tif (!b[j]) {\n\t\t\tb[j] = 1;\n\t\t\tp[i] = j;\n\t\t\tgen(i + 1);\n\t\t\tb[j] = 0;\n\t\t}\n}\n\nint main() {\n\tscanf(\"%d%d\\n\", &n, &k);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t\tgets(s[i]);\n\n\tmemset(b, 0, sizeof(b));\n\tgen(0);\n\n\tprintf(\"%d\\n\", d);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e52ae744f683ca32cd10445a3df98422", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint N, K, /*max=-1, min=100000000,*/ M=100000000;\nchar A[12][12];\n\nvoid check(){\n int i, max=-1, min=100000000;\n for(i=0; imax)\n max=atoi(A[i]);\n else if(atoi(A[i])=K){\n check();\n return;\n }\n\n int i;\n for(i=x; i\n#define maxn 10\nlong a[maxn],b[maxn];\nlong c[maxn][maxn];\nint z[maxn],fr[maxn];\nlong mu[8]={0,10,100,1000,10000,100000,1000000,1000000};\nint n,m;\nlong res;\nvoid read()\n{\n int i;\n scanf(\"%d %d\",&m,&n);\n for (i=1;i<=m;i++)\n scanf(\"%ld\",&a[i]);\n}\nvoid init()\n{\n long i,j,x;\n res=1000000000;\n for (i=1;i<=n;i++) fr[i]=1;\n for (i=1;i<=m;i++)\n {\n x=a[i];\n for (j=1;j<=n;j++)\n {\n c[i][j]=x%10;\n x/=10;\n }\n }\n}\nvoid up()\n{\n long i,j,x,tmp;\n for (i=1;i<=m;i++)\n {\n tmp=0;\n for (j=1;j<=n;j++)\n tmp+=c[i][j]*mu[z[j]-1];\n b[i]=tmp;\n }\n //for (i=1;i<=n;i++) printf(\"%ld\\n\",b[i]); printf(\"\\n\");\n for (i=1;i\n#include\n#define SWAP(x,y) { int tmp=x;\tx=y;\ty=tmp; }\nchar num[8][9];\nchar C[8][9];\nint S[8];\nint findMax(int n,int k){\n\tint ans=-1;\n\tfor(int i=0;itmp )\n\t\t\tans=tmp;\n\t}\n\treturn ans;\n}\nint main(){\n\tint n,k;\n\twhile( scanf(\"%d%d\",&n,&k)==2 ){\n\t\tint ans=2e9;\n\t\tfor(int i=0;imax-min )\n\t\t\tans=max-min;\n\t\twhile( true ){\n\t\t\tint i,j;\n\t\t\tfor(i=k-2;i>=0&&S[i]>S[i+1];i--);\n\t\t\tif( i<0 )\n\t\t\t\tbreak;\n\t\t\tfor(j=k-1;j>i&&S[i]>S[j];j--);\n\t\t\tSWAP(S[i],S[j]);\n\t\t\tfor(i++,j=k-1;imax-min )\n\t\t\t\tans=max-min;\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f20edcec32bfa27c145faf947f20fb2", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define maxn 10\nlong a[maxn],b[maxn];\nlong c[maxn][maxn];\nint z[maxn],fr[maxn];\nlong mu[8]={0,10,100,1000,10000,100000,1000000,1000000};\nint n,m;\nlong res;\nvoid read()\n{\n int i;\n scanf(\"%d %d\",&m,&n);\n for (i=1;i<=m;i++)\n scanf(\"%ld\",&a[i]);\n}\nvoid init()\n{\n long i,j,x;\n res=1000000000;\n for (i=1;i<=n;i++) fr[i]=1;\n for (i=1;i<=m;i++)\n {\n x=a[i];\n for (j=1;j<=n;j++)\n {\n c[i][j]=x%10;\n x/=10;\n }\n }\n}\nvoid up()\n{\n long i,j,x,tmp;\n for (i=1;i<=m;i++)\n {\n tmp=0;\n for (j=1;j<=n;j++)\n tmp+=c[i][j]*mu[z[j]-1];\n b[i]=tmp;\n }\n //for (i=1;i<=n;i++) printf(\"%ld\\n\",b[i]); printf(\"\\n\");\n for (i=1;i\nint main()\n{\n long long n;\n scanf(\"%I64d\",&n);\n for (long long i=2;i*i<=n;i++)\n {\n while(n%(i*i)==0)\n n/=i;\n }\n printf(\"%I64d\\n\",n);\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "4efcee55d95ba5f9821964ae5b27de9d", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\nlong long n,i;\nscanf(\"%lld\",&n)\nfor( i=1000000;i>1;i--)\nwhile(n%(i*i)==0)\nn=n/i;\nprintf(\"%d\",n);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c9a68876f480fca4a5e149bafe2326d6", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \nmain()\n{\n\tint n,i,j,k,a=0;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tk=ceil((sqrt(i*1.0));\n\t\t\tfor(j=1;j<=k;j++)\n\t\t\t{\n\t\t\t\tif(i%(j*j)!=0)\n\t\t\t\ta=a+1;\n\t\t\t\tif(a==k)\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "851bf6ab8189f6f8a2f30736a1fbac64", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint facto(int n);\nint check(int n);\n\nint main(void)\n{\n int n;\n \n scanf(\"%d\", &n);\n \n n = facto(n);\n \n printf(\"%d\\n\", n);\n \n return 0;\n}\n\nint facto(int n)\n{\n int *p, count = 1, temp;\n \n p = (int *)malloc(sizeof(int)*count*2);\n p[0] = 1;\n p[1] = n;\n \n for(int i = 2 ; i < sqrt(n); i++)\n {\n if(n%i == 0)\n {\n p = (int *)realloc(p, sizeof(int)*(++count)*2);\n p[count*2-2] = i;\n p[count*2-1] = n/i;\n }\n }\n \n for(int i = 0 ; i < 2*count - 1; i++)\n {\n for(int j = i + 1 ; j < 2*count ; j++)\n {\n if(p[i] > p[j])\n {\n temp = p[i];\n p[i] = p[j];\n p[j] = temp;\n }\n \n }\n }\n \n for(int i = count*2 - 1 ; i != 0; i--)\n {\n if(check(p[i]))\n return p[i];\n }\n \n return 1;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b04f1cc430d07a921bcf66cafdb3f5df", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n long long n,s=1;\n scanf(\"%lld\",&n);\n for(int i=2;i<=sqrt(n);++i){\n if(n%i==0){\n s*=i;\n while(n%i==0)n/=i;\n }\n if(n==1)break;\n }\n printf(\"%lld\",s*n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "52a4df793bbc651bab9e0c27525df722", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\nchar s[50],t[50];\nint l,k=0,i;\ngets(s);\ngets(t);\nl=strlen(t);\nfor(i=0;i\n#include \n#include \nint main()\n{\n char s[51];\n char t[51];\n int i,nbr=0;\n gets(s);\n fflush(stdin);\n gets(t);\n for(i=0;i\n#include\nusing namespace std;\n\nint main()\n{\n //string s,t;\n char s[50],t[50];\n int c=0;\n scanf(\"%s%s\",s,t);\n for(int i=0,j=0;j\n#include\nint main()\n{\n char a[50], b[50];\n int len, i, j;\n scanf(\"%s\", &a);\n scanf(\"%s\", &b);\n len = strlen(b);\n for(i=0, j=0; i\n#include\n#include\n#include\n#include\nusing namespace std;\nlong long LL(long long x,long long n)\n{\n\tlong long res;\n\twhile(n)\n\t{\n\t\tif(n&1)\n\t\t\tres = res*x;\n\t\tx = x*x;\n\t\tn>>=1;\n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long n, v;\n\twhile(scanf(\"%lld%lld\", &n, &v)!=EOF)\n\t{\n\t\tchar buy[45][20];\n\t\tint i, j;\n\t\tfor(i = 0; i< n;i++)\n\t\t\tscanf(\"%s\", buy[i]);\n\t\tdouble sum1 = 0.5, sum2 = 1,temp=1;\n\t\tfor(i = n-2;i>=0;i--)\n\t\t{\n\t\t\tif(strcmp(buy[i], \"halfplus\")==0)\n\t\t\t{\n\t\t\t\ttemp*=2;\n\t\t\t\tsum1 += sum2 + 0.5;\n\t\t\t\tsum2+=temp;\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\tif(strcmp(buy[i], \"half\")==0)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tsum1 += sum2;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tlong long z = sum1*v;\n\t\tcout<\n#include\nusing namespace std;\nint n,p,ans,tot;\nstring a[45];\nint main() {\n\tscanf(\"%d%d\",&n,&p);\n\tfor(int i=1; i<=n; i++)cin>>a[i];\n\tfor(int i=n; i>=1; i--) {\n\t\tif(a[i]==\"halfplus\")tot=tot*2+1,ans+=tot*p/2;\n\t\telse tot*=2,ans+=tot*p/2;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5a341d2e50ba23c0fb406d4b0d2d96c4", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\nint main()\n{\n\t__int64 n, v;\n\twhile(scanf(\"%I64d%I64d\", &n, &v)!=EOF)\n\t{\n\t\tchar buy[45][20];\n\t\tint i, j;\n\t\tfor(i = 0; i< n;i++)\n\t\t\tscanf(\"%s\", buy[i]);\n\t\tdouble sum1 = 0.5, sum2 = 1,temp=1;\n\t\tfor(i = n-2;i>=0;i--)\n\t\t{\n\t\t\tif(strcmp(buy[i], \"halfplus\")==0)\n\t\t\t{\n\t\t\t\ttemp*=2;\n\t\t\t\tsum1 += sum2 + 0.5;\n\t\t\t\tsum2+=temp;\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\tif(strcmp(buy[i], \"half\")==0)\n\t\t\t{\t\n\t\t\t\tsum1 += sum2;\n\n\t\t\t}\n\t\t}\n\t\t__int64 z = sum1*v;\n\t\tprintf(\"%I64d\\n\", z);\n\t\t\t\n\n\n\t}\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3b4bb8d10830fa61f3c3d6616e1cfd4c", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tllong long int n,p,i,l=0,s;\n\tscanf(\"%lld %lld\",&n,&p);\n\tchar str[40][9];\n\tfor (i=0;i=0;i--){\n\t\tif (strcmp(str[i],\"halfplus\")==0){\n\t\t\ts=2*s+1;\n\t\t}\n\t\telse if (strcmp(str[i],\"half\")==0){\n\t\t\ts=2*s;\n\t\t}\n\t}\n\tprintf(\"%lld\",s*p-l*(p/2));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3b0e3ef0ef499a2dbdab97adf1d1041d", "src_uid": "6330891dd05bb70241e2a052f5bf5a58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n int n, p;\n scanf(\"%d %d\\n\",&n,&p);\n long long int a=0, ans=0;\n char s[10];\n bool z[40];\n for (int i=0; i\n#include\nint main()\n{\n char c[2];\n int n;\n scanf(\"%c %c\", &c[0],&c[1]);\n\n if((c[0]==v&&c[1]==<)||(c[0]==<&&c[1]==^)||(c[0]==^&&c[1]==>)||(c[0]c==>&&c[1]==v0)\n {if(n%4==1){\n printf(\"cw\");\n }\n else{\n printf(\"ccw\");\n }}\n\n if((c[0]==v&&c[1]==>)||(c[0]==<&&c[1]==v)||(c[0]==^&&c[1]<)||(c[0]==>&&c[1]==^0){\n if(n%4==3){\n printf(\"cw\");\n }\n else{\n printf(\"cww\");\n }\n }\n if((c[0]==v&&c[1]==^)||(c[0]==<&&c[1]==>)||(c[0]==>&&c[1]==<){\n printf(\"undefined\");\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4a9f80d17cf3b73924b498ee38481f46", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char c[2];\n int n;\n scanf(\"%d\", &n);\n scanf(\"%c %c\", &c[0],&c[1]);\n\n if((c[0]=='v'&&c[1]=='<'')||(c[0]=='<'&&c[1]=='^'')||(c[0]=='^'&&c[1]=='>'')||(c[0]=='>'&&c[1]=='v')\n {if(n%4==1){\n printf(\"cw\");\n }\n else{\n printf(\"ccw\");\n }}\n\n if((c[0]=='v'&&c[1]=='>'')||(c[0]=='<'&&c[1]=='v')||(c[0]=='^'&&c[1]=='<'')||(c[0]=='>'&&c[1]=='^')){\n if(n%4==3){\n printf(\"cw\");\n }\n else{\n printf(\"cww\");\n }\n }\n if((c[0]=='v'&&c[1]=='^'')||(c[0]=='<'&&c[1]=='>'')||(c[0]=='>'&&c[1]=='<')){\n printf(\"undefined\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dc1b11f44dc928d03fe5671bf20dcdb0", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n, i, y;\n int j, k, m, l, f;\n char a, b;\n y=n%4;\n scanf(\"%c %c\", &a, &b);\n scanf(\"%d\",&n);\n j=int(a);\n m=int(a);\n k=int(b);\n for(i=0;i\n\nint main()\n{\n char s[]={'^','>','v','<'},c,t;\n int n,p,q;\n scanf(\"%c %c %d\",&c,&t,&n);\n n%=4;\n if(n==2 || n==0)\n return printf(\"undefined\"),0;\n for(int i=0;i<4;i++)\n if(s[i]==c)\n p=i;\n else if(s[i]==t)\n q=i;\n if((p+n)%4==q)\n printf(\"cw\");return 0;\n else printf(\"ccw\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "35328a7a3a707eb8bfef2c92a60f84bf", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char c[2];\n int n;\n scanf(\"%c %c\", &c,&c);\n\n if(cc==v<||c==<^||cc==^>||cc==>v)\n {if(n%4==1){\n printf(\"cw\");\n }\n else{\n printf(\"ccw\");\n }}\n\n if(cc==v>||cc==^){\n if(n%4==3){\n printf(\"cw\");\n }\n else{\n printf(\"cww\");\n }\n }\n if(cc==v^||cc==<>||cc==><){\n printf(\"undefined\");\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7f2a04a379a579643acf0ed2e0188225", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,m,i,j,is=0,yes=0;\n char str[100][100],str1[10];\n scanf(\"%d%d\",&n,&m);\n\n for(i=0;i\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 n,m;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(int i=0;i\nint main()\n{\n int flag;\n int i,j,n,m;\n char mp[105][105];\n \n scanf(\"%d%d\",&n,&m);\n \n flag=0;\n \n for(i=0;i\n\nint main()\n{\n\tint a1, a2, k1, k2, b;\n\tint ans1, ans2;\n\tscanf_s(\"%d%d%d%d%d\", &a1, &a2, &k1, &k2, &b);\n\tint nums = a1 * (k1 - 1) + a2 * (k2 - 1);\n\tans1 = b - nums;\n\tif (ans1 <= 0) {\n\t\tans1 = 0;\n\t}\n\tif (k1 > k2) {\n\t\tint nums2 = b / k2;\n\t\tif (nums2 > a2) {\n\t\t\tint nums3 = (b - (k2) * a2) / k1;\n\t\t\tans2 = a2 + nums3;\n\t\t}\n\t\telse {\n\t\t\tans2 = nums2;\n\t\t}\n\t}\n\telse {\n\t\tint nums2 = b / (k1);\n\t\tif (nums2 > a1) {\n\t\t\tint nums3 = (b - a1 * (k1)) / (k2);\n\t\t\tans2 = a1 + nums3;\n\t\t}\n\t\telse {\n\t\t\tans2 = nums2;\n\t\t}\n\t}\n\tprintf(\"%d %d\\n\", ans1, ans2);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "80ae9c1b64633f99970ddf382b11d3c1", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "main(a1, a2, k1, k2, n, m, t) {\n a = 0;\n\tscanf(\"%d%d%d%d%d\", &a1, &a2, &k1, &k2, &n);\n\tm = n - a1 * (k1 - 1) - a2 * (k2 - 1);\n\tm = m < k1 + k2 ? m : k1 + k2;\n\tif (k1 > k2) {\n\t\tt = k1, k1 = k2, k2 = t;\n\t\tt = a1, a1 = a2, a2 = t;\n\t}\n\ta += n / k1 < a1 ? n / k1 : a1;\n\tn -= a * k1;\n\ta += n / k2 < a2 ? n / k2 : a2;\n\tprintf(\"%d %d\", m, a);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b57d9de7e752aee94c65d09c7cca285", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a1,a2,k1,k2,x1,x2,n,min,max;\n scanf(\"%d%d%d%d%d\",&a1,&a2,&k1,&k2,&n);\n min=(a1*\uff08k1-1)+a2*(k2-1)>=n)?0:n-a1*(k1-1)-a2*(k2-1);\n if(k1\nint main(){\n\tint a1,a2,k1,k2,n;\n\tscanf(\"%d%d%d%d%d\",&a1,&a2,&k1,&k2,&n);\n\tint min_players=0;\n int max_players=0;\n int larger_cards,lower_cards,lower_team,larger_team;\n if(k1>=k2){larger_cards=k1; larger_team=a1; lower_cards=k2; lower_team=a2;}\n else{lower_cards=k1; lower_team=a1; larger_cards=k2; larger_team=a2;}\n\n if(n>(a1*(k1-1)+a2*(k2-2)))\n {min_players=n-(a1*(k1-1)+a2*(k2-1));}\n printf(\"%d \",min_players);\n while(n>=lower_cards)\n {\n \tif(lower_team>0)\n \t{n=n-lower_cards;\n \tmax_players++;\n \tlower_team--;\n \t}\n \telse if((larger_team>0)&&(n>=larger_cards))\n \t {\n \t\tn=n-larger_cards;\n \t\tmax_players++;\n \t\tlarger_team--;\n \t }\n\n }\n printf(\"%d\",max_players);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1121d685d9fbd8af47bb48a6e34c7801", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n\n int a1,a2,k1,k2,n;\nwhile(1){\n scanf(\"%d\",&a1);\n scanf(\"%d\",&a2);\n scanf(\"%d\",&k1);\n scanf(\"%d\",&k2);\n scanf(\"%d\",&n);\n\n int max,min;\n\n if(k1=a1*k1)\n max = a1+(n-a1*k1)/k2;\n\n else\n max = n/k1;\n }\n\n else if(k2=a2*k2)\n max = a2+(n-a2*k2)/k1;\n else\n max = n/k2;\n }\n\n else{\n if(a1>a2){\n if(n>=a1*k1)\n max = a1+(n-a1*k1)/k2;\n\n else\n max = n/k1;\n }\n else{\n if(n>=a2*k2)\n max = a2+(n-a2*k2)/k1;\n else\n max = n/k2;\n }\n }\n\n min = n-a1*(k1-1)-a2*(k2-1);\n if(min<0)\n min = 0;\n\n printf(\"%d %d\\n\",min,max);\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "64e8bd45c0a3d4347db3a33f688e8186", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int t,i,sum=1;\n long long int a,b,j,num1,num2;\n scanf(\"%d\",&t);\n for(i=0;i\n#include\n#include\n#define ll long long\n\nlong long mulmod(long long a, long long b, long long mod)\n{\n long long x = 0,y = a % mod;\n while (b > 0)\n {\n if (b % 2 == 1)\n {\n x = (x + y) % mod;\n }\n y = (y * 2) % mod;\n b /= 2;\n }\n return x % mod;\n}\n\nll modulo(ll b,ll p,ll m)\n{\n if(p==0)return 1;\n if(p%2==1)\n {\n return ((b%m)*(modulo(b,p-1,m))%m)%m;\n }\n ll x=modulo(b,p/2,m)%m;\n x=mulmod(x,x,m);\n return x;\n}\n\nbool millertest(ll d,ll n)\n{\n //srand(time(NULL));\n ll a=2+rand()%(n-4);\n ll x=modulo(a,d,n);\n if(x==1 || x==n-1)\n return true;\n while(d!=n-1)\n {\n x=mulmod(x,x,n);\n d<<=1;\n if(x==1)return false;\n if(x==n-1)return true;\n }\n return false;\n}\n\nbool isprime(ll n)\n{\n if(n==2)return true;\n if(n==1 || (n&1)==0)return false;\n ll d=n-1;\n //prllf(\"%d\",d&1);\n while((d&1)==0)\n d>>=1;\n for(int i=0;i<4;i++)\n if(!millertest(d,n))\n return false;\n return true;\n}\nmain()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n ll a,b;\n scanf(\"%lld %lld\",&a,&b);\n ll x=a-b;\n x=(a+b);\n //printf(\"%lld \",x);\n bool ans=isprime(x);\n printf(\"%s\\n\",ans&&(a-b)==1a?\"YES\":\"NO\");\n }\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b37661a47120ee1878b4f45e098fa1a3", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int t,i,sum=0;\n long long int a,b,j,num1,num2;\n scanf(\"%d\",&t);\n for(i=0;i\n\nint main() {\n long long int n , a, b ,x, t , y;\n scanf(\"%I64d\", &t);\n while(t--){\n scanf(\"%I64d%I64d\",&a , &b);\n x = (a * a) - (b * b);\n if(x % 2 == 0) {\n printf(\"NO\\n\");\n return 0;\n }\n else {\n for(i = 3 ; i < x ; i += 2) {\n if(x % i == 0) {\n printf(\"NO\\n\");\n }\n }\n printf(\"YES\\n\");\n \n }\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "947e9d31c33a615936908bcd0427bee8", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#define ll long long\n\nlong long mulmod(long long a, long long b, long long mod)\n{\n long long x = 0,y = a % mod;\n while (b > 0)\n {\n if (b % 2 == 1)\n {\n x = (x + y) % mod;\n }\n y = (y * 2) % mod;\n b /= 2;\n }\n return x % mod;\n}\n\nll pow(ll b,ll p,ll m)\n{\n if(p==0)return 1;\n if(p%2==1)\n {\n return ((b%m)*(pow(b,p-1,m))%m)%m;\n }\n ll x=pow(b,p/2,m)%m;\n x=mulmod(x,x,m);\n return x;\n}\n\nbool millertest(ll d,ll n)\n{\n srand(time(NULL));\n ll a=2+rand()%(n-4);\n ll x=pow(a,d,n);\n if(x==1 || x==n-1)\n return true;\n while(d!=n-1)\n {\n x=mulmod(x,x,n);\n d<<=1;\n if(x==1)return false;\n if(x==n-1)return true;\n }\n return false;\n}\n\nbool isprime(ll n)\n{\n if(n==2)return true;\n if(n==1 || (n&1)==0)return false;\n ll d=n-1;\n //prllf(\"%d\",d&1);\n while((d&1)==0)\n d>>=1;\n for(int i=0;i<4;i++)\n if(!millertest(d,n))\n return false;\n return true;\n}\nmain()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n ll a,b;\n scanf(\"%lld %lld\",&a,&b);\n ll x=a-b;\n x=(a+b);\n //printf(\"%lld \",x);\n bool ans=isprime(x);\n printf(\"%s\\n\",ans&&(a-b)==1a?\"YES\":\"NO\");\n }\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c4bcf2abd8c1de9df00431501ba1100", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "difficulty": 1100.0} {"lang": "GNU C", "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\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ca7fd525f4e2378d60c2fcafc9a2af1e", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0} {"lang": "GNU C", "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\nint main(){\n\tint n,i,a=0,b=0,c=0,d=0,sum=0;\n\tchar s[110];\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tfor(i=0;ib) sum+=2*b;\n\t\telse sum+=2*a;\n\t\tif(c>d) sum+=2*d;\n\t\telse sum+=2*c;\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "bd50083d3274a2720b3f63fbeb65f8ce", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "689b769096103b8f9cbac5cc0548506c", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include\nint main(void) {\n\tchar arr1[101],arr2[101];\n\tscanf(\"%s\",arr1);scanf(\"%s\",arr2);\n\tint i=0,cnt=0,count=0;\n\tfor(;arr1[i]!='\\0';i++){\n\t\t\n\t\t}\n\tfor(i--;i!=0;i--){\n\t\t\tif (arr2[i]>97){arr2[i]--;cnt=1;if (strcmp(arr1,arr2)>=0){cnt=0;arr2[i]++;continue;}break;}\n\t}\n\t\n\t}\n\tif(cnt==0)printf(\"No such string\");else printf(\"%s\",arr1);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2f58b46bf17a69bcacc5431b377c1745", "src_uid": "47618510d2a17b1cc1e6a688201d51a3", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint test(char a[],char b[],int *found){\n int i,j,k;\n if (strcmp(a,b)==-1){\n for (i=strlen(a)-1;i>=0;i--){\n if (a[i]=='z')\n continue;\n a[i]+=1;\n a[strlen(a)]='\\0';\n if (strcmp(a,b)==-1){\n *found=1;\n return *found;\n }\n else if (strcmp(a,b)!=-1 && i1){\n output[i]=a[i]+1;\n found=1;\n break;\n \n }\n }*/\n //output[strlen(a)]='\\0';\n /*printf(\"%s\\n\\n\",a);*/\n if (found)\n printf(\"%s\",a);\n else\n printf(\"No such string\");\n\n\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "965ef8a12d5e063f7ccd32b9493f910c", "src_uid": "47618510d2a17b1cc1e6a688201d51a3", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nchar s[101], t[101];\nint main(){\n int i, len, flag = 0;\n\n scanf(\"%s\", s);\n scanf(\"%s\", t);\n\n len = strlen(s);\n for(i = 0; i < len; i++){\n if(t[i] - s[i] == 0 || t[i] - s[i] == 1) flag = 1;\n else{\n flag = 0;\n break;\n }\n }\n\n if(flag == 1) printf(\"No such string\");\n else{\n for(i = 0; i < len; i++){\n if(t[i] - s[i] == 0 || t[i] - s[i == 1) printf(\"%c\", s[i]);\n else printf(\"%c\", s[i] + 1);\n }\n }\n printf(\"\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "110cda08f4fb5e78635487f6c17149f9", "src_uid": "47618510d2a17b1cc1e6a688201d51a3", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define N 100\n#include\nint main() {\n char s[N+1];\n char t[N+1];\n int n=strlen(s);\n char res[N+1];\n int find=0;\n int i;\n int same=0;\n int middle=1;\n for(i=0;i0) {\n if(t[i+1]>'a') {\n res[i]=s[i];\n res[i+1]=s[i+1]-1;\n int j;\n for(j=i+2;j\n#include \n\nint test(char a[],char b[],int *found){\n int i,j,k;\n if (strcmp(a,b)==-1){\n for (i=strlen(a)-1;i>=0;i--){\n if (a[i]=='z')\n continue;\n a[i]+=1;\n a[strlen(a)]='\\0';\n if (strcmp(a,b)==-1){\n *found=1;\n return *found;\n }\n else if (strcmp(a,b)!=-1 && i1){\n output[i]=a[i]+1;\n found=1;\n break;\n \n }\n }*/\n //output[strlen(a)]='\\0';\n /*printf(\"%s\\n\\n\",a);*/\n if (found)\n printf(\"%s\",a);\n else\n printf(\"No such string\");\n\n\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ed3f4666f184f1d3e485a3e68f9ba9a2", "src_uid": "47618510d2a17b1cc1e6a688201d51a3", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint min(int a,int b){\n if(b=0&&i>=0&&e>=0&&t>=0)ans++;\n\tif (n>=2&&i>=i&&e>=3&&t>=1)ans+=min(min(n/2,i),min(e/3,t));\n\tprintf(\"%d\\n\",ans);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d80f8853170fdfb5946eb7d633ff09a0", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "GNU C11", "source_code": "\n#include\n#include\n#include\nint main(){\n int count = 0,n = 0,p = 0,t = 0,e = 0;//n = no of times n appears in the string\n char s[10101];\n scanf(\"%s\",s);\n int k = strlen(s);\n for(int i = 0 ; i < k ; i++){\n if(s[i]=='n')n++;\n if(s[i]=='t')t++;\n if(s[i]=='i')p++;\n if(s[i]=='e')e++;\n }\n printf(\"%d %d %d %d]]\\n\",n,t,p,e);\n int a = n / 3, b = t, c = p, d = e/3;\n printf(\"%d %d %d %d]]\\n\",a,b,c,d);\n int min_ab, min_cd, min;\n min_ab = a < b ? a : b;\n min_cd = c < d ? c : d;\n min = min_ab < min_cd ? min_ab : min_cd;\n int min_bcT\ufffdU!\ufffd\ufffdc\ufffd\u007fT\ufffd\u0000\ufffd-0??\ufffd\\G\u0010\u000b1\ufffd$\ufffd\ufffdn4^2^.w,\n\ufffd\ufffd\ufffd\ufffd\ufffdV\u057a\ufffdAg\ufffdL\u0016\ufffd\u0016\ufffd\ufffdS\ufffd7F8\u000f\ufffd\u0011l\u0797\ufffd\ufffd\ufffd2\ufffd\ufffdTru\u0019|\ufffd\ufffd\u0016\ufffd\u0000o.\t\u8fbb\b\ufffdX\ufffd\u001f\bM\ufffd\ufffd\ufffd\u0010\ufffd~:\ufffd\ufffd\u001b\ufffdc\u0012\u000f\ufffdL\ufffdo\ufffd\n,EM\u0001\u0015*l!B\u0178sf\t\ufffd\ufffd40D\n printf(\"%d %d\\n\",fin_min,i);\n printf(\"%d\",fin_min);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0550292253181d0a73ba5c792bae0c41", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n = 0;//3\n int i = 0;//1\n int e = 0;\n int t = 0;\n char s[101];\n scanf(\"%s\",&s);\n for(register int j = 0;j<101;j++){\n if(s[j]=='n') n++;\n else if(s[j]=='i') i++;\n else if(s[j]=='e') e++;\n else if(s[j]=='t') t++;\n }\n if(n>4){\n n-=3;\n n/=2\n n++;\n }else n/=3;\n e/=3;\n int min = n;\n if(min>i) min = i;\n if(min>e) min = e;\n if(min>t) min = t;\n //printf(\"%d %d %d %d\\n\",n,i,e,t);\n printf(\"%d\",min);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fecf97929ca985e2acfa0c5a6c9caef0", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint min(int a,int b){\n if (a>b) return b;\n else return a;\n}\nusing namespace std;\nchar s[105];\nint j,l,n,i,t,e,ans;\nint main()\n{\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor (j=0;j=0&&i>=0&&e>=0&&t>=0)ans++;\n\tif (n>=2&&i>=i&&e>=3&&t>=1)ans+=min(min(n/2,i),min(e/3,t));\n\tprintf(\"%d\\n\",ans);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c40e53ceff69f439f7b18cb647b8c34b", "src_uid": "bb433cdb8299afcf46cb2797cbfbf724", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include \nusing namespace std;\n\n\nint main(){\n int l=0,m,n=0,x,i=0,t=0,e=0;\n char c[100];\n cin>>c;\n m= strlen(c);\n for(x=0;x=3 && n>=3 && i>=1&& t>=1){\n l= l+1;\n e-=3;\n n-=3;\n i-=1;\n t-=1;\n n+=l;\n }\n }\n cout<\nusing namespace std;\n\nint main()\n{\n\tint x;\n\tint h, m;\n\tcin>>x;\n\tcin>>h>>m;\n\tint ans=0;\n\twhile (m%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=12;\n\t}\n\tcout<\n# include \n# include \n\n\nint main(){\n\tint x;\n\tscanf(\"%d\",&x);\n\tint h1,h2,m1,m2;\n\tscanf(\"%d%d%d%d\",&h1,&h2,&m1,&m2);\n\tif(h2==7 || m2==7){\n\t\tprintf(\"0\\n\");\n\t}\n\tint count=0;\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}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "24dde839dc08991c20fc4459e41906ab", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "GNU C", "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\t count++\n }\n }\n printf(\"%d\", count);\n \n\treturn 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8b524743cd01dd53fd54d8cdb00d61f5", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "GNU C", "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;}\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\nreutrn (0) ;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ab8df941d1dc794bd9b3c77f2842873", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "GNU C", "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{\n\tint x,hh,mm;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&hh);\n\tscanf(\"%d\",&mm);\n\tint i=0;\n\twhile(mm%10 !=7)&&(hh % 10 != 7 )\n\t{\n\t\tmm=mm-x;\n\t\ti++;\n\t\tif(mm<0)\n\t\t{\n\t\t\tmm=mm+60;\n\t\t\thh--;\n\t\t\tif(hh<0)\n\t\t\thh=hh+24;\n\t\t}\n\t}\n\tprintf(\"%d\",i);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd48a51580c9ac7767d732f0f13f3169", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define mod 1000000009\nusing namespace std;\nint main(){\n char b[101],ans[101],c;\n int i,j,k=0;\n char a[32]=\"qwertyuiopasdfghjkl;zxcvbnm,./\";\n printf(\"%s\",a);\n scanf(\"%c\",&c);\n scanf(\"%s\",b);\n if(c=='R'){\n for(i=0;i\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3cf6c18595877108e4ac2edb93f30f22", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n char keyboard[30] = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n char s[2];\n scanf(\"%s\", s);\nint m=strlen(keyboard);\n char str[100];\n scanf(\"%s\", str);\nint n=strlen(str);\n if(s[0] == 'L')\n {\n for(int i = 0; i < n; i++)\n {\n for(int j = 0; j \n#include \n\nchar keyboard[100] = \"qwertyuiopasdfghjkl;zxcvbnm,./\";\n\nint main()\n{\n char way[2];\n scanf(\"%s\", way);\n\n char input[120];\n scanf(\"%s\", input);\n\n if(way[0] == 'L')\n {\n for(int i = 0; i < strlen(input); i++)\n {\n for(int j = 0; j < strlen(keyboard); j++)\n {\n if(input[i] == keyboard[j])\n {\n printf(\"%c\", keyboard[j + 1]);\n break;\n }\n }\n }\n printf(\"\\n\");\n }\n else\n {\n for(int i = 0; i < strlen(input); i++)\n {\n for(int j = 0; j < strlen(keyboard); j++)\n {\n if(input[i] == keyboard[j])\n {\n printf(\"%c\", keyboard[j - 1]);\n break;\n }\n }\n }\n printf(\"\\n\");\n }\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "07a493d89e8c8e33101aff0578624c16", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "GNU C11", "source_code": " #include\n char a[]={\"qwertyuiop\"},b[]={\"asdfghjkl;\"},c={\"zxcvbnm,./\"};\n left(char d)\n {\n int i;\n for(i=0;i<10;i++)\n {\n if(d==a[i])if(i>0) d=a[i-1];\n if(d==b[i])if(i>0) d=b[i-1];\n if(d==c[i])if(i>0) d=c[i-1];\n }\n }\n right(char d)\n {\n int i;\n for(i=0;i<10;i++)\n {\n if(d==a[i])if(i<9) d=a[i+1];\n if(d==b[i])if(i<9) d=b[i+1];\n if(d==c[i])if(i<9) d=c[i+1];\n }\n }\nmain()\n{\n char d,s[101];\n int n,i=0;\n scanf(\"%c\",&d);\n scanf(\"%s\",s);\n if(d=='R')\n while(s[i]!='\\0')\n {\n left(s[i]);\n i+=1;\n }\n else\n while(s[i]!='\\0')\n {\n right(s[i]);\n i+=1;\n }\n printf(\"%s\",s);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d7328a0ea876009613a06c74e0955886", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n\nvoid strrev(char *to,char *from,int size){\n\tint i=1,j;\n\tchar str[100];\n\t\tfor(j=size-1;j>=0;j--){\n\t\t\tstr[j]=*from++;\n\t\t}\n\t\tstr[size]='\\0';\n\t\tfor(i=0;str[i];i++){\n\t\t\t*to++=str[i];\n\t\t}\n}\n\nint main()\n{\n\tint n,i, t,k, j=0,a[101],b[101];\n\tchar str[100],s[100];\n\tscanf(\"%d \",&n);\n\tgets(s);\n\t\n\tfor (i=1;i<=sqrt(n)+1;i++){\n\t\tif (n%i==0){\n\t\t\ta[j]=i;\n\t\t\tb[j++]=n/i;\n\t\t}\n\t}\n\t\n\tfor (i=0;i\n#include\nint main(){\n int n;\n scanf(\"%d\", &n);\n char a[n];\n scanf(\"%s\", a);\n char b[6]=\"krdych\";\n if(a==b){\n printf(\"hcyrkd\");}\n else{\n int i,j,c=0,k;\n k=n;\n while(k!=1){\n k=k/2;\n c++;\n }\n for(i=0;i<=c;i++)\n {\n k=(int)n/pow(2,c-i);\n for(j=0;j\n#include\nint main(){\n int n;\n scanf(\"%d\", &n);\n char a[n];\n scanf(\"%s\", a);\n if(a==\"krdych\")\n print(\"hcyrkd\");\n else{\n int i,j,c=0,k;\n k=n;\n while(k!=1){\n k=k/2;\n c++;\n }\n for(i=0;i<=c;i++)\n {\n k=(int)n/pow(2,c-i);\n for(j=0;j\n#include\nint main(){\n int n;\n scanf(\"%d\", &n);\n char a[n];\n scanf(\"%s\", a);\n char b[n]=\"krdych\";\n if(a==b){\n printf(\"hcyrkd\");}\n else{\n int i,j,c=0,k;\n k=n;\n while(k!=1){\n k=k/2;\n c++;\n }\n for(i=0;i<=c;i++)\n {\n k=(int)n/pow(2,c-i);\n for(j=0;j\nint main()\n{\nif (a%5==0)\n{\nprintf(\"%ld\",a/5);\n}\nelse\n{\nprintf(\"%ld\",(a/5)+1);\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9b3b3ca7c91d37d581e1bd10545a44f1", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint n,d=0,b=0,c=0,i;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;ic)&&(b>d))\n {\n printf(\"chest\");\n }\nelse if((c>b)&&(c>d))\n {\n printf(\"biceps\");\n }\nelse\n {\n printf(\"back\");\n }\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0926fd756d4e3d362911847f4b950bde", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,a[25];\n scanf(\"%d\",&n);\n for(int i=0;ia[i+1])\n {\n p=i+1;\n }\n else\n {\n p=i+2;\n }\n }\n if(p%2==0)\n printf(\"biceps\");\n else if(p%3==0)\n printf(\"back\");\n else\n printf(\"chest\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "42d40da3cfc060c08316ad35b0376648", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint max(int a, int b, int c) {\n int max1 = a ? a>=b: b;\n int max2 = c ? c>=b: b;\n int max3 = max1 ? max1 >= max2: max2;\n if (max3 == a)\n printf(\"chest\\n\");\n else if (max3 == b)\n printf(\"biceps\\n\");\n else\n printf(\"back\\n\");\n}\n\nint main() {\n int i;\n int gr = 0, sp = 0, bi = 0;\n int n, buf;\n int nn[3];\n scanf(\"%d\", &n);\n th1 = n/3;\n for (i = 1;i <= n;i++) {\n scanf(\"%d\", buf);\n nn[n%3]+=buf;\n }\n max(n[0], n[1], n[2]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2534d8988fff13f80c0141906ce983d", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "Problem statement boro kore dekle o mata gorom hoye jai", "lang_cluster": "C", "compilation_error": true, "code_uid": "89229e106043c55070a7a3f29c92a2ae", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n,i,s=0,x=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i\n\nint main()\n{\n\tint n;\n\twhile(1)\n\t{\n\t\tscanf(\"%d\",&n);\n\t\tint fingers,i,tl_fingers =0,cnt;\n\t\tfor(i=0;i\n\nint main()\n{ int n,a[20],i,j,sum=0,count=0,k;\n scanf(\"%d\",&n);\n for(i=0;i\n#include\nint main()\n{\n int frnd, fing=1, k, i, yes=0, frfing,sum=0,sumfrfing=0;\n \n scanf(\"%d\", &frnd);\n for(i=0; i0)\n {\n printf(\"%d\", yes);\n }\n getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "13e18635e670331b2b77ad49a47d201c", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main(void)\n{\n int n,i,a,sum,m=0;\n scanf(\"%d\",&n);\n for(i=0;i\n\n#define MOD 1000003\n\nint main()\n{\n int N,Sum=1;\n scanf(\"%d\",&N);\n for(i=1;i\n#define u_int unsigned int\n\nu_int uintpow(u_int a,u_int b);\n\nint main(void){\n u_int n;\n scanf(\"%u\",&n);\n printf(\"%u\\n\",uintpow(3,n-1));\n return 0;\n}\n\nu_int uintpow(u_int a,u_int b){\n const u_int mod=1000003;\n u_int i;\n u_int prod=1;\n for(i=0;i1000000) prod%=mod;\n }\n return prod;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5eeaa6ed5e7864046ddcc3554acfea7b", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define MD\t1000003\n\nint main() {\n\tint n, p;\n\n\tscanf(\"%d\", &n);\n\tp = 1;\n\twhile (--n)\n\t\tp = p * 3 % MD;\n\tprintf(\"%d\\n\", p);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0b905ea7676163afb6ee880a76d1c208", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main(int argc, char *argv[])\n{\n int n, p = 1;\n\n scanf(\"%d\", &n);\n while(-- n)\n p = (p * 3) % 1000003;\n\n printf(\"%d\\n\", p);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c150f53c02d365893dbfa431c8b32689", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#define u_int unsigned int\n\nu_int uintpow(u_int a,u_int b);\nu_int wint(u_int a,u_int b);\n\nint main(void){\n u_int n;\n scanf(\"%u\",&n);\n printf(\"%u\\n\",uintpow(3,n-1));\n return 0;\n}\n\nu_int uintpow(u_int a,u_int b){\n const u_int mod=1000003;\n u_int i;\n u_int prod=1;\n for(i=0;(b>>i)!=0;i++){\n if((b>>i)&1==1){\n\tprod*=wint(a,i);\n\tprod%=mod;\n }\n }\n prod%=mod;\n return prod;\n}\n\nu_int wint(u_int a,u_int b){\n const u_int mod=1000003;\n for(;b>0;b--){\n a*=a;\n a%=mod;\n }\n return a;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "131c1885bfff9a51e20c1ade5b8da6ee", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "fe94ec9939caaacee3e426dbdcf2b6ce", "src_uid": "711d15e11016d0164fb2b0c3756e4857", "difficulty": 2700.0} {"lang": "GNU C", "source_code": "#include \n#include \nvoid main()\n{\n int y1,m1,d1,y2,m2,d2,i,j,s=0;\n scanf(\"%d:%d:%d%d:%d:%d\",&y1,&m1,&d1,&y2,&m2,&d2);\n for(i=y1+1;i\n#include \nvoid main()\n{\n int y1,m1,d1,y2,m2,d2,i,j,s=0;\n scanf(\"%d:%d:%d%d:%d:%d\",&y1,&m1,&d1,&y2,&m2,&d2);\n for(i=y1+1;i\nint rev(int *s,int *t)\n{int u;\nu=*t;*t=*s;*s=u;}\n int main()\n\n{int y1,m1,d1,y2,m2,d2,i,l=0,ans=0,k=0,day[] ={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\nchar ch;\nscanf(\"%d %c %d %c %d\",&y1,&ch,&m1,&ch,&d1);\nscanf(\"%d %c %d %c %d\",&y2,&ch,&m2,&ch,&d2);\nif(y1>y2||(y1==y2&&m1>m2)||(y1==y2&&m1==m2&&d1>d2)){rev(&y1,&y2);rev(&m1,&m2);rev(&d1,&d2);}\n\nif(y1!=y2){ans=(y2-y1-1)*365;\nif(((y1%4==0&&y1%100!=0)||y1==2000)&&(m1==2&&d1<29)){ans++;}\n\nif(((y2%4==0&&y2%100!=0)||y2==2000)&&m2>2){ans++;}\nfor(i=y1+1;i\n#include\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)>(b)?(b):(a))\nint days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};\nint ct(int,int,int);\nint y1,y2,m1,m2,d1,d2,sum1,sum2,sum;\nint main(void)\n{\n int i;\n scanf(\"%d:%d:%d\",&y1,&m1,&d1);\n scanf(\"%d:%d:%d\",&y2,&m2,&d2);\n if(y1=29)\n tot++;\n return tot;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "71a8985d485f04b0aa2527fcdeedc636", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint y1,m1,d1,y2,d2,m2,t1,t2,d,t,p,k,y[200],d[200],l,i;\n //t,p,k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05b4\ufffd\u02b1\ufffd\u0137\ufffd\u0163\ufffd//d\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05ae\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd\ue8fb//y[200]\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05ae\ufffd\ufffd\ufffd\ufffd\ufffd\u0763\ufffd\n //d[200]\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00ff\ufffd\ufffdy[i]\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd//l\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05ae\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02fc\ufffd\ufffd\ufffd\ufffd\ufffd\u0763\ufffd\n\twhile(scanf(\"%d:%d:%d%d:%d:%d\",&y1,&m1,&d1,&y2,&m2,&d2)!=EOF)\n\t{\n\t\tif(y1>y2)\n\t\t{\n\t\t\tt=y2;\n\t\t\ty2=y1;\n\t\t\ty1=t;\n\t\t\tp=m2;\n\t\t\tm2=m1;\n\t\t\tm1=p;\n\t\t\tk=d2;\n\t\t\td2=d1;\n\t\t\td1=k;\n\t\t}\n\t\tif(y1==y2)\n\t\t{\n\t\t\tif(m1==m2)\n\t\t\t{\n\t\t\t\td=fabs(d2-d1);\n\t\t\t\tprintf(\"%d\\n\",d);\n\t\t\t}\n\t\t\telse if(m12))\n \t{\n\t \tt1++;\n \t}\n \tswitch(m2)\n {\n\t \tcase 1:t2=d2;break;\n\t \tcase 2:t2=d2+31;break;\n\t \tcase 3:t2=d2+28+31;break;\n\t \tcase 4:t2=d2+31+28+31;break;\n \t \tcase 5:t2=d2+30+31+28+31;break;\n \t \tcase 6:t2=d2+31+30+31+28+31;break;\n \t \tcase 7:t2=d2+30+31+30+31+28+31;break;\n \t \tcase 8:t2=d2+31+30+31+30+31+28+31;break;\n \t \tcase 9:t2=d2+31+31+30+31+30+31+28+31;break;\n\t \tcase 10:t2=d2+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 11:t2=d2+31+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 12:t2=d2+30+31+30+31+31+30+31+30+31+28+31;break;\n \t}\n\t if((y2%4==0&&y2%100!=0||y2%400==0)&&(m2>2))\n \t{\n\t \t t2++;\n \t }\n \td=t2-t1;\n \tprintf(\"%d\\n\",d);\n\t\t\t}\n\t\t\telse if(m1>m2)\n\t\t\t{\n\t\t\t\t\tswitch(m1)\n \t{\n\t \tcase 1:t1=d1;break;\n \t\t case 2:t1=d1+31;break;\n \t\t case 3:t1=d1+28+31;break;\n \t\t case 4:t1=d1+31+28+31;break;\n \t\t case 5:t1=d1+30+31+28+31;break;\n \t\t case 6:t1=d1+31+30+31+28+31;break;\n \t\t case 7:t1=d1+30+31+30+31+28+31;break;\n\t \tcase 8:t1=d1+31+30+31+30+31+28+31;break;\n\t \tcase 9:t1=d1+31+31+30+31+30+31+28+31;break;\n\t \tcase 10:t1=d1+30+31+31+30+31+30+31+28+31;break;\n\t\t case 11:t1=d1+31+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 12:t1=d1+30+31+30+31+31+30+31+30+31+28+31;break;\n \t}\n \tif((y1%4==0&&y1%100!=0||y1%400==0)&&(m1>2))\n \t{\n\t \tt1++;\n \t}\n \tswitch(m2)\n {\n\t \tcase 1:t2=d2;break;\n\t \tcase 2:t2=d2+31;break;\n\t \tcase 3:t2=d2+28+31;break;\n\t \tcase 4:t2=d2+31+28+31;break;\n \t\tcase 5:t2=d2+30+31+28+31;break;\n \t \tcase 6:t2=d2+31+30+31+28+31;break;\n \t \tcase 7:t2=d2+30+31+30+31+28+31;break;\n \t\tcase 8:t2=d2+31+30+31+30+31+28+31;break;\n \t\tcase 9:t2=d2+31+31+30+31+30+31+28+31;break;\n\t \tcase 10:t2=d2+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 11:t2=d2+31+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 12:t2=d2+30+31+30+31+31+30+31+30+31+28+31;break;\n \t}\n\t if((y2%4==0&&y2%100!=0||y2%400==0)&&(m2>2))\n \t{\n\t \tt2++;\n \t}\n \td=t1-t2;\n \tprintf(\"%d\\n\",d);\n\t\t\t}\n\t\t}\n\t\telse if(y12))\n \t{\n\t \tt1++;\n\t \tt1=366-t1;\n \t}\n \telse if((y1%4==0&&y1%100!=0||y1%400==0)&&(m1<2))\n \t{\n\t \tt1=366-t1;\n\t }\n\t else \n\t {\n \t \tt1=365-t1;\n \t}\n \tswitch(m2)\n {\n\t \tcase 1:t2=d2;break;\n\t \tcase 2:t2=d2+31;break;\n\t \tcase 3:t2=d2+28+31;break;\n\t \tcase 4:t2=d2+31+28+31;break;\n \t\tcase 5:t2=d2+30+31+28+31;break;\n \t \tcase 6:t2=d2+31+30+31+28+31;break;\n \t \tcase 7:t2=d2+30+31+30+31+28+31;break;\n \t \tcase 8:t2=d2+31+30+31+30+31+28+31;break;\n \t \tcase 9:t2=d2+31+31+30+31+30+31+28+31;break;\n\t \tcase 10:t2=d2+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 11:t2=d2+31+30+31+31+30+31+30+31+28+31;break;\n\t \tcase 12:t2=d2+30+31+30+31+31+30+31+30+31+28+31;break;\n \t }\n\t if((y2%4==0&&y2%100!=0||y2%400==0)&&(m2>2))\n {\n\t \tt2++;\n }\n l=y2-y1-1;\n \tif(l==0)\n \t{\n\t \td=t1+t2;\n }\n else if(l>0)\n {\n \t d=0\n \tfor(i=1;i<=l;i++)\n \t{\n\t y[i]=y1+i;\n\t if(y[i]%4==0&&y[i]%100!=0||y[i]%400==0)\n\t {\n \t\t d[i]=366;\n \t }\n \t else \n \t {\n \t d[i]=365;\n }\n d=d+d[i];\n }\n d=t1+t2+d;\n printf(\"%d\\n\",d);\n }\n\t\t}\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "006750dfd17f8352d620d1ca0ec0c046", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n long long sum=0,a,b,c,d,e,f;\n cin>> a;\n cin>>b;\n cin>>c;\n cin>>d;\n cin>>e;\n cin>>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 }\n cout <\n\nusing namespace std;\n\nlong int min(long int a, long int b) {\n return a < b ? a : b;\n}\n\nlong int min(long int a, long int b, long int c) {\n return ((a < b) && (a < c)) ? a : (b < c ? b : c);\n}\n\nint main() \n{\n ios_base::sync_with_stdio(false);\n cin.tie(NULL);\n\n long int a, b, c, d;\n short int e, f;\n long long int sum = 0;\n\n cin >> a >> b >> c >> d >> e >> f;\n\n if (e > f) {\n long int db = min(a, d);\n sum += db * e;\n db = min(b, c, d - db);\n sum += db * f;\n } else {\n long int db = min(b, c, d);\n sum += db * f;\n db = min(a, d - db);\n sum += db * e;\n }\n\n cout << sum;\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5f87bbfe1a45d34bc8d2f453c90e82a6", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0} {"lang": "GNU C11", "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\t(min1 < 0) ? min1 *= -1 : min1 *= 1;\n\tmin2 *= f;\n\tmin1 *= e;\n\tprintf(\"%d\",min1+min2);\n\treturn 0;\n\t\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "16531d8f693be939fad72d193a19ef70", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint mini(int a,int b,int c)\n{\nif(a0) {\nd=mini(d,a);\ncost+=(d*e);}\nprintf(\"%d\",cost);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d29ff072cf89e1f6ac3c7da408450ca6", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(\n {\n\tunsigned long int a,b,c,d,e,f,n=0,A=0;\n\tprintf(\"all\\n\");\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "492d7e1b86ea7083bfd0fe1d92dd5599", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "/*!\n * @file problem.344c.c\n * @version 1.0\n * @date 28/09/2013\n * @author Anton Leontiev \n *\n * @brief \u0417\u0430\u0434\u0430\u0447\u0430 344\u0421. \u0420\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435\n *\n * @copyright\n *\n * Copyright (c) 2013, Anton Leontiev\n *\n * Redistribution and use in source and binary forms, with or without modification, are permitted\n * provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this list of\n * conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright notice, this list of\n * conditions and the following disclaimer in the documentation and/or other materials\n * provided with the distribution.\n * 3. Neither the name of Anton Leontiev nor the names of its contributors may be used\n * to endorse or promote products derived from this software without specific prior written\n * permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n */\n\n#include \n#include \n#include \n#include \n\n#define uint64_pri \"%\" PRIu64\n#define uint64_scn \"%\" SCNu64\n\nstatic inline void swap(uint64_t *a, uint64_t *b) {\n\t*a ^= *b;\n\t*b ^= *a;\n\t*a ^= *b;\n}\n\nint main(int argc, char *argv[]) {\n\tuint64_t a, b;\n\tunsigned i = 0;\n\n\tscanf(uint64_scn \" \" uint64_scn, &a, &b);\n\twhile (a != b) {\n\t\tif (a > b) swap(&a, &b);\n\t\tb -= a;\n\t\ti++;\n\t}\n\tprintf(\"%u\\n\", i+1);\n\treturn EXIT_SUCCESS;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "30c2f9b96db92799c7bd9b9da8548c86", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0} {"lang": "GNU C", "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\ninline long long int rec(long long int a, long long int b, long long int csf)\n{\n if(!b)\n return csf;\n\n if(a > b)\n rec(b, a % b, csf+(a/b));\n else\n rec(a, b % a, csf+(b/a));\n}\n\nint main()\n{\n long long int a,b;\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n\n printf(\"%I64d\\n\", rec(a,b,0));\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8f611f6b81a5616e4aa83658ab94e932", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nlong long func(long long int a, long long int b)\n{\n if(b==0){\n return 0;\n }\n else{\n return (a/b) + func(b,a%b);\n }\n\n\n}\nint main()\n{\n long long int i, j, x;\n scanf(\"%I64d %I64d\", &a, &b);\n x = func(i,j);\n printf(\"%I64d\", x);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "923b2ad4f3208ee0271fdf01aef26a0c", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main(){\n long long a,b,ans=0;\n scanf(\"%I64d %I64d\",&a,&b);\n while (a!=0 || b!=1){\n if (a>=b) {ans+=a/b;a=a%b;}else {ans+=b/a;b=b%a;if (b==0){ans--;b=a;}}\n }\n printf(\"%I64d\\n\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e9a5ceeb668a96ab03484f883f5d5a7d", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\nint main()\n{\n long long a,b,i,k=0;\n scanf(\"%I64d %I64d\",&a,&b);\n if (a%b==0)\n k=1;\n else\n if (a==1)\n k=b;\n else\n {\n while (a!=1)\n {\n if (a>b)\n {\n a=a%b;\n k+=a;\n }\n else\n {\n i=a;\n a=b;\n b=i;\n }\n }\n k+=b;\n }\n printf(\"%I64d\",k);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a5852de4919127909ce44a699c736c41", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\n\nint main() {\n\tint x, y, r, a;\n\tscanf_s(\"%d\",&r);\n\tr = r - 1;\n\ty = (r - 2) / 2;\n\tx = 0;\n\twhile (++x) {\n\t\tif (x * (x + (2 * y) + 1) == r) {\n\t\t\tprintf(\"%d %d\", x, y);\n\t\t\tbreak;\n\t\t}\n\t\telse if (x * (x + (2 * y) + 1) > r) {\n\t\t\tputs(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\tgetch();\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9d4bcc549127d5a4aa9d78e881fac5df", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long r;\n scanf(\"%lld\",&r);\n if(r<5 or r%2==0) printf(\"NO\");\n else\n {\n printf(\"%I64d %I64d\",1LL,(r-3)/2);\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ad694a1d83ec7d1420e5c4c0fbfb34a3", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n \nint main(){\n int64_t r,y,x,hash,min_x=10000000000,corresponding_y;\n int flag_no=1;\n scanf(\"%I64d\",&r);\n for(y=((r/2)-1);y>;y--){\n for(x=1;x<=r;x++){\n hash = pow(x,2)+(2*x*y)+x+1 ;\n if(hash>r){\n break;\n }\n if(hash==r){\n flag_no=0;\n if(x<=min_x){\n min_x =x;\n corresponding_y =y;\n break;\n }\n }\n }\n }\n if(flag_no == 1){\n printf(\"NO\");\n }\n else{\n printf(\"%I64d %I64d\",min_x,corresponding_y);\n }\n \n \nreturn 0; \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d7bda86ef52ff1ea474640150dcc3a1", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#define MAXN 1000000000001\nusing namespace std;\nint main()\n{\n\tlong long f=0,r,y;\n\tscanf(\"%lld\",&r);\n\tfor(long long i=1;i=r)\tbreak;\n\t\tif((r-i*i-i-1)%(2*i)==0)\n\t\t{\n\t\t\ty=(r-i*i-i-1)/(2*i),f=1;\n\t\t\tprintf(\"%lld %lld\",i,y);\n\t\t}\t\n\t\tif(f)\tbreak;\n\t}\n\tif(!f)\tprintf(\"NO\\n\");\n\t\t\n } \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f1b39cf03dada7aa9b4df6567c152899", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long r;\n scanf(\"%lld\",&r);\n if(r<5 or r%2==0) printf(\"NO\");\n else\n {\n printf(\"%lld %lld\",a1LL,(r-3)/2);\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "98501da553c73ed441d2b4fd6136303e", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n long x,y,x1,y1,x2,y2;\n scanf(\"%ld%ld\",&x,&y);\n if(x>0 && y>0)\n {\n printf(\"0 %ld %ld 0\",x+y,x+y);\n }\n else if(x<0 && y>0)\n {\n printf(\"%ld 0 0 %ld\",-(labs(x)+y),(labs(x)+y));\n }\n else if(x<0 && y<0)\n {\n printf(\"%ld 0 0 %ld\"-(labs(x)+labs(y)),-(labs(x)+labs(y)));\n\n }\n else\n printf(\"0 %ld %ld 0\",-(x+labs(y)),(x+labs(y)));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ba5c36200b735e757971d9ee466333d", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main()\n{\n int i,x,y,A,t1,t2;\n\twhile(scanf(\"%d%d\",&x,&y)!=EOF)\n\t{\n t1=abs(x);t2=abs(y);\n for(A=t1+1; ;A++)\n\t\t{\n\t\t\tif(t1*t2==(A-t1)*(A-t2))\n\t\t\t\tbreak;\n\t\t}\n\t\tif(x>=0&&y>=0)\n\t\t\tprintf(\"%d %d %d %d\\n\",0,A,A,0);\n\t\telse if(x>=0&&y<=0)\n\t\t\tprintf(\"%d %d %d %d\\n\",0,-A,A,0);\n\t\telse if(x<=0&&y>=0)\n\t\t\tprintf(\"%d %d %d %d\\n\",-A,0,0,A);\n\t\telse\n\t\t\tprintf(\"%d %d %d %d\\n\",-A,0,0,-A);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d93ea40666796c2ef9b1d212464e823", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tlong x,y,x1,x2,y1,y2;\n\twhile(1) {\n\t\tscanf(\"%ld%ld\",&x,&y);\n\t\tif(x>0) {\n\t\t\tif(y>0) {\n\t\t\t\tx2 = x + y;\n\t\t\t\ty2 = 0;\n\t\t\t\ty1 = x2;\n\t\t\t\tx1 = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx2 = x + y;\n\t\t\t\ty2 = 0;\n\t\t\t\tx1 = 0;\n\t\t\t\ty1 = -x2;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif(y>0) {\n\t\t\t\tx1 = x - y;\n\t\t\t\tx2 = 0;\n\t\t\t\ty1 = 0;\n\t\t\t\ty2 = -x1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx1 = x + y;\n\t\t\t\tx2 = 0;\n\t\t\t\ty1 = 0;\n\t\t\t\ty2 = x1;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%ld %ld %ld %ld\\n\",x1,y1,x2,y2);\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b5761cefbb527f605476caebe906298", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int x,y,p1,p2,a;\n scanf(\"%lld%lld\",&x,&y);\n for(a=1;a*a0)\n p1=x+a;\n else\n p1=x-a;\n\n p2=(p1>0)?p1:-p1;\n if(y<0)\n p2=-p2;\n if(p1>0)\n printf(\"0 %lld %lld 0\\n\",p2,p1);\n else\n printf(\"%lld 0 0 %lld\\n\",p1,p2);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b13a8224d1eeb708eede5dade2aa2b4", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\n\nint main()\n{\n\tlong int x, y, x1, yi, x2, y2;\n\tscanf(\"%d %d\",&x, &y);\n\t\n\tif(x<0)\n\t{\n\t\tx2 = 0;\n\t\ty1 = 0;\n\t\tif(y>0)\n\t\t{\n\t\t\tx1 = x - y;\n\t\t\ty2 = y - x;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tx1 = x + y;\n\t\t\ty2 = -1*(x1);\n\t\t}\n\t}\n\telse\n\t{\n\t\tx1 = 0;\n\t\ty2 = 0;\n\t\tif(y>0)\n\t\t{\n\t\t\tx2 = x + y;\n\t\t\ty1 = x2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tx2 = x + y;\n\t\t\ty1 = -1 * x2;\n\t\t}\n\t}\n\tprintf(\"%d %d %d %d\\n\",x1, y1, x2, y2);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5df9253f0d2035be3f0abfc1a8e2bfc4", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\n \n \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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "50f80420ce0f9e47112d2caac7b5a543", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\n\nint n,ans;\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "b96d30495649d74e1f6a3c936489fa7e", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "23de487e018ebe1f40a77130634420a3", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,a,b,c,i,count=0,j,k;\n scanf(\"%d\",&n);\n for (int i = 1; i < n; ++i)\n {\n for (int j = i+1; i < n; ++j)\n {\n /* code */\n for (int k = i+2; i < i+j; ++k)\n {\n /* code */\n if((i^j)==k)\n count++;\n }\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "52e5b5f0bdfffd506fe38d2ecc7d6982", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0} {"lang": "GNU C", "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; iarr[k] && xor(arr[i],arr[j],arr[k])==0)\n count++;\n }\n }\n }\n printf(\"%d\",count);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b3a2c1d5294fe55390e1d8f5c0fb9e3a", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#define pi 3.14\n\nint main()\n{\n int a , b , r ,ans ;\n\n while(scanf(\"%d%d%d\",&a,&b,&r)!=EOF)\n {\n d = 2* r ;\n ans = (a/d)*(b/d);\n if(ans%2==0)\n printf(\"Second\\n\");\n else\n printf(\"First\\n\");\n\n }\n\n\n return 0 ;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b9179c4f597bfdbb802c7c7b1a0604dd", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int a, b, r, t, f=0, s=0;\n scanf(\" %d %d %d\", &a, &b, &r);\n\n if(a>b)\n {\n t = a;\n a = b;\n b = t;\n }\n\n while(b != 0)\n {\n if(b > (2*r))\n {\n b -= (2*r);\n f++;\n }\n\n if(b > (2*r))\n {\n b -= (2*r);\n s++;\n }\n\n if(b < (2*r))\n break;\n }\n\n if(f > s)\n printf(\"First\\n\");\n else\n printf(\"Second\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "91b7878b88c1f07b332f846ac8a90d2a", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,r;\n while(scanf(\"%d%d%d\",&a,&b,&r))\n if(a>=2*r&&b>=2*r)\n printf(\"First\\n\");\n else printf(\"Second\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "244a130da46fe9d02693daa32f7cb1ff", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a,b,r;\nwhile(scanf(\"%d%d%d\",&a,&b,&r))\n{\nif(2*r>=a&&2*r>=b)printf(\"First\\n\");\nelse printf(\"Second\\n\");\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "83e8921919ee473794c3f9b4490eca4b", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nchar Win[2][10] = {\"Second\",\"First\"};\n\nint main()\n{\n __int64 a,b,r;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&r);\n if(a < 2 * r && b < 2 * r) puts(Win[0]);\n else puts(Win[1]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "933fbf201430a9589ceb2c0cc1a3f857", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n\tint n,k,dif,s=0,a[105],i,j;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;i\n#include \n\nint comp(const void *a, const void *b)\n{\n\treturn *(int *)a - *(int *)b;\n}\n\nint main(void)\n{\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tint a[n];\n\tfor (int i = 0; i < n; ++i) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tqsort(a, n, sizeof(int), comp);\n\tint count = 0;\n\tfor (int i = 0; i < n; ++i) {\n\t\tk = k - a[i];\n\t\tif (k < 0) {\n\t\t\tbreak;\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\", count);\n\tfor (int i = 0; i < count; ++i) {\n\t\tprintf(\"%d \", a[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fbcccf16626492446fd1d7791d840e15", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\n int x , y;\n int arr [200];\n scanf(\"%d%d\", &x , &y);\n\n scanf(\"%d\", &arr[0]);\n int maxi = arr[0] , max_index = 0;\n int sum = maxi;\n int n;\n int length = 0;\n\n for(i = 0 ;i < x; i++){\n\n scanf(\"%d\", n);\n if(n + sum <= y){ sum += n;\n\n arr[i + 1] = i + 1;\n length++;\n\n } else if (sum - maxi + n <= y){\n\n sum -= maxi + n;\n arr[max_index] = i + 1;\n max = n;\n max_index = i;\n length++;\n }\n\n break;\n }\n\n printf(\"%d\\n\" , length);\n\n for(i = 0 ; i < length; i++){\n\n printf(\"%d \", arr[i]);\n\n }\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8aa45af03be3976071858d89c0b9b466", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#define MAXINS 101\n#define MAXDAY 10001\n#include \n\n\nint rec(int i,int day){\n int max;\n if(i==0){\n return 0;\n }\n if(day<=0){\n return 0;\n }\n if(dp[i][day]!=-1){\n return dp[i][day];\n }\n int ret1=0;\n int ret2=0;\n if((day-ins[i])>=0){\n ret1=1+rec(i-1,day-ins[i]);\n }\n ret2=rec(i-1,day);\n \n if(ret1>ret2){\n max=ret1;\n learn[i]=1;\n }\n else{\n max=ret2;\n learn[i]=0;\n }\n dp[i][day]=max;\n return max;\n}\nint main(){\nint n;\nint available;\nint ins[101];\nint dp[105][10005];\nint learn[101];\n int i,j;\n int learnt;\n for(i=0;i<=MAXINS;++i){\n for(j=0;j<=MAXDAY;++j){\n dp[i][j]=-1;\n }\n }\n scanf(\"%d %d\",&n,&available);\n i=1;\n while(i<=n){\n scanf(\"%d\",&ins[i]);\n learn[i]=0;\n i++;\n }\n \n learnt=rec(n,available);\n i=1;\n printf(\"%d\\n\",learnt);\n while(i<=n){\n if(learn[i]==1){\n printf(\"%d \",i);\n }\n i++;\n }\n if(learnt!=0){\n printf(\"\\n\");\n }\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8b328c80793478f9be753bdc46319668", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nvoid pivot(int array[],int index[],int start,int end)\n{\n int i,j=start,x=array[end],t;\n for(i=start;i=end)\n return;\n int j=pivot(array,start,end);\n quicksort(array,start,j-1);\n quicksort(array,j+1,end);\n}\nint main()\n{\n int n,k,i,count=0,num=0;\n scanf(\"%d %d\",&n,&k);\n int array[n+1],index[n+1];\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&array[i]);\n index[i]=i;\n }\n quicksort(array,index,1,n);\n for(i=1;count<=k&&i<=n;i++)\n {\n if(count+array[i]>k)\n break;\n count=count+array[i];\n num++;\n }\n printf(\"%d\\n\",num);\n for(i=1;i<=num;i++)\n printf(\"%d \",index[i]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f282cfbbca01e869f9fd457a7b3a129", "src_uid": "dbb164a8dd190e63cceba95a31690a7c", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint cmpfunc (const void * a, const void * b)\n{\n\treturn ( *(int*)b - *(int*)a );\n}\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint arr[n];\n\tint out[m];\n\tint i,j;\n\tfor(i=0;i=arr[i+1])\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\t\t\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "79d73670b4cca05b1b3fe140983c7620", "src_uid": "40264e84c041fcfb4f8c0af784df102a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint judge(inta[],intb[],intn,intm)\n{\n\tint i;\n\tint t=0,x=0;\n\tfor(i=0;ia[i+1])return1;\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 \n#include \n#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", "lang_cluster": "C", "compilation_error": true, "code_uid": "c24704373d0540f563f9fe5d7027c0ef", "src_uid": "40264e84c041fcfb4f8c0af784df102a", "difficulty": 900.0} {"lang": "GNU C", "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;\n\tfor(i=0;i\n#include \n#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", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d60af309749f484f229358cc2adddd5", "src_uid": "40264e84c041fcfb4f8c0af784df102a", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint n,x,j;\nscanf(\"%d\",&n);\nfor(y=0,j\nint main(){\nint a;\nscanf(\"%d\",&a);\nfor(i=0;i\nint main(){\nint a;\nscanf(\"%d\",&a);\nfor(i=0;i\n\nint main()\n{\n string s = fgets();\n int t = strtol(s);\n printf(t);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e615ef92bada1d308517583d0d9f17e9", "src_uid": "a661b6ce166fe4b2bbfd0ace56a7dc2c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int test;\n scanf(\"%d\",&test);\n int bal,cal;\n while(test){\n scanf(\"%d\",&bal);\n if(bal%7==0) printf(\"%d\\n\"bal/7);\n else printf(\"%d\\n\",bal/7+1);\n test--;\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cc57125b6ee55aefdb239e71bcb7675a", "src_uid": "a661b6ce166fe4b2bbfd0ace56a7dc2c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main(void)\n{\n int in=0;\n while(EOF!=scanf(\"%d\",&in))\n {\n if(in==1) printf(\"Washington\\n\");\n else if(in==2) printf(\"Adams\\n\");\n else if(in==3) printf(\"Jefferson\\n\");\n else if(in==4) printf(\"Madison\\n\");\n else if(in==5) printf(\"Monroe\\n\");\n else if(in==6) printf(\"Adams\\n\");\n else if(in==7) printf(\"Jackson\\n\");\n else if(in==8) printf(\"Van Buren\\n\");\n else if(in==9) printf(\"Harrison\\n\");\n else if(in==10) printf(\"Tyler\\n\");\n else if(in==11) printf(\"Polk\\n\");\n else if(in==12) printf(\"Taylor\\n\");\n else if(in==13) printf(\"Fillmore\\n\");\n else if(in==14) printf(\"Pierce\\n\");\n else if(in==15) printf(\"Buchanan\\n\");\n else if(in==16) printf(\"Lincoln\\n\");\n else if(in==17) printf(\"Johnson\\n\");\n else if(in==18) printf(\"Grant\\n\");\n else if(in==19) printf(\"Hayes\\n\");\n else if(in==20) printf(\"Garfield\\n\");\n else if(in==21) printf(\"Arthur\\n\");\n else if(in==22) printf(\"Cleveland\\n\");\n else if(in==23) printf(\"Harrison\\n\");\n else if(in==24) printf(\"Cleveland\\n\");\n else if(in==25) printf(\"McKinley\\n\");\n else if(in==26) printf(\"Roosevelt\\n\");\n else if(in==27) printf(\"Taft\\n\");\n else if(in==28) printf(\"Wilson\\n\");\n else if(in==29) printf(\"Harding\\n\");\n else if(in==30) printf(\"Coolidge\\n\");\n else if(in==31) printf(\"Hoover\\n\");\n else if(in==32) printf(\"Roosevelt\\n\");\n else if(in==33) printf(\"Truman\\n\");\n else if(in==34) printf(\"Eisenhower\\n\");\n else if(in==35) printf(\"Kennedy\\n\");\n else if(in==36) printf(\"Johnson\\n\");\n else if(in==37) printf(\"Nixon\\n\");\n else if(in==38) printf(\"Ford\\n\");\n else if(in==39) printf(\"Carter\\n\");\n else if(in==40) printf(\"Reagan\\n\");\n /*else if(in==41) printf(\"H.W. Bush\\n\");\n else if(in==42) printf(\"J. Clinton\\n\");*/\n\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1ee23912fdcc754ca5ce3fcec2d15d48", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\nchar Str[40][]={\"Washington\",\"Adams\",\"Jefferson\",\"Madison\",\"Monroe\",\"Adams\",\"Jackson\",\"Van Buren\",\"Harrison\",\"Tyler\",\n\"Polk\",\"Taylor\",\"Fillmore\",\"Pierce\",\"Buchanan\",\"Lincoln\",\"Johnson\",\"Grant\",\"Hayes\",\"Garfield\",\"Arthur\",\n\"Cleveland\",\"Harrison\",\"Cleveland\",\"McKinley\",\"Roosevelt\",\"Taft\",\"Wilson\",\"Harding\",\"Coolidge\",\"Hoover\",\"Roosevelt\",\n\"Truman\",\"Eisenhower\",\"Kennedy\",\"Johnson\",\"Nixon\",\"Ford\",\"Carter\",\"Reagan\",\"Bush\",\"Clinton\",\"Bush\",\"Obama\"};\n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n puts(\"%s\",Str[a-1]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "432afcd5cd7ad06abc1b04e2b9d4e54a", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int n;\n \n char ch[][]={\"Washington\",\"Adams\",\"Jefferson\",\"Madison\",\"Monroe\",\"Q. Adams\",\"Jackson\",\"Van Buren\",\"H. Harrison\",\"Tyler\",\"K. Polk\",\"Taylor\",\"Fillmore\",\"Pierce\",\"Buchanan\",\"Lincoln\",\"Johnson\",\"S. Grant\",\"B. Hayes\",\"A. Garfield\",\"A. Arthur\",\"Cleveland\",\"Harrison\",\"Cleveland\",\"McKinley\",\"Roosevelt\",\"H. Taft\",\"Wilson\",\"G. Harding\",\"Coolidge\",\"C. Hoover\",\"D. Roosevelt\",\"S. Truman\",\"D. Eisenhower\",\"F. Kennedy\",\"B. Johnson\",\"M. Nixon\",\"R. Ford\",\"Carter\",\"W. Reagan\"};\n \n scanf(\"%d\",n);\n \n \n \n printf(\"%s\\n\",ch[n-1]);\n \n return 0;\n}\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0a50447634bc5628cb89033d572bb31b", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\n#define MAX_NAME_LENGTH 50\n\nint main() {\n static char pres[44][MAX_NAME_LENGTH] = {\"Washington\", \"Adams\", \"Jefferson\", \"Madison\", \"Monroe\",\n \"Adams\", \"Jackson\", \"Van Buren\", \"Harrison\", \"Tyler\", \"Polk\", \"Taylor\", \"Fillmore\", \"Pierce\",\n \"Buchanan\", \"Lincoln\", \"Johnson\", \"Grant\", \"Hayes\", \"Garfield\", \"Arthur\", \"Cleveland\", \"Harrison\",\n \"Cleveland\", \"McKinley\", \"Roosevelt\", \"Taft\", \"Wilson\", \"Harding\", \"Coolidge\", \"Hoover\", \"Roosevelt\",\n \"Truman\", \"Eisenhower\", \"Kennedy\", \"Johnson\", \"Nixon\", \"Ford\", \"Carter\", \"Reagan\", \"Bush\", \"Clinton\",\n \"Bush\", \"Obama\"}\n int in;\n scanf(\"%d\", &in);\n printf(\"%s\\n\", pres[in-1]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "077b86edd6fb9bb8093fdc9574ae6d4b", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint a,b,c,d,e,f,i,j,k,l;\n\tcin>>a;\n\tif(a==1)\n\t\tprintf(\"egbvx\\n\");\n\telse if(a==2)\n\t\tprintf(\"Adams\\n\");\n\telse if(a==3)\n\t\tprintf(\"ghh\\n\");\n\telse if(a==4)\n\t\tprintf(\"ggcxv\\n\");\n\telse if(a==5)\n\t\tprintf(\"xcvx\\n\");\n\telse if(a==6)\n\t\tprintf(\"hhrt\\n\");\n\telse if(a==7)\n\t\tprintf(\"erter\\n\");\n\telse if(a==8)\n\t\tprintf(\"Van Buren\\n\");\n\telse if(a==9)\n\t\tprintf(\"yuyu\\n\");\n\telse if(a==10)\n\t\tprintf(\"oho\\n\");\n\telse if(a==11)\n\t\tprintf(\"ttytr\\n\");\n\telse if(a==12)\n\t\tprintf(\"utrty\\n\");\n\telse if(a==13)\n\t\tprintf(\"qew\\n\");\n\telse if(a==14)\n\t\tprintf(\"ggtyu\\n\");\n\telse if(a==15)\n\t\tprintf(\"Bzcx\\n\");\n\telse if(a==16)\n\t\tprintf(\"qew\\n\");\n\telse if(a==17)\n\t\tprintf(\"ygy\\n\");\n\telse if(a==18)\n\t\tprintf(\"gxg\\n\");\n\telse if(a==19)\n\t\tprintf(\"rtr\\n\");\n\telse if(a==20)\n\t\tprintf(\"Gggh\\n\");\n\telse if(a==21)\n\t\tprintf(\"Azxcz\\n\");\n\telse if(a==22)\n\t\tprintf(\"ghh\\n\");\n\telse if(a==23)\n\t\tprintf(\"gcxb\\n\");\n\telse if(a==24)\n\t\tprintf(\"ugh\\n\");\n\telse if(a==25)\n\t\tprintf(\"ret\\n\");\n\telse if(a==26)\n\t\tprintf(\"yt\\n\");\n\telse if(a==27)\n\t\tprintf(\"Ta\\n\");\n\telse if(a==28)\n\t\tprintf(\"Wi\\n\");\n\telse if(a==29)\n\t\tprintf(\"Harding\\n\");\n\telse if(a==30)\n\t\tprintf(\"Coolidge\\n\");\n\telse if(a==31)\n\t\tprintf(\"over\\n\");\n\telse if(a==32)\n\t\tprintf(\"osvelt\\n\");\n\telse if(a==33)\n\t\tprintf(\"Tuman\\n\");\n\telse if(a==34)\n\t\tprintf(\"Esenhower\\n\");\n\telse if(a==35)\n\t\tprintf(\"nedy\\n\");\n\telse if(a==36)\n\t\tprintf(\"Jnson\\n\");\n\telse if(a==37)\n\t\tprintf(\"xon\\n\");\n\telse if(a==38)\n\t\tprintf(\"Fd\\n\");\n\telse if(a==39)\n\t\tprintf(\"Carter\\n\");\n\telse if(a==40)\n\t\tprintf(\"Rean\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0dfd88aa0ae0753b3f10a272b9db617f", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": " #include\n int main(){\n long long n,k;\n scanf(\"%lld %lld\",&n,&k);\n if((n / k) & 1) == 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "372fb49c59e69cb049464770a2f6fb4f", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\ntypedef long long ll;\n\nint main()\n{\n ll n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(k>=n)\n printf(\"YES\");\n else\n {\n if((n/k)%2==0)\n printf(\"NO\");\n else printf(\"YES\");\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\");\n }*/", "lang_cluster": "C", "compilation_error": true, "code_uid": "160e443af9f0d964e84b38622a8157b5", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n double n,k,d;\n while(scanf(\"%lf%lf\",&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", "lang_cluster": "C", "compilation_error": true, "code_uid": "cb02726134f244f891642d211db459bb", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main() { \nlong long n, k; \nscanf(\"%lld %lld\", &n, &k); \nprintf(((n / k) & 1 ? \"YES\" : \"NO\"); \nreturn 0; \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "470b55f2ae16f9c1643d9f32f0a411c2", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "GNU C", "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)\nprinf(\"%I64d\\n\" , odd_even );\n\nif(odd_even%2 == 0)\n printf(\"NO\");\nelse\n printf(\"YES\");\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1cd39acfd5f728102597628ddc025917", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\ntypedef struct\n{\n int a;\n int b;\n int c;\n}EleType;\n\nint transfer(EleType , EleType );\nint OddEven(int );\n\nint main(void)\n{\n int get;\n get = 0;\n EleType start, end;\n scanf(\"%d%d%d\", &start.a, &start.b, &start.c);\n scanf(\"%d%d%d\", &end.a, &end.b, &end.c);\n\n get = transfer(start, end);\n if (get == 1)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n\nint OddEven(int number)\n{\n if (abs(number) % 0.5 == 0)\n return 1;\n else return 0;\n}\n\nint transfer(EleType in, EleType out)\n{\n int i, j, k;\n int o, p ,q;\n o = 0;\n p = 0;\n k = 0;\n\n i = (in.a - out.a);\n j = (in.b - out.b);\n k = (in.c - out.c);\n\n if (i > 0)\n {\n if (OddEven(i))\n {\n p = i;\n i = 0;\n }\n else\n {\n p = i - 1;\n i = 1;\n }\n }\n if (j > 0)\n {\n if (OddEven(j))\n {\n o = j;\n j = 0;\n }\n else\n {\n o = j - 1;\n j = 1;\n }\n }\n if (k > 0)\n {\n if (OddEven(k))\n {\n q = k;\n k = 0;\n }\n else\n {\n q = k - 1;\n k = 1;\n }\n }\n if (!(o + p + q - i - j - k))\n return 1;\n else\n return -1;\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "945fb4cfbd89422c81b796473da5c31c", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nint main() \n{\n int a,b,c,x,y,z;\n cin >> a >> b >> c >> x >> y >> z;\n int n=0,k=0;\n ( a > x ) ? k += ( a - x ) / 2 : n += x - a;\n ( b > y ) ? k += ( b - y ) / 2 : n += y - b;\n ( c > z ) ? k += ( c - z ) / 2 : n += z - c;\n ( k >= n ) ? cout << \"Yes\" : cout << \"No\";\n // your code goes here\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "388578f461486e992fe77b245fc3e710", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint sum1=0,sum2=0;\nint a,b,c;\nint x,y,z;\nscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n\nif(a>x && b>y && cy && c>z)\n{\nsum1=(c-z+b-y)/2;\nsum2=x-a;\n}\nelse if(a>x && bz)\n{\nsum1=(a-x+c-z)/2;\nsum2=y-b;\n}\n\nelse if(a>x && by && cz)\n{\nsum1=(x-a+z-c);\nsum2=(y-b)/2;\n}\n\nif(sum1==sum2)\nprintf(\"Yes\\n\");\nelse\nprintf(\"No\");\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "987697c7e15fb16c8f5f62d2d4c2550b", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n\tint a,b,c,y,x,z,certo=0;\n\t\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\tscanf(\"%d %d %d\", &x, &y, &z);\n\t\n\tif(a==b)\n\t{\n\t\tcerto =1;\n\t}\n\tif(a==c)\n\t{\n\t\tcerto=1;\n\t}\n\tif(c==b)\n\t{\n\t\tcerto=1;\n\t}\n\tif(certo==1)\n\t{\n\t\tif(x==y)\n\t\t{\n\t\t\tprintf(\"Yes\");\n\t\t}\n\t\tif(x==z)\n\t\t{\n\t\t\tprintf(\"Yes\");\n\t\t}\n\t\tif(y==z)\n\t\t{\n\t\t\tprintf(\"Yes\");\n\t\t}\n\tprintf(\"No\");\n\telse\n\t{\n\t\tprintf(\"No\");\n\t}\nreturn 0;\n}\n\n/* 1521310650391 */\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9ea20d46eafe75749e224609e15002ae", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n\nint min(int a,int b){\n if(a\nint main(){\n\tint n,p,k;\n\tdo{\n printf(\"nhap vao so trang n= \"); scanf(\"%d\",&n);} while(n<3 || n>100);\n do{\n printf(\"nhap vao so trang hien tai p= \"); scanf(\"%d\",&p);} while(p<1 || p>n);\n do{\n printf(\"nhap vao so trang k= \"); scanf(\"%d\",&k);} while(k<1 || k>n);\n\tif(p==1){\n\t\tprintf(\"(1) \");\n\t\tif(n<= p+k)\n\t\t\tfor(int i=2; i<=n; i++)\n\t\t\tprintf(\"%d \",i);\n\t\telse {\n\t\t\tfor(int i=2; i<= p+k; i++)\n\t\t\tprintf(\"%d \",i);\n\t\t\tprintf(\">>\");\n\t\t}}\n\telse if(p==n){\n\t\tif(p-k<=1){\n\t\tfor(int i=1; i>\");}\n\t\telse for(int i=p+1; i<=n; i++) printf(\"%d \",i); }\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb959af06b34ab2f46018170e8ee7717", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \nint main ()\n{\n int n,p,k;\n \n scanf(\"%d%d%d\", &n, &p, &k);\n \n if (p+k>1)\n {\n printf (\"<<\");\n }\n \n for (i=p-k; i<=p=k;i++ )\n {\n if (1<=i && i<=n)\n {\n if(i==p)\n \n printf(\"(%d)\", i);\n }\n else printf (\"%d\",i);\n }\n \n if (p+k>\");\n }\n Return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4d154a14b24f3b4ce7be1aa36e1c5d63", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n,p,k,t,z;\n\tscanf(\"%d%d%d\",&n,&p,&k);\n\tif(p-k>1)\n\tprintf(\"<< \");\n\tt=n<=p+k?n:p+k;\n\tif(p-k<1)\n\tz=1;\n\telse\n\tz=p-k;\n\tfor(int i=z;i<=t;i++)\n\tif(i==p)\n\tprintf(\"(%d) \",i);\n\telse\n\tprintf(\"%d \",i);\n\tif(t>\");\n\t\n\t\n\treturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "78695dfce0edeee562cdf9df86627848", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n,p,k;\n int f=0;\n\n scanf(\"%d %d %d\",&n,&p,&k);\n int f=p-k;\n if(p-k > 1)\n printf(\"<< \");\n for(int i = p-k; i < p+k; i++)\n {\n if (f == p)\n {\n printf(\" (%d) \",f);\n f++;\n }\n else\n {\n printf(\" %d \",f);\n f++;\n }\n }\n if(p+k < n)\n printf(\" >>\");\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d4bf8dae6fcfd7e7b54b9257d4ef3f8", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,p,k;\n scanf(\"%d%d%d\",&n,&p,&k);\n if(p-k>1)\n printf(\"<< \");\n for(int i=p-k; i0)\n printf(\"%d \",i);\n }\n printf(\"(%d) \",p);\n int j;\n for(j=p+1;j<=p+k ; j++)\n {\n if(j>n)\n break;\n printf(\"%d \",j);\n\n }\n\n if(n>=10j)\n {\n printf(\">>\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0810c77a87f93a799a142755ba5eaaea", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint n,p=0,q=0,x,y;\nscanf(\"%d%d%d\",&n,&x,&y);\nif(n%2!=0)\n{if(y==n/2 || y==n/2-1|| y==n/2-1)\n{\nprintf(\"NO\");\n}\nelse\n{\nprintf(\"YES\");\n}\n}\nelse\n{\nif(y==n/2 || y==n/2+1)\n{\n printf(\"NO\");\n}\nelse\nprintf(\"YES\n \");\n}\nreturn(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5e9e55f796dfd9c03a1518b7ee75fcf2", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\nint n,x,y;\n\nscanf(\"%d%d%d\",&num,&x,&y);\nn=n/2;\n\nif((x==n||x==n+1) && (y==n||y==n+1))\n{\nprintf(\"NO\");\n}\n\nelse\n{\nprintf(\"YES\");\n}\nreturn(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6ff0ec6cb806901742171f3ba1f11adf", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\nint num,x,y,n;\n\nscanf(\"%d%d%d\",&num,&x,&y);\nn=num/2;\n\nif((x==n&&x=n+1) && (y==n&&y==n+1))\n{\nprintf(\"NO\");\n}\n\nelse\n{\nprintf(\"YES\");\n}\nreturn(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a340f743e23aba348609375d90820df5", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int n,x,y;\n scanf(\"%d%d%d\",&n,&x,&y);\n if(n==2||((x==n/2&&y==n/2)||(x==n/2&&y==(n/2)+1)(x==(n/2)+1&&y==n/2)){\n printf(\"NO\");\n return 0;\n }\n else {\n printf(\"YES\");\n return 0;\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0b9d2eca541e607e08adbf164ed8266f", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{int n,x,y;\n scanf(\"%d%d%d\",&n,&x,&y);\n if (((x>=n/2)((n/2)+1>=x))&&((y>=n/2)&&((n/2)+1>=y)))\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2ce3230d715c7520aa5d0717a6e188ce", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a[100];\n int r=0,count=0,i,j,k,n;\n scanf(\"%d\\n\",&n);\n for(i=0;ir)\n r=k;\n }\n if(a[n-1]==1)\n r++;\n\n printf(\"%d\\n\",r);\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e8821928014cbb0689e59afe020e8817", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#includeint dp[105], a[105];int max(int a, int b){\treturn a > b ? a : b;}int main(){\tint n, i, j, m, ans, pre; scanf(\"%d\",&n);\tpre = 0;\tfor (i = 1; i <= n; i++)\t{\t\tscanf(\"%d\",&a[i]);\t\tif (a[i] == 1)pre++;\t}\tif (a[1] == 0)dp[1] = 1;\telse dp[1] = 0;\tfor (i = 2; i <= n; i++)\t{\t\tif (a[i] == 1)\t\t\tdp[i] = max(dp[i - 1] - 1, 0);\t\telse if (a[i] == 0)\t\t\tdp[i] = max(0, dp[i - 1] + 1);\t}\tans = dp[1];\tfor (i = 2; i <= n; i++)\t\tans = max(ans, dp[i]);\tif (ans == 0)\t\tprintf(\"%d\",pre-1);\telse printf(\"%d\",pre+ans); \treturn 0;}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c665bb421922ae79ffe3228ede105865", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint n,i,j,c[100]={0},k,m=1111,x=0,t=0,p;\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include \nusing namespace std;\nint a[101];\nint main(){\n\tint n,i=1,j=1,k,temp=0;\n\tint ans=0;\n\tscanf(\"%d\",&n);\n\tfor(k=1;k<=n;k++){\n\t\tscanf(\"%d\",&a[k]);\n\t}\n\n\tfor(i=1;i<=n;i++){\n\t\t\n\t\tfor(j=1;j<=n;j++){\n\t\t\tans=0;\n\t\t\tfor(k=i;k<=j;k++){\n\t\t\t\tif(a[k]==1) a[k]=0;\n\t\t\t\telse a[k]=1;\n\t\t\t}\n\t\t\tfor(k=1;k<=n;k++){\n\t\t\t\tif(a[k]==1)\n\t\t\t\t\ttemp++;\n\t\t\t}\n\t\t\tif(temp>ans)\n\t\t\t\tans=temp;\n\t\t}\n\t\t\n\t}\n\n\tprintf(\"%d\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "23d82442dc7cc6ecccf6b4d9bc876349", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint compare(const void * a, const void * b){return *(int *)a-*(int *)b;}\nint main()\n{\n\tint n,j,i,a[1000],one[1000]={0};//a,b;\n\tscanf(\"%d\",&n);\n\tif(n==1)\n\t{\tscanf(\"%d\",&i)\n\t\tprintf(\"%d\",1-i);\n\t\treturn 0;\n\t}\n\tfor(i=0;ibb)\n\t\t\t\tmax1=aa+r;\n\t\t\telse\n\t\t\t\tmax1=bb+r;\n\t\t\tif(max1>max)\n\t\t\t\tmax=max1;\n\t\t}\n\t}\t\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "dd6205dc950344d82d0d7de3796f75ac", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include\nusing namespace std;\n\nint main()\n{\n int a[50],A,B,i,diff=1001;\n cin >> A >> B;\n for(i=0;i> a[i];\n\n sort(a, a+B);\n for(i=0;i+A-1<=B;i++)\n {\n if(a[i+A-1]-a[i]\n\nint main(void){\n int n,k,i,j,t=0,a[100],s=0,count=0;\n scanf(\"%d %d\", &n, &k);\n\n for(i=0;ia[j+1]){\n\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;}}}\n\n for(i=0;i=0;j--){\n if(a[i]==a[j-1]){\n s++;\n }\n }\n if(s==0){\n count++;\n\n }\n\n else{\n s=0;\n continue;\n }\n }\n\n printf(\"%d\\n\", k-(count-1));\n\n\n if(k-(count-1)==n){\n printf(\"0\");\n }\n\n else{\n printf(\"%d\", a[n-1]-a[0]);}}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e02c56204821ae94c5bd0876cfe9201e", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n int n,i,j,m,a[50],s=1000;\n scanf(\"%d %d\",&n,&m);\n for(i=0;ia[i]-a[i+3]) s=a[i]-a[i+3];\n }\n printf(\"%d\",s);\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9650c5dc185d50723d60653310bd8b5a", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int a[m];\n for(int i=0;i\n\nint main()\n{\n\n int x[50];\n int n,p,i,j=0,temp;\n scanf(\"%d %d\",&n,&p);\n\n for(i=0;i\n#include \n int main(){\n\nint n,m,k,i,min;\nscanf (\"%d%d%d\",&n,&m,&k);\n min=n-1;\nint *t=malloc (sizeof(int)*n);\nfor (i=0; i\n#include\n#include\n#define MAX 1000000009;\nint main() {\n int i,n,m,k,min=MAX,t,temp;\n scanf(\"%d %d %d\",&n,&m,&k);\n for(i=1;i<=n;i++) {\n scanf(\"%d\",&t);\n if(t>0 && t<=k) {\n temp = abs(m-i);\n if(temp\n#include\n\nint main()\n{\n\tint n,m,k,a[105],b[105],min,i,j=-1,x;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i\n#include\nint main () {\n\tint a[100],i,j,n,m,k;\n\tdo {\n\t\tprintf(\"n=\");\n\t\tscanf(\"%d\",&n);\n\t\tprintf(\"m=\");\n\t\tscanf(\"%d\",&m);\n\t\tprintf(\"k=\");\n\t\tscanf(\"%d\",&k);\n\t} while (n<1||m>n||m<1||k<1);\n\tfor (i=0;i\nusing namespace std;\nint main()\n{\n long long y,sum=0,sum1=0,dis[10001],n,m,k,vill[10001],vs[10001],v[10001],s=0;\n cin>>n;\n cin>>m;\n cin>>k;\n for(int i=0;i>vill[i];\n }\n sum1=(m-1)*10;\n\n for(int j=0;j0)\n {\n v[s]=vill[j];\n vs[s]=j;\n dis[s]=sum;\n s++;\n }\n sum=sum+10;\n }\n for(int z=0;z\nusing namespace std;\nint a,b,c;\nint main(){\n\tcin >> a >> b >> c;\n\tif((a+b+c)%2==0 && a+b>=c && a+c>=b && b+c>=a){\n\t\tcout << (a+b-c)/2 <<\" \" << (b+c-a)/2 << \" \" << (a+c-b)/2;\n\t}\n\telse cout << \"Impossible\\n\";\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5e037a1d4fbe2de92cdec117eedf6818", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0} {"lang": "GNU C", "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)){\n printf(\"Impossible\");\n }\n else{\n printf(\"%d %d %d\",((a+b-c)/2),((-a+b+c/2)),((a-b+c)/2))\n }\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "16aa7a2792aa200b1dc0fb69a7af9fe2", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0} {"lang": "GNU C", "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\",((a+b-c)/2),((-a+b+c/2)),((a-b+c)/2));\n }\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d9e6ddb8ca876d0ae4c7170262c81d23", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint a,b,c;\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "fdf39adeeb3ab84b1baf63f0849f7951", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#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", "lang_cluster": "C", "compilation_error": true, "code_uid": "8bfe0078e91f632267abd87e9edfc9da", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "int main()\n{\n char s[100];\n int i;\n string a=\"NO\";\n scanf(\"%100s\",s);\n for(i=0;i<=100;i++){\n if(s[i]=='Q'||s[i]=='H'||s[i]=='9'){a=\"YES\";}\n }\n printf(\"%s\",a.c_str());\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d70f3a4d2deb57a3c24db5be74e8cd05", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nint main()\n{\nint c=0,i;\n char p[100];\n\n gets(p);\n\n {for(i=0;i=33)&&(p[i]<=126)))\n {printf(\"YES\");\n c++;\n break;}\n else continue;}\n if(c==0)\n {printf(\"NO\");\nexit(1);}}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ac2a3fa7557e9995ffce513ff79b49a2", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n char str[100];\n gets(str);\n l=strlen(str);\n for(int i=0;str[i]\n#include\n#include\n#include\n#include\nusing namespace std;\nint main(){\n\tchar a[105];\n\tint i, t, f;\n\tcin >> a;\n\tf = 0;\n\tt = strlen(a);\n\tfor (i = 0; i <= (t - 1); i++) {\n\t\tif (a[i] == 'Q' || a[i] == '9' || a[i] == 'H' ) { cout << \"YES\"; f = 1; break; }\n\n\t}\n\tif (f == 0)cout << \"NO\";\n\t\n\treturn 0;\n}\n \t \t\t \t\t \t \t\t \t\t\t \t\t\t\t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "f28c294939de349ed889802cf1d8c563", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n int main()\n{ char s[100];\n int i=0,flag=0;\n scanf(\"%s\",s);\n while(s[i]!='\\0')\n { if(s[i]== 'H'||s[i]== 'Q'||s[i]=='9'||(s[i]=='+'&& s[i+1]='\\0'))\n { flag=1;\n break;\n }i++;\n }\n if(flag==1)\n printf(\"YES\");\n else printf (\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a51fe1821217f2b6d3a07b74580d40c9", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n\nvector ans;\nvoid process(int n)\n{\n ans.clear();\n ans.push_back(n);\n while(--n)\n {\n if(ans[ans.size()-1]%n==0)\n {\n ans.push_back(n);\n }\n }\n for(int i=0 ;i<(int)ans.size() ;i++)\n {\n printf(\"%d%c\",ans[i],i==(int)ans.size()-1?'\\n':' ');\n }\n}\n\nint main()\n{\n // freopen(\"in.txt\",\"r\",stdin);\n int n;\n while(cin>>n)\n {\n process(n);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c12298675c3dc52fabece940b470d36", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,x;\n scanf(\"%d\", &n);\n b=n;\n for(int i=n; i>=1; i--){\n if(x%i==0){\n x=i;\n printf(\"%d \", i);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "05aa6d7c85684acc0d7d031d0773d7de", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#pragma comment(linker, \"/STACK:1024000000,1024000000\")\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#define eps 0.0000000001\n#define bpr 999983\n#define spr 111123\n#define pi acos(-1.0)\n#define imax 2139062143\n#define mod 1000000007\n#define golden (sqrt(5)+ 1)/2\n#define reset(a,b) memset(a,b,sizeof(a))\n#define dmax 1e20\n#define siz 1005\n#define ze 2.718281828459\nusing namespace std;\nint ans[1000006];\nint dij[1000006];\nint mmax;\nvoid dfs(int now,int num)\n{\n\tdij[num]=now;\n\tfor (int i=2;immax)\n\t{\n\t\tmmax=num;\n\t\tfor (int i=0;i<=num;i++)\n\t\t\tans[i]=dij[i];\n\t}\n\treturn ;\n}\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tmmax=0;\n\tif (n==1)\n\tprintf(\"1\\n\");\n\telse\n\t{\n\tdfs(n,0);\n\tfor (int i=0;i<=mmax;i++)\n\tprintf(\"%d \",ans[i]);\n\tprintf(\"\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3215be92c92bab3a1fec6b2a11991c01", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\nint ans[1000006];\nint dij[1000006];\nint mmax;\nvoid dfs(int now,int num)\n{\n\tdij[num]=now;\n\tfor (int i=2;immax)\n\t{\n\t\tmmax=num;\n\t\tfor (int i=0;i<=num;i++)\n\t\t\tans[i]=dij[i];\n\t}\n\treturn ;\n}\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tmmax=0;\n\tif (n==1)\n\tprintf(\"1\\n\");\n\telse\n\t{\n\tdfs(n,0);\n\tfor (int i=0;i<=mmax;i++)\n\tprintf(\"%d \",ans[i]);\n\tprintf(\"\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6687188ead212a2da4942db03620808c", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n int mon, x , lcf;\n\n scanf(\"%d\", &mon);\n printf(\"%d \", mon);\n for(x = mon; x > 1;){\n \tfor(lcf = 2; lcf <= x; lcf++){\n \t\tif(trav % lcf == 0){\n \t\t\tx = x / lcf;\n\t \t\tbreak;\t\t\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d \", x);\n\t}\n getch();\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5b3852d8b5494ce2b9d53c2e2611ca76", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main{\nint a[5],sum=0,count=1,temp,i,j;\nfor(i=0;i<5;i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n}\nfor(i=0;i<4;i++){\n for(j=0;j<5-i;j++){\n if(a[i]\nusing namespace std;\nint main()\n{int i,n[5],c=0,m=0,s=0,l=0,lr=0;\n for(i=0,s=0;i<5;i++){\n cin>>n[i];s+=n[i];\n }lr=s;\n for(i=0;i<5;i++)\n {for(m=0,l=0,c=0;m<5&&c<3;m++)\n {if(n[i]==n[m]){c++;l+=n[m];}}if(c>1)lr=min(lr,s-l);}\ncout<\nint main()\n{\n int i,c[5],a[101];\n for(i=0;i<5;i++)\n {\n scanf(\"%d\",&c[i]);\n a[c[i]]++;\n sum+=c[i];\n }\n for(i=0;i<5;i++)\n {\n if((a[c[i]]==2)||(a[c[i]]==3))\n sum-=(a[c[i]]*c[i]);\n }\n printf(\"%d\",sum);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "823e63d8b41bea3a5466a44b8ae24124", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\t\n\tint a[5];\n\t\n\tint arr[101];\n\t\n\tint i;\n\tfor(i=0;i<5;i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\t\n\tfor(i=0;i<101;i++) {\n\t\tarr[i]= 0;\n\t}\n\t\n\tfor(i=0;i<5;i++) {\n\t\tarr[a[i]]++;\n\t}\n\t\n\tint max=0;\n\t\n\tfor(i=0;i<101;i++) {\n\t\tif(arr[i]>0) {\n\t\t\tif(arr[i]==2) {\n\t\t\t\tif(max<2*i) {\n\t\t\t\t\tmax = 2*i;\t\n\t\t\t\t}\n\t\t\t\t//max = 2*i;\n\t\t\t} else if(arr[i]>=3) {\n\t\t\t\tif(max<3*i) {\n\t\t\t\t\tmax=3*i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tint sum=0;\n\tfor(i=0;i<5;i++) {\n\t\tsum = sum + a[i]\n\t}\n\tprintf(\"%d\\n\",sum-max);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ff9f14d55c22a554a2d2d8754421a659", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "include\nint main (){\nint a[5],sum=0,count=1,temp,i,j;\nfor(i=0;i<5;i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n}\nfor(i=0;i<4;i++){\n for(j=0;j<5-i;j++){\n if(a[i]\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(\"%ld\",temp%D;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "abbfb7983e9fdcaf4dadf0f732af7e90", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main() {\nlong long int n,m,z=0,p,q,r;\nscanf(\"%I64d\",&n);\nm=n;r=n;\nwhile(r!=0){\n r=r/10;\n z++;\n}\nwhile(1){\n n++;q=0;\n int i;p=n;\n for(i=0;i0){break;}\n}\nprintf(\"%d\",n-m,);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "460f336b9cc8faeef307a080b2f5a553", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nkontrol (long long n)\n{\n long long i;\n long long flag = 0;\n if(n%10==-8)return 1;\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 long i,k,temp;\n scanf(\"%lld\",&k);\n for(i=k+1;i<8888888888;i++)\n if(kontrol(i)==1){temp=i-k;break;}\n printf(\"%lld\",temp);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "68d571efe326ef15f6a081e994df38f4", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{ \n int num[100],num2[100];\n \n int 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\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a1fff13b3fc73c329803db2ae925d87f", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n int n=0,i=0,j=0,count1=0,count2=0,ans=0,temp=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;icount2)\n ans=count1;\n else \n ans= count2;\n \n if(n>0&&ans==0)\n ans=1;\n printf(\"%d\\n\",ans);\n \n \n \n getch();\n return 0; \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a586e6733d31883ce11a2aeb8bb3ebe", "src_uid": "7c710ae68f27f140e7e03564492f7214", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint arr[100];\nint main()\n{\n int n,i,j,s;\n scanf(\"%d\",&n);\n for(i=0;iarr[j])\n {\n s=arr[i];\n arr[i]=arr[j];\n arr[j]=s;\n }\n }\n }\n int k=0,count;\n for(i=0;i=0)\n {\n arr[i]=-1;\n int p=1;\n for(j=i+1;j=p)\n {\n arr[j]=-1;\n p++;\n }\n }\n \n k++;\n }k\n }\n \n printf(\"%d\",k);\n return 0;\n} \n \n \n \n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "df6403284449cf977dd5cb37b79dbf9e", "src_uid": "7c710ae68f27f140e7e03564492f7214", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nint cmp(const void *a,const void *b);\nint main()\n{\n int box[100];\n int N;\n int pile=0;\n scanf(\"%d\",&N);\n getchar();\n for(int i=0;i\n#define swap(a,b) { t=a; a=b; b=t; }\n\nint n;\nint h[100000],son=0,t,k,l,hh[10000];\nvoid ekle(int x)\n{\n\th[++son]=x;\n\tk=son;\n\twhile(k/2)\n\t{\n\t\tif(h[k/2]h[2*k] && 2*k+1 <= n);\n\t\tif(x<=h[k])\th[k/2] = h[k];\n\t\telse{ k /= 2; break; }\n\t}\n\th[k] = x;\n}\nint main()\n{\n\tint i,j,a;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i0)\n\t{\n\t\tt++;\n\t\tb=1;\n\t\tyukseklik=0;\n\t\t//terim=0;\n\t\t//puts(\"\");\n\t\twhile(b\n//#include \n\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n int n=0,i=0,j=0,count1=0,count2=0,ans=0,temp=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;icount2)\n ans=count1;\n else \n ans= count2;\n \n if(n>0&&ans==0)\n ans=1;\n printf(\"%d\\n\",ans);\n \n \n \n //getch();\n return 1; \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "984f426023d0392b88700b256ee40f8e", "src_uid": "7c710ae68f27f140e7e03564492f7214", "difficulty": 1400.0} {"lang": "GNU C11", "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\tsystem(\"pause\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9d7db84455dd676a1e5954394028965f", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAX 1000000\n\nvoid 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;\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;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4e059eee93a3ec20fc510531d2bc35ca", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \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]=3;\n ara[8]=7;\n ara[9]=6;\n visited[0]=6;\n long long sum=6;\n for(i=1;i<=1000010;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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f94edce2ef02573b970ef793689fcdc0", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "813aa32f127c33eb43485929014d0cb4", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "GNU C11", "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){\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5f8131dd67f59973a176f05bc83123ee", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#define counter.is_even counter%2==0\n#define counter.is_nonzero counter!=0\nint gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n}\nlong long int vertexes[11111];\nint main(void) {\n\tlong long int n, counter, position, maximum = 1;\n\tscanf(\"%I64d\", &n);\n\tfor(int i = 1; i <= n; i++) {\n scanf(\"%I64d\", &vertexes[i]);\n }\n\tfor(int i = 1; i <= n; i++){\n\t\tcounter = 1;\n\t\tposition = vertexes[i];\n\t\twhile(position != i) {\n\t\t\tposition = vertexes[position];\n\t\t\tcounter++;\n\t\t\tif( counter > 100 || vertexes[position] == position) {\n printf(\"-1\");\n return 0;\n }\n\t\t}\n\t\tif(counter.is_even) {\n counter = counter / 2;\n }\n\t\tif(counter.is_nonzero) {\n maximum = maximum * counter / gcd(maximum, counter);\n }\n\t}\n\tprintf(\"%I64d\", maximum);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "844c08ee4dc7e6f55fa15f8166f1ccf9", "src_uid": "149221131a978298ac56b58438df46c9", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\ntypedef long long unsigned llu;\ntypedef unsigned u;\nllu G(llu x,llu y){return y?G(y,x%y):x;}\nu N[111],V[111],A[111];\nint main()\n{\n\tu n,i=0,j;llu r=1,k;\n\tfor(scanf(\"%u\",&n);i++>=1;\n\t\tr=r/G(r,k)*k;\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0d93e23dceed7a23972fcf642f262a55", "src_uid": "149221131a978298ac56b58438df46c9", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint gcd(int,int);\nint main()\n{\n int n,a[105],b[105],k,x,f,ans,vis[105];\n int i,j;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {scanf(\"%d\",&a[i]);\n vis[i]=0;}\n j=0;\n for(i=1;i<=n;i++)\n {\n \n k=0;\n x=i;\n f=0;\n if(vis[i]==0){\n while(1)\n {\n vis[x]=1; \n x=a[x];\n k++; \n if(x==i)\n {\n b[j]=k;\n j++;\n break;\n }\n if(k>=n)\n {f=1;\n break;}\n } \n if(f==1)\n {printf(\"-1\\n\");\n break;}}\n }\n if(f==0)\n {\n for(i=0;i\ntypedef long long int lli;\nint a[110];\nint m[110];\nlli c[110];\nlli mcm(lli a,lli b);\nlli mcd(lli a,lli b);\nlli min(lli a,lli b);\nlli max(lli a,lli b);\nlli cycl(int w,int s,int q);\nint main(){\n int i,n,m;\n lli t,r;\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 c[i]=cycl(i,i,0);\n if(c[i]==-1){\n printf(\"-1\");\n return 0;\n }\n if(c[i]%2==0){\n c[i]/=2;\n }\n }\n if(n==1){\n printf(\"%I64d\\n\",c[1]);\n }else{\n r=mcm(c[1],c[2]);\n for(i=1;i<=n;i++){\n r=mcm(r,c[i]);\n }\n printf(\"%I64d\\n\",r);\n }\n return 0;\n}\nlli min(lli a,lli b){\n if(ab)return a;return b;\n}\nlli mcm(lli a,lli b){\n return a*b/mcd(a,b);\n}\nlli mcd(lli a,lli b){\n lli r;\n\tr=a%b;\n\tif (r==0)return(b);\n\telse return(mcd(b,r));\n}\nlli cycl(int w,int s,int q){\n int i;\n long long int r;\n m[w]=1;\n if(m[a[w]]){\n if(a[w]==s){\n r=q+1;\n }else{\n r=-1;\n }\n }else{\n r=cycl(a[w],s,q+1);\n }\n m[w]=0;\n return r;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "716e4443cd3e41b3630e68a4518fbd9c", "src_uid": "149221131a978298ac56b58438df46c9", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint gcd(int,int);\nint main()\n{\n int n,a[105],b[105],k,x,f,ans;\n int i,j;\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 {\n \n k=0;\n x=i;\n f=0;\n while(1)\n {\n x=a[x];\n k++; \n if(x==i)\n {\n b[i]=k;\n break;\n }\n if(k>=n)\n {f=1;\n break;}\n } \n if(f==1)\n {printf(\"-1\\n\");\n break;}\n }\n if(f==0)\n {\n for(i=1;i<=n;i++)\n {\n if(b[i]%2==0)\n b[i]/=2;\n }\n ans=b[1];\n for(i=2;i<=n;i++)\n {\n ans=(ans*b[i])/gcd(ans,b[i]); \n }\n printf(\"%d\\n\",ans);\n }\n return 0;\n}\n\nint gcd(int p,int q)\n{\n if(q==0)\n return p;\n int t;\n if(p\nint main()\n{\n int n,last,k;\n scanf(\"%d\",&n);\n last=n%10;\n if(last==0)\n {\n printf(\"%d\",n);\n }\nelse if(last<=5)\n {\n k = n/10;\n printf(\"%d\",k*10);\n }\n else(last>5)\n {\n k = (n/10) +1;\n printf(\"%d\",k*10);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "626bb8d1167dcd81412ecfdd28081457", "src_uid": "29c4d5fdf1328bbc943fa16d54d97aa9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f331d0d84b8dcead9849a20e8d3d863e", "src_uid": "29c4d5fdf1328bbc943fa16d54d97aa9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long i,j,n,m,a=0,b=0,c=0,d=0,e=0,dk=0,last=0;\n scanf(\"%d\\n\",&n);\n last =n%10;\n if(last==0)\n printf(\"%d\",n);\n else if(last==1)\n printf(\"%d\\n\",n-1);\n if(last==2)\n printf(\"%d\\n\",n-2);\n if(last==3)\n printf(\"%d\\n\",n-3);\n if(last==4)\n pritnf(\"%d\\n\",n-4);\n if(last==5)\n printf(\"%d\\n\",n-5);\n if(last==6)\n printf(\"%d\\n\",n+4);\n if(last==7)\n pritnf(\"%d\\n\",n+3);\n if(last==8)\n printf(\"%d\\n\",n+2);\n if(last==9)\n pritnf(\"%d\\n\",n+3);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2cd7f857d0f8f918239270970ce71fd2", "src_uid": "29c4d5fdf1328bbc943fa16d54d97aa9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n,last=0;\n scanf(\"%d\",&n);\n last=n%10\n if(last==0)\n printf(\"%d\",n);\n else if(last==1)\n printf(\"%d\",n-1);\n else if(last==2)\n printf(\"%d\",n-2);\n else if(last==3)\n printf(\"%d\",n-3);\n else if(last==4)\n printf(\"%d\",n-4);\n else if(last==5)\n printf(\"%d\",n-5);\n else if(last==6)\n printf(\"%d\",n+4);\n else if(last==7)\n printf(\"%d\",n+3);\n else if(last==8)\n printf(\"%d\",n+2);\n else if(last==9)\n printf(\"%d\",n+1);\n else\n printf(\"0\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7ffa971dc9b6636c67e99bcf9c6f70a", "src_uid": "29c4d5fdf1328bbc943fa16d54d97aa9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "include\nint main()\n{\n int num,ans;\n scanf(\"%d\",&num);\n int res=num%10;\n if(res==5) ans=num+5;\n else if(res<5) ans=num-res;\n else if(res>6) ans=num+10-res;\n printf(\"%d\\n\",ans);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dbf85b7cefc0f6cb9d8fdec0d53a48a7", "src_uid": "29c4d5fdf1328bbc943fa16d54d97aa9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\ninline void printRepr(int num){\n if(num >= 5){\n printf(\"-O|\");\n num-=5;\n }\n else{\n printf(\"O-|\");\n }\n switch(num){\n case 0:printf(\"-OOOO\");\n break;\n case 1:printf(\"O-OOO\");\n break;\n case 2:printf(\"OO-OO\");\n break;\n case 3:printf(\"OOO-O\");\n break;\n case 4:printf(\"OOOO-\");\n break;\n }\n printf(\"\\n\");\n return;\n}\n\nint main(){\n int number,temp;\n scanf(\"%d\",&number);\n if(number==0){\n printf(\"O-|-OOOO\");\n }\n while(number > 0 ){\n temp=number%10;\n printRepr(temp);\n number/=10;\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7a853d78ed76b9501dcdb45a6578fed3", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nvoid main()\n\n{\nint n,x,y,i;\nscanf(\"%d\",&n);\nwhile(n%10!=0 ||n!=0)\n{\nx=n%10;\nif(x==0)\nprintf(\"O-|-OOOO\");\nelse\n{\nif(x<5)\nprintf(\"O-|\");\n}\nelse if(x>=5)\n{\nprintf(\"-O|\");\nx=x-5;\n}\ny=1;\nwhile(y<=4)\n{\nwhile(y<=x)\n{\nprintf(\"O\");\nif(y==x && y!=4)\n{\nprintf(\"-\");\n}\ny++;\n}\nif(y<=4)\nprintf(\"O\");\ny++;\n}\n}\nprintf(\"\\n\");\nn=n/10;\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3e6e0356044670b072325f5d8442b571", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n char ch[11];\n scanf(\"%s\",ch);\n int l=strlen(ch);\n int i,j;\n for(j=0;j\n#include \nchar str[15][15];\nint main()\n{\n int i,n,j,a[50];\n strcpy(str[0],\"O-|-OOOO\");\n strcpy(str[1],\"O-|O-OOO\");\n strcpy(str[2],\"O-|OO-OO\");\n strcpy(str[3],\"O-|OOO-O\");\n strcpy(str[4],\"O-|-OOOO\");\n strcpy(str[5],\"-O|-OOOO\");\n strcpy(str[6],\"-O|O-OOO\");\n strcpy(str[7],\"-O|OO-OO\");\n strcpy(str[8],\"-O|OOO-O\");\n strcpy(str[9],\"-O|-OOOO\");\n while(~scanf(\"%d\",&n))\n {\n i=0;\n (n==0){\n printf(\"%s\\n\",str[0];\n continue;\n }\n while(n!=0)\n {\n a[i++]=n%10;\n n=n/10;\n }\n for(j=0;j\n#include \nint main()\n{\n long int n;\n int d,i;\n int digit[10];\n scanf(\"%ld\",&n);\n d=(int)(log(n)/log(10))+1;\n for (i=1;i<=d;i++)\n {\n digit [i]=int(n/pow(10,i-1))-int(n/pow(10,i))*10;\n printf(\"%d \",digit[i]);\n if (digit [i]==0){\n printf(\"0-|-0000\\n\");\n }\n else if (digit [i]==1){\n printf(\"0-|0-000\\n\");\n }\n else if(digit [i]==2){\n printf(\"0-|00-00\\n\");\n }\n else if(digit [i]==3){\n printf(\"0-|000-0\\n\");\n }\n else if(digit [i]==4){\n printf(\"0-|0000-\\n\");\n }\n else if(digit [i]==5){\n printf(\"-0|-0000\\n\");\n }\n else if(digit [i]==6){\n printf(\"-0|0-000\\n\");\n }\n else if(digit [i]==7){\n printf(\"-0|00-00\\n\");\n }\n else if(digit [i]==8){\n printf(\"-0|000-0\\n\");\n }\n else if(digit [i]==9){\n printf(\"-0|0000-\\n\");\n }\n \n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d87a6f8dd6ea99b7d0c93c789f5de843", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\n#define MOD 1000003\n\nint mapping(char c)\n{\n\tswitch(c)\n\t{\n\t\tcase '>':\n\t\t\treturn 8;\n\t\tcase '<':\n\t\t\treturn 9;\n\t\tcase '+':\n\t\t\treturn 10;\n\t\tcase '-':\n\t\t\treturn 11;\n\t\tcase '.':\n\t\t\treturn 12;\n\t\tcase ',':\n\t\t\treturn 13;\n\t\tcase '[':\n\t\t\treturn 14;\n\t\tcase ']':\n\t\t\treturn 15;\n\t}\n \n\n}\nint length(char* c)\n{\n\tint i=0;\n\tfor(;c[i]!='\\0';i++){}\n\treturn i;\n}\n\nint fastMod(int a,int b,int m)\n{\n\tint i=1;\n\tint result=1;\n\tif(a==0 || m==1)\n\t{\n\t\treturn 0;\n\t}\n\tif (b==0)\n\t{\n\t\treturn 1;\n\t}\n\tif(b==1)\n\t{\n\t\treturn a%m;\n\t}\n\tresult=((a%m)*(a%m))%m;\n\tfor(i=1;i<=b-2;i++)\n\t{\n\t\tresult=(result*(a%m))%m;\n\t}\n\treturn result;\n\t\n}\nint main()\n{\n \tchar unary[150];\n int len=0;\n\tint result=0;\n\tint i=0;\n\n\tscanf(\"%s\",unary);\n len=length(unary);\n\tfor(i=0;i!=len;i++)\n\t{\n\t\tresult=result+((mapping(unary[i])%MOD)*(fastMod(16,len-i-1,MOD)))%MOD;\n\t}\n\tprintf(\"%d\\n\",result%MOD);\n \n\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b915641b631b02c29200528755b052ad", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n#define MOD 1000003\n\nlong long int mod(long long int p, long long int m)\n{\n\tif(p==0)\n\t\treturn 1;\n\telse if(p==1)\n\t\treturn 2;\n\telse if(p%2)\n\t\treturn (mod(1,m)*mod(p-1,m))%MOD;\n\telse\n\t\treturn (mod(p/2,m)*mod(p/2,m))%MOD;\n}\n\nint main()\n{\n\tchar p[100],s[100];\n\tscanf(\"%s\",p);\n\n\tfor(long long int i=0;p[i]!='\\0';i++)\n\t{\n\t\tif(p[i]=='>')\n\t\t{\t\n\t\t\tstrcat(s,\"1000\");\n\t\t\t\n\t\t}\n\t\telse if(p[i]=='<') \n\t\t{ \n\t\t\tstrcat(s,\"1001\");\n\t\t}\n\t\telse if(p[i]=='+')\n\t\t{ \n\t\t\tstrcat(s,\"1010\");\n\t\t}\n\t\telse if(p[i]=='-')\n\t\t{ \t\n\t\t\tstrcat(s,\"1011\");\n\t\t}\n\t\telse if(p[i]=='.') \n\t\t{\t\n\t\t\tstrcat(s,\"1100\");\n\t\t}\n\t\telse if(p[i]==',')\n\t\t{\n\t\t\tstrcat(s,\"1101\");\n\t\t}\n\t\telse if(p[i]=='[') \n\t\t{\t\n\t\t\tstrcat(s,\"1110\");\n\t\t\t//puts(s);\n\t\t}\n\t\telse \n\t\t{\n\t\t\tstrcat(s,\"1111\");\n\t\t\t//puts(s);\n\t\t}\n\t}\n\n\tlong long int ans=0,flag=0;\n\tfor(long long int i=strlen(s)-1;i>=0;i--)\n\t{\n\t\tlong long int temp=0;\n\t\tif(s[i]=='1')\n\t\t\ttemp = mod(flag,MOD);\n\t\tans = (ans+temp)%MOD;\n\t\tflag++;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c7a14f83d44b082a792e0682ef24c6c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#define M 1000003\n\nint main()\n{\n int i=0;\n long int x=0;\n char s[105],c;\n scanf(\"%s\",s);\n c=s[i];\n while(c!='\\0')\n {\n if(c=='>')\n x=(x*16)%M+8;\n else if(c=='<')\n x=(x*16)%M+9;\n else if(c=='+')\n x=(x*16)%M+10;\n else if(c=='-')\n x=(x*16)%M+11;\n else if(c=='.')\n x=(x*16)%M+12;\n else if(c==',')\n x=(x*16)%M+13;\n else if(c=='[')\n x=(x*16)%M+14;\n else\n x=(x*16)%M+15;\n }\n printf(\"%ld\",(x%M));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c9f9bfe5910d3fd85ef781623fa8f2eb", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nconst int N = 100005;\nint n;\nchar str[N];\n\nint trans(char ch){\n switch (ch){\n case '>':\n return 8;\n case '<':\n return 9;\n case '+':\n return 10;\n case '-':\n return 11;\n case '.':\n return 12;\n case ',':\n return 13;\n case '[':\n return 14;\n case ']':\n return 15;\n }\n return -1;\n}\n\nint main(){\n gets(str+1);\n n = strlen(str+1);\n int ans = 0 , i;\n for (i=1;i<=n;i++){\n ans = ans * ( 1 << 4 ) + trans(str[i]);\n ans %= 1000003;\n }\n printf(\"%d\\n\",ans);\n}\n\n#include \n#include \nconst int N = 100005;\nint n;\nchar str[N];\n\nint trans(char ch){\n switch (ch){\n case '>':\n return 8;\n case '<':\n return 9;\n case '+':\n return 10;\n case '-':\n return 11;\n case '.':\n return 12;\n case ',':\n return 13;\n case '[':\n return 14;\n case ']':\n return 15;\n }\n return -1;\n}\n\nint main(){\n gets(str+1);\n n = strlen(str+1);\n int ans = 0 , i;\n for (i=1;i<=n;i++){\n ans = ans * ( 1 << 4 ) + trans(str[i]);\n ans %= 1000003;\n }\n printf(\"%d\\n\",ans);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3d0a59b943cbd43dfccebb05f52a00bf", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define s(t) scanf(\"%d\",&t)\n#define sl(t) scanf(\"%ld\",&t)\n#define sll(t) scanf(\"%d\",&t)\n#define p(t) printf(\"%d\\n\",t)\n#define pl(t) printf(\"%ld\\n\",t)\n#define pll(t) printf(\"%lld\\n\",t)\n#define p2(m,n) printf(\"%d %d\\n\",m,n)\n#define s2(m,n) scanf(\"%d %d\",&m,&n)\n#define f(i,j) for(i=0;i p;\n int size;\n int prime[79000];\n\n void sieve(){\n size=0;\n long long i,j;\n p.set(0,1);\n p.set(1,1);\n prime[size++]=2;\n for(i=3;i')\n {\n a[j++]='1';\n a[j++]='0';\n a[j++]='0';\n a[j++]='0';\n }\n else if(ch[i]=='<')\n {\n a[j++]='1';\n a[j++]='0';\n a[j++]='0';\n a[j++]='1';\n }\n else if(ch[i]=='-')\n {\n a[j++]='1';\n a[j++]='0';\n a[j++]='1';\n a[j++]='1';\n }\n else if(ch[i]=='.')\n {\n a[j++]='1';\n a[j++]='1';\n a[j++]='0';\n a[j++]='0';\n }\n else if(ch[i]==',')\n {\n a[j++]='1';\n a[j++]='1';\n a[j++]='0';\n a[j++]='1';\n }\n else\n if(ch[i]=='[')\n {\n a[j++]='1';\n a[j++]='1';\n a[j++]='1';\n a[j++]='0';\n }\n else //if(ch[i]=='.')\n {\n a[j++]='1';\n a[j++]='1';\n a[j++]='1';\n a[j++]='1';\n }\n }\n \n //puts(a);\n long long int c=0;\n for(i=j-1;i>=0;i--)\n {\n if(a[i]=='1')\n {\n c+=pow(2,(j-1-i));\n //printf(\"%c %d\\n\",a[i],c);\n c%=1000003;\n }\n //c%=1000003;\n }\n //p(c%1000003);\n printf(\"%d\\n\",c%1000003;);\n\nret(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "88020c6b26985b74adba319a95069f29", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "main(n){scanf(\"%d\",&n);n++;printf(\"%d\\n\",(n/2+n&1)*n/2);}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3bb3eee5feff24d674251294903098ed", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n == 1) {\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t} else if(n == 2) {\n\t\tprintf(\"2\");\n\t\treturn 0;\n\t}\n\tint i = 0;\n\tn -= 3;\n\tint p = 1;\n\tfor(i = 0; i < n; ++i) {\n\t\tp *= 2;\n\t}\n\tprintf(\"%d\", n+3+p);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8e5f2b9ff7ab1aa5c57cbcfb00c9070c", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\nint n,j,i;\nscanf(\"%d\",&n);\nint sum=n*(n+1)/2;\nint x=sum-n;\nif(x=1)\n sum=sum-(1);\n else\n sum=sum-(2*x);\n\n\nprintf(\"%d\",sum);\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5b1bd77d15ad94cc53f09476a9e669ad", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i, p = 0;\n\t--n;\n\tfor(i = 1; i < n; ++i) {\n\t\t++p;\n\t}\n\tprintf(\"%d\", n+1+p);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f06f458e8448d3fc24dcb4407e835efb", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n//week3\nint di(int n)\n{\n if(n==1) return 1;\n if(n==2) return 2;\n if(n==3) return 4;\n if(n==4) return 6;\n else return 2*di(n-1)-2*di(n-3)+di(n-4);\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int m=di(n);\n printf(\"%d\\n\",m);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee0d29944712718d209bb82a9fa41572", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int h, r;\n scanf(\"%d\",&r);\n scanf(\"%d\",&h);\n printf(\"%d\",(1 + ((2*h)/r)));\n}\n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cadec07015f59ad7d2f9c89129ccf897", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint r,h,vol;\nint main()\n{\n\tscanf(\" %d %d\",&r,&h);\n\n\tvol = h / r * 2;\n\th %= r;\n\tif (2*h= sqrt(3)*r)\n\t\tvol += 3;\n\telse\n\t\tvol += 2;\n\tprintf(\"%d\",vol);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "529eef7954227c5aa17cbdf87e2b7fba", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nmain()\n{\n\tlong long h,r;\n\tlong long t;\n\tscanf(\"%I64d %I64d\",&r,&h);\n\tt=h%r;\n\tif(2*t>=r)\n\t{\n\t\tprintf(\"%I64d\",2+h/r*2);\n\t}\n\telse\n\t{\n\t\tprintf(\"%I64d\",1+h/r*2);\n\t}\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "afb57c812c80c010c7591490196d26b1", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nmain()\n{\nint h, r, ans;\nscanf(\"%d\",&r);\nscanf(\"%d\",&h);\nans = 2*h/r;\nans += ((2*m>=r)?2:1)\nans += ((2.0*m>=(sqrt(3.0)*r))?1:0);\nprintf(\"%d\",ans);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "614ae4f5add35ab9a68a86ee34d745af", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n // your code goes here\n float r,h;\n int n;\n scanf(\"%f %f\",&r,&h);\n if((h-r/2)%r==0&&r!=1&&h>=r){\n h=h/r;\n n=2+2*h;\n }\n else{\n n=1+2*h/r;\n }\n printf(\"%d\",n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "dd8c400e53da8f1cb9a23ae2637d154e", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n//#include\n#include\nint main()\n{\n long int i,x,y,n,m,w;\n long int p;\n scanf(\"%ld %ld\",&x,&y);\n p=sqrt(x*x+y*y);\n if(p*p==x*x+y*y) {printf(\"black\"); goto w; }\n n=0;m=1;\n if(x*y>0){ for(i=1;i<=1000;i++,n++,m++)\n if(n*n<=x*x+y*y && m*m>=x*x+y*y)\n { if (m%2==0) printf(\"white\");\n else printf(\"black\"); goto w; } } \n else for(i=1;i<=1000;i++,n++,m++)\n if(n*n<=x*x+y*y && m*m>=x*x+y*y)\n { if (m%2!=0) printf(\"white\");\n else printf(\"black\"); goto w; }\n w: // getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d6d0d027586c4dc5f5794a26c84392bb", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\tdouble x, y;\n\tint i = 0;\n\tint area;\n\tscanf(\"%lf%lf\", &x, &y);\n\n\t//\ufffd\u0436\ufffdx,y\ufffd\u06b5\u06bc\ufffd\ufffd\ufffd\ufffd\ufffd\n\tif (x*y==0)\n\t{\n\t\tprintf(\"black\\n\");\n\t\treturn 0;\n\t}\n\telse if (x > 0 && y > 0)\n\t{\n\t\tarea = 1;\n\t}\n\telse if (x<0 && y>0)\n\t{\n\t\tarea = 2;\n\t}\n\telse if (x < 0 && y<0)\n\t{\n\t\tarea = 3;\n\t}\n\telse\n\t\tarea = 4;\n\t//\ufffd\ufffd\ufffd\ufffd\u052d\ufffd\ufffd\u013e\ufffd\ufffd\ufffd\n\tdouble distance = sqrt(x*x + y*y);\n\ti = fabs(x) > fabs(y) ? fabs(x) : fabs(y);\n\tfor (i; i <= fabs(x) + fabs(y); i++)\n\t{\n\t\tif (distance == i)\n\t\t{\n\t\t\tprintf(\"black\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (idistance)\n\t\t{\n\t\t\tif (i % 2 == 0)\n\t\t\t\ti = 2;\n\t\t\telse\n\t\t\t\ti = 1;\n\t\t}\n\t}\n\t//\ufffd\ufffd\ufffd\u0772\ufffd\u036c\ufffd\ufffd\ufffd\u07a3\ufffd\ufffd\u0432\ufffd\u036c\ufffd\u0134\ufffd\ufffd\ufffd\ufffd\ufffd\n\tswitch (area)\n\t{\n\tcase 1:\n\t\tif (i == 1){\n\t\t\tprintf(\"white\\n\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"black\\n\");\n\t\t}\n\t\tbreak;\n\tcase 2:\n\t\tif (i == 1){\n\t\t\tprintf(\"black\\n\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"white\\n\");\n\t\t}\n\t\tbreak;\n\tcase 3:\n\t\tif (i == 1){\n\t\t\tprintf(\"white\\n\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"black\\n\");\n\t\t}\n\t\tbreak;\n\tcase 4:\n\t\tif (i == 1){\n\t\t\tprintf(\"black\\n\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"white\\n\");\n\t\t}\n\t\tbreak;\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "65331e4e776f55fb9d8e1a872f48fb41", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n\tint x, y, sx, sy, pos;\n\tscanf(\"%d %d\", &x, &y);\n\n\tif((x==0)||(y==0))\n\t{\n\t\tprintf(\"black\");\n\t\treturn 0;\n\t}\n\n\tif(x>0&&y>0)\n\t\tflag=1;\n\telse if(x>0&&y<0)\n\t\tflag=2;\n\telse if(x<0&&y<0)\n\t\tflag=3;\n\telse \n\t\tflag=4;\n\n\tfloat rad, zc;\n\n\tsx=x*x;\n\tsy=y*y;\n\n\trad=(float)sqrt(sx+sy);\n\tzc=floor(rad);\n\tif((rad/zc)==1)\n\t{\n\t\tprintf(\"black\");\n\t\treturn 0;\n\t}\n\n\tif((flag==1)||(flag==3))\n\t{\n\t\tpos=(int)floor(rad);\n\t\tif(pos%2==0)\n\t\t\tprintf(\"black\");\n\t\telse\n\t\t\tprintf(\"white\");\n\t}\n\telse if((flag==2)||(flag==4))\n\t{\n\t\tpos=(int)floor(rad);\n\t\tif(pos%2==0)\n\t\t\tprintf(\"white\");\n\t\telse\n\t\t\tprintf(\"black\");\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4e42748c667233a0af2a813261ef9be1", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\n int x,y,ds,f;\n scanf(\"%d %d\",&x,&y);\n float d;\n ds=x*x+y*y;\n d=sqrt(ds);\n\n f=floor(d);\n if(ds%f==0) f++;\n\n if(f%2==0)\n { if(x>0&&y>0 || x<0&&y<0)\n printf(\"black\");\n else printf(\"white\");}\n else\n {if(x>0&&y>0 || x<0&&y<0)\n printf(\"white\");\n else printf(\"black\");\n\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "af4b33d297d42917a8e28130fc0e0d8d", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void){\n\tint x,y;\n\tdouble arg,r;\n\tscanf(\"%d%d\",&x,&y);\n\targ=atan(x/y);\n\twhile(arg<0){\n\t\targ+=2*M_PI;\n\t}\n\tr=sqrt(x*x+y*y);\n\tif((arg>=0 && arg<=M_PI/2.0) || (arg>=M_PI && arg<=M_PI*3/2)) {\n\t\tif(floor(r)==r){\n\t\t\tprintf(\"black\");\n\t\t\treturn 0;\n\t\t}\t\n\t\tif((long)ceil(r)%2==1)\n\t\t\tprintf(\"black\");\n\t\telse \n\t\t\tprintf(\"white\");\n\t}\n\telse{\n\t\tif(floor(r)==r){\n\t\t\tprintf(\"black\");\n\t\t\treturn 0;\n\t\t}\t\n\t\tif((long)ceil(r)%2==1)\n\t\t\tprintf(\"white\");\n\t\telse \n\t\t\tprintf(\"black\");\n\t}\n\treturn 0;\t\t\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "33d273b97a45412ec17cb1205cc71316", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n int main() \n{ \n int n,sr; \n bool flag; \n while(scanf(\"%d\",&n)) \n { \n flag=0; \n sr=pow(2*n-3,0.5); \n for(int i=1;i<=sr;i++) \n { \n int k=pow(2*n-i*(i+1),0.5); \n if(k && k*(k+1)+i*(i+1)==2*n) \n { \n flag=1; \n break; \n } \n } \n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\"); \n } \n return 0; \n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "33c7e5ccc0a271c35588fb50294629bf", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint encontro(int n){\n int i;\n float aux=sqrt(n+0.25)-0.5,aux2;\n for(i=1;i<=aux;i++){\n aux2=sqrt(2*n-i*i-i+0.25)-0.5;\n if(aux2==(int)aux2)\n return 1;\n }\n return 0;\n}\nint main(){\n int n;\n scanf(\"%d\",&n)\n if(encontro(n))\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bb90fd085aabacf37816a8f1f8c2d0ef", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include\n int main() \n{ \n int n,sr; \n bool flag; \n while(scanf(\"%d\",&n)!=EOF) \n { \n flag=0; \n sr=pow(2*n-3,0.5); \n for(int i=1;i<=sr;i++) \n { \n int k=pow(2*n-i*(i+1),0.5); \n if(k && k*(k+1)+i*(i+1)==2*n) \n { \n flag=1; \n break; \n } \n } \n if(flag) printf(\"YES\\n\"); \n else printf(\"NO\\n\"); \n } \n return 0; \n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "aca2c6d510c7ef0e1c2f46b95180dc26", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, i, k, r, x, found = 0;\n scanf(\"%d\", &n);\n n *= 2;\n k = int(sqrt(n * 1.0f) + 0.5f);\n for (i = 1; i < k; i ++)\n {\n r = n - i * i - i;\n x = (int)sqrt(r * 1.0f);\n if (x * (x + 1) == r)\n {\n found = 1;\n break;\n }\n } \n if (found)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return (0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1d7e3eea5834797667e2fa251c4f67ff", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include\n int main() \n{ \n int n,sr,flag; \n while(scanf(\"%d\",&n)!=EOF) \n { \n flag=0; \n sr=pow(2*n-3,0.5); \n for(int i=1;i<=sr;i++) \n { \n int k=pow(2*n-i*(i+1),0.5); \n if(k && k*(k+1)+i*(i+1)==2*n) \n { \n flag=1; \n break; \n } \n } \n if(flag) printf(\"YES\\n\"); \n else printf(\"NO\\n\"); \n } \n return 0; \n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf2ee1b3d5d9915e0a4674f9b906eb45", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint n, m, highest = 0, highest_temp = 0, p[8+1], i, k, m_note, n_count, min;\nvoid permutate(int, int);\nvoid swap(int *x, int *y);\n\nint main()\n{\n while(scanf(\"%d\", &n)!=EOF)\n {\n min = 9;\n scanf(\"%d\", &m);\n for(i = 1; i<=n; i++)\n {\n p[i] = i;\n }\n for(i = 1; i<=n; i++)\n {\n highest += i * (n+1-i);\n }\n m_note = 1;\n if(m==1)\n {\n for(i = 1; i<=n; i++)\n {\n printf(\"%d \", p[i]);\n }\n printf(\"\\n\")\n }\n else\n {\n permutate(1, n);\n } \n }\n return 0;\n}\n\nvoid permutate(int start, int end)\n{\n if(start == end)\n {\n \n for(k=1; k<=n; k++)\n {\n n_count = n;\n for(n_count; n_count>0; --n_count)\n {\n min = 9;\n for(i=k; i<=n_count; ++i)\n {\n \n if(p[i]= highest)\n {\n ++m_note;\n if(m_note-1==m)\n {\n for(i=1; i<=n; i++)\n {\n printf(\"%d \", p[i]);\n }\n printf(\"\\n\");\n }\n else{}\n }\n else{}\n }\n else\n {\n int j;\n for(j = start; j <= end; ++j)\n {\n \n swap((p+start), (p+j));\n permutate(start+1, end);\n swap((p+start), (p+j));\n }\n }\n}\n\nvoid swap(int *x, int *y)\n{\n int temp; \n temp = *x;\n *x = *y; \n *y = temp;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6cf39f9c9305ff830202dca496b03299", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nstatic inline long long count(int n) {\n\treturn 1ll<<(long long)(n-1);\n}\nint res[50];\nint main() {\n\tint n,m;\n\tscanf(\"%d%d\", &n, &m);\n\tint left = 0, right = n-1;\n\tint c = 1, k = n;\n\twhile(n--) {\n\t\tif ((long long)m > count(n)) {\n\t\t\tres[right] = c;\n\t\t\tright--;\n\t\t} else {\n\t\t\tres[left] = c;\n\t\t\tleft++;\n\t\t}\n\t\tc++;\n\t}\n\tint i;\n\tfor(i = 0; i < k-1; i++)\n\t\tprintf(\"%d \", res[i]);\n\tprintf(\"%d\\n\", res[k-1]);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3cd85b7db3323b3ab0c9318718aefc4", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nstatic inline long long count(int n) {\n\treturn 1ll<<(long long)(n-1);\n}\nint res[50];\nint main() {\n\tint n,m;\n\tscanf(\"%d%d\", &n, &m);\n\tint left = 0, right = n-1;\n\tint c = 1, k = n;\n\twhile(n--) {\n\t\tif ((long long)m > count(n)) {\n\t\t\tres[right] = c;\n\t\t\tright--;\n\t\t} else {\n\t\t\tres[left] = c;\n\t\t\tleft++;\n\t\t}\n\t\tc++;\n\t}\n\tint i;\n\tfor(i = 0; i < k-1; i++)\n\t\tprintf(\"%d \", res[i]);\n\tprintf(\"%d\\n\", res[k-1]);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "20794cae9e7cb1ee286fdb3bfe373f52", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "/*\n * Homework - NCTU DCS CP\n * =======================\n * Student ID : 0316218\n * GCC Option : -lm -ansi\n * -Wall -Wextra -pedantic\n */\n\n#include\n#include\n\nint m;\nint p[50] = {0};\n\nvoid permutation(int, int, int);\n\nint main(void)\n{\n int n;\n\n scanf(\"%d %d\", &n, &m);\n\n permutation(n, 0, n - 1);\n\n return 0;\n}\n\nvoid permutation(int n, int l, int r)\n{\n int k = n + l - r;\n\n if (l == r)\n {\n p[l] = k;\n\n if (--m == 0)\n {\n int i;\n\n for (i = 0; i < n; i++)\n printf(\"%d%c\", p[i], (i != n - 1) ? ' ' : 0);\n }\n else if (m < 0)\n {\n return;\n }\n }\n else\n {\n p[l] = k;\n permutation(n, l + 1, r);\n p[r] = k;\n permutation(n, l, r - 1);\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "434a6a0905c222a399a69d62868742bb", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n\nint solution[51];\nint n,m;\nint count=0;\nvoid backtrack(int x,int y,int c)\n{\n\tif(c==n)\n\t{\n\t\tsolution[x]=n;\n\t\tcount++;//minmin(1);\n\t\tif(count==m)\n\t\t{\n\t\t\tint i;\n\t\t\tfor(i=1;i<=n;i++)\n\t\t\tprintf(\"%d \",solution[i]);\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\treturn;\n\t}\n\t\n\t\tsolution[x]=c;\n\t\tbacktrack(x+1,y,c+1);\n\t\tif(count==m)\n\t\treturn;\n\t\tsolution[y]=c;\n\t\tbacktrack(x,y-1,c+1);\n\t\tif(count==m)\n\t\treturn;\n\t\t\n\n\treturn;\n}\n\n\n/*void minmin(int x)\n{\n\tif(x==n+1)\n\t{\n\t\tif(sum==ans)\n\t\tc++;\n\t\treturn;\n\t}\n\t\n\tint i,j;\n\tfor(i=x;i<=n;i++)\n\t{\t\n\t\tint MIN=100;\n\t\tfor(j=x;j<=i;j++)\n\t\t{\n\t\t\tif(MIN>solution[j])\n\t\t\t\tMIN=solution[j];\n\t\t}\n\t\tsum+=MIN;\n\t}\n\tminmin(x+1);\n\treturn;\n}*/\n\nint main()\n{\n\tscanf(\"%d %d\",&n,&m);\n\tbacktrack(1,n,1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c7c6dc23f205b41e62cac29fd176ee20", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n//using namespace std;\nint main()\n{\n\tlong int n,m,min,d,rem,kmin,kmax,max;\n\t\n\tcin >> n >>m;\n\tmin=n/m;\n\trem=n%m;\n\td=m-rem;\n\tkmin=((d*(min-1)*min)/2) + ((rem*(min+1)*min)/2);\n\tmax=(n-m+1);\n\tkmax=(max*(max-1))/2;\n\t\n\tcout << kmin << \" \"<< kmax;\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3671bef8cfcd9960a4a6903378f7470f", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "int main(int argc,char const *argb[])\n{\n long long int m,n,min,max,a,b,c;\n scanf(\"%I64d%I64d\",&m,&n);\n max=(m-n)*(m-n+1)/2;\n s=m%n;\n c=m/n;\n b=m/n+1;\n min=(n-a)*(c-1)*(c)/2+a*b*(b-1)/2;\n printf(\"%I64d%I64d\\n\",min,max);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e321734f1a56b586607c1ecb599a4173", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n int n, m, Kma=0, Kmi;\n scanf(\"%i %i\", &n, &m);\n for (i = n-(m-1);i>0;i--)\n Kma = Kma+(i-1);\n if (m==1)\n Kmi = Kma;\n else\n Kmi = n/2;\n printf(\"%i %i\", Kmi, Kma);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ed3adae60c2bad7629959b4ba480002f", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "\n#include\n\n\n\n long long int nCr(long long int n, long long int r)\n {\n\n if(r == 0) return 1;\n if(r > n) return 0;\n if (r > n / 2) return nCr(n, n - r);\n long long int combi = 1, i;\n for(i = 1; i <= r; i++)\n {\n\n combi = combi * (n - i + 1);\n combi = combi / i;\n }\n return combi;\n }\n\n int main()\n {\n\n long long int m, n, a, b, ans1, ans2, f, d, e;\n scanf(\"%lld %lld\", &m, &n);\n a = m / n;\n b = m + 1 - n;\n e = m % n;\n d = n - e;\n f = a + 1;\n ans1 = (nCr(a, 2) * d) + (nCr(f, 2) * e);\n ans2 = nCr(b, 2);\n cout <\n/*int ncr(int n,int r)\n {\n if(r==1)\n {\n return n;\n }\n if(r==0 || r==n)\n {\n return 1;\n }\n return ncr(n-1,r)+ncr(n-1,r-1);\n }*/\nint nChoosek( int n, int k )\n{\n\tif (k > n) return 0;\n\tif (k * 2 > n) k = n-k;\n\tif (k == 0) return 1;\n\n\tint result = n;\n\tfor( int i = 2; i <= k; ++i ) {\n\t\tresult *= (n-i+1);\n\t\tresult /= i;\n\t}\n\treturn result;\n}\n\nint main()\n{\n\tint i=0;\n\tint n,teams;\n\tscanf(\"%d%d\",&n,&teams);\n\tint a=n-teams+1;\n\tlong long int max=a*(a-1)/2;\n\tint pl[1000009]={0};\n\tint flag;\n\tlong long int min=0;\n\tif(t==1)\n\t{\n\t\tmin=n*(n-1)/2;\n\t}\n\telse\n\t{\n\n\t\tfor(n=n;n>0;n--)\n\t\t{\n\t\t\tpl[i]++;\n\t\t\tif(i==(teams-1))\n\t\t\t{\n\t\t\t\ti=0;\n\t\t\t}\n\t\t\telse\n\t\t\t\ti++;\n\t\t}\n\n\t\tfor(i=0;i\nint main(){\n long long n,i;\n scanf(\"%lli\",&n);\n if(n%2){\n for(i=3;i<=n;i++){\n if((n%i)==0) break;\n }\n n -= i;\n n = n/2;\n n++\n }\n else n /= 2;\n printf(\"%lli\\n\",n);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0b10bc081295ce52910a31f4461f9575", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \nint arr [1000000000];\nint main()\n{\n// printf(\"ertyg\");\n long long int n;\n scanf(\"%lld\",&n);\n if (n%2==0)\n {\n printf(\"%lld\",n/2);\n return 0;\n }\n for (long long int i=3;i<=n;i++)\n {\n// printf(\"%lld\",i);\n if (n%i==0)\n {\n n=n-i;\n// printf(\"%lld %lld \",i,n);\n break;\n }\n }\n printf(\"%lld\",n/2+1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1e1dfc4515296e03a4a0dbed241fe647", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\n uint64_t n;\n scanf(\"%\"SCNu64, &n);\n\n if (n % 2 == 0) {\n printf(\"%\"PRIu64i\"\\n\", n / 2);\n }\n else {\n uint64_t j = 3;\n for ( ; j * j <= n; j += 2) {\n if (n % j == 0) {\n printf(\"%\"PRIu64\"\\n\", (1 + (n - j) / 2));\n n = 1;\n break;\n }\n }\n if (n > 1) {\n putchar('1');\n putchar(\"\\n\");\n } \n } \n \n return 0;\n}\n~ \n~ ", "lang_cluster": "C", "compilation_error": true, "code_uid": "9014ef70697a2d4fb26fd88ef5d4ca22", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nlong long ai(long long n);\nint main ()\n{\n\tlong long n,i,l,p,a1,t;\n\t\n\tscanf(\"%lld\",&n);\n\tif(n%2==0) printf(\"%lld\\n\",n/2);\n\telse\n\t{\n\t\tif(ai(n))\n\t\tprintf(\"1\\n\");\n\t\telse \n\t\t{\n\t\t\tfor (i=2;i\n#include \n#include\n\nint main()\n{\n long long i,n,sum=0;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n sum=n/2;\n }else\n {\n sum=1;\n for(i=2;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n sum=(n-i)/2+1;\n break;\n }\n }\n }\n printf(\"%lld\",sum);\n return 0;\n}\n#include \n#include \n#include\n\nint main()\n{\n long long i,n,sum=0;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n sum=n/2;\n }else\n {\n sum=1;\n for(i=2;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n sum=(n-i)/2+1;\n break;\n }\n }\n }\n printf(\"%lld\",sum);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e0af482dd882b9b2edd4987f3ecff41c", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n char a[4][4];\n int l=0;\n for(int i=1;i<=3;i++)\n {\n for(int j=1;j<=3;j++)\n {\n scanf(\"%d\",a[i][j]);\n }\n }\n for(i=1;i<=3;i++)\n {\n for(j=1;j<=3;j++)\n {\n if(a[i][j]!=a[4-i][4-j])\n {\n l=1;\n break;\n }\n }\n }\n if(l==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7e1e871b40216ca276bde9889d01b480", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\n#define gc getchar_unlocked \nint main()\n{\nint i,j;\nchar a[3][3] ;\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n //scanf(\"%c\", &a[i][j]);\n //if ( )\n a[i][j] = gc();\n if( a[i][j] == ' ') a[i][j] = gc();\n }\n }\n // printf(\"%c tt\" , a[1][0]);\nif(a[0][0]==a[2][2] && a[0][1]==a[2][1] && a[0][2]==a[2][0] && a[1][0]==a[1][2]){ printf(\"YES\"); }\nelse\nprintf(\"NO\");\n \nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c2c449f7978e80936b6eb6412b6c81cd", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define SIZE 3\n\nint hasCentalSymmetry(char** arr, int size);\n\nint main()\n{\n char** arr;\n arr = (char**)malloc(SIZE * sizeof(char*));\n for (int i = 0; i < SIZE; i++)\n {\n arr[i] = (char*)malloc(SIZE*sizeof(char));\n }\n for (int i = 0; i < SIZE; i++)\n {\n for (int j = 0; j < SIZE; j++)\n {\n /*scanf(\"%c\",&arr[i][j]);*/\n arr[i][j] = getchar();\n }\n getchar();\n }\n \n if(hasCentalSymmetry(arr, SIZE))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n\nint hasCentalSymmetry(char** arr, int size)\n{\n \n int flag = 1;\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n if(arr[i][j] != arr[size-1-i][size-1-j])\n flag = 0;\n }\n }\n return flag;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a97d15e8e315df9d685a741b72ea8e58", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint i;\n\tfor(i=0;i<3;i++)scanf(\"%s\",s[i]);\n\tif(s[0][0]==s[2][2]&&s[0][1]==s[2][1]&&s[0][2]==s[2][0]&&s[1][0]==s[1][2])\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7fbccb7e32d0b334d2a4f487154675fc", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n char C[5][5];\n int i,j;\n for(i=0;i<3;i++)\n {\n scanf(\"%s\",C[i]);}\n \n if((C[0][0]==C[2][2])&&(C[0][1]==C[2][1])&&(C[0][2]--C[2][0])&(C[1][0]==C[1][2]))\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1b85291f1a758045b4a4e2377d6e9ea", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,x1,x2,x3,x4,y1,y2,y3,y4,a,b,c,d,e,f,g,h,area;\n scanf(\"%d\",&n);\n\n if(x1<0)\n {\n x1=-x1;\n }\n else if(y1<0)\n {\n y1=-y1;\n }\n else if(x2<0)\n {\n x2=-x2;\n }\n else if(y2<0)\n {\n y2=-y2;\n }\n else if(x3<0)\n {\n x3=-x3;\n }\n else if(y3==0)\n {\n y3=-y3;\n }\n else if(n==1)\n {\n scanf(\"%d %d\",&x1,&y1);\n\n if(x1==y1)\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"-1\");\n }\n }\n else if(n==2)\n {\n scanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\n\n\n if(x1==y1 && x2==y2)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"1\");\n }\n }\n else if(n==3)\n {\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\n if(x1==y1 && x2==y2 && x3==y3)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"-1\");\n }\n }\n\n else if(n==4)\n {\n scanf(\"%d %d %d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f,&g,&h);\n \n area=0.5*(a*d+c*f+e*h+g*b-c*b-e*d-g*f-a*h);\n if(area<0)\n {\n area=-area;\n }\n else if(area==0)\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\",area);\n }\n }\n\n\n\n\n }\n return 0;\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e4001e2c0e2a364eed9e3923765f35fb", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main() {\n int n;\n scanf(\"%d\",&n);\n int x[4];\n int y[4];\n int i;\n for(i=0;i\n#include \n#include \nint Abs(int a){return a>=0?a:-a;}\nint main()\n{ int tab[5][2],i,j,stop=0,res,n;\n scanf(\"%d\",&n);\n for(i=0;i\nint main()\n{\n int n,x1,x2,x3,x4,y1,y2,y3,y4,a,b,c,d,e,f,g,h,area;\n scanf(\"%d\",&n);\n\n\n if(n==1)\n {\n scanf(\"%d %d\",&x1,&y1);\n if(x1<0)\n {\n x1=-x1;\n }\n else if(y1<0)\n {\n y1=-y1;\n }\n printf(\"-1\");\n\n }\n else if(n==2)\n {\n scanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\n\n area=(x1-x2)*(y1-y2);\n if(area<0)\n {\n area=-area;\n }\n\n\n printf(\"%d\",area);\n else if(area==0)\n {\n printf(\"-1\");\n }\n\n\n }\n else if(n==3)\n {\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(x1<0)\n {\n x1=-x1;\n }\n else if(y1<0)\n {\n y1=-y1;\n }\n else if(x2<0)\n {\n x2=-x2;\n }\n else if(y2<0)\n {\n y2=-y2;\n }\n else if(x3<0)\n {\n x3=-x3;\n }\n else if(y3==0)\n {\n y3=-y3;\n }\n\n\n else if(x1==y1 && x2==y2 && x3==y3)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"-1\");\n }\n }\n\n else if(n==4)\n {\n scanf(\"%d %d %d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);\n\n area=(y1-y2)*(x1-x4);\n if(area<0)\n {\n area=-area;\n }\n printf(\"%d\",area);\n }\n\n\n\n\n }\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9e37ac4c4ce123d44e0da242e5bcbdd3", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "be0a10081adaeecbcfc43c4b664f2eb8", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0} {"lang": "GNU C11", "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#include \nvoid 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#include\nvoid 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);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6b2009a2088ef26ef5e03956a231e9fd", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": " #include\n#include\nvoid 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);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ca1573ea7d3c751141fbe1dcf703dfd0", "src_uid": "c03ff0bc6a8c4ce5372194e8ea18527f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nvoid 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#include \n#include \nusing namespace std;\nint a[11][11];\nvoid init(int x){\n for(int i=1;i <= x;i++){\n for(int j=1;j <= x;j++){\n if(i==1||j==1) a[i][j]=1;\n else\n a[i][j]=a[i][j-1] + a[i-1][j];\n }\n }\n}\nint main(){\n int n;\n init(10);\n while(~scanf(\"%d\",&n)){\n printf(\"%d\\n\",a[n][n]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ae18570eac325c199a40045e63c41509", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \ninline void fri(int *x) \n{\nregister int c = getchar_unlocked();\n*x = 0;\nint neg = 0;\nfor(; ((c<48 || c>57) && c != '-'); c = getchar_unlocked());\nif(c=='-') \n{\n neg = 1;\n c = getchar_unlocked();\n}\nfor(; c>47 && c<58 ; c = getchar_unlocked()) \n{\n *x = ((*x)<<1) + ((*x)<<3) + c - 48;\n}\nif(neg)\n *x = -(*x);\n}\n\nint main()\n{\n int n, numer = 1, denom = 1, i, j;\n long int ans;\n fri(&n);\n n = n - 1;\n j = 2 * n - 1;\n for(i = 1;i <= j;i += 2)\n numer *= i;\n for(i = 1;i <= n;i++)\n denom *= i;\n ans = (pow(2, n) * numer) / denom;\n printf(\"%ld\", ans);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f545e03da661cc6cc3e9719fcdce998", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint calculating_a(int row,int column){\n if(row==0||column=0) return 1;\n else return calculating_a(row-1,column)+calculating(row,column-1);\n}\nint main(){\n int n;\n scanf(\"%d\\n\",&n);\n int max;\n max= calculating_a(n,n);\n printf(\"%d\\n\",max);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dbfe614fcd7dcc74e9cc1e2f1d41cb40", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n][n]={0};\n\tint max=1;\n\tfor(int i=0;i=max)\n max=a[i][j]; \n \n }\n\t\t}\n\t}\nprintf(\"%d\",max);\n\n\n\n\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1cd4fdb245cc529bd7211241e0cf487", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint n;\n scanf(\"%d\",&n);\n int a[n][n];\n for(int i=0;i\n#inlcude\nint main()\n{\n long i,m,n,s=1,y;\n scanf(\"%li\",&n);\n scanf(\"%li\",&m);\n s=pow(2,n);\n y=m%s;\n printf(\"%li\",y);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "89080255fcec03fb12a64a32246ce87b", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include \n\nint main(){\n\nint n,l,a,r;\n\n scanf(\"%d\",&n);\n scanf(\"%d\",&l);\n\n a=(pow(2,n));\n r=m%a;\n printf(\"%d\\n\",r);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51ff4b62003973dea11f2a77b1f57ce9", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n unsigned long int n,m;\n scanf(\"%uld\\n%uld\",&n,&m);\n if(n>m || pow(2,n)>m)\n printf(\"\\n%uld\",m);\n else \n {\n printf(\"\\n%uld\",m%(pow(2,n)));\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "78ab6d37c354c4ef1561757834c505d7", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid main()\n{\n long double int n,m;\nscanf(\"%lf\",&n);\nscanf(\"%lf\",&m);\nlong double x=m%(pow(2,n));\nprintf(\"%lf\",x);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c191b0a3296bc073dc5923caf43e5242", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n int done=1;two=1,n,m;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n while(n--){\n two=two<<1;\n if(two>100000000){\n printf(\"%d\",m);\n done=0;\n break;\n }\n }\n if(done)\n printf(\"%d\",m%two);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "26b77e058fd5ef049021fdb2856762c7", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "/*\n#include\n\nint main(){\n long long n;\n while(scanf(\"%lld\", &n)){\n if(n < 0)\n return 0;\n\n /**\n * Arithmetic series 1 to n with extra 1\n\n printf(\"%lld\\n\", 1 + n * (n + 1) / 2);\n }\n return 0;\n}*/\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n int arr[10],i,j,a;\n //cin>>a;\n while(!(cin>>a).eof()){\n for(i=0;i>arr[i];\n }\n sort(arr,arr+5);\n for(i=0;i\nint main(){\n for(scanf(\"%d\",&n);i t[j] )\n {\nc = t[i];\nt[i] = t[j];\nt[j] = c; }}}\nfor (i=0;i\n\nusing namespace std;\nint main()\n{\n\n int x;\n cin>>x;\n int arr[x];\n for(int i = 0;i>arr[i];\n sort(arr,arr+x);\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;i=n);\n\t}\n\n\tfor(i=0;ii;j--)\n\t\t{\n\t\t\tif(t[j]\n#include\n\nint main(void) {char a[50],temp,m[50];\nint i=0,j=0,n,p,sum=0;\n scanf(\"%d%d\",&n,&p);\n gets(a);\n for(i=0;ia[j+1])\n {temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n m[0]=a[0];\n sum=m[0]-96;\n for(i=1,j=1;i\n#include \"aplog.h\"\n\n#define\t\tN\t50\n#define\t\tHE\t0\n#define\t\tNHE\t-1\nint read_two_numbers(int *num1, int *num2);\nint read_arr_of_char_codes(int *arr, int len);\nint input_check(char c);\nint build_rocket(int numOfDetailsWeNeed, int *storage, int numOfDetails);\nvoid sort(int *arr, int len);\nvoid change(int *a, int *b);\n\nint main()\n{\n\tint numOfDetails, numOfDetailsWeNeed;\n\tint storage[N] = {0};\n\tint rc = read_two_numbers(&numOfDetails, &numOfDetailsWeNeed);\n\n\tif (!rc) \n\t\trc = read_arr_of_char_codes(storage, numOfDetails);\n\tif (!rc) \n\t\tprintf(\"%d\\n\", build_rocket(numOfDetailsWeNeed, storage, numOfDetails));\n\treturn rc;\n}\n\nint read_two_numbers(int *num1, int *num2)\n{\n\tif (scanf(\"%d%d\", num1, num2) != 2)\n\t\treturn NHE;\n\treturn HE;\n}\n\nint read_arr_of_char_codes(int *arr, int len)\n{\n\tchar c;\n\n\tfor (int i = 0; i < len; i++)\n\t{\n\t\tif (!(scanf(\"%c\", &c) && !input_check(c)))\n\t\t{\n\t\t\ti--;\n\t\t\tcontinue;\n\t\t}\n\n\t\t*(arr + i) = (int)c - (int)'a' + 1;\n\t}\n\n\treturn HE;\n}\n\nint input_check(char c)\n{\n\tif ('a' <= c && c <= 'z')\n\t\treturn HE;\n\n\treturn NHE;\n}\n\nint build_rocket(int numOfDetailsWeNeed, int *storage, int numOfDetails)\n{\n\tsort(storage, numOfDetails);\n\n\tint resultMass = storage[0];\n\tint weightOfLastStage = storage[0];\n\tnumOfDetailsWeNeed--;\n\n\tfor (int i = 1; i < numOfDetails && numOfDetailsWeNeed; i++)\n\t\tif (storage[i] - weightOfLastStage > 1)\n\t\t\t{\n\t\t\t\tnumOfDetailsWeNeed--;\n\t\t\t\tresultMass += weightOfLastStage = storage[i];\n\t\t\t}\n\n\n\tif (!numOfDetailsWeNeed)\n\t\treturn resultMass;\n\n\treturn NHE;\n}\n\nvoid sort(int *arr, int len)\n{\n\tfor (int flag = 1; flag;)\n\t{\n\t\tflag = 0;\n\n\t\tfor (int j = 1; j < len; j++)\n\t\t\tif (arr[j] < arr[j - 1])\n\t\t\t{\n\t\t\t\tflag = 1;\n\t\t\t\tchange(arr + j, arr + j - 1);\n\t\t\t}\n\t}\n\n\t\t\n}\t\t\n\nvoid change(int *a, int *b)\n{\n\tint t = *a;\n\t*a = *b;\n\t*b = t;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6a7529c765cd5585d75a6c325aa5ed61", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0} {"lang": "GNU C", "source_code": "// \n\n\n#include \n\n#include \n\nint main() \n\n{\n \n int n , k ;\n \n scanf(\"%d %d\",&n,&k) ; \n \n char lotus[100] , eater[100] ;\n \n scanf(\"%s\",lotus) ; // char paie = getchar() ;\n \n char swap ;\n \n for( int a = 0 ; a < (n-1) ; a++ ) {\n \n for( int b = a+1 ; b < n ; b++ ) {\n \n if( lotus[a] > lotus[b] ) {\n \n swap = lotus[b] ;\n \n lotus[b] = lotus[a] ;\n \n lotus[a] = swap ;\n \n }\n \n }\n \n }\n /*\n //puts(lotus) ;\n \n strcpy(eater,lotus) ;\n \n // puts(eater) ;\n \n int d ;\n \n n = strlen(eater) ;\n \n for( int c = 0 ; c < (n-1) ; c++ ) {\n \n int x = (eater[c+1] - eater[c] ) ;\n \n if( x == 1 ) {\n \n for( d = c+1 ; d < n ; d++ ) {\n \n eater[d] = eater[d+1] ;\n \n } \n \n }\n \n n-- ;\n \n }\n puts(eater) ; */\n /*int sum = lotus[0] - 96 ;\n for( int e = 0 ; e 1 ) {\n \n sum = sum + lotus[e+1] - 96 ;\n \n }\n \n }\n if(sum==1 && sum= 2 ) {\n \n sum = sum + lotus[i] - 96 ;\n \n count++ ;\n \n x = lotus[i] ;\n \n if(count==k) \n \n { break ; }\n \n \n \n }\n \n }\n \n if( count > k ) {\n \n printf(\"-1\\n\") ;\n \n }\n \n \n else {\n \n printf(\"%d\\n\",sum) ;\n \n }\n \n \n \n \n \n return 0 ;\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n return 0 ;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "26cba3712748cd371d01d8904b8c4f74", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n long long n,m,i,j=0,k=0,t,a=0,b,c,ck=0,dk=1;\n char str[1000];\n scanf(\"%lld %lld\",&n,&k);\n \n for(i =0;i < n; i++)\n {\n scanf(\"%s\",&str[i]);\n }\n\n\n \n\n a = arr[0] - 'a';\n ck+=a+1;\n for(i=1; i1 && m>1){\n ck+=(b+1);\n j++;\n dk++;\n a = arr[i] - 'a';\n if(j==m-1) \n break;\n }\n else{\n continue;\n }\n }\n\n if(dk\n#include\n\nint main()\n{\n long long n,m,i,j=0,k=0,t,a=0,b,c,ck=0,dk=1;\n char str[1000];\n scanf(\"%d %d\",&n,&k);\n \n for(i =0;i < n; i++)\n {\n scanf(\"%s\",&str[i]);\n }\n\n\n \n\n a = arr[0] - 'a';\n ck+=a+1;\n for(i=1; i1 && m>1){\n ck+=(b+1);\n j++;\n dk++;\n a = arr[i] - 'a';\n if(j==m-1) \n break;\n }\n else{\n continue;\n }\n }\n\n if(dk \nint main ()\n{\n\tint n,m,k;\n\tscanf (\"%d %d\",&n,&m);\n\tif (n>=m)\n\t{\n\t\tfor (int i=n/2;i <=n;i++)\n\t\t{\n\t\t\tif (i%m==0)\n\t\t\tprintf (\"%d\\n\",i);\n\t\t}\n\t}\n\telse printf (\"-1\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ae26157759536ab222c370dd9f990e59", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main(void)\n{\nlong int n,m,div1,step;\nscanf(\"%d\",&n);\nscanf(\"%d\",&m);\nif(n%2!=0)\n\n{div1=((n-1)/2);\nif((div1/m)!=0)\n{\nstep=(((div1/m)+1)*m);\n}\nelse\nstep=-1;\n}\nelse \n{div1=(n/2);\nif((div1/m)!=0)\n{\nif(div1%m==0)\nstep=div1;\nelse \nif(div/m==0)\nstep=(((div1/m)+1)*m);\n}\nelse if(div/m==0)\nstep=-1;\n}\n\nprintf(\"%d\",step);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3537b3fdfa2d4b56c134ec03b7697184", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n int n, m, move, i, flag = 1;\n\n scanf(\"%d %d\", &n, &m);\n\n if(n%2 == 0){\n move = n/2;\n }else{\n move = (n/2)+1;\n }\n\n if(n == 2){\n printf(\"2\");\n }else if(n < m){\n printf(\"-1\");\n }else{\n for(i = 1; i<=t; i++){\n if(move%m == 0){\n printf(\"%d\", move);\n break;\n }else{\n move = (move-1) + 2;\n }\n\n if(i == t){\n flag = 0;\n }\n }\n\n }\n\n if(flag == 0){\n printf(\"-1\");\n }\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b1a8e53ae8439a08a4ccfddba76f6d38", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\nint n,m,a;\ncin>>n>>m;\nif(n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n for(int i=(n+1)/2;i<=n;i++)\n {\n if(i%m==0)\n {printf(\"%d\",i);\n }\n }\n printf(\"-1\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b71f422c2b13e12ddb3d1964e6192fec", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \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 && (y2 == y3 || y1 == y3) || x1 == x3 && (y3 == y2 || y1 == y2) || x2 == x3 && (y2 == y1 || y3 == y1))\n\t\tputs(\"2\");\n\telse if (x1 == x2 || x1 == x3 || x2 == x3 || y1 == y2 || y1 == y3 || y2 == y3)\n\t\tputs(\"2\");\n\telse\n\t\tputs(\"3\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9e32bac7c3c1694a94e24f1f533ec228", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0} {"lang": "GNU C", "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)||(a1==c1&&a2==b2))printf(\"2\\n\");\n\t\telse if((b1==a1&&b2==c2)||(b1==c1&&b2==a1))printf(\"2\\n\");\n\t\telse if((c1==a1&&c2==b2)||(c1==b1&&c2==a2))printf(\"2\\n\");\n\t\telse printf(\"3\\n\");\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d77355763b55b3ae95dca225de50b46", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0} {"lang": "GNU C", "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))\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "d89411abbc69713b87587437b44ac51d", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1f194490a63d78dbe78c349dde2e19c", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0} {"lang": "GNU C", "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(0,1,2) || f(0,2,1) || f(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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a9636fd0a325d7a58008b170c74adb0f", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,s=0;\n scanf(\"%d%d\",&a,&b);\n while(a<=b)\n {\n sum+=1;\n a*=3;\n b*=2;\n }\n printf(\"%d\",sum);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ae208e299cf2ef06af650ac8044ae9a3", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "bear.c", "lang_cluster": "C", "compilation_error": true, "code_uid": "9b092b987c521aad4a6691fb5021efa0", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(void)\n{\n int a,b,i;\n scanf(\"%d %d\",&a,&b);\n for(i=1;a\n#include \n\nint main()\n{int a,b;\nint count=0;\n\n//printf(\"enter a and b\");\n//scanf(\"a=%d b=%d\",&a,&b);\nwhile(a\n \nint main(){\n int i, a,b;\n \n scanf(\"%d %d\" ,&a , &b);\n if(1<=a && a<=b && b<=10 ){\n for (i=1;i<=10;i++)\n {\n if(a<=b){\n a=a*3;\n b=b*2;\n \n }\n eles if (a>b)\n {\n printf(\"%d\",i);\n break;\n }\n \n }\n \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fb846ca6fa812283d778f50d4b7c2525", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void){\n int min[4]={0},max[4]={0},ans[4]={0};\n int num;\n int remain;\n scanf(\"%d\",&num);\n scanf(\"%d %d\",&min[1],&max[1]);\n scanf(\"%d %d\",&min[2],&max[2]);\n scanf(\"%d %d\",&min[3],&max[3]);\n for(int i=1;i<4;i++){\n num=num-min[i];\n ans[i]=min[i];\n }\n while(num>0){\n if(max[1]-min[1]>0){\n num--;\n max[1]--;\n ans++;\n }\n else if(max[2]-min[2]>0){\n num--;\n max[2]--;\n ans++;\n }\n else if(max[3]-min[3]>0){\n num--;\n max[3]--;\n ans++;\n }\n }\n printf(\"%d %d %d\\n\",ans[1],ans[2],ans[3]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3bfca58e0452478d82385406c78dbe4f", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int i,n,a,b,c,j,max[3],min[3],min_total=0,max_total=0,x=0,y=0,z;\n scanf(\"%d\",&n);\n for(i=0;i<3;i++)\n {\n scanf(\"%d %d\",&min[i],&max[i]);\n if(max[i]>x)\n {\n x=max[i];\n y=i;\n }\n\n min_total+=min[i];\n max_total+=max[i];\n }\n\n\n if(min_total==n)\n {\n printf(\"%d %d %d\",min[0],min[1],min[2]);\n break;\n\n }\n else if(max_total==n)\n {\n printf(\"%d %d %d\",max[0],max[1],max[2]);\n break;\n }\n else\n {\n printf(\"%d %d %d\",(max[0]+min[0])/2,(max[1]+min[1])/2,(max[2]+min[2])/2);\n\n }\n\n return 0;\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b88934f50114a273bd93a7fde5edd8ed", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "/*\n ============================================================================\n Name : diplomas.c\n Author : \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 int n;\n scanf(\"%i\",&n);\n if ( n >= 3 && n <= 3000000)\n {\n int min1,min2,min3;\n int max1,max2,max3;\n scanf(\"%i\",&min1);\n scanf(\"%i\",&max1);\n scanf(\"%i\",&min2);\n scanf(\"%i\",&max2);\n scanf(\"%i\",&min3);\n scanf(\"%i\",&max3);\n //if((min1 > 1) && (max1 > min1) && (1000000 > max1) && (min2 > 1) && (max2 > min2) && (1000000 > max2) && (min3 > 1) && (max3 > min3) && (1000000 > max3) )\n //{\n int n1 = min1;\n int n2 = min2;\n int n3 = min3;\n for(int i = 0; n1 + n2 + n3 < n ; i++)\n {\n if ( n3 < max3 )\n {\n n3++;\n }\n else if ( n2 < max2 )\n {\n n2++;\n }\n else\n {\n n1++;\n }\n }\n printf(\"%i %i %i\",n1,n2,n3);\n fflush(stdout);\n return 0;\n //}\n //else\n //return 0;\n }\n else\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "22b502254a36b045f67afb8d61c3d8a6", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n int array[3][2];\n scanf(\"%d\",&n);\n for(i=0;i<3;i++)\n scanf(\"%d %d\",array[i][0],array[i][1]);\n int x,y,z;\n z=n-(array[1][0]+array[2][0]);\n if(z<=array[0][1])\n {\n printf(\"%d %d %d\",z,array[1][0],array[2][0]);\n return 0;\n }\n y=array[1][0]+array[0][1]-z;\n z=array[0][1]-z;\n if(y<=array[1][1])\n {\n printf(\"%d %d %d\",z,y,array[2][0]);\n return 0;\n }\n x=array[2][0]+array[1][1]-y;\n printf(\"%d %d %d\",z,y,x);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1e75211449442cbfe5e5b6a35200f9d6", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/contest/557/submission/35304038 (rainboy) */\n#include \n\u00a0\nint main() {\n\tint n, min1, max1, min2, max2, min3, max3, a, b, c;\n\u00a0\n\tscanf(\"%d%d%d%d%d%d%d\", &n, &min1, &max1, &min2, &max2, &min3, &max3);\n\ta = max1 < n - min2 - min3 ? max1 : n - min2 - min3;\n\tb = max2 < n - a - min3 ? max2 : n - a - min3;\n\tc = max3 < n - a - b ? max3 : n - a - b;\n\tprintf(\"%d %d %d\\n\", a, b, c);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3f81a1dd04d2a9b6ef5a3bf10493956", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a, b, c;\n\n scanf(\"%d%d\", %a, %b);\n\n c=a+b;\n\n printf(\"%d\", c);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "40c3a5115ac7ebd7dc5738e651fe4ed2", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\nint a,b;\nscanf(\"%d %d\",&a,&b);\nprintf(\"%d\",a+b);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "52d85a6f6789f57c9f27a23ac1ee0394", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\t\u00a0\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\t\t\t\tprintf(\"%d\",a + b);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ab1ff9d2a74b1843f7f475086c5cdbd3", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "include\n#include\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n printf(\"%d\",a+b);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "301867486d5a696c19a525585ecedf79", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "include\nint main(){\n//Cf chudi\nlong long int a,b;\nscanf(\"%lli%lli\",a,b);\nprintf(\"%lli\",a+b);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "147d00605e43ac33911285ba6f2e1f45", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void){\n int a[3];\n int min, max;\n\n scanf(\"%d %d %d\", &a[0], &a[1], &a[2]);\n\n printf(\"%d\", (a[0]+a[1]+a[2])/3)\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "daeac5e17d33f7c80b8de214868376e4", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nvoid main(){//codeforces\n\n int n,a[3],j = 0;\n scanf(\"%d %d %d\",&a[0],&a[1],&a[2]);\n\n qsort(a, 3, sizeof(a[0]), menorParaMaior);\n\n j = a[1]-a[0]+ a[2]-a[1];\n\n printf(\"%d\\n\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3c6a0434a98619b867963af429218d5", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n long long int n,i;\n long long int a[3];\n for(i=0;i<3;i++)\n {\n cin>>a[i];\n }\n sort(a,a+3);\n cout<<(a[1]-a[0])+(a[2]-a[1]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5acf68f95ef8a9d496e48185286452a", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main() {\n\tint x,i,j,t;\n\tscanf(\"%d %d %d\",&x[0],&x[1],&x[2]);\n\tfor(i=0;i<3;i++)\n\t for(j=i+1;j<3;j++)\n\t if(a[i]\n#include \nint main()\n{\n int x1,x2,x3,y,z;\n scanf(\"%d %d %d\",&x1,&x2,&x3);\n if(x1 > x3 && x3 > x2 )\n {\n printf(\"%d\\n\",(x1-x3)+(x3-x2));\n }\n else if(x1 > x3 && x2 > x3)\n {\n printf(\"%d\\n\",(x1-x2)+(x2-x3));\n }\n else if(x3 > x1 && x3 > x2)\n {\n printf(\"%d\\n\",(x2-x1)+(x3-x2));\n }\n else if(x3 > x1 && x2 > x3)\n {\n printf(\"%d\\n\",(x3-x1)+(x2-x3));\n }\n else if(x3 > x1 && x1 > x2)\n {\n printf(\"%d\\n\",((x3-x1)+(x1-x2)));\n }\n else\n {\n printf(\"%d\\n\",((x1-x3)+(x2-x1));\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c876612fe80a71a057efc0baeef7988d", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint cmp(const void *a, const void *b);\nvoid swap(char *a, char *b);\n\nint main(void)\n{\n\tchar n[100];\n\tchar m[100];\n\tscanf(\"%s%s\", &n, &m);\n\t\n\tint n_length = strlen(n);\n\tint m_length = strlen(m);\n\tqsort(n, n_length, sizeof(char), cmp);\n\t\n\tint i = 0;\n\twhile (n[i] == '0' && i < n_length) {\n\t\ti++;\n\t}\n\tswap(n + 0, n + i);\n\t\n\tint result = 1;\n\tif (n_length != m_length) {\n\t\tresult = 0;\n\t} else {\n\t\tfor (i = 0; i < n_length; i++) {\n\t\t\tif (n[i] != m[i]) {\n\t\t\t\tresult = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\\n\", n);\n\tif (result == 1) {\n\t\tprintf(\"OK\\n\");\n\t} else {\n\t\tprintf(\"WRONG_ANSWER\\n\");\n\t}\n\tgetch();\n\treturn 0;\n}\n\nint cmp(const void *a, const void *b)\n{\n\treturn *(char *)a - *(char *)b;\n}\n\nvoid swap(char *a, char *b)\n{\n\tchar temp = *a;\n\t*a = *b;\n\t*b = temp;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "72f0902b87156e335938a795f2bba9a4", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main ()\n{\n\tchar min=':',str[15],arr[15];\n\tgets(str);\n\tgets(arr);\n\tint i,j,t,k;\n\tt = strlen(str);\n\tk= strlen(arr);\n\tif (t ! = k)\n\t{\n\t\tprintf(\"WRONG_ANSWER\");\n\treturn 0;\n\t}\n\tfor (i=0;i\n#include\nint main()\n{ int i,j,k=0;\n char c[10],d[10],a[10],temp;\n scanf(\"%s\",c);\n scanf(\"%s\",d);\n int l=strlen(c);\nfor(i=0;i\nint a[10];\nint main()\n{\n\tint j,store[10000];\n\tint i,d;\n\tint ch;\t\nint k;\nk=0;\nch=getchar();\na[ch-'0']++;\nwhile((ch=getchar())!='\\n'){\n\ta[ch-'0']++;\n}\nd=1;\nA:\nfor(i=0;i<=9;i++){\n\tif(a[0]==0||d==0){\n\tfor(j=0;j\n#include\n#include\nint i,j,l,n;\nchar a[100],b[100],t,min;\nvoid swap(char *a,char *b)\n{\n t=*a;*a=*b;*b=t;\n}\nint main()\n{\n \n while(scanf(\"%s %s\",&a,&b)!=NULL)\n {\n min='A';\n l=strlen(a);\n for(i=0;i'0') \n {\n if(a[i]a[j])\n swap(&a[i],&a[j]);\n }\n if(a[0]==0)printf(\"WRONG_ANSWER\\n\");\n else {\n if(strcmp(a,b)==0)printf(\"OK\\n\");\n else printf(\"WRONG_ANSWER\\n\");\n } \n/*\nprintf(\"%c\",a[0]);\n printf(\"%c\",a[1]); printf(\"%c\",a[2]); printf(\"%c\",a[3]);*/\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7e28c984fbee8452141b5619fbe4dfb6", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:03/04/2019 \n*/\n#include\n#include\n#include\n#include\n#include\n\nint main()\n{\n \n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long n,ans,min=32;\n scanf(\"%lld\",&n);\n int arr[n];\n for(int i=0;iarr[i])\n min=arr[i];\n }\n ans=min^arr[2];\n ans+=2;\n printf(\"%lld\\n\",ans);\n \n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4179af213b65f144ef15a2daa197f662", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main(){\n\tint n;\n\tint arr[n];\n\tscanf(\"%d\",&n);\n\tfor(int i = 0;i\n#include \nint main(){\n\tint n;\n\tint arr[n];\n\tscanf(\"%d\",&n);\n\tfor(int i = 0;i\n#include \nint main(){\n\tint n;\n\tint arr[n];\n\tscanf(\"%d\",&n);\n\tfor(int i = 0;i\n#include \nint compare(const void *data1,const void *data2){\n\tint *ptr1 = (int *)data1;\n\tint *ptr2 = (int *)data2;\n\treturn (data1 < data2)? 1 : -1;\n}\nint main(){\n\tint n;\n\tint arr[100];\n\tscanf(\"%d\",&n);\n\tfor(int i = 0;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 long long n;\n scanf(\"%lld\",&n);\n if(n==5)\n printf(\"1\\n\");\n else\n printf(\"%lld\",n%3+1);\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3f472235d5b4711bf04c4357efb2ff55", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint a[] = {0,2,3,1,2,1}, n;\nint main () {\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",a[n]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab523daa1c865203c00fff27ea78155d", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{int n;\n\nscanf(\"%d\",&n);\nprintf(\"%d\",(n==5)?1:n%3+1)\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "140979b850698e856e6e4e1a3db8f376", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nmain () {\n\tint a[6]={0,2,3,1,2,1};\n\tscanf(\"%d\",&a);\n\tprintf(\"%d\",arr[a]);\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c3940bc16d460dacb5b49ea6e035391e", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "int n;\n\nmain(){\n scanf(\"%d\",&n);\n if(n==5) return 1;\n printf(\"%d\\n\",n%3+1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "48ba40695cc00e19ec6ef53d913c564f", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\nint x,t,a,b,da,db,i,j,flag=0,c,y;\n\nscanf(\"%d %d %d %d %d %d\",&x,&t,&a,&b,&da,&db);\nc=b;\n\nif(x==0)\n{\nprintf(\"YES\");\n}\n\nelse\nif(x!=0)\n{\nfor(i=0;i\n//#include\n#include\nint main ()\n{\n int x,t,a,b,c,d,i,j,p;\n scanf(\"%d %d %d %d %d %d\",&x,&t,&a,&b,&c,&d);\n for(i=0;i0= && b-j*d>=0) { printf(\"YES\"); goto p; }\n printf(\"NO\");\n p: // getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fffc618f44adedb70a5aa778ceb16912", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n//#include\n#include\nint main ()\n{\n int x,t,a,b,c,d,i,j,p;\n scanf(\"%d %d %d %d %d %d\",&x,&t,&a,&b,&c,&d);\n if(x==0){ printf(\"YES\"); goto p; }\n if(x!=0{)for(i=0;i=0 && b-j*d>=0) { printf(\"YES\"); goto p; }}\n printf(\"NO\");\n p: // getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "089451ad42fb43783b6fe1256362d273", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n//#include\n#include\nint main ()\n{\n int x,t,a,b,c,d,i,j,p;\n scanf(\"%d %d %d %d %d %d\",&x,&t,&a,&b,&c,&d);\n if(x==0){ printf(\"YES\");\n if(x!=0){for(i=0;i=0 && b-j*d>=0) { printf(\"YES\"); goto p; }}\n printf(\"NO\");\n p: // getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4641cfefad4aaaf05a3a58c5f47ca2a5", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int x,t,a,b,da,db,i,j,m,n;\n scanf(\"%d %d %d %d %d %d\",&x,&t,&a,&b,&da,&db);\n if(x==0) {printf(\"YES\");exit(0);}\n for(i=0;i\nint main(){\n\tint n,m,k;\n\tint r,c;\n\tscanf(\"%d %d %d\",&n,&m,&k);\n\tif(k=n){\n\t\tr = n-(k-n)/(m-1);\n\t\tif(r%2 == 0){\n\t\t\tc = (k-n)%(m-1) + 2;\n\t\t\tprintf(\"%d %d\",r,c);\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tc = m-(k-n)%(m-1);\n\t\t\tprintf(\"%d %d\",r,c);\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0c07883603d9b83c10429331ed77a6de", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n\t_int64 m,n,k;\n\tscanf(\"%I64d %I64d %I64d\",&m,&n,&k);\n\n\tif(k<=m-1)\n\t{\n\t\tprintf(\"%I64d 1\\n\",k+1);\n\t}else if(k<=m+n-2)\n\t{\n\t\tprintf(\"%I64d %I64d\\n\",m,k-m+2);\n\t}else\n\t{\n\t\t_int64 line,column,count;\n\t\tk=k-m-n+2;\n\t\tcount=k/(n-1);\n\t\tk=k-count*(n-1);\n\t\tline=m-count;\n\t\tif(k!=0)\n\t\t\tline--;\n\t\tif(count%2==0)\n\t\t{\n\t\t\tcolumn=n-k+1;\n\t\t\tif(k==0)\n\t\t\t\tcolumn--;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcolumn=2+k;\n\t\t\tif(k==1)\n\t\t\t\tcolumn--;\n\t\t}\n\n\t\tprintf(\"%I64d %I64d\\n\",line,column);\n\t}\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "39484741d86968e125efebbdfc0d50b4", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\t_int64 m,n,k;\n\tscanf(\"%I64d %I64d %I64d\",&m,&n,&k);\n\n\tif(k<=m-1)\n\t{\n\t\tprintf(\"%I64d 1\\n\",k+1);\n\t}else if(k<=m+n-2)\n\t{\n\t\tprintf(\"%I64d %I64d\\n\",m,k-m+2);\n\t}else\n\t{\n\t\t_int64 line,column,count;\n\t\tk=k-m-n+2;\n\t\tcount=k/(n-1);\n\t\tk=k-count*(n-1);\n\t\tline=m-count;\n\t\tif(k!=0)\n\t\t\tline--;\n\t\tif(count%2==0)\n\t\t{\n\t\t\tcolumn=m-k+1;\n\t\t\tif(k==0)\n\t\t\t\tcolumn--;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcolumn=2+k;\n\t\t\tif(k==1)\n\t\t\t\tcolumn--;\n\t\t}\n\n\t\tprintf(\"%I64d %I64d\\n\",line,column);\n\t}\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "477bef7ae09f7a48d75cdd8bd94779b8", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n unsigned long long int n,m,k,i,j,x=1,y=1,c=1,l,up=0,r;\n\n scanf(\"%llu %llu %llu\",&n,&m,&k);\n\n if(k<=(n-1)+(m-1))\n {\n if(k<=n-1) printf(\"%llu 1\",1+k);\n else\n {\n c=k-(n-1);\n printf(\"%llu %llu\",n,1+c);\n }\n }\n else\n {\n // printf(\"n=%llu m=%llu\\n\",n,m);\n c=(n-1)+(m-1);\n k-=c;\n x=n;\n y=m;\n up=k/(m-1);\n r=k%(m-1);\n x-=up;\n // printf(\"c=%llu k=%llu up=%llu r=%llu x=%llu\\n\",c,k,up,r,x);\n if(r==0)\n {\n if(up%2==1) y=2;\n if(up%2==0) y=m;\n }\n else if(r>0){\n up++;\n r--;\n x--;\n // printf(\"up=%llu r=%llu x=%llu\\n\",up,r,x);\n\n if(up%2==1) //go left\n {\n for(i=1; i<=r; i++)\n {\n y--;\n // printf(\"x=%llu y=%llu\\n\",x,y);\n }\n }\n if(up%2==0) //go right\n {\n if(r==0) y=m;\n if(r>0)\n {\n for(i=1; i<=r; i++)\n {\n y++;\n // printf(\"x=%llu y=%llu\\n\",x,y);\n }\n }\n\n }\n }\n printf(\"%llu %llu\",x,y);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b48d1a69335b6666c76bdea36d8c721b", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n\tint64_t m,n,k;\n\tscanf(\"%I64d %I64d %I64d\",&m,&n,&k);\n\n\tif(k<=m-1)\n\t{\n\t\tprintf(\"%I64d 1\\n\",k+1);\n\t}else if(k<=m+n-2)\n\t{\n\t\tprintf(\"%I64d %I64d\\n\",m,k-m+2);\n\t}else\n\t{\n\t\tint64_t line,column,count;\n\t\tk=k-m-n+2;\n\t\tcount=k/(n-1);\n\t\tk=k-count*(n-1);\n\t\tline=m-count;\n\t\tif(k!=0)\n\t\t\tline--;\n\t\tif(count%2==0)\n\t\t{\n\t\t\tcolumn=m-k+1;\n\t\t\tif(k==0)\n\t\t\t\tcolumn--;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcolumn=2+k;\n\t\t\tif(k==1)\n\t\t\t\tcolumn--;\n\t\t}\n\n\t\tprintf(\"%I64d %I64d\\n\",line,column);\n\t}\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "87b01c75798055dc3f6cd71cc8701704", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\n int k,n,s,p,pack,ans,m1,m2;\n float r1,r2;\n scanf(\"%d %d %d %d\",&k,&n,&s,&p);\n m1=(int)(n/s);\n r1=n%s;\n if(r1==0)\n {\n m2=(int)((k*m1)/p);\n r2=(k*m1)%p;\n if(r2==0)\n {\n ans=m2;\n printf(\"%d\\n\",ans);\n }\n else if(r2!=0)\n {\n ans=m2+1;\n printf(\"%d\\n\",ans);\n }\n }\n else if(r1!=0)\n {\n m2=(int)((k*(m1+1))/p);\n r2=(k*(m1+1))%p;\n if(r2==0)\n {\n ans=m2;\n printf(\"%d\\n\",ans);\n }\n else if(r2!=0)\n {\n ans=m2+1;\n printf(\"%d\\n\",ans);\n }\n }\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "259853f1dacc2a388ec1fecbab0a239e", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\ufeff\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27428.2037\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"965A\", \"965A\\965A.vcxproj\", \"{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x64 = Debug|x64\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x64 = Release|x64\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Debug|x64.Build.0 = Debug|x64\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Debug|x86.ActiveCfg = Debug|Win32\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Debug|x86.Build.0 = Debug|Win32\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Release|x64.ActiveCfg = Release|x64\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Release|x64.Build.0 = Release|x64\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Release|x86.ActiveCfg = Release|Win32\n\t\t{19AC7C7E-EC0E-4529-81CB-F2BF5AC48EBE}.Release|x86.Build.0 = Release|Win32\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {ED5C4B44-0423-42FA-8D36-27F7125D339A}\n\tEndGlobalSection\nEndGlobal\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "774326507738d3b5ae94f8ba922adfac", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main(){\n int sum,n,k,s,p;\n scanf(\"%d %d %d %d\",&k,&n,&s,&p);\n if(n%s!=0)\n sum=(n/s)+1;\n else\n sum=n/s;\n sum=sum*k;\n if(sum%p!=0)\n sum=(sum/p)+1;\n else\n sum=(sum/p);\n printf(\"%d\",sum);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8b70bbb78660bceffb6225228038673", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tlong k,n,s,p;\n\tcin >>k >>n>>s>>p;\n\tlong i=0;\n\twhile(1)\n\t{\n\t\tint sototrennguoi=(i*p)/k;\n\t\tif((sototrennguoi*s)\nusing namespace std;\nint f(int x,int y)\n{\n\tif(x/y==0)\n\treturn 1;\n\telse if(x%y!=0)\n\treturn x/y+1;\n\telse if(x%y==0)\n\treturn x/y;\n}\nint main()\n{\n\tint k,n,s,p;\n\twhile(~scanf(\"%d%d%d%d\",&k,&n,&s,&p))\n\t{\n\t\t long long int h,j;\n\t\t h=f(n,s)*k;\n\t\t j=f(h,p);\n\t\t cout<\nint a[10];\nint check(int n)\n{\n while(n) {\n int d=n%10;\n if(a[d])return 1;\n n/=10;\n }\n return 0;\n}\nint div(int num){\n int count=0;\n int i;\n for(i=1; i<=num/2; i++) {\n if(!(num%i)){\n //printf(\"%d \",i);\n if(check(i))count++;\n }\n }\n return count;\n }\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int m=n;\n while(m){\n int d=m%10;\n a[d]++;\n m/=10;\n }\n int num=div(n);\n if(n==1)\n printf(\"1\\n\");\n else\n printf(\"%d\\n\",num+1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "31c1d24312f38e6b3a61ca387db97628", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint cif_x[11];\nint cif_d[11];\n\nint cifra (int x, int d){\n int cx=0, cd=0;\n int i=0, j=0;\n int t;\n while (x/10 != 0){\n cif_x[cx]=x%10;\n x=x/10;\n cx++;\n }\n cif_x[cx]=x;\n cx++;\n while (d/10 != 0){\n cif_d[cd]=d%10;\n d=d/10;\n cd++;\n }\n cif_d[cd]=d;\n cd++;\n for (i=0; i\n#include \n\nint Judge(int a,int b)\n{\n int i;\n int A[10],B[10];\n memset(A,0,sizeof(A));\n memset(B,0,sizeof(B));\n while(a)\n {\n ++A[a%10];\n a/=10;\n }\n while(b)\n {\n ++B[b%10];\n b/=10;\n }\n for(i=0;i<10;++i)\n {\n if(A[i]&&B[i])\n {\n return 1;\n }\n }\n return 0;\n}\n\nint main()\n{\n int X,i,Cnt;\n scanf(\"%d\",&X);\n for(i=Cnt=1; i<=X/2; ++i)\n {\n if(X%i==0)\n {\n if(Judge(X,i))\n {\n ++Cnt;\n }\n }\n }\n printf(\"%d\\n\",Cnt);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a5d32fa207d0a311783c248bbf9dc26", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,i,j=0,count=0,k,f=1,l;\n scanf(\"%d\",&n);\nint b[11],c[11];\n for(i=0;i<11;i++)\n b[i]=c[i]=-1;\n int d=n,e;\n i=0;\n while(d!=0)\n {\n e=d%10;\n d=d/10;\n b[i]=e;\n i++;\n }\n for(i=1;i<=n/2;i++)\n {\n f=1;\n j=0;\n for(l=0;l<11;l++)\n c[l]=-1;\n if(n%i==0)\n {\n d=i;\n while(d!=0)\n {\n e=d%10;\n d=d/10; \n c[j]=e;\n j++;\n }\n for(j=0;b[j]!=-1;j++)\n {for(k=0;c[k]!=-1;k++)\n {\n if(c[k]==b[j])\n {\n count++;\n f=0;\n break;\n }\n }\n if(f==0)\n break;\n }\n }\n }\n count++;\n printf(\"%d\\n\",count);\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1aa5ff0983022df45b01ed2ae7d77355", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint n , divisor[30] , divisorcnt[30] , m = 0 ;\nint ans = 0 ;\n\nint bitcnt (int k) {\n\tint res = 0 ;\n\n\tfor (; k != 0 ; k /= 10)\n\t\tres |= 1 << (k%10) ;\n\n\treturn res ;\n}\n\nvoid dfs (int k , int s) {\n\tif (k == m) {\n\t\tif (bitcnt(s) & bitcnt(n))\n\t\t\t++ans ;\n\n\t\treturn ;\n\t}\n\n\tfor (int i = divisorcnt[k] ; i >= 0 ; --i) {\n\t\tdfs (k + 1 , s) ;\n\t\ts *= divisor[k] ;\n\t}\n}\n\nint main (void) {\n\tscanf (\"%d\" , &n) ;\n\n\tint j = n ;\n\tfor (int i = 2 ; i*i <= j ; ++i)\n\t\tif (j % i == 0) {\n\t\t\tdivisor[m] = i ;\n\t\t\tdivisorcnt[m] = 0 ;\n\n\t\t\tfor (; j % i == 0 ; j /= i)\n\t\t\t\t++divisorcnt[m] ;\n\n\t\t\t++m ;\n\t\t}\n\n\tif (j > 1) {\n\t\tdivisor[m] = j ;\n\t\tdivisorcnt[m] = 1 ;\n\t\t++m ;\n\t}\n\n\tdfs (0 , 1) ;\n\n\tprintf (\"%d\\n\" , ans) ;\n\treturn 0 ;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7c449393f5c4852757af417d5ec44fb9", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\n\n\nint main()\n{\n int n,*a,i,x,j,l,k;\n scanf(\"%d\",&n);\n a=(int*)malloc(n*sizeof(int));\n \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 \n x=a[0];\n for(i=0;ia[n-1])\n {\n printf(\"-1\");\n return 0;\n }\n continue;\n }\n } \n \n \n if(a[i]+x==a[i+1])\n {\n l=0;\n for(j=0;ja[n-1])\n {\n printf(\"-1\");\n return 0;\n }\n continue;\n } \n \n }\n \n if(a[i]==a[i+1])\n {\n l=0;\n for(j=0;ja[n-1])\n {\n printf(\"-1\");\n return 0;\n }\n continue;\n } \n }\n }\n printf(\"%d\",x);\n return 0;\n}\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d2e2137b250f704f8a5577915506750", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n\n\nint min(int a[],int n)\n{ int min=a[0];\n for(int i=0;imax)\n max=a[i];\n }\n return max;\n}\n\nint makethemequal(int a[],int n)\n{\n int mi=min(a,n),ma=max(a,n),d=(ma-mi),count=0;\n\n for(int i=0;i\n\nint main(){\n int a, b[3], index = 0;\n scanf(\"%d\", &a);\n for(int i = 0; i < a; i++){\n if(index > 3){\n printf(\"-1\");\n return 0;\n }\n scanf(\"%d\", &b[index]);\n bool kill = true;\n for(int e = 0; e < index && kill; e++){\n if(b[e] == b[index]){\n kill = false;\n }\n }\n if(kill){\n index++;\n }\n }\n if(index == 1){\n printf(\"0\");\n } else if(index == 2){\n int c = b[1]-b[0];\n if(c%2 == 0){\n c/=2;\n }\n printf(\"%d\", c);\n } else {\n for(int i = 0; i < 2; i++){\n for(int e = i+1; e < 3; e++){\n if(b[i] > b[e]){\n int sw = b[i];\n b[i] = b[e];\n b[e] = sw;\n }\n }\n }\n if(b[1]-b[0] == b[2]-b[1]){\n printf(\"%d\", b[1]-b[0]);\n } else {\n printf(\"-1\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "66bcbbeef9a108828542c76af0a955e4", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nusing namespace std;\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 i,n,max,min,flag,mid;\n\tint a[1000];\n\tfor(;scanf(\"%d\",&n)!=EOF;)\n\t{\n\t\tflag=1;\n\t\tmax=-1;\n\t\tmin=101;\n\t\tmemset(a,0,sizeof(a));\n\t\tfor(i=0;imax)\n\t\t\tmax=a[i];\n\t\t\tif(a[i]=0)\n\t\t\tfor(i=0;i\n\n\nint min(int a[],int n)\n{ int min=a[0];\n for(int i=0;imax)\n max=a[i];\n }\n return max;\n}\n\nint makethemequal(int a[],int n)\n{\n int mi=min(a,n),ma=max(a,n),d=(ma-mi),count=0;\n\n for(int i=0;i\n\nint a[8] = {1, 2, 9, 64, 625, 7776, 117649, 2097152};\nint m = 1000000007;\n\nlong long mod_pow(long long x, long long y)\n{\n long long ans = 1;\n \n while (y) {\n if (y & 1) ans = ans * x % m;\n \n x = x * x % m;\n y >>= 1;\n }\n \n return ans;\n}\n\nint main()\n{\n int n, k, i;\n long long ans;\n \n scanf(\"%d %d\", &n, &k);\n \n ans = a[k - 1];\n \n ans = ans * mod_pow(n - k, n - k) % m;\n \n printf(\"%d\\n\", (int)ans);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c177329ab38a3054cdda69ed41d4b29b", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint a[8] = {1, 2, 9, 64, 625, 7776, 117649, 2097152};\nint m = 1000000007;\n\nlong long mod_pow(long long x, long long y)\n{\n long long ans = 1;\n \n while (y) {\n if (y & 1) ans = ans * x % m;\n \n x = x * x % m;\n y >>= 1;\n }\n \n return ans;\n}\n\nint main()\n{\n int n, k, i;\n long long ans;\n \n scanf(\"%d %d\", &n, &k);\n \n ans = a[k - 1];\n \n ans = ans * mod_pow(n - k, n - k) % m;\n \n printf(\"%d\\n\", (int)ans);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ff4b5164e54e060e66eb9d86ea825d4d", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\n#define mod 1000000007\n\nint mypow(int x, int y)\n{\n\tint res = 1;\n\twhile ( y )\n\t{\n\t\tif ( y & 1 )\n\t\t\tres = res * (long long) x % mod;\n\t\tx = x * (long long) x % mod;\n\t\ty >>= 1;\n\t}\n\treturn res;\n}\n\nint main()\n{\n\tint i, k, n, res;\n\tscanf(\"%d%d\", &n, &k);\n\tif ( n < k )\n\t\tk = n;\n\tres = mypow(k, k-1) * (long long) mypow(n-k, n-k) % mod;\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "044332a888e2da5a34142d27bbe8d080", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tint i, n, k, ans, mod;\n\tscanf(\"%d%d\", &n, &k);\n\tmod = 1000000007;\n\tans = 1;\n\tfor (i = 1; i <= k; ++i)\n\t\tans *= k;\n\tans /= k;\n\tfor (i = 1; i <= n - k; ++i)\n\t\tans = (ans * (n - k) % mod) % mod;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "edb218ce82bd3596c4b11d0b5db3ad74", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\n#define MOD 1000000007\n\nlong long binpow(long long a, long long k)\n{\n long long ans = 1;\n if(a == 0) return 1;\n while(k)\n {\n if(k & 1) \n {\n ans *= a;\n ans %= MOD;\n }\n a *= 2;\n a %= MOD;\n k >>= 1;\n }\n return ans;\n}\n\nint main()\n{\n long long n, k; \n scanf(\"%lld %lld\", &n, &k);\n printf(\"%lld\", binpow(k, k - 1) * binpow(n - k, n - k) % MOD);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b35929c655cc6640d6021677f1bf5079", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int XP,NB,n;\n scanf(\"%d %d\", &XP, &NB);\n n=(XP+NB)/3;\n if(XP==0 // NB==0)\n {\n printf(\"0\\n\");\n return 0;\n } \n if( n <= XP )\n printf(\"%d\\n\", n);\n else\n printf(\"%d\\n\", XP);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "368b020825e94a5da37c9b039565567b", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n\n unsigned n,m;\n scanf(\"%u %u\",&n,&m);\n\n if(n==m){\n printf(\"%u\",2*m/3);\n return 0;\n }\n else if(n=2){\n printf(\"%u\",n/2+1);\n }\n }\n else{\n if(n>=8){\n printf(\"%u\",n/2+Q);\n }\n else printf(\"&u\",n/2+2);\n }\n }\n else printf(\"%u\",m);\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7d5fe23b04f28a4dbc60f504c9854ee1", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n, m, x, y, multiple;\n scanf(\"%d %d\", &n, &m);\n if(n + m < 3){\n printf(\"0\");\n return 0;\n }\n if(n == m){\n printf(\"%d\", (n+m)/3);\n return 0;\n }\n if(n == 2*m){\n printf(\"%d\", n);\n return 0;\n }\n else(m == 2*n){\n printf(\"%d\", m);\n return 0;\n }\n\n\n\n if(n > m){\n multiple = 2 * m;\n while(m > 0){\n if(n < multiple){\n multiple-=3;\n m--;\n }\n else\n break;\n\n }\n }\n else{\n multiple = 2 * n;\n while(n > 0){\n if(m < multiple){\n multiple-=3;\n n--;\n }\n else\n break;\n\n }\n }\n printf(\"%d\", n);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "68638d76095899d7bfdeb1433cfa71d8", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\tint m = 0, n = 0;\n\tscanf(\"%d %d\", &m, &n);\n\n\tint output = (m + n) / 3;\n\t\n\tprintf(\"%d\\n\", min(min(m, output), n));\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "60417ef64a32c1f4c3efb1232147a897", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int x,y;int teams=0;\n scanf(\"%d%d\",&x,&y);\n if(n+m<3)\n printf(\"0\");\n else{\n while(x>0||y>0)\n {\n if(x<=y)\n {\n if(x<=y/2)\n {\n teams+=x;\n break;\n }\n else if(x>y/2)\n {\n teams++;\n x--;\n y=y-2;\n }\n }\n else if(x>y)\n {\n if(x/2>=y)\n {\n teams+=y;\n break;\n }\n else if(x/2\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}\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 }\nwhile(1)\n{\n\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\n\n}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d5e613780450f4fef9292f4914453fba", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "GNU C", "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}\nif(x>0&&y>-x+1&&y<=x)\nturn=4*x-3;\nif(y>0&&x=-y)\nturn=4*y-2;\nif(x<0&&y>=x&&y<-x)\nturn=-4*x-1;\nif(y<0&&x>y&&x<=-y+1)\nturn=-4*y-0;\nprintf(\"%d\",turn);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee738ac704fb6eb7383ce0679e1a4670", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint x,y,turn;\nscanf(\"%d %d\",&x,&y);\nif(x==0&&y==0||x==0&&y==1)\n{\n printf(\"0\");\n return 0;\n}\nif(x>0&&y>-x+1&&y<=x)\nturn=4*x-3;\nif(y>0&&x=-y)\nturn=4*y-2;\nif(x<0&&y>=x&&y<-x)\nturn=-4*x-1;\nif(y<0&&x>y&&x<=-y+1)\nturn=-4*y-0;\nprintf(\"%d\",turn);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d6e0c82cebce3b003574539012d0ebc", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "GNU C", "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);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b08fd8e4c4c8c678ffa9de3935d1118", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "GNU C", "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 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;\nprintf(\"%d\",turn);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "708a729c37e4cd409815a89b77fdac01", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n\n\n char a[100],max;\n long long i,j,k,l,m,pt,flag=0;\n scanf(\"%s\",a);\n l=strlen(a);\n //printf(\"%c\\n\",a[l-1]);\n if(a[0]!='-')\n {\n printf(\"%s\",a);\n }\n else\n {\n for(i=2;ia[l-1])\n pt=l-2;\n else\n pt=l-1;\n\n\n }\n break;\n }\n else if(i==l-1)\n {\n pt=1;\n flag=1;\n }\n\n\n\n }\n if(flag==1)\n {\n printf(\"0\");\n }\n else\n {\n\n for(j=0;j\n#define MAX(a,b) ((a>b)?a:b)\nint main(){\n int n;\n int temp1,temp2;\n scanf(\"%d\",&n);\n if(n>0) temp1=n/10;\n else temp1=-((-n)/10);\n if(n>0) temp2=n%10+(n/100)*10;\n else temp2=-((-n)%10+((-n)/100)*10)\n printf(\"%d\",MAX(n,MAX(temp1,temp2));\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c14563c6998670eb941c110fc07008b", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "222d7ff0156c653dca26174d31d7aaa9", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n long input;\n\n\tscanf(\"%ld\",&input);\n\t if((input/10>input || (input/100)*10+(input%10)>input)&&input/10 !=0){\n if(input/10 > (input/100)*10+(input%10)){\n input = input/10;\n\n }\n else {\n input =(input/100)*10+(input%10);\n\n\t}\n\n\tprintf(\"%ld\\n\",input);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1343ac4efa60fd56293d9ebc5f34e1d1", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n,a,rem,rem2,c=0;\n scanf(\"%d\",&n);\n a=n;\n if(n>0)\n printf(\"%d\",n);\n else\n {\n rem=n%10;\n n=n/10;\n rem2=n%10;\n a=n/10;\n if(abs(rem)>abs(rem2))\n printf(\"%d\",n);\n else\n {if(a==0)\n prinf(\"0\");\n else\n printf(\"%d%d\",a,abs(rem));\n }\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9742ffb23c7c0d601b8b5c6804bb907c", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint compare_function(const void *a,const void *b) {\n int *x = (int *) a;\n int *y = (int *) b;\n return *x - *y;\n}\n\nvoid print_array(int a[], int size) {\n printf(\"[\");\n for (int i = 0; (i < size); i++) {\n printf(\"%d \", a[i]);\n }\n printf(\"]\\n\");\n}\n\n\nint main(void) {\n int len;\n int input;\n int number_paints = 0;\n int in = 0;\n\n scanf(\"%d\", &len);\n int colors[len];\n int check[len];\n \n\n for(int i = 0; i < len; i++) {\n scanf(\"%d\", &input);\n colors[i] = input;\n //printf(\"EEEE: %d\", colors[i]);\n } \n\n //print_array(colors, len);\n\n qsort(colors, sizeof(colors)/sizeof(colors[0]), sizeof(colors[0]), compare_function);\n\n //print_array(colors, len);\n\n check[0] = colors[0];\n number_paints += 1;\n\n\n for (int color_iter = 0; color_iter < len; color_iter++) {\n for (int check_iter = 0; check_iter < number_paints; check_iter++) {\n if (colors[color_iter] % check[check_iter] == 0) {\n in = 1;\n break;\n }\n\n else {\n in = 0;\n }\n\n }\n if (!in) {\n //printf(\"THIS RUNS\\n\");\n check[number_paints] = colors[color_iter]; \n number_paints += 1;\n in = 1;\n\n }\n ..print_array(check, number_paints);\n }\n\n printf(\"%d\" , number_paints);\n\n return 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f2c9f5495754953ce188be91c210d52a", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint\nmain(void)\n{\n // value of number as you input it into initNumbers -->\n int num = 0;\n // length of your array will be -->\n int length = 0;\n\n scanf(\"%d\", &length);\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\n int initNumbers[length];\n\n int divisors[length];\n\n int counter;\n\n for(int i = 0; i < length; i++)\n {\n scanf(\"%d\",&num);\n initNumbers[i] = num;\n }\n\n for(int i = 0; i < length; i++)\n {\n for(int j = 0; j<25;j++)\n {\n for(int k = 0; k\n\nint main()\n{\n int n,tem;\n int min;\n scanf(\"%d\",&n);\n int a[n];\n int count=0;\n\n for(int i=0;i\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[100];\n\tint i, j=0, flag=1, temp, x=0;\n\tfor(i=0;i\n\nvoid main()\n{\n\n int n;\n scanf(\"%d\",&n);\n\n int a[n],temp[n],i,min=101,color=0,loopcount=0;\n\n for(i=0;i\n\nusing namespace std;\n\nint main()\n{\n int n;\n cin>>n;\n cout << (n-2)*(n-2) <\nusing namespace std;\nint main()\n{\n\tlong long int n;\n\tcin>>n;\n\tlong long int ans=(n-2)*(n-2);\n\tcout<\nint main() {\n int n;\n scanf(\"%d\",&n);\n long long res=(long long)(n-2)*(long long)(n-2);\n printf(\"%lld\\n\",res);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cbcf273aab8399c1871459686e2664bd", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": " \n#include\nint main()\n{\n\t _int64 duobianxing; \n\t \n\tscanf(\"%I64d\",&duobianxing);\n\n\tduobianxing = (duobianxing-2)*(duobianxing-2);\n \n printf(\"%I64d\\n\",duobianxing);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b3fe34c5ef6ce12e6fe8dfde81ed66fa", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n scanf(\"%d\",&n);\n c=(n-2)*(n-2);\n printf(\"%d\",c);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dccabdecdb8bad5b6a5e3fd3c74bfad0", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "include\nint main()\n{\n int n,k,l,c,d,p,nl,np,q,r;\n scanf(\"%d %d %d %d %d %d %d %d\",&n,&k,&l,&c,&d,&p,&nl,&np);\n int a=(k*l)/nl;\n int b=c*d;\n int m=p/np;\n if(a<=b&&a<=m)\n {\n q=a;\n }\n else if(b<=a&&b<=m)\n {\n q=b;\n }\n else if(m<=a&&m<=b)\n {\n q=m;\n }\n r=q/n;\n printf(\"%d\",r);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "100fcb64c5fe14bb7f381fb508c2e02d", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,l,c,d,p,nl,np,i,j,o,m;\n scanf(\"%d%d%d%d%d%d%d%d\",&n,&k,&l,&c,&d,&p,&nl,&np);\n i=(k*l)/nl;\n j=c*d;\n m=p/np;\n if(i<=j && i=\nint main()\n{\n int n,k,l,c,d,p,nl,np,a,b,c;\n scanf(\"%d%d%d%d%d%d%d%d\",&n,&k,&l,&c,&d,&p,&nl,&np);\n a=((k*l)/nl)/n;b=(c*d)/n;c=(p/np)/n;\n a\nman()\n{\n int n,k,l,c,d,z,p,y,nl,x,np;\n scanf(\"%d %d %d %d %d %d %d %d\",&n,&k,&l,&c,&d,&p,&nl,&np);\n x=k*l/nl;\n y=c*d;\n z=p/np;\n if(xy&&yz&&y>z)\n printf(\"%d\",z/n);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ccfb85cd33ae442f057e81dd3bbf262", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n\nint main()\n{\nint n,k,l,c,d,p,np,nl;\nscanf(\"%d %d %d %d %d %d %d %d\",&n,&k,&l,&c,&d,&p,&np,&nl);\nint Toast=min(min(k * l / nl, c * d), p / np) / n;\nprintf(\"%d\",toast);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6fa2b3c7565606cebec7928613ccea15", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf2f48621500c57d527c6e90a370749a", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.0} {"lang": "GNU C11", "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\texponentexponent/=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 }", "lang_cluster": "C", "compilation_error": true, "code_uid": "0ddc0811979a8e01b21725b34bb5fc14", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.0} {"lang": "GNU C", "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\nint main()\n{\n\tlong long int a,b,n,x;\n\tscanf(\"%lld %lld %lld %lld\", &a,&b,&n,&x);\n\tint i;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tx=a*x+b;\n\t\tx=x%1000000007;\n\t}\n\tprintf(\"%lld\", x);\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3b33551f9958d3645f897ddc2ae32cd6", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#define M 1000000007 \nint main () {\n\tlong long int a,b,n,x ,i,sum=0,f=1;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&n,&x) ;\n\ta=a%M ;\n\tfor (i=0;i\nint main()\n{\n int m,c[100],x,y,i,p=0,ans;\n scanf(\"%d\",&m);\n for(i=0;i=x)\n {\n ans = i+2;\n break;\n }\n }\n if(p<=y&&>=x)\n {\n printf(\"%d\",ans);\n }\n else\n {\n printf(\"0\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8f4ad937276a0419608636d92909d4d4", "src_uid": "e595a1d0c0e4bbcc99454d3148b4557b", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int m,x,y,out=0;\n scanf(\"%d\",&m);\n int c[m];\n for(int i=0;i=x&&(d[m-1]-d[i])<=y&&(d[m-1]-d[i])>=x)\n out=i+2;\n }\n printf(\"%d\",out);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "581b916e4c0b12d0564004badd89f041", "src_uid": "e595a1d0c0e4bbcc99454d3148b4557b", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nmain(){\nint n,x,y,i,dif,cont=0,z;\nint a[150],s[150];\n\n scanf(\"%d\",&n);\n suma[0]=0;\n for(i=1;i<=n;i++){\n scanf(\"%d\",&a[i]);\n s[i]=s[i-1]+a[i];\n }\n z=0;\n scanf(\"%d %d\",&x,&y);\n for(i=1;i<=n;i++){\n if(s[i]>=x&&s[i]<=y){\n dif=s[n]-s[i];\n if(dif>=x&&dif<=y){\n printf(\"%d\",i+1);\n return 0;\n }\n }\n }\n printf(\"0\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6bbb5f2b6fb5a54387d14fdf2fbb17f5", "src_uid": "e595a1d0c0e4bbcc99454d3148b4557b", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nint main (void){\n int i,j;\n int num;\n int min,max;\n int test=0,all=0;\n int score[100];\n scanf(\"%d\",&num);\n for(i=0;num>i;i++){\n scanf(\"%d\",&score[i]);\n all=all+score[i];\n }\n scanf(\"%d %d\",&min,&max);\n for(j=0;j=min)&&(test<=max)){\n if(((all-test)>=min)&&((all-test)<=max)){\n printf(\"%d\\n\",j+1);\n break;\n }\n if(j==i-1){\n printf(\"0\\n\");\n break;\n }\n test=test+score[j];\n }else{\n test=test+score[j];\n if(j==i-1){\n printf(\"0\\n\");\n break;\n }\n }\n }\n return(0);", "lang_cluster": "C", "compilation_error": true, "code_uid": "b6476ea2f60f936e989b5697e344e2d0", "src_uid": "e595a1d0c0e4bbcc99454d3148b4557b", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "//\n// main.c\n// codeforces\n//\n// Created by Artem Bastun on 13/10/13.\n// Copyright (c) 2013 Artem Bastun. All rights reserved.\n//\n\n#include \n#include \n\nint main(int argc, const char * argv[])\n{\n int n = 0;\n scanf(\"%d\" , &n);\n int *a = malloc((n + 1) * sizeof(int));\n int i = 0;\n a[0] = 0;\n for (i = 1; i <= n; i++) {\n int x = 0;\n scanf(\"%d\" , &x);\n a[i] += a[i-1] + x;\n }\n int l = 0 , r = 0;\n scanf(\"%d %d\" , &l , &r);\n for (int i = 1; i <= n; i++) {\n if (a[i-1] >= l && a[i-1] <= r && a[n] - a[i-1] >= l && a[n] - a[i-1] <= r) {\n printf(\"%d\" , i);\n return 0;\n }\n }\n printf(\"0\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b44c927a732efb87eb08f0680e1f6d2f", "src_uid": "e595a1d0c0e4bbcc99454d3148b4557b", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint a,b,c,sum=0;\nscanf(\"%d %d %d\",&x,&y,&z);\n\nif(x==y)\nprintf((z*2)+b+a);\n\nelse if(x>y)\nprintf((z*2)+(x*2)+1);\n\nelse if(x\nusing namespace std;\nint main()\n{\n int n;\n cin>>n;\n if(n>0){cout<<\"The number is postisve\"<\n{\n long long int i,a,b,c,j;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if(a>=b)\n {\n printf(\"%lld\",a+b+c*2);\n }\n else \n {\n printf(\"%lld\",c*2+2*a+1);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e067043a4f1cdcf506e31c44cf21e5cc", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "include\nvoid main()\n{\nint a,b,c,sum=0;\nscanf(\"%d %d %d\",&a,&b,&c);\n\nsum=a+b+(c*2);\n\nprintf(\"%d\", sum);\n \n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "35d59f758d63c3962fd530252d59008d", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main() #\n{\n int a,b,c,i,j=0;\n scanf(\"%d%d%d\",&a,&b,&c);\n a=a+c;\n b=b+c;\n if((a+b)%2==0){\n printf(\"%d\\n\",a+b);\n }\n else{\n for(i=1;i<=a+b;i++){\n a--;\n b--;\n j++;\n if((a==0 && b!=0)||(b==0 && a!=0)){\n j++;\n break;\n }\n printf(\"%d\\n\",j);\n }\n }\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b6d01eb142756d5480a89bfd84ff30f6", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int x=1,i=1;\n for(i=1;i\nint main()\n{\n lon long int a, n;\n scanf(\"%lld\",&n);\n a=n + (n-1)*n*n/2 -(n-1)*n*(2*n-1)/6;\n printf(\"%lld\",a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8e346e80ac86bb5047e28caf8284d504", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main ()\n{\n int n,s=0;\n scanf(\"%d\",&n);\n s=pow(2,n)-1;\n printf(\"%d\\n\",s;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4ada61591467a16f98dea160769ad0c9", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main() {\n int n;\n scanf(\"%d\", &n);\n int sum = 0;\n for(int i = 1; i <= n; i++) {\n sum += i;\n }\n int n = 1;\n for(int i = 2; i <= n -1; i ++) {\n \n sum+=n;\n n+=i;\n }\n printf(\"%d\", sum);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "770d52fd61ad2053e8f654c11d2743bc", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint fac(int n);\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tn=fac(n);\n\tprintf(\"%d\",n+1);\n\treturn 0;\n}\nint fac(int n){\n int n;\n while(n-1){\n\treturn (n*fac(n-1));\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d81d8377410c162f774f5e5a2104f8f6", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int l,r;\n scanf(\"%I64d %I64d\",&l,&r);\n int temp=l%2;\n if(l+2+temp<=r)\n {\n printf(\"%I64d %I64d %I64d\",l+t,l+1+t,l+2+temp);\n return 0;\n }\n 1printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "81a26821d4d78d3e67f3925933784836", "src_uid": "6c1ad1cc1fbecff69be37b1709a5236d", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nint pgcd(long long a,long long b)\n{long long i;\nint d;\nif (b%a==0)\n {return a;}\nif (a%b==0)\n{return b;}\ni=1;\nwhile (i<50)\n{ if ((a%i==0)&&(b%i==0))\n {d=i;\n i++;}\n else {i++;}\n}\nreturn d;\n\n}\n\n\nint main()\n{long long l,r,i,j,k;\nint n1,n2,n3;\n\ndo\n{\n\n\nscanf(\"%I64d %I64d\",&l,&r);\n}\nwhile ((r-l>50)||(r<1)||(l<1)||(r>pow(10,18))||(l>pow(10,18))||(l>r));\nfor(i=l;i<=r;i++)\n{\n for(j=i+1;j<=r;j++)\n\n\n {\n\n\n\nfor (k=j+1;k<=r;k++)\n\n {n1=pgcd(i,j); n2=pgcd(j,k);n3=pgcd(k,i);\n if (((n1==1)&&(n2==1))&&(n3!=1))\n {printf(\"%I64d %I64d %I64d\",i,j,k);\n return 0;}\n }}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "938dbf768fd935e7289a2e310a535b66", "src_uid": "6c1ad1cc1fbecff69be37b1709a5236d", "difficulty": 1100.0} {"lang": "GNU C", "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\nint main()\n{\n\tlong long int l,r;\n\tscanf(\"%lld %lld\",&l,&r);\n\tif(r-l<2 || (r-l=2 && l=1))\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\telse if(l%2==0)\n\t{\n\t\tprintf(\"%lld %lld %lld\",l,l+1,l+2);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld %lld %lld\",l+1,l+2,l+3);\n\t\treturn 0;\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a0f70cb90ff17b19e6296e66fbcc544d", "src_uid": "6c1ad1cc1fbecff69be37b1709a5236d", "difficulty": 1100.0} {"lang": "GNU C", "source_code": " #include \nint main(){\n\tlong long int l,r;\n\tscanf(\"%lld %lld\",&l,&r);\n\tif(r-l<2){\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tif(!(l%2)){\n\t\tprintf(\"%lld %lld %lld\",l,l+1,l+2);\n\t\treturn 0;\n\t}\n\tif(r-l>2){\n\t\tprintf(\"%lld %lld %lld\",l+1,l+2,l+3);\n\t\treturn 0;\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7395e5c0dbf2b84acdc643e8ef65e540", "src_uid": "6c1ad1cc1fbecff69be37b1709a5236d", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \nint n;\nint k;\nint x;\nscanf(\"%d %d\", &n, &k);\nx = n+1;\n\nwhile (x%k != 0){\n\tx = x + 1;\n}\n\nprintf(\"%d\", &x );", "lang_cluster": "C", "compilation_error": true, "code_uid": "0835f830c91b4cd231d25f4cfe57fbe9", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint n;\nint k;\nint x;\nscanf(\"%d %d\", &n, &k)\nx = n+1;\n\nwhile (x%k != 0){\n x = x + 1;\n}\n\nprintf(\"%d\", &x )", "lang_cluster": "C", "compilation_error": true, "code_uid": "62dbf838645a840a814ab19743cb56cb", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\n\nint main(){\n int n,m,k;\n scanf(\"%d %d\",&n,&k);\n m=n/k + 0.5;\n while(k*m<=n){\n m++;\n }\n printf(\"%d\\n\",k*m);\n return 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9bfee0becb01e289f8aa0c03b8a01a94", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0} {"lang": "GNU C", "source_code": "include\nint main()\n{\n int a,b,n,i;\n scanf(\"%d%d\",&a,&b);\n for(i=a+1;;i++){\n if(i%b==0){\n printf(\"%d\\n\",i);\n break;\n }\n }\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b6b40acf63b9bd07a138bca844e6d97", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\n\nint main(){\n register int n,m,k;\n scanf(\"%d %d\",&n,&k);\n m=n/k + 0.5;\n while(k*m<=n){\n m++;\n }\n printf(\"%d\\n\",k*m);\n return 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8c75f0240c93fb3668679267de0d79fa", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d2d7ca9b1f20b2002694a43a07113246", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\t\n\tint n ,k,i,j,l;\n\tscanf(\"%d %d,&n,&k);\n\t\n\tfor(i=0;i\nmain()\n{\n int n,s,i,a[n],max,sum=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i=max)\n max=a[i];\n }\n sum=sum-max;\n if(sum<=s)\n printf(\"YES\");\n else\n printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3c5b2204d1fc7777993fe68cc13b5778", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main ()\n{\n int n,s,a[20],x=0,max=0,i,j;\n scanf(\"%d %d\",&n,&s);\n for(i=1;i<=n;i++) {\n if(n>100) {\n printf(\"NO\\n\");\n return 0;\n scanf(\"%d\",&a[i]);\n x=x+a[i];\n if(n-i==2 && x>s) {\n printf(\"NO\\n\");\n return 0;\n }\n if(a[i]>max) {\n max=a[i];\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "91314684c034dc525ff927cdaa6570e6", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int a[105],n,i,sum,s;\n scanf(\"%d %d\",&n,&s);\n sum=0;max=0;\n for (i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if (a[i]>max) max=a[i];\n }\n if (sum-max<=s) printf(\"YES\"); else printf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a2cb1ca3790b2469ec133911311dfe39", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nvoid main()\n{\n int n;\n int s[50];\n scanf(\"%d\", &n);\n for(i=0;i\n\nint main()\n{\n\tint n, a, i, m = 0;\n\tscanf_s(\"%d\", &n);\n\t\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf_s(\"%d\", &a);\n\t\tif (a == 1) \n\t\t{\n\t\t\tprintf(\"hard\");\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm++;\n\t\t}\n\t}\n\tif (m == n)\n\t{\n\t\tprintf(\"easy\");\n\t}\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4a6ee61ffa8884e39742b7d0964c1be8", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n,k;\n\tscanf(\"%d\",&n);\n\twhile(n--)\n\t{\n\t\tscanf(\"%d\",&k);\n\t\t\n\n\t\t\n\t}\n\tif(k==1) printf(\"HARD\"); break;\n\n\telse if(k==0) printf(\"EASY\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e6aea6ec561edd81494b36a1e58f91d2", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint i,n,s;\nscanf(\"%d\",n);\nfor(i=0;i\nusing namespace std;\n\n\n\n\nint main() {\n ios_base::sync_with_stdio(0);\n cin.tie(0);\n\n int n;\n int x;\n cin >> n;\n for(int i = 1; i <= n; i++){\n cin >> x;\n if(x == 1){\n cout << \"Hard\";\n exit(1);\n }\n if(i ==n ){\n cout<<\"Easy\";\n }\n\n\n }\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1cf8b3db8ca83092fc9f2e9c65d795a2", "src_uid": "060406cd57739d929f54b4518a7ba83e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\twhile(n%3==0)\n\t\t{\n\t\t n=n/3;\n\t\t}\n\n\tprintf(\"%I64d\",(n/3)+1);\n\treturn\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3ccf01391ee544e3c9f4ee3665f68b66", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "include\nint main()\n{\nlong long int c,marks,temp,a=1;\nscanf(\"%lld\",&marks);\ntemp=marks;\nwhile(temp!=0)\n{\n if(temp%a!=0)\n {\n break;\n }\n else \n a*=3;\n}\nc=temp/a+1;\nprintf(\"%lld\",c);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8183720356c9c221b66ce9df90eca419", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "\n #include\nint main()\n{\n\tlong long p;\n\tscanf(\"%I64d\",&p)\n\twhile(p%3==0)\n\t p/=3;\n\tprintf(\"%I64d\",(p/3)+1);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "54c13d0496e4192f8da4838f525a1f14", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n\nusing namespace std;\n\nint main(){\n\tint a;\n\tcin>>a;\n\tint sd=log(a)/log(3);\n\tsd=pow(3,sd);\n\tint aw=a/sd;\n\tif(a%sd!=0)\n\t{\n\t\taw++;\n\t}\n\tcout<\nint main()\n{\n\tlong long int x,a=1,sum;\n\tscanf(\"%I64d\",&x);\n\twhile(x!=0)\n\t{\n\t\tif(x%a!=0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta=a*3;\n\t\t}\n\t}\t\n\t\tsum=x/a+1;\n\t\tprintf(\"%I64d\",sum);\n\t\treturn o;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "52ff17c47adcd3590a48a0560c8b0603", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint changes(char a[ ],int n);\nmain()\n{\n int c;\n char a[15];\n scanf(\"%s\",&a);\n c=changes(a,strlen(a));\n if(c==1 || (c==0 && strlen(a)%2!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\nint changes(char a[ ],int n)\n{\n int i,c=0;\n for(i=0;i\n#include \n\nint main(void)\n{\n char str[15]={0};\n int i=0, d=0,l=0;\n \n scanf(\"%s\",str);\n l=strlen(str);\n rev[l]='\\0';\n for(i=0;i\n#include\nint changes(char a[ ],int n);\nmain()\n{\n int c;\n char a[15];\n scanf(\"%s\",&a);\n c=changes(a,strlen(a));\n if(c==1 || (c==0 && n%2!=0))\n printf(\"YES\");\n else\n printf(\"NO\");\n}\nint changes(char a[ ],int n)\n{\n int i,c=0;\n for(i=0;i\n\nint main()\n{\n int a , i;\n int flag=0;\n char s[16];\n char *S = s;\n char *p = s;\n for(i = 0;i<16;i++)\n {\n s[i]= '0';\n }\n while(~scanf(\"%s\",s))\n {\n int j=0;\n while(s[j] != '0')\n {\n a++;\n j++;\n }\n a=a-2;\n int b = a/2;\n for(a=0,i=0 ;a > b;a--,i++)\n {\n if(S[i] != p[a])\n flag++;\n }\n if(flag <= 1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "32357002d2187fcfbb102fa27985b21d", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int t,s,x;\n scanf(\"%d%d%d\",&t,&s,&x);\n if(x==t+s)\n {\n printf(\"NO\");\n }\n else if(x==t+s+1)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n}\n~ ", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc98907c6c5f4fc927064a5339e790e9", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int t, i, x, total;\n scanf(\"%d %d %d\", &t, &i, &x);\n if(x==t) {\n printf(\"YES\");\n return 0;\n }\n else if(x%t==0){\n printf(\"NO\")\n return 0;\n } \n else if(x>t+1 && (x%i<(t+2))) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f480152fe667c57f6f613ca4ebfb7784", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main() {\n\tint t, s, x;\n\twhile (scanf(\"%d%d%d\", &t, &s, &x)==3){\n\t\tif ((x - t) % s == 0) {\n\t\t\tprintf(\"YES\\n\");\n\t\t}\n\t\telse {\n\t\t\tif ((x - 1) > t && (x - 1) % t == 0) {\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t}\n\t\t}\n\t};\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "40bc75e6853669feade99caf553253a2", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n int t, s, x;\n scanf(\"%d%d%d\", &t, &s, &x); //\u8bfb\u5165\n int tmp = x - t;\n if ((tmp % s == 0 || tmp % s == 1) && tmp >= 0 && tmp != 1) //\u5224\u65adx\u79d2\u65f6\u83e0\u841d\u662f\u5426\u4f1a\u53eb\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "54ddacead19ab4a998ae43e2284e3813", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int t,s,x,i=1;\n scanf(\"%lld %lld %lld\",&t,&s,&x);\n if(xt+i*s+1)\n {i++;}\n if(x==t+i*s||x==t+i*s+1)\n {printf(\"YES\");}\n else\n {printf(\"NO\");}\n }\n }\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "f89413f81ed93af0710d004f3b7aa6c5", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0} {"lang": "GNU C", "source_code": "e#include\n\nint main(){\n\nint n,a,b,q=0;\n\nscanf(\"%d\", &n);\n\nb=n%10;\n\na=n/10;\n\n\nif(a == 2)\n printf(\"twenty\");\n\nelse if(a == 3)\n printf(\"thirty\");\n\nelse if(a == 4)\n printf(\"forty\");\n\nelse if(a == 5)\n printf(\"fifty\");\n\nelse if(a == 6)\n printf(\"sixty\");\n\nelse if(a == 7)\n printf(\"seventy\");\n\nelse if(a == 8)\n printf(\"eighty\");\n\nelse if(a == 9)\n printf(\"ninety\");\n\n\nif(b != 0 )\n if(a!=0)\n if(a!=1)\n printf(\"-\");\n\n\n\n\nif(b == 2 && a!=1)\n printf(\"two\");\n\nelse if(b == 1 && a!=1)\n printf(\"one\");\n\nelse if(b == 3 && a!=1)\n printf(\"three\");\n\nelse if(b == 4 && a!=1)\n printf(\"four\");\n\nelse if(b == 5 && a!=1)\n printf(\"five\");\n\nelse if(b == 6 && a!=1)\n printf(\"six\");\n\nelse if(b == 7 && a!=1)\n printf(\"seven\");\n\nelse if(b == 8 && a!=1)\n printf(\"eight\");\n\nelse if(b == 9 && a!=1)\n printf(\"nine\");\n\n\nif(n==0)\n printf(\"zero\");\n\nif(n == 10)\n printf(\"ten\");\n\nelse if(n == 11)\n printf(\"eleven\");\n\nelse if(n == 12)\n printf(\"twelve\");\n\nelse if(n == 13)\n printf(\"thirteen\");\n\nelse if(n == 14)\n printf(\"fourteen\");\n\nelse if(n == 15)\n printf(\"fifteen\");\n\nelse if(n == 16)\n printf(\"sixteen\");\n\nelse if(n == 17)\n printf(\"seventeen\");\n\nelse if(n == 18)\n printf(\"eighteen\");\n\nelse if(n == 19)\n printf(\"nineteen\");\n\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9f3097924b6133f90f508ac08de01250", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int x,y;\n scanf(\"%d\", &x);\n y=x/10;\n if(y){\n switch (y){\n case 2:\n printf(\"twenty\");\n break;\n case 3:\n printf(\"thirdy\");\n break;\n case 4:\n printf(\"forty\");\n break;\n case 5:\n printf(\"fifty\");\n break;\n case 6:\n printf(\"sixty\");\n break;\n case 7:\n printf(\"seventy\");\n break;\n case 8:\n printf(\"eighty\");\n break;\n case 9:\n printf(\"ninety\");\n break;\n default:\n switch(x-y*10){\n case 0:\n printf(\"ten\\n\");\n break;\n case 1:\n printf(\"eleven\\n\");\n break;\n case 2:\n printf(\"twelve\\n\");\n break;\n case 3:\n printf(\"thirteen\\n\");\n break;\n case 4:\n printf(\"fourteen\\n\");\n break;\n case 5:\n printf(\"fifteen\\n\");\n break;\n case 6:\n printf(\"sixteen\\n\");\n break;\n case 7:\n printf(\"seventeen\\n\");\n break;\n case 8:\n printf(\"eighteen\\n\");\n break;\n case 9:\n printf(\"nineteen\\n\");\n break;\n }\n }\n }\n if (y>1&&(x-y*10)!=0){\n printf(\"-\");\n }\n x=x-y*10;\n if (x&&y!=1]){\n switch(x){\n case 1:\n printf(\"one\\n\");\n break;\n case 2:\n printf(\"two\\n\");\n break;\n case 3:\n printf(\"three\\n\");\n break;\n case 4:\n printf(\"four\\n\");\n break;\n case 5:\n printf(\"five\\n\");\n break;\n case 6:\n printf(\"six\\n\");\n break;\n case 7:\n printf(\"seven\\n\");\n break;\n case 8:\n printf(\"eight\\n\");\n break;\n case 9:\n printf(\"nine\\n\");\n break;\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "dc2a3e6c5a3fbd35b48d121cad1b2641", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint ekok(int y){\n\n if(y==1){printf(\"one\");}\n if(y==2){printf(\"two\");}\n if(y==3){printf(\"three\");}\n if(y==4){printf(\"four\");}\n if(y==5){printf(\"five\");}\n if(y==6){printf(\"six\");}\n if(y==7){printf(\"seven\");}\n if(y==8){printf(\"eight\");}\n if(y==9){printf(\"nine\");}\n printf(\"\\n\");\n\n\n}\nint doshok(int x){\n\n if(x/10==2){ printf(\"twenty\"); }\n if(x/10==3){ printf(\"thirty\"); }\n if(x/10==4){ printf(\"forty\"); }\n if(x/10==5){ printf(\"fifty\"); }\n if(x/10==6){ printf(\"sixty\"); }\n if(x/10==7){ printf(\"seventy\"); }\n if(x/10==8){ printf(\"eighty\"); }\n if(x/10==9){ printf(\"ninety\"); }\n\n int l=x-((x/10)*10);\n if(l>=1){\n printf(\"-\");\n ekok(l);\n\n }\n};\n\nint main (){\n\n int num;\n scanf(\"%d\",&num);\n if(num==ten){printf(\"ten\\n\");}\n if(num<10){\n\n ekok(num);\n\n }\n if(num>10 && num<20){\n\n if(num==11){ printf(\"eleven\\n\");}\n if(num==12){ printf(\"twelve\\n\");}\n if(num==13){ printf(\"thirteen\\n\");}\n if(num==14){ printf(\"fourteen\\n\");}\n if(num==15){ printf(\"fifteen\\n\");}\n if(num==16){ printf(\"sixteen\\n\");}\n if(num==17){ printf(\"seventeen\\n\");}\n if(num==18){ printf(\"eighteen\\n\");}\n if(num==19){ printf(\"nineteen\\n\");}\n\n\n\n\n\n }\n\n if(num>=20){\n\n doshok(num);\n }\n\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "622c488197fa187002ac6f377dde056b", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n\nint n,a,b,q=0;\n\nscanf(\"%d\", &n);\n\nb=n%10;\n\na=n/10;\n\n\nif(a == 2)\n printf(\"twenty\");\n\nelse if(a == 3)\n printf(\"thirty\");\n\nelse if(a == 4)\n printf(\"forty\");\n\nelse if(a == 5)\n printf(\"fifty\");\n\nelse if(a == 6)\n printf(\"sixty\");\n\nelse if(a == 7)\n printf(\"seventy\");\n\nelse if(a == 8)\n printf(\"eighty\");\n\nelse if(a == 9)\n printf(\"ninety\");\n\n\nif(b != 0 )8\n if(a!=0)\n if(a!=1)\n printf(\"-\");\n\n\n\n\nif(b == 2 && a!=1)\n printf(\"two\");\n\nelse if(b == 3 && a!=1)\n printf(\"three\");\n\nelse if(b == 4 && a!=1)\n printf(\"four\");\n\nelse if(b == 5 && a!=1)\n printf(\"five\");\n\nelse if(b == 6 && a!=1)\n printf(\"six\");\n\nelse if(b == 7 && a!=1)\n printf(\"seven\");\n\nelse if(b == 8 && a!=1)\n printf(\"eight\");\n\nelse if(b == 9 && a!=1)\n printf(\"nine\");\n\n\nif(n==0)\n printf(\"zero\");\n\nif(n == 10)\n printf(\"ten\");\n\nelse if(n == 11)\n printf(\"eleven\");\n\nelse if(n == 12)\n printf(\"twelve\");\n\nelse if(n == 13)\n printf(\"thirteen\");\n\nelse if(n == 14)\n printf(\"fourteen\");\n\nelse if(n == 15)\n printf(\"fifteen\");\n\nelse if(n == 16)\n printf(\"sixteen\");\n\nelse if(n == 17)\n printf(\"seventeen\");\n\nelse if(n == 18)\n printf(\"eighteen\");\n\nelse if(n == 19)\n printf(\"nineten\");\n\n\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ee6e398d46b727ade8c48109179e1c17", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n\t\tint s;\n\t\tscanf(\"%d\",&s);\n\n\t\tchar *a[100];\n\t\ta[0] = \"zero\";\n\t\ta[1] = \"one\";\n\t\ta[2] = \"two\";\n\t\ta[3] = \"three\";\n\t\ta[4] = \"four\";\n\t\ta[5] = \"five\";\n\t\ta[6] = \"six\";\n\t\ta[7] = \"seven\";\n\t\ta[8] = \"eight\";\n\t\ta[9] = \"nine\";\n\t\ta[10] = \"ten\";\n\t\ta[11] = \"eleven\";\n\t\ta[12] = \"twelve\";\n\t\ta[13] = \"thirteen\";\n\t\ta[14] = \"fourteen\";\n\t\ta[15] = \"fifteen\";\n\t\ta[16] = \"sixteen\";\n\t\ta[17] = \"seventeen\";\n\t\ta[18] = \"eighteen\";\n\t\ta[19] = \"nineteen\";\n\t\ta[20] = \"twenty\";\n\t\ta[30] = \"thirty\";\n\t\ta[40] = \"forty\";\n\t\ta[50] = \"fifty\";\n\t\ta[60] = \"sixty\";\n\t\ta[70] = \"seventy\";\n\t\ta[80] = \"eighty\";\n\t\ta[90] = \"ninety\";\n\n\t\tif(s%10==0 || s<20)\n\t\t\t\tprintf(\"%s\\n\",a[s]);\n\t\telse\n\t\t\t\tprintf(\"%s-%s\\n\",a[(s/10)*10],a[s%10]);\n\n\t\treturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "5ce857400a3fed2d46961d21fe68c89c", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint abd[1000000001];\n\nint main()\n{\n\tlong long int a,b,i,cp,max=0,max_ind=0;\n\tscanf(\"%lld%lld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tfor(cp=2;cp <= (i/2)+1;cp++)\n\t\t{\n\t\t\tif(i % cp == 0)\n\t\t\t\tabd[cp] += 1;\n\t\t\tif(abd[cp] > max)\n\t\t\t{\n\t\t\t\tmax_ind = cp;\t\n\t\t\t\tmax = abd[cp];\n\t\t\t} \n\t\t}\n\t}\n\tprintf(\"%lld\\n\",max_ind);\n\treturn 0;\n}\t\t\n\t\t\t\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4a454fdb7bfd4a564fc4a7423b942ea0", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint abd[500000001];\n\nint main()\n{\n\tlong long int a,b,i,cp,max=0,max_ind=0;\n\tscanf(\"%lld%lld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tfor(cp=2;cp <= (i/2)+1;cp++)\n\t\t{\n\t\t\tif(i % cp == 0)\n\t\t\t\tabd[cp] += 1;\n\t\t\tif(abd[cp] > max)\n\t\t\t{\n\t\t\t\tmax_ind = cp;\t\n\t\t\t\tmax = abd[cp];\n\t\t\t} \n\t\t}\n\t}\n\tprintf(\"%lld\\n\",max_ind);\n\treturn 0;\n}\t\t\n\t\t\t\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "49b5ee68df4139215bfb42846d2b1343", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n long long int x,y;\n scanf(\"%d %d\",&x,&y);\n if (x==y && x%2!=0) printf(\"%I64d\",x);\n else printf(\"2\");\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2bde39e2a1ec389a224dfa7bf719105", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\n int l,r;\n cin>>l>>r;\n if(l==r)\n printf(\"%d\\n\",l);\n else\n puts(\"2\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "57a3b1bc0c033e63d0b3d013560de6af", "src_uid": "a8d992ab26a528f0be327c93fb499c15", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\n\n\n\nint main()\n{\n int a,b,h,arr[10]={0},temp,c=0,i=3;\n cin>>a;\n cin>>b;\n h=2;\n cout<\n#include \nint main()\n{\n\tint n,m,i,j,a,min1=9,min2=9;\n\tint a[10]={0},b[10]={0};\n\tscanf(\"%d%d\",&n,&m);\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a);\n\t\tif (a\n\nint main()\n{\n\n int n,m;\n\n int min1=10,min2=10,min3=10;\n int k=0;\n scanf(\"%d %d\",&n,&m);\n\n int a[n+1],b[m+1];\n int keep1[n+1],keep2[m+1];\n\n for(int i=0;imin2)\n {\n printf(\"%d%d\\n\",min2,min1);\n }\n \n }\n\n\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "be882c6e6c60aa67d9de98c6b20a0eef", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nint main() {\n\tint n1,n2;\n\tscanf(\"%d %d\",&n1,&n2);\n\tint a[10],b[10];\n\tint i;\n\tfor(i=0;i<10;i++)\n\ta[i]=b[i]=0;\n\tfor(i=0;i\n#include \n\n\nint main()\n{\n int x , y ;\n scanf(\"%d\" ,&x );\n scanf (\"%d\", &y);\n int line1 [x];\n int line2 [y];\n int i ;\n int great1 = 9;\n int great2 = 9 ;\n int great =0 ;\n for (i=0;i line1[i] && line1[i]> 0 )\n great1= line1 [i] ;\n }\n for (i=0 ; i line2[i] && line2[i]> 0)\n great2= line2 [i] ;\n }\n\n if (great1 > great2 ) {\n great = great2 *10 + great1 ;\n }\n else if (great2 > great1 ) {\n great = great1 *10 + great2 ;\n }\n else \n great = great1 ;\n int j ;\n for (i =0 ; i < x ; i ++){\n for ( j =0 ; j < y ; j ++){\n if (line1[i]== line2 [j] && line2[j] < great){\n great = line2 [j];8\n break ;}\n }\n } \n printf(\"%d\", great );\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f0b5876d281f9377f510719e3e346ad8", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int arr1[9];\n\n int arr2[9];\n arr3[];\n arr4[];\n int i;\n int j;\n\n for(i=0 , i<9 ; i++)\n {\n\n if(arr1[i]>= '0' && arr1[i]<= '9')\n scanf(\"%d\",&arr1[i]);\n }\n\n for(j=0 , j<9 ; j++)\n {\n\n if(arr2[j]>= '0' && arr2[j]<= '9')\n scanf(\"%d\",&arr2[j]);\n }\n if (arr1[i]==arr2[i])\n arr4[]=arr1[i];\n else\n {arr3[]=arr1[i]*10+arr2[i];\n arr4[]=arr2[i]*10+arr1[i];\n }\n\n if ( arr3[i]< arr4[i])\n for(i=0 ; i<9 ; i++)\n\nif (arr3[i]\nint main()\n{\n int no_of_domino;\n scanf(\"%d\",&no_of_domino);\n int arr[no_of_domino][2];\n int upperhalf=0;\n int lowerhalf=0;\n int i;\n int first,second;\n for(i=0;i\nint main()\n{\n int l,i,j,k,m,n;\n m=n=0;\n scanf(\"%d\",&l);\n int a[l][2];\n for(i=0;i\nint main()\n{\n int l,i,j,k,m,n;\n m=n=0;\n scanf(\"%d\",&l);\n int a[l][2];\n for(i=0;i\n\nint main(){\n int i,n,n1,n2,a[2][100],odd1=0,odd2=0,p=0,m=0;\n\n scanf(\"%d\",&n);\n\n for (i=0; i0 && n2%2==0){odd1++;}\n if (n2%2>0 && n1%2==0){odd2++;}\n if (n1%2>0 && n2%2>0){p++;}\n }\n\n if (odd1+odd2%2>0){\n m=-1;\n }\n\n else if (p%2>0){\n while (odd1%2==0 || odd2%2==0){\n if (odd1%2==0){\n odd1--;\n odd2++;\n m++;\n }\n else if (odd2%2==0){\n odd1++;\n odd2--;\n m++;\n }\n }\n }\n else if (p%2==0){\n while (odd1%2>0 || odd2%2>0){\n if (odd1%2>0){\n odd1--;\n odd2++;\n m++;\n }\n else if (odd2%2>0){\n odd1++;\n odd2--;\n m++;\n }\n }\n }\n\n printf(\"%d\",m);\n return();\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7d377effcf2062d09bdb099bb32312c0", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int l,i,j,k,m,n;\n m=n=0;\n scanf(\"%d\",&l);\n int a[l][2];\n for(i=0;i\nint main()\n{\n int l,i,j,k,m,n;\n m=n=0;\n scanf(\"%d\",&l);\n int a[l][2];\n for(i=0;i\nint main()\n{\n int l,i,j,k,m,n;\n m=n=0;\n scanf(\"%d\",&l);\n int a[l][2];\n for(i=0;i\nint main()\n{\n int n,i,j,k,m,n;\n m=n=0;\n scanf(\"%d\",&n)\n for(i=0;i\n#include\nint main()\n{\n int m;\n scanf(\"%d\",&m);\n if((m/2)%2==1){\n printf(\"%d %d\", m/2-2,m/2+2);\n else if(m%2==1){\n \n \n printf(\"%d %d\", m/2, m/2+1);\n }\n \n }\n else{\n printf(\"%d %d\", m/2-1,m/2+1);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f2c2f12d8f3385eba2bc1f86821ff06e", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n int n,m,r;\n\n scanf(\"%d\",&n);\n\n if(n%2!=0)\n r=(n/2)+1;\n m=n-r;\n if(n==4)\n r=n-1;\n m=n-r;\n if(n==6)\n r=n-1;\n m=n-r;\n if(n==10)\n r=n-3;\n m=n-r;1\n if (n%2==0&&n>10)\n r=(n/2)+1;\n m=n-r;\n printf(\"%d %d\",m,r);\n\n\n\n return 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7312e85e8f6b6b0d2f4e85bd7d88425b", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int N,i;\n float resultado;\n scanf(\"%d\",&N);\n for(i=1; i<=N; i++)\n {\n resultado=(float)i/(N-i));\n if(resultado>=1)\n {\n i--;\n break;\n }\n\n }\n printf(\"%d %d\",i,N-i);\n return 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3e97d34f0cef032f592c7f57359902b", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nvoid main()\n{\n int n;\n cin>>n;\n if(n%4==0)\n cout<\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%2==1)\n printf(\"%d %d\", n/2, n/2+1);\n else if((n/2)%2==1)\n printf(\"%d %d\", n/2-2,n/2+2);\n else\n printf(\"%d %d\", n/2-1,n/2+1);\n return 0;\n}\n\n(19) - 431C\nC. k-Tree\nTime limit per test 1 second\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "11ad0056e64c0f2e7715ab4dc32a1141", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n int i,p,r,q,g,d,j,t;\n \n char ch[100][100],ch1[100][100];\n\n gets(ch);\n gets(ch1);\n \n p=mod(ch[1]-ch1[1]);\n \n printf(\"%d\",p);\n \n \n if(ch[0]ch1[0])\n { \n for(j=0;jch1[1])\n \n { for(g=0;g\n#include \n\ninline int max(int a, int b) {\n return (a > b)? a: b;\n}\ninline int abs(int a) {\n return (a > 0)? a: -a;\n}\n\nint main(void) {\n char sc, tc;\n int sn, tn;\n scanf(\"%c%d\\n\", &sc, &sn);\n scanf(\"%c%d\", &tc, &tn);\n char x[8],y[8],n[8],s[24];\n memset(x,'\\0',8);\n memset(x,'R',max(0,tc-sc));\n memset(x,'L',max(0,sc-tc));\n memset(y,'\\0',8);\n memset(y,'U',max(0,tn-sn));\n memset(y,'D',max(0,sn-tn));\n int xy = max(abs(sc-tc),abs(sn-tn));\n memset(n,'\\0',8);\n memset(n,'\\n',xy);\n s[0] = '\\0';\n int i;\n for (i = 0; i <= xy; i++) {\n strncat(s,x+i,1);\n strncat(s,y+i,1);\n strncat(s,n+i,1);\n }\n printf(\"%d\\n%s\", xy, s);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4af74138c92762b0f985241e31398645", "src_uid": "d25d454702b7755297a7a8e1f6f36ab9", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main()\n{\n char start[3] , end[3] ;\nint x , y ;\n\n\nscanf(\"%s\", &start);\nscanf(\"%s\", &end);\n\nx = end[0] - start[0] ;\ny = end[1] - start[1] ;\n\nif (y > x )printf(\"%d \\n\" , abs(y));\nelse printf(\"%d \\n\" , abs(x));\n\nwhile (x !=0 || y!=0 ){\nif (x > 0 )\n{\n\tx -= 1 ;\n\tprintf(\"R\");\n}\nelse (x < 0 )\n{\n\tx += 1 ;\n\tprintf(\"L\");\n\n}\nif (y > 0 )\n{\n\ty -= 1 ;\n\tprintf(\"U\\n\");\n}\nelse (y < 0 )\n{\n\ty += 1 ;\n\tprintf(\"D\\n\");\n\n}\n\n\n}\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e806ffc26a29428a7405c39c7319786a", "src_uid": "d25d454702b7755297a7a8e1f6f36ab9", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nusing namespace std;\nint main()\n{\n char s[5];\n char f[5];\n \n scanf(\"%s\",s);\n getchar();\n scanf(\"%s\",f);\n \n int cs=(int)s[0];\n int cf=(int)f[0];\n \n int rs=(int)s[1];\n int rf=(int)f[1];\n \n int dc=cf-cs;\n int dr=rf-rs;\n \n int max=abs(dc)>=abs(dr)?abs(dc):abs(dr);\n \nint diff=abs(dc)-abs(dr);\n\nint moves=abs(diff)+(max-abs(diff));\nprintf(\"%d\\n\",moves);\n\nwhile( dc!=0 || dr!=0)\n{\n if(dc>0)\n {\n printf(\"L\");\n dc--;\n }\n else if(dc<0)\n {\n printf(\"R\");\n dc++;\n }\n \n if(dr>0)\n {\n printf(\"U\");\n dr--;\n }\n else if(dr<0)\n {\n printf(\"D\");\n dr++;\n }\n printf(\"\\n\");\n\n}\n \n \n \n // printf(\"\\n%d%d%d%d\",rs,rf,cs,cf);\n // getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "75ddb0ec4de2df6afedec87419c483dd", "src_uid": "d25d454702b7755297a7a8e1f6f36ab9", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nvoid ct1(char a[],char b[])\n{\n\tint i,j;\n\ti=b[1]-a[1];\n\t\n\tif (i>0)\n\t\t{\tprintf (\"%d\",i);\n\t\t\tfor (j=0;ji;j--)\n\t\t\t\tprintf (\"\\nU\");\n\t\t}\n\telse\n\t\tprintf (\"%d\",i);\n}\nint bd(char a)\n{\n\tswitch(a)\n\t{\n\t\tcase 'A': \treturn 1;break;\n\t\tcase 'B':\treturn 2;break;\n\t\tcase 'C':\treturn 3;break;\n\t\tcase 'D':\treturn 4;break;\n\t\tcase 'E':\treturn 5;break;\n\t\tcase 'F':\treturn 6;break;\n\t\tcase 'G':\treturn 7;break;\n\t\tcase 'H':\treturn 8;break;\n\t}\n}\nvoid ct2(char a[],char b[])\n{\n\tint m,n,i,j;\n\tm=bd(a[0]);\n\tn=bd(b[0]);\n\ti=n-m;\n\tif (i>0)\n\t\t{\n\t\t\tprintf (\"%d\",i);\n\t\t\tfor (j=0;ji;j--)\n\t\t\t\tprintf (\"\\nL\");\n\t\t}\n\telse \n\t\t{\n\t\t\tprintf (\"%d\",i);\n\t\t}\n}\nvoid ct3(char a[],char b[])\n{\n\tint m,n,i,j,k,l;\n\tm=bd(a[0]);\n\tn=bd(b[0]);\n\ti=n-m;\n\tj=b[1]-a[1];\n\tif ((i>0)&&(j>0))\n\t\t{\n\t\t\tif (i>j)\n\t\t\t\t{\n\t\t\t\t\tm+=j;\n\t\t\t\t\ta[1]+=j;\n\t\t\t\t\tk=n-m;\n\t\t\t\t\tprintf (\"%d\",j+k);\n\t\t\t\t\tfor (l=0;l0)&&(j<0))\n\t\t{\n\t\t\tif (i>-j)\n\t\t\t\t{\n\t\t\t\t\tm-=j;\n\t\t\t\t\ta[1]-=j;\n\t\t\t\t\tk=n-m;\n\t\t\t\t\tprintf (\"%d\",-j-k);\n\t\t\t\t\tfor (l=0;l<(-k);l++)\n\t\t\t\t\t\tprintf (\"\\nR\");\n\t\t\t\t\tfor (l=0;l<-j;l++)\n\t\t\t\t\t\tprintf (\"\\nRD\");\n\t\t\t\t}\n\t\t\telse if (i<-j)\n\t\t\t\t{\n\t\t\t\t\tm+=i;\n\t\t\t\t\ta[1]+=i;\n\t\t\t\t\tk=b[1]-a[1];\n\t\t\t\t\tprintf (\"%d\",i-k);\n\t\t\t\t\tfor (l=0;l<-k;l++)\n\t\t\t\t\t\tprintf (\"\\nR\");\n\t\t\t\t\tfor (l=0;l0))\n\t\t{\n\t\t\tif (-i>j)\n\t\t\t\t{\n\t\t\t\t\tm+=j;\n\t\t\t\t\ta[1]+=j;\n\t\t\t\t\tk=n-m;\n\t\t\t\t\tprintf (\"%d\",j-k);\n\t\t\t\t\tfor (l=0;l<-k;l++)\n\t\t\t\t\t\tprintf (\"\\nL\");\n\t\t\t\t\tfor (l=0;li)\n\t\t\t\t{\n\t\t\t\t\tm-=j;\n\t\t\t\t\ta[1]-=j;\n\t\t\t\t\tk=n-m;\n\t\t\t\t\tprintf (\"%d\",-j-k);\n\t\t\t\t\tfor (l=0;l<-k;l++)\n\t\t\t\t\t\tprintf (\"\\nL\");\n\t\t\t\t\tfor (l=0;l<-j;l++)\n\t\t\t\t\t\tprintf (\"\\nLD\");\n\t\t\t\t}\n\t\t\telse if (j\nint main(){\n long long int n,x,t=0;\n scanf(\"%llu\",&n);\n for(i=1;i<=n;i=i*10)\n {\n t=n-i+1;\n }\n printf(\"%llu\",t);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6c02eba10237a494db6fa4df78095409", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nusing namespace std;\nint main()\n{\n int x,n;\n long long int T=0;\n scanf(\"%d\",&n);\n for(x=1;n>=x;x*=10)\n {\n T+=n-x+1;\n }\ncout<\n#include\nint main()\n{\n int n,i;\n int count=-1;\n int temp=9;\n int sum=0;\n long long result;\n scanf(\"%d\",&n);\n i=n;\n while(i>0)\n {\n i=i/10;\n count++;\n }\n if(count >0)\n {\n //sum = ((n+1.0) - pow(10.0,(double)count));\n sum = ((n+1) - power(10,count));\n sum = sum*(count+1);\n }\n else\n {\n sum = n;\n }\n i=1;\n while(i<=count)\n { \n sum += temp * power(10,(i-1)) *i;\n i++;\n }\n result = (long long)sum;\n printf(\"I64d\",result);\n return 0;\n}\nint power(int a, int b)\n{\n int i=0,exp=1;\n for(i=1;i<=b;i++)\n {\n exp *= a\n }\n return exp;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8e820ea2d6cd6e3ba615b51f179b61df", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nint time10(int x);\n\nint main(void){\n\n int input;\n scanf(\"%d\", &input);\n\n int n, tmp;\n tmp = input;\n for(n=0; tmp/10 > 0; n++){\n tmp /= 10;\n }\n\n unsigned long long int ans;\n ans = (input-time10(n)+1)*(n+1);\n\n int i;\n for(i=1; i<=n; i++){\n ans = ans + 9*time10(i-1)*(i);\n }\n\n cout << ans << endl;\n\n return 0;\n}\n\nint time10(int x){\n int i, out = 1;\n for(i=0; i\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int d=1,c=0,num=n,k;\n while(num!=0)\n {\n \tnum/=10;\n \tc++;\n }\n k=c;\n while(k-->1)\n \td*=10;\t\n while(c>0)\n {\n \tans += (n-d+1)*(c--);\n \tn = d-1;\n \td/=10;\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "13605cbbc163162df94d625fc6ff99ca", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int day;\n char s1[15];\n scanf(\"%d\",&day);\n scanf(\"%s\",s1);\n scanf(\"%s\",s1);\n if(s[0]=='w')\n {\n if(day==5||day==6)\n printf(\"53\\n\");\n else\n printf(\"52\\n\");\n }\n else\n {\n if(day<=29)\n printf(\"12\\n\");\n else if(day<=30)\n printf(\"11\\n\");\n else\n printf(\"7\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "abded73bb5bc3d237da66f8452f7445e", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n int x;\n char a[10],b[10];\n scanf(\"%d%s%s\",&x,b,a);\n if(strcmp(a,\"week\")==0)\n {\n if(x==5 || x==6)\n printf(\"53\");\n else\n printf(\"52\");\n }\n else\n {\n if(x<=29)\n printf(\"12\");\n else if(x==30)\n printf(\"11\");\n else\n printf(\"7\")\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "591c4b8a476ca20b89c86534427eca6a", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#define SIZE 300\n\nint main()\n{\n\tint x;\n\tchar s[SIZE];\n\n\tscanf_s(\"%d of \", &x);\n\tgets_s(s, 300);\n\n\tif (s[0] == 'w') {\n\t\tif (x >= 4 && x <= 6)\n\t\t\tprintf(\"52\");\n\t\telse\n\t\t\tprintf(\"51\");\n\t} else {\n\t\tif (x == 31)\n\t\t\tprintf(\"7\");\n\t\telse if (x == 30)\n\t\t\tprintf(\"11\");\n\t\telse\n\t\t\tprintf(\"12\");\n\t}\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5cbebed897644dbe20fa01df4adfebec", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#define pp printf\nchar a[9],r[9];\nint x;\nint main(){\nscanf(\"%d %s %s\",&x,a,r);\nif(r[0]=='m'){\n if(x==31)\n pp(\"7\\n\");\n else if(x==30)\n pp(\"11\\n\");\n else\n pp(\"12\\n\");}\nelse{\n if(x==6 || x==5)\n pp(\"53\\n\");\n else\n pp(\"52\\n\");}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d25b2702f645b230d9fd64b4f8c2153", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int d,m;\n char w[10];\n printf(\"input\\n\");\n scanf(\"%d\",&d);\n getchar();\n gets(w);\n if(strcmp(w,\"of week\"))\n {\n m=d;\n printf(\"output\\n\");\n if(m==31)\n {\n printf(\"7\");\n }\n else if(m==30)\n {\n printf(\"11\");\n }\n else if(m>=1 && m<30)\n {\n printf(\"12\");\n }\n else\n {\n printf(\"\")\n }\n }\n else\n {\n printf(\"output\\n\");\n if(d==1 || d==2 || d==3 || d==4 || d==7)\n {\n printf(\"52\\n\");\n }\n else if(d==5 || d==6)\n {\n printf(\"53\\n\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "97b8153ed8bd798added293b0a7bccfb", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0} {"lang": "GNU C", "source_code": "/* DHUOJ solution #360677 @ 2018-08-08 11:49:50.318 */\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\n\tint n;\n\tint a[105] = { 0 };\n\tcin >> n;\n\tfor (int i = 0; i < n; i++) {\n\t\tcin >> a[i];\n\t}\n\tint tem = 0, ans = 0;\n\tbool flag = 1;\n\tfor (int i = 0; i < n && flag; i++) {\n\t\tif (a[i] != a[0] && a[i] != tem) {\n\t\t\tif (tem) flag = 0;\n\t\t\telse {\n\t\t\t\ttem = a[i];\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == a[0]) ans++;\n\t}\n\tif (flag && ans * 2 == n) {\n\t\tcout << \"YES\" << endl;\n\t\tcout << a[0] << ' ' << tem << endl;\n\t}\n\telse cout << \"NO\" << endl;\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3b21e730b47ec2cd1622bc0f706ca668", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[102]={0};\n int b[4];\n int num;\n int index=0;\n for(int i=0;i0&&a[i]!=n/2)\n {\n printf(\"NO\\n\");\n flag=1;\n break;\n }\n if(a[i]==n/2)\n {\n index++;\n b[index]=i;\n }\n }\n if(!flag)\n {\n printf(\"YES\\n%d %d\\n\",b[1],b[2]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2115d3244e481f0589e681c903bcc43", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n#include \n#include \nusing namespace std;\nconst int maxn = 111;\nint num[maxn];\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int flag=1;\n int k1=0,k2=0;\n int a;\n for(int i=1;i<=n;i++){\n scanf(\"%d\",&a);\n if(!flag) continue;\n if(num[a]==0){\n num[a]++;\n if(!k1){\n k1=a;\n continue;\n }\n if(!k2){\n k2=a;\n continue;\n }\n if(k1!=0&&k2!=0){\n flag=0;\n }\n }\n num[a]++;\n }\n if(flag&&num[k1]==num[k2]){\n printf(\"YES\\n%d %d\\n\",k1,k2);\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb234c648644785df17b155b5709b204", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main(){\n\tint t, i, n, s = 1, a = 0, b = 0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &a);\n\tfor (i = 1, i < n, ++i){\n\t\tscanf(\"%d\", &t);\n\t\tif (t != a){\n\t\t\tif (b == 0){\n\t\t\t\tb = t;\n\t\t\t}\n\t\t\telse if (b != t){\n\t\t\t\tprintf(\"NO\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse s++;\n\t}\n\tif (s * 2 != n || b == 0){\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\telse {\n\t\tprintf(\"YES\\n%d %d\", &a, &b);\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "85d09c5f45cf083eb8e59ac1692356ad", "src_uid": "2860b4fb22402ea9574c2f9e403d63d8", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\nll a, b, f, k;\nint main()\n{\n while (cin >> a>>b>>f>>k)\n {\n int cnt = 0;\n if (b < f||b\nint strlen(char *ptr);\nint abs(int number);\nint main(void)\n{\nchar start,pointer;\nint steps=0, i=0, temp, len1, number1;\nchar arr[101];\nscanf(\"%s\", arr);\nstart='a';\nlen1=strlen(arr);\npointer=arr[0];\nwhile(i=start)\n{\nnumber1=25-pointer+1+start;\nsteps+=abs(number1);\n}\nelse\n{\nnumber1=25+pointer+1-start;\nsteps+=abs(number1);\n}\n\n}\nstart=arr[i+1];\npointer=arr[i];\ni++;\n}\nprintf(\"%d\\n\", steps);\n\nreturn 0;\n}\n\nint abs(int number)\n{\nif(number>=0);\nelse\nnumber*=-1;\nreturn number;\n\n}\n\nint strlen(char *ptr)\n{\nint i=0;\nwhile(ptr[i]!='\\0')\n{\ni++;\n}\nreturn i;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "17f8f20c8cc92ba4cf55e0d4d17fa67a", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nchar s[100];\nint c,d\ngets(s);\nint x=strlen(s);\nint i;\nchar ch='a';\nint sum=0;\nfor(i=0;i\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9406d04071f0b61f4c784a47cf1de028", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint min(int a,int b){\n if(a\n#include \nint main()\n{\n chaine c=\"\";\n char a;\n int i=0,k=0,d=0;\n while((strlen(c)==0)||(strlen(c)>100)||(k==0))\n { i=0;\n k=1;\n printf(\"donner le mot a saisir \");\n scanf(\"%s\",&c);\n while(i<=strlen(c)-1)\n {if((c[i]<'a')||(c[i]>'z'))\n k=0;\n i++;}\n }\n a='a';\n i=0;\n while(i13)\n k=26-k;\n d=d+k;\n a=c[i];\n i++;\n\n }\n printf(\"%d\",d);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "baff03d3df26564f3494b68f5a12250f", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n int n,k,i,r,ck;\n float add,avg,check;\n\n while(2== scanf(\"%d%d\",&n,&k)){\n int a[n];\n add=0;\n for(i=0;i\n\nint main(void)\n{\n int n,k;\n int i=0;\n int *a;\n int sum=0;\n \n scanf(\"%d %d\",&n,&k);\n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n\nint main(){int n,i;\n int k,s=0,d;\n scanf(\"%d %d\\n\",&n,&k);\nint a[n];\n for (i=0;i0)s=s+k;\n if(s*2>=(((n+i)*(2k)-(n+i)))){printf(\"%d\",i); return 0;}\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1da1b6b45f316045eed75ee5ac35ad0e", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int n,k;\n int i=0,ans=0;\n int a;\n int sum=0;\n \n scanf(\"%d %d\",&n,&k);\n for(i=0;i= 0) || (2*sum) <= (-1)*n) printf(\"0\\n\");\n else\n {\n ans = -2*sum-n;\n }\n \n printf(\"%d\",ans);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "20587e447df0fe64111fa98d8e624cb7", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main(void)\n{\n int n,k,i,sum=0,a[120],sm;\n float s,div;\n scanf(\"%d %d\",&n,&k);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n }\n i--;\n s=float(sum);\n sm=sum;\n sum=sum/i;\n s=s/float(i);\n s=s-float(sum);\n if(s==0||s<0.5)\n s=float(sum);\n else\n s=float(sum)+1;\n if(s=float(k-0.5))\n break;\n }\n printf(\"%d\",i-n);\n }\n else\n printf(\"%d\",i-n);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e4348d1e95fd4b3dd852384bf8b0755a", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0} {"lang": "GNU C", "source_code": "include\nint main()\n{\n names[4] = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n;\n scanf(\"%d\",&n);\n long T[n];\n for(int i = 0 ; i\nint a[1000000000];\nint main (){\n int i,x,n,y=5,z=6;\n a[0]=1;\n a[1]=2;\n a[2]=3;\n a[3]=4;\n a[4]=5;\n scanf(\"%d\",&n);\n for(i=0;i\n#include\nint main(){\n int n;\n scanf(\"%d\",&n);\n int a = 1;\n while(a*5\n#include \nint main(){\n int i;\n double n;\n char *name[5]={\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n i=ceil(log(n/5+1)/log(2));\n n=ceil(n-5*(1<<(i-1)-1)/1<<(i-1))\n printf(\"%s\", name[n-1]);\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "78a2ae32113068979df66050c497b487", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main()\n{\n int n,f,d=0,a[6],b[6],c=5,i,e=0,g=5;\n scanf(\"%d\",&n);\n \n \n for(i=1;i<=5;i++)\n {\n a[i]=i;\n }\n while(c<=n)\n {\n e=c;\n g=g*2;\n c=c+g;\n d++;\n }\n \n if(d==0)\n {\n if(n==1)\n printf(\"Sheldon\");\n if(n==2)\n printf(\"Leonard\");\n if(n==3)\n printf(\"Penny\");\n if(n==4)\n printf(\"Rajesh\");\n if(n==5)\n printf(\"Howard\");\n }\n else\n {\n for(i=1;i<=5;i++)\n {\n a[i]=a[i]*pow(2,d);\n b[i]=a[i];\n b[i]=b[i]+e;\n \n printf(\"%d \n }\n for(i=1;i<=5;i++)\n {\n if(n<=b[i])\n {\n if(i==1)\n printf(\"Sheldon\");\n if(i==2)\n printf(\"Leonard\");\n if(i==3)\n printf(\"Penny\");\n if(i==4)\n printf(\"Rajesh\");\n if(i==5)\n printf(\"Howard\");\n break;\n }\n \n }\n }\n return(0);\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c10ef324c377cd17c6993966eddf6482", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nmain()\nint i,e=0;\n{\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "58baafa18dc492c9e3379574e1d5cfd7", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc1164627c8144e56b0a06bc0ebfad05", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "GNU C11", "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] == 'A' && name[0] == 'A'){\n\n count = 1;\n }\n else if((test[0] == name[0]) && (test[1] == name[1])){\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "8cb4dd8f6fdbf8438280d55a190077b1", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "\n\n\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\n\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ef25f8150fca8c1ba5139e22ac5d673", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "GNU C11", "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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n#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) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d185c9f8d82a9c0ffd4341559dc413df", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a826e6fbbf4c029381fae8292d0e76c9", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "difficulty": 1900.0} {"lang": "GNU C", "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\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]=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", "lang_cluster": "C", "compilation_error": true, "code_uid": "4c65d348a73254d86003d2eaa5df245b", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "difficulty": 1900.0} {"lang": "GNU C", "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(int *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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6b8326d495aa4bafa128b571b13996bf", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "difficulty": 1900.0} {"lang": "GNU C", "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[2]/3)==a[0]+a[1])\n {\n for(c=3;c>=1;c--)\n {\n a[c]=a[c-1];\n }\n a[0]=a[3]/3;\n printf(\"%d\\n\",c[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", "lang_cluster": "C", "compilation_error": true, "code_uid": "8cabeaa2a055cb02d63c20eb3cf985ba", "src_uid": "230e613abf0f6a768829cbc1f1a09219", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tint n, m, k, s=0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &m);\n\n\tif (m%n != 0 )\n\t\tprintf(\"-1\\n\");\n\telse if (m == n)\n\t\tprintf(\"0\\n\");\n else\n\t{\n\n\t\tk = m / n;\n\t\twhile (k != 1)\n\t\t{\n\t\t\tif (k % 6 == 0)\n\t\t\t{\n\t\t\t\ts += 2;\n\t\t\t\tk /= 6;\n\t\t\t}\n\n\t\t\telse if (k % 2 == 0)\n\t\t\t{\n\t\t\t\ts += 1;\n\t\t\t\tk /= 2;\n\t\t\t}\n\t\t\telse if (k % 3 == 0)\n\t\t\t{\n\t\t\t\ts += 1;\n\t\t\t\tk /= 3;\n\t\t\t}\n\t\t\telse\n {\n c=-1;\n break;\n }\n\t\t}\n\t\tprintf(\"%d\\n\", s);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8633a1740a76cd7c9514f552fc702c36", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "}\n#include\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if (b % a != 0) {\n printf(\"-1\");\n return 0;\n }\n b /= a;\n a = 0;\n\n while (b % 2 == 0) {\n b /= 2; \n a++; \n }\n while (b % 3 == 0) { \n b /= 3;\n a++; \n }\n if (b != 1) a = -1;\n printf(\"%d\", a);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "841f8751c646cbc9ae483d40137c694c", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int m,n,i,j,count=0;\n scanf(\"%d %d\",&n,&m);\n if(m==n)\n printf(\"0\");\n else if(m%n==0)\n {\n m=m/n;\n do\n {\n if(m%2==0)\n {\n m=m/2;\n count++;\n }\n else if\n {\n if(m%3==0)\n {\n m=m/3;\n count++;\n }\n else \n {\n printf(\"-1\");\n break;\n }\n \n }\n }while(m!=1);\n printf(\"%d\",count);\n }\n else if(m%n!=0||m\nusing namespace std;\n\nint GAME23 (){\n int n;\n int m1;\n int m;\n int p=0,q=0;\n cin>>n>>m;\n m1=m/n;\n if (m==n)\n return(0) ;\n else if (m%n!=0){\n return(-1);\n }\n else {\n while(m1%2==0){\n m1=m1/2;\n p++;\n }\n if(p>1) m1=m1*2;\n while(m1%3==0){\n m1=m1/3;\n q++;\n }\n\n return(p+q);\n\n}\n}\n\nint main()\n{\ncout<\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n {\n printf(\"0\");return 0;\n }\n int c=0;\n while(a*6<=b)\n {\n a=a*6;\n c=c+2;\n }\n if(a*2=b)\n c++;\n else if(a*3==b)\n c++;\n \n if(c==0)\n printf(\"-1\");\n else\n printf(\"%d\",c);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "27051d8cd5ef518c5218f9b019b73788", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint a[7],b=0;\nfor(int i=0;i<7;++i) \n{\nscanf(\"%d\",&a[i]);\nb+=a[i];\n}\nif(b==n)\n{\nprintf(\"7\");\nreturn 0\n}\nelse{\nn%=b;\nif(n/a[0]==0 || (n/a[0]==1 && n%a[0]==0)) \n{\nprintf(\"1\");\nreturn 0;\n}\nelse n-=a[0];\nif(n/a[1]==0 || (n/a[1]==1 && n%a[1]==0)) \n{\nprintf(\"2\");\nreturn 0;\n}\nelse n-=a[1];\nif(n/a[2]==0 || (n/a[2]==1 && n%a[2]==0)) \n{\nprintf(\"3\");\nreturn 0;\n}\nelse n-=a[2];\nif(n/a[3]==0 || (n/a[3]==1 && n%a[3]==0)) \n{\nprintf(\"4\");\nreturn 0;\n}\nelse n-=a[3];\nif(n/a[4]==0 || (n/a[4]==1 && n%a[4]==0)) \n{\nprintf(\"5\");\nreturn 0;\n}\nelse n-=a[4];\nif(n/a[5]==0 || (n/a[5]==1 && n%a[5]==0)) \n{\nprintf(\"6\");\nreturn 0;\n}\nelse n-=a[5];\nif(n/a[6]==0 || (n/a[6]==1 && n%a[6]==0)) \n{\nprintf(\"7\");\nreturn 0;\n}\nelse n-=a[6];\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7cd433438560415d08879edde07ad7a", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0} {"lang": "GNU C", "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 \ufffd\ufffd 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 \ufffd\ufffd 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\nusing namespace std;\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\n#include\nusing namespace std;\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\n#include\nint main()\n{\n int count=0,n,a[7],i;\n scanf(\"%d\",&n);\n for(i=0;i<7;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n while(count<=n)\n {\n for(i=0;i<7;i++)\n {\n if(count+a[i]4\n\nint main()\n{\n int n,i;\n int a[7];\n /*printf(\"Enter n\");*/\n scanf(\"%d\",&n);\n for (i=0 ; i<7 ; i++)\n {\n /*printf(\"Enter n in month %d\",i+1);*/\n scanf(\"%d\",&a[i]);\n }\n for (i=0 ; i<7 ; i++)\n {\n n=n-a[i];\n if (n<=0)\n break;\n if (i==6)\n i=-1;\n }\n printf(\"%d\",i+1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8b56712551e2bfa2c617649e16a350d6", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "include\nint main()\n{\nint n,i,c=0;\nscanf(\"%d\",&n);\nfor(i=1;i<=n/2;i++)\nif(n%i==0)\n{\nc++\n}\n}\nprintf(\"%d\\n\",c);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d1ebdb6ad693e1475946fd212e038e3", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int n,c=0;\n cin>>n;\n for (int i=2; i<=n; i++)\n {\n if(n%i==0)\n {\n c++;\n }\n\n }\n cout<\n#include\nusing namespace std;\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=1; \n\tfor(int i = 2; i <= sqrt(n); i++){\n\t\tif(n%i==0){\n\t\t\tif(n%(i * i) != 0)\n\t\t\t\tcount+=2;\n\t\t\telse count++;\n\t\t\tn/=i;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fe78d4338daf0140d7bca5e80737d399", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n int flag=0;\n scanf(\"%d\",&n);\n for(int i=1;i=\nint main()\n{\n long int j,n,c=0;\n scanf(\"%ld\",&n);\n j=n;\n for(i=1;i<=(n/2+1);i++)\n {\n if(j!=1)\n j=j/2;\n \n if((j+1)*i==n)\n c++;\n \n printf(\"%ld\",c);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b92117de63f990d139ea7e625bc9e4b3", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nchar m[7][5]={\"jolt\",\"flar\",\"umbr\",\"leaf\",\"glac\",\"sylv\"};\nint main()\n{\n\tint n;char s[5];\n\tscanf(\"%d%s\",&n,s);\n\n\tif(n==8)puts(\"vaporeon\");\n\tif(n==6)puts(\"espeon\");\n\n\tif(n==7)\n\t{\n\t\tfor(int i=0;i<6;i++)\n\t\t{\n\t\t\tbool flag=true;\n\t\t\tfor(int j=0;j<4;j++)\n\t\t\t{\n\t\t\t\tif(s[j]!='.'&&s[j]!=m[i][j]){flag=false;break;}\n\t\t\t}\n\t\t\tif(flag)\n\t\t\t{\n\t\t\t\tprintf(\"%seon\",m[i]);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d668eea76da06f9a23cd3bfc205a410c", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n char a[9];\n int i,n;\n scanf(\"%d\",&n);\n for(i=0;i<=7;i++)\n scanf(\"%c\",&a[i]);\n if(a[1]=='v'||a[2]=='a'||a[5]=='r')\n printf(\"vaporeon\");\n else if(a[1]=='j'||a[2]=='o'||a[4]=='t')\n printf(\"jolteon\");\n else if(a[1]=='f'||a[2]=='l'&&a[4]=='r')\n printf(\"flareon\");\n else if(a[1]=='e'||a[2]=='s'||)\n printf(\"espeon\");\n else if(a[1]=='u'||a[2]=='m'||a[3]=='b')\n printf(\"umbreon\");\n else if(a[1]=='l'||a[2]=='e'||a[4]=='f')\n printf(\"leafeon\");\n else if(a[1]=='g'||a[2]=='l'&&a[4]=='c')\n printf(\"glaceon\");\n else if(a[1]=='s'||a[2]=='y'||a[4]=='v')\n printf(\"sylveon\");\n else\n printf(\"espeon\");\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b50d49674fda21fca7ec7b5ab19ea41a", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main(void) {\n int n,l;\n scanf(\"%d\",&n);\n char a[8];\n scanf(\"%s\",a);\n l=strlen(a);\n if(l==6)\n printf(\"espeon\\n\");\n else if(l==8)\n printf(\"vaporeon\\n\");\n else{\n \n if((a[0]=='.'||a[0]=='j')&&(a[1]=='.'||a[1]=='o')&&(a[2]=='l'||a[2]=='.')&&(a[3]=='t'||a[3]=='.'))\n printf(\"jolteon\\n\");\n else if((a[0]=='.'||a[0]=='g')&&(a[1]=='.'||a[1]=='l')&&(a[2]=='a'||a[2]=='.')&&(a[3]=='c'||a[3]=='.'))\n printf(\"glaceon\\n\");\n else if((a[0]=='.'||a[0]=='f')&&(a[1]=='.'||a[1]=='l')&&(a[2]=='a'||a[2]=='.')&&(a[3]=='r'||a[3]=='.'))\n printf(\"flareon\\n\");\n else if((a[0]=='.'||a[0]=='s')&&(a[1]=='.'||a[1]=='y')&&(a[2]=='l'||a[2]=='.')&&(a[3]=='v'||a[3]=='.'))\n \n else\n printf(\"umbreon\\n\");\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "45c598de71cbfe0ad7a1c44701bc2f69", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n, i, j, check;\n char s[10], s1[6][10]={\"jolteon\", \"flareon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\"};\n scanf(\"%d\", &n);\n scanf(\"%s\", &s);\n if(n==8) printf(\"vaporeon\\n\");\n else if(n==6) printf(\"espeon\\n\");\n else\n {\n for(i=0;i<6;i++)\n {\n check=1;\n for(j=0;j<7;j++)\n {\n if(s[j]!='.' && s[j]!=s1[i][j])\n {\n check=0;\n break;\n }\n }\n if(check)\n {\n printf(\"%s\\n\", s1[i]);\n return 0;\n }\n }\n }\n\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "707904d99e12ba93e2dbe7fa82336c01", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nchar str[8][10]={\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\"};\n\nint main()\n{\n\tint n,i,j;\n\tchar inp[10];\n\tint flag[8];\n\tmemset(flag,1,sizeof(flag));\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",inp);\n\tint length=strlen(inp);\n\tfor(i=0; i\n#include \nshort target[3005]={0};\nreturn main(void)\n{\n\tshort n,i,j,sum=0;\n\t\n\tscanf(\"%hd\",&n);\n\t\n\tfor(i=2;i<=n;i++)\n\t{\n\tfor(j=2;j\nusing namespace std;\n\nmain()\n{\n long int m,i,j,k,l,c=0,re=0,a[3030]={0};\n cin>>m;\n if(m>5)\n {\n for(i=2;i*i<=m;i++)\n {\n if(a[i]==0)\n {\n for(j=i+i;j<=m;j+=i)\n a[j]=1;\n }\n }\n for(k=6;k<=m;k++)\n { c=0;\n for(l=2;l<=(k/2);l++)\n {\n if(a[l]==0)\n {\n if(k%l==0)\n c++;\n }\n }\n if(c==2)\n re++;\n }\n cout<\n#include\nint main()\n{int n,i,j,k,flag,count=0,count1=0;\n scanf(\"%d\",&n);\n if(n==2000)\n printf(\"%d\",958);\n else\n {\n for(k=4;k<=n;k++)\n {count=0;\n for(i=2;i<=k;i++)\n {flag=0;\n for(j=2;j<=sqrt(i);j++)\n {\n if(i%j==0)\n {flag=1;\n }\n }\n if(flag==0)\n {if(k%i==0)\n count++;\n } ", "lang_cluster": "C", "compilation_error": true, "code_uid": "201e4c9ec5234db09a4e47c1c6bd29f1", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint almostprime(int n){\n int i,j;\n int s[n];\n for(i=1;i<=n;i++)\n s[i]=0;\n for(i=2;i*i<=n;i++)\n {\n \n if(s[i]==0) for(j=i*i;j<=n;j+=i) s[j]=1;\n \n }\n \n int c=0;\n for(i=1;i<=n;i++) if(s[i]==0) c++;\n \n if(c==2) return 1;\n else return 0;\n}\n \nint main(){\n int n,i;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n if(almostprime(n)) c++;\n printf(\"%d\\n\",c);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5bdf4fae785e268e3f3a266da3555064", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nisPrime(n){\n int i,flag=1;\n if(n==2) return 1;\n for(i=2;i*i\n\nconst int dx[5] = {0, 1, -1, 0, 0};\nconst int dy[5] = {0, 0, 0, 1, -1};\n\nint n, m, best;\nlong long g[45], rest[45];\n\nvoid dfs(long long mask, int cur, int cura) {\n\tif (cura >= best) return;\n\tif (cur >= n*m) return;\n\tif (mask == (1LL << n * m) - 1)\n\t\tbest = cura;\n\telse if ((mask | rest[cur]) ^ (1LL << n * m) - 1) return;\n\telse dfs(mask | g[cur], cur + 1, cura + 1), \n\tdfs(mask, cur + 1, cura);\n}\n\nint main() {\n\tscanf(\"%d%d\", &n, &m);\n\tfor (int i = 0; i < n; ++ i)\n\t\tfor (int j = 0; j < m; ++ j) {\n\t\t\tint num = i * m + j;\n\t\t\tfor (int k = 0; k < 5; ++ k) {\n\t\t\t\tint x = i + dx[k], y = j + dy[k];\n\t\t\t\tif (x < 0 || x >= n || y < 0 || y >= m) continue;\n\t\t\t\tg[num] |= 1LL << x * m + y;\n\t\t\t}\n\t\t}\n\tfor (int i = n * m - 1; i >= 0; -- i) rest[i] = rest[i + 1] | g[i];\n\tbest = n * m; dfs(0, 0, 0);\n\tprintf(\"%d\\n\", n * m - best);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "76e8cb48adfe5c984e87d2c5c664b59c", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#pragma comment(linker, \"/STACK:1024000000,1024000000\")\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC optimize(3)\n#pragma GCC optimize(\"inline\")\n#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n\n#include \n\nconst int dx[5] = {0, 1, -1, 0, 0};\nconst int dy[5] = {0, 0, 0, 1, -1};\n\nint n, m, best;\nlong long g[45], rest[45];\n\nvoid dfs(long long mask, int cur, int cura) {\n\tif (cura >= best) return;\n\tif (cur >= n*m) return;\n\tif (mask == (1LL << n * m) - 1)\n\t\tbest = cura;\n\telse if ((mask | rest[cur]) ^ (1LL << n * m) - 1) return;\n\telse dfs(mask | g[cur], cur + 1, cura + 1), \n\tdfs(mask, cur + 1, cura);\n}\n\nint main() {\n\tscanf(\"%d%d\", &n, &m);\n\tfor (int i = 0; i < n; ++ i)\n\t\tfor (int j = 0; j < m; ++ j) {\n\t\t\tint num = i * m + j;\n\t\t\tfor (int k = 0; k < 5; ++ k) {\n\t\t\t\tint x = i + dx[k], y = j + dy[k];\n\t\t\t\tif (x < 0 || x >= n || y < 0 || y >= m) continue;\n\t\t\t\tg[num] |= 1LL << x * m + y;\n\t\t\t}\n\t\t}\n\tfor (int i = n * m - 1; i >= 0; -- i) rest[i] = rest[i + 1] | g[i];\n\tbest = n * m; dfs(0, 0, 0);\n\tprintf(\"%d\\n\", n * m - best);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "49295a0acefa7cd871d42de6dd53d21d", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#define oo 1000000000\n#define lowbit(a) ((a)&(-(a)))\n#define max(a,b) ((a)>(b)?(a):(b))\n\nint f[42][65][65],v[65];\nint n,m;\n\nvoid dfs(int i,int j,int k,int now,int a,int b,int c)\n{\n if (now>n)\n f[i+1][b][c]=max(f[i+1][b][c],f[i][j][k]+n-v[a]);\n else\n {\n if (i>1)\n dfs(i,j,k,now+1,a|(1<1)\n dfs(i,j,k,now+1,a,b|(1<m)\n {\n n^=m;\n m^=n;\n n^=m;\n }\n for (i=1;i<=1<=0)\n dfs(i,j,k,1,j,k,0);\n for (i=0;i<1<\n\nconst int dx[5] = {0, 1, -1, 0, 0};\nconst int dy[5] = {0, 0, 0, 1, -1};\n\nint n, m, best;\nlong long g[45], rest[45];\nregister long long whole;\n\nvoid dfs(long long mask, int cur, int cura) {\n\tif (cura >= best) return;\n\tif (cur >= n * m) return;\n\tif (mask == whole) best = cura;\n\telse if ((mask | rest[cur]) ^ whole) return;\n\telse dfs(mask | g[cur], cur + 1, cura + 1), \n\tdfs(mask, cur + 1, cura);\n}\n\nint main() {\n\tregister int i, j, k;\n\tscanf(\"%d%d\", &n, &m);\n\twhole = (1LL << n * m) - 1;\n\tfor (i = 0; i < n; ++ i)\n\t\tfor (j = 0; j < m; ++ j)\n\t\t\tfor (k = 0; k < 5; ++ k) {\n\t\t\t\tint x = i + dx[k], y = j + dy[k];\n\t\t\t\tif (x < 0 || x >= n || y < 0 || y >= m) continue;\n\t\t\t\tg[i * m + j] |= 1LL << x * m + y;\n\t\t\t}\n\tfor (i = n * m - 1; i >= 0; -- i) rest[i] = rest[i + 1] | g[i];\n\tbest = n * m; dfs(0, 0, 0);\n\tprintf(\"%d\\n\", n * m - best);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4e460ad84bfabad63e3474761e42177f", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#pragma comment(linker, \"/STACK:1024000000,1024000000\")\n#pragma GCC optimize(\"Ofast\")\n#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native\")\n\n#include \n\nconst int dx[5] = {0, 1, -1, 0, 0};\nconst int dy[5] = {0, 0, 0, 1, -1};\n\nint n, m, best;\nlong long g[45], rest[45];\n\nvoid dfs(long long mask, int cur, int cura) {\n\tif (cura >= best) return;\n\tif (cur >= n*m) return;\n\tif (mask == (1LL << n * m) - 1)\n\t\treturn void (best = cura);\n\tif ((mask | rest[cur]) ^ (1LL << n * m) - 1) return;\n\tdfs(mask | g[cur], cur + 1, cura + 1);\n\tdfs(mask, cur + 1, cura);\n}\n\nint main() {\n\tregister int i, j, k;\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; ++ i)\n\t\tfor (j = 0; j < m; ++ j)\n\t\t\tfor (k = 0; k < 5; ++ k) {\n\t\t\t\tint x = i + dx[k], y = j + dy[k];\n\t\t\t\tif (x < 0 || x >= n || y < 0 || y >= m) continue;\n\t\t\t\tg[i * m + j] |= 1LL << x * m + y;\n\t\t\t}\n\tfor (i = n * m - 1; i >= 0; -- i) rest[i] = rest[i + 1] | g[i];\n\tbest = n * m; dfs(0, 0, 0);\n\tprintf(\"%d\\n\", n * m - best);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "07f36cd460e5901ce8c2f46a84e743d9", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int i,n;\n int x=0;\n scanf(\"%d\",&n);\n char a[100];\n scanf(\"%s\",a);\n i=0;\n while(i\n#include \n\nint main()\n{\n int i,n;\n int x=0;\n scanf(\"%d\",&n);\n char a[100];\n scanf(\"%s\",a);\n i=0;\n while(i\n#include \n\nint main()\n{\n int i,n;\n int x=0;\n scanf(\"%d\",&n);\n char a[100];\n scanf(\"%s\",a);\n i=0;\n while(i\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char* str[101];\n char* mod_str[101];\n \n scanf(\"%s\",str);\n int count = 0;\n for(int i = 0; i\n#define MAX(a,b) ((a>b)?(a):(b))\nint ans = 0;\nint n;\nchar str[101];\n\ninline void go(int piv, int cnt){\n\tif (piv >= n-1){\n\t\tans = MAX(ans, cnt);\n\t\treturn;\n\t}\n\tif (str[piv] == 'U'){\n\t\tif (str[piv + 1] == 'R')\n\t\t\tgo(piv + 2, cnt + 1);\n\t}\n\telse if (str[piv] == 'R'){\n\t\tif (str[piv + 1] == 'U')\n\t\t\tgo(piv + 2, cnt + 1);\n\t}\n\tgo(piv + 1, cnt);\n}\n\nint main(){\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\tint cnt = 0;\n\tgo(0,0);\n\n\tprintf(\"%d\\n\", n-ans);\n\treturn 0;\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "f69ff65e3d234341fdc2a8480d4328a9", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800.0} {"lang": "GNU C11", "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 n, i, j = 0;\n scanf(\"%d\", &n);\n char str[n], str2[n];\n scanf(\"%s\", str);\n for(i = 0; i < n; i++){\n if(i != (n - 1) && str[i] != str[i + 1]){\n str2[j] = 'D';\n j++;\n i++;\n }\n else{\n str2[j] = str[i];\n j++;\n }\n \n }\n int c = 0;\n \n while (str2[c] == 'U' || str2[c] == 'D' || str2[c] == 'R') c++\n \n printf(\"%d\\n\", c);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b509eb3f6d359598426e5cd3931ab770", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint min,max;\n\tint extra;\n\tmin = n/7;\n\textra = n%7;\n\tif(extra>2)\n\t\tmax = min + 2;\n\telse\n\t\tmax = min + extra;\n\tprintf(\"%d %d\",min,max);\n\treturn 0\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6dab2134772858f51db38dbf8f7ee4dc", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0} {"lang": "GNU C11", "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*/7+1;\n min=n*2/7;\n printf(\"%d %d\",min,max);\n }\n break;\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bedb4c8fbfef3629ea45f389d0b9be6a", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,a,b,m,l;\n\tscanf(\"%d\",&n);\n\ta=n%7;\n\tb=n/7;\n\tif(a==0|0\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 if(n==1)|(n==6)\n printf(\"0 1\");\n else if((n<=7)&&(n!=6))\n printf(\"0 2\");\n else\n {\n a=(n/7)*2;\n b=n%7;\n if(b==0)\n printf(\"%d %d\",a,a);\n if(b==1)\n printf(\"%d %d\",a,a+1);\n if(b>=2)\n printf(\"%d %d\",a,a+2);\n }\n\n\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b518206d485d3a383353ba05d4a2dcea", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c387fbcd256212309107c3538880bb85", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "int main() { \nint n; cin>>n;\nchar s[50];cin>>s;\nint x=0; int y=0;\n\nfor(int i=0;i\n#include\nint main()\n{\n int i,t,j;\n char a[100000000000000];\n scanf(\"%d\",&t);\n for(j=1;j<=t;j++)\n {\n gets(a);\n i=strlen(a);\n printf(\"%d\\n\",i+1);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "881d7d8edb5dd6516c4c2288592607e9", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\nint main()\n{\n\tint n;char *str;int i;int countL=0,countR=0;\n\tcin>>n;\n\tstr = new int[n+1];\n\tfor(i=0;i>str[i];\n\t\tif(str[i]=='L')\n\t\t\tcountL++;\n\t\telse if(str[i]=='R')\n\t\t\tcountR++;\n\t}\n\n\tcout<\n#include\nint main()\n{\n int a;\n char b[1000];\n scanf(\"%d\",&a);\n for(i=1;i<=a;i++)\n {\n scanf(\"%s\",b);\n }\n printf(\"%d\\n\",a+1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "acb5afc2fec9ccd2a77002f64178d347", "src_uid": "098ade88ed90664da279fe8a5a54b5ba", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main () {\n long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;\n scanf(\"%lld %lld %lld\", &a, &b, &c);\n d = pow(2, log2(a));\n g = a - d;\n while ((g - pow(2, log2(a))) != 0) {\n g = g - pow(2, log2(a));\n e += pow(2, log2(a)) / 2\n f += pow(2, log2(a)) * b;\n }\n while (d / 2 > 0) {\n e += d / 2;\n f += d * b;\n d /= 2;\n }\n printf(\"%lld %lld\", e + f, a * c);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b103d3fe91b0cf940ebccfd74abdd8d5", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n//long long int asd( long long int r);\n\nint main()\n{\n long long int n, b, p, m, r;\n scanf(\"%I64d %I64d %I64d\", &n, &b, &p);\n r=n;\n long long int ans=0;\n while(r>1)\n {\n m=(r)/2; ans+=m; //r+=m-pow(2,m);\n r+=m-m*2;\n }\n b=ans*(b*2+1);\n p=p*n;\n printf(\"%I64d %I64d\\n\", b, p);\n}\n\n\n/*long long int asd( long long int r)\n{\n long long int m=0; while(r>0)\n {\n r/=2;\n m++;\n }\n return m-1;\n}*/\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "208ebf6f5ded7139fb71477d462c4444", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n//long long int asd( long long int r);\n\nint main()\n{\n int n, b, p, m, r;\n scanf(\"%d %d %d\", &n, &b, &p);\n r=n;\n int ans=0;\n while(r>1)\n {\n m=(r)/2; ans+=m; //r+=m-pow(2,m);\n r+=m-m*2;\n }\n b=ans*(b*2+1);\n p=p*n;\n printf(\"%d %d\\n\", b, p);\n return 0;\n}\n\n\n/*long long int asd( long long int r)\n{\n long long int m=0; while(r>0)\n {\n r/=2;\n m++;\n }\n return m-1;\n}*/\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2b96c218614db5201aa29b8efef6231b", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,b,p,x,y,k;\n\tscanf(\"%d%d%d\",&n.&b,&p);\n\tif(n%2!=0)\n\t\tk=n-1;\n\telse\n\t\tk=n;\n\tx=(k*(k-2)/2+k)/2*5;\n\ty=n*p;\n\tprintf(\"%d %d\",x,y); \n } ", "lang_cluster": "C", "compilation_error": true, "code_uid": "877bd7fa24fb2baed18479b280ab296f", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint n,b,p,a;\n\tint NB=0;\n\t\n\tscanf(\"%d %d %d\",&n,&b,&p);\n\tint T=p*n;\n\ta=n;\n\twhile(a!=1)\n\t{\n\t\tif(a%2==0)\n\t\t{\n\t\t\tNB=NB+(2*b+1)*a;\n\t\t\ta=a/2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tNB=NB+(2*b+1)*(a-1);\n\t\t\ta=a+1/2;\n\t\t}\n\t}\n\tprintf(\"%d %d\",NB,T);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f3922b5742bc151736fff6d032b3ccf9", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nstruct node{\n struct node *next;\n char c;\n}\n\nint main(void){\n struct node *first = malloc(sizeof(struct node));\n struct node *current = first;\n char b = 's';\n scanf(\"%c\",&b);\n while(b != 32){\n current->c = b;\n struct node *new = malloc(sizeof(struct node));\n current->next = new;\n current = new;\n scanf(\"%c\",&b);\n }\n current->next = NULL;\n scanf(\"%c\",&b);\n current = first;\n bool equal = true;\n while(current != NULL){\n if(current->c != b){\n equal = false;\n }\n current = current->next;\n scanf(\"%c\",&b);\n }\n \n if(!equal){\n printf(\"1\");\n }\n current = first;\n while(current != NULL){\n if(equal){\n printf(\"%c\",current->c);\n }\n struct node *holder = current;\n current = current->next;\n free(holder);\n }\n printf(\"\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "66894b5094fc72abf78327ebc08afea1", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include\nusing namespace std;\n\nint main() {\n\tlong long int a,i,b;\n\tchar s1[10001];\n\tchar s2[10001];\n\tfor(i=0;i<1001;i++)\n\t{\n\t\ts1[i]=' ';\n\t\ts2[i]=' ';\n\t}\n\tscanf(\"%s\",s1);\n\tscanf(\"%s\",s2);\n\tif(strcmp(s1,s2)==0)\n\tprintf(\"%s\\n\",s2);\n\telse\n\tprintf(\"1\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "90f9342198e500295f9e25955ab666ab", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include\n#include\nusing namespace std;\n\nint main() {\n\tlong long int a,i,b;\n\tchar s1[10001];\n\tchar s2[10001];\n\tfor(i=0;i<1001;i++)\n\t{\n\t\ts1[i]=' ';\n\t\ts2[i]=' ';\n\t}\n\tscanf(\"%s\",s1);\n\tscanf(\"%s\",s2);\n\tif(strcmp(s1,s2)==0)\n\tprintf(\"%s\\n\",s2);\n\telse\n\tprintf(\"1\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9ffa6fee09635953098defb51c6d0fbf", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\n long long double a,b,x;\n scanf(\"%llf%llf\",&a,&b);\n if(a\n#include \n#include \n\nstruct node{\n struct node *next;\n char c;\n}\n\nint main(void){\n struct node *first = malloc(sizeof(struct node));\n struct node *current = first;\n char b = 's';\n scanf(\"%c\",&b);\n while(b!= ' '){\n current->c = b;\n struct node *new = malloc(sizeof(struct node));\n current->next = new;\n current = new;\n scanf(\"%c\",&b);\n }\n current->next = NULL;\n scanf(\"%c\",&b);\n current = first;\n bool equal = true;\n while(current != NULL){\n if(current->c != b){\n equal = false;\n }\n current = current->next;\n scanf(\"%c\",&b);\n }\n \n if(!equal){\n printf(\"1\");\n }\n current = first;\n while(current != NULL){\n if(equal){\n printf(\"%c\",current->c);\n }\n struct node *holder = current;\n current = current->next;\n free(holder);\n }\n printf(\"\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf326550b2e16db2f3bfd47b685dc1ac", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n \nint main(){\n\nint n,m,s=0;\nscanf(\"%d%d\",&n,&m);\nint a;\nfor(int i=0;i\nint aray[103];\nint main()\n{\n int n, i, j=0, k, a=0, b=0, m;\n scanf(\"%d %d\", &n, &m);\n for(i=0;im){\n i--;\n b=0;\n a++;\n }\n\n //printf(\"B:%d a:%d\\n\", b, a);\n }\n\n printf(\"%d\", a);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bbb5df5928a7613e96f06fb20156fc7f", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#define for(i,n) for(int i=0;i\n#include \n\nint main(void) {\n // your code goes here\n int n,m,i,tmp,c,bus=0;\n int a;\n //int* a=(int *)calloc((sizeof(int)),n);\n scanf(\"%d %d\",&n,&m);\n for(i=0;i0)\n {\n c=tmp+a[i];\n if(tmp<=m && c<=m)\n tmp=tmp+a[i];\n else if(tmp<=m)\n {\n tmp=a[i];\n bus=bus+1;\n }\n }\n }\n if(tmp<=m)\n bus++;\n printf(\"%d\",bus);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "969da73f4bd1bc56d7144f945cdbe878", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void) {\n // your code goes here\n int n,m,i,tmp,c,bus=0;\n int a;\n //int* a=(int *)calloc((sizeof(int)),n);\n scanf(\"%d %d\",&n,&m);\n for(i=0;i0)\n {\n c=tmp+a;\n if(tmp<=m && c<=m)\n tmp=tmp+a;\n else if(tmp<=m)\n {\n tmp=a;\n bus=bus+1;\n }\n }\n }\n if(tmp<=m)\n bus++;\n printf(\"%d\",bus);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "86e3b02be7b5958514d48e34dcfec102", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \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\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 while((c = getchar()) != '\\n')\n {\n address[i++] = c;\n }\n\n address[i] = '\\0';\n\n puts(address);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "728911efbe6eb1ca3a6beeb1a32aebd8", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\u601d\u6e05 15:32:45\n#include \"stdio.h\"\n\nchar url[1000] = \"\" ;\n\nint main(){\n int pos,i ;\n gets(url) ;\n pos = 'h' == url[0] ? 4 : 3 ;\n for(i = 0 ; i < pos ; i ++){\n putchar(url[i]) ;\n }\n printf(\"://\") ;\n for(pos ++ ; url[pos] ; pos ++){\n if('r' == url[pos] && 'u' == url[pos + 1]){\n break ;\n }\n }\n while(i < pos){\n putchar(url[i ++]) ;\n }\n printf(\".ru\") ;\n if(url[pos + 2]){\n putchar('/') ;\n puts(url + i + 2) ;\n } else {\n puts(\"\") ;\n }\n \n return 0 ;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f6fd55f74e5f39d6f8764bddab05edc5", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "GNU C", "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\u00f3n de variables */\n char string[CARACTERES];\n int indice = 0;\n int pos;\n /* Lectura de variables */\n scanf(\"%s\", string);\n\n while(string[indice]!='p')\n printf(\"%c\", string[indice++]);\n\n printf(\"%c://\", string[indice++]);\n\n /* Suma dos posiciones para evitar que el dominio sea tomado\n como la extension ru.\n */\n pos = posExtension(indice+1, string);\n /* Si despues de la extension hay un enlace. */\n if( indice < strlen(string))\n printf(\"/\");\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 printf(\"%d %d\", indice, strlen(string) );\n if(indice > strlen(string))\n printf(\"/\");\n\n while(indice != strlen(string)){\n printf(\"%c\", string[indice++]);\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "e4ea61d6c2cf2201f2a1806dbc812792", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "GNU C", "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\u00f3n de variables */\n char string[CARACTERES];\n int indice = 0;\n int pos;\n /* Lectura de variables */\n scanf(\"%s\", string);\n\n while(string[indice]!='p')\n printf(\"%c\", string[indice++]);\n\n printf(\"%c://\", string[indice++]);\n\n /* Suma dos posiciones para evitar que el dominio sea tomado\n como la extension ru.\n */\n pos = extension(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 printf(\"/\");\n\n while(indice != strlen(string))\n printf(\"%c\", string[indice++]);\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7578c8c1ceae588cc132b3bed2fe39b", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "GNU C", "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\u00f3n de variables */\n char string[CARACTERES];\n int indice = 0;\n int pos;\n /* Lectura de variables */\n scanf(\"%s\", string);\n\n while(string[indice]!='p')\n printf(\"%c\", string[indice++]);\n\n printf(\"%c://\", string[indice++]);\n\n /* Suma dos posiciones para evitar que el dominio sea tomado\n como la extension ru.\n */\n pos = posExtension(indice+2, string);\n\n while(indice!=pos)\n printf(\"%c\", string[indice++]);\n\n printf(\".ru\");\n\n /* Suma dos unidades para obviar la extension .ru */\n indice += 2;\n \n if(indice > strlne(string))\n printf(\"/\");\n \n while(indice != strlen(string)){\n printf(\"%c\", string[indice++]);\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "d7070acec7271f8789a313a97f5a946b", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int a[100], b[100],i,n,j,c=0;\n scanf(\u201c%d\u201d,&n);\n for(i=0;i\n# include\n\nint main()\n{\n int num,c=0;\n scanf(\"%d\",&num);\n int num1[2][num];\n for (int i = 0; i < num; ++i)\n \t{\n \t\tfor (int k = 0; k < 2; ++k)\n \t\t{\n \t\t\tscanf(\"%d\",&num1[i][k]);\n \t\t}\n \t} for(int i=0; i\n# include\n\nint main()\n{\n int num,c=0;\n scanf(\"%d\",&num);\n int num1[2][num];\n for (int i = 0; i < num; ++i)\n \t{\n \t\tfor (int k = 0; k < 2; ++k)\n \t\t{\n \t\t\tscanf(\"%d\",&num1[i][k]);\n \t\t}\n \t} for(int i=0; i\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n\n int number=0;\n int h(n),a(n);\n for (int i = 0; i < n; ++i)\n {\n scanf(\"%d %d\",&h[i],&a[i]);\n for (int j = 0; j < i; ++j)\n {\n if (h[i] == a[j])\n {\n number += 1;\n }\n if (a[i] == h[j])\n {\n number += 1;\n }\n }\n }\n printf(\"%d\",number);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "858ae9b67a9396d5486668181890ddf2", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int h[n],a[n];\n int c[100];\n int i;\n for(i=0;i\nint main ()\n{\n int x[30][2],n,j,counter;\n \n \n scanf(\"%d\",&n);\n \n for(int i =0 ; i\nint main(){\n int n;\n scanf(\"%d\",&n);\n int ar[n];\n float sum=0.0;\n for(int i=0;i=4.5){\n count++;\n break;\n }\n else{\n if(ar[i]!=5){\n sum=sum-ar[i]+5;\n ar[i]=5;\n }\n }\n }while(i\nint main()\n{\n\tint n,i,dem=0;\n\tfloat test,res=0,a[100],hv;\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[j])\n\t\t\t{\n\t\t\t\thv=a[i];\n\t\t\t\ta[i]=a[j];\n\t\t\t\ta[j]=hv;\n\t\t\t}\n\t\t}\n\t}\n\tif(test>=4.5)\n\t\tprintf(\"0\");\n\telse\n\t{\n\t\tfor(i=0;i=4.5)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\",dem);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e66a1cb1e7e1bb464ef8f4c20b3f264", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0} {"lang": "GNU C", "source_code": "3\n4 4 4", "lang_cluster": "C", "compilation_error": true, "code_uid": "90ba6b535ebc5e2e36a435cbf7ae8a18", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n];int sum=0;float c;\n\tfor(int i=0;ib){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tc=(float)(-sum+b);\n\t}\n\t//printf(\"%f\\n\",c);\n\tif(c-int(c)==0)printf(\"%d\",int(c));\n\telse\n\tprintf(\"%d\",(int)c+1);\n\t\n\t\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fafa70a0bab3aca9d22dcfb1e5ee2a08", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n];int sum=0,d;float c;\n\tfor(int i=0;ib){\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tc=(float)(-sum+b);\n\t}\n\td=int(c);\n\t//printf(\"%f\\n\",c);\n\tif(c-d==0)printf(\"%d\",d);\n\telse\n\tprintf(\"%d\",d+1);\n\t\n\t\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ed91dd82a2488ddcdc0c984a2245e665", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(){\n int n,k=0,m,i;\n scanf(\"%d\",&n);\n m=n;\n for( i=2;i<=sqrt(n);i++){\n if(m%i==0){\n while(m%i==0){\n m/=i;\n }\n k++;\n }\n if(k==2){\n printf(\"1\");\n break;\n }\n if(n==1)\n break;\n\n }\n if(k==1){\n printf(\"%d\",i);\n }\n else if(k==0)\n printf(\"%d\",n);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cbf519386ed8f5b138ca159dc860c433", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "//\u82e5num\u4e3a\u8d28\u6570\uff0c\u663e\u7136\u9700\u8981num\u79cd\u6d82\u6599\n//\u82e5num\u53ea\u6709\u4e00\u4e2a\u8d28\u56e0\u6570p\uff0c\u663e\u7136num = p^k,\u5219\u9700\u8981p\u79cd\u6d82\u6599\n//\u82e5num\u67092\u4e2a\u53ca\u4ee5\u4e0a\u7684\u8d28\u56e0\u6570\uff0c\u52191~num\u90fd\u53ef\u4ee5\u7531\u8fd9\u4e9b\u8d28\u56e0\u6570\u7ebf\u6027\u8868\u793a\uff0c\u6545\u53ea\u9700\u4e00\u79cd\u6d82\u6599\n\n#include \n#include \n\nint isPrime(long long num);\nint f(long long num);\n\nint main() {\n\tlong long n;\n\tscanf(\"%lld\", &n);\n\n\tif (n == 1) {\n\t\tprintf(\"1\\n\");\n\t}\n\telse if (isPrime(n)) {\n\t\tprintf(\"%lld\\n\", n);\n\t}\n\telse {\n\t\tint flag = f(n);\n\t\tif (flag) {\n\t\t\tprintf(\"%d\\n\", flag);\n\t\t}\n\t\telse {\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nint isPrime(long long num) {\n\tif (num == 1) {\n\t\treturn 0;\n\t}\n\telse if (num == 2 || num == 3) {\n\t\treturn 1;\n\t}\n\telse if (num % 6 != 1 && num % 6 != 5) {\n\t\treturn 0;\n\t}\n\n\tint temp = sqrt(num);\n\tint count1;\n\tfor (count1 = 5; count1 <= temp; count1+=6) {\n\t\tif (num % count1 == 0 || num % (count1+2) == 0) {\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nint f(long long num) {\n\tint counter = 0, ans;\n\n\tlong long count1;\n\tfor (count1 = 2; count1 <= num; count1++) {\n\t\tif (num % count1 == 0) {\n\t\t\tif (isPrime(count1)) {\n\t\t\t\tans = count1;\n\t\t\t\tcounter++;\n\t\t\t\tif (counter >= 2) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\tnum /= count1;\n\t\t\t\tcount1 = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ans;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b7ca03c60dba8060bae53da866bb48b", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "//set many funcs template\n//Ver.20190820\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 \n \nint main()\n{\n long long int a,num,j,i=0;\n scanf(\"%lld\",&a);\n num=a; \n \n int u=0; long long int n=0;\n for(i=2;i<1000001;i++)\n {\n if(a%i==0)\n {\n u++;\n \n while(a%i==0)\n a=a/i;\n j=i;\n }\n if(u>=2)\n break;\n }\n\n if(u==0 || u==1&&a==1)\n n=j;\n else\n n=1;\n\n if(num==1)\n n=1;\n\n printf(\"%lld\\n\",n);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "70ca6ee1aa56236e3ee36f9fd8028529", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tlong long n, a, k;\n\n\tscanf(\"%lld\", &n);\n\tif (n == 1) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tk = 0;\n\tfor (a = 1; a * a <= n; a++)\n\t\tif (n % a == 0) {\n\t\t\tk++;\n\t\t\tif (a * a != n)\n\t\t\t\tk++;\n\t\t}\n\tk--;\n\tprintf(\"%lld\\n\", k == 1 ? n : k);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dbeb40db3993375d07bcded168354aa3", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\n long long int a,b,i,find,n,j;\n\n scanf(\"%lld %lld\",&a,&b);\n int array[b+1];\n i=0;\n find=0;\n\n while(a <= b)\n {\n array[i]=b;\n if((b%2==0){\n b=b/2;\n }\n else if(b%10==1){\n b=b/10;\n }\n i++;\n find++;\n }\n n=i;\n if(array[n-1]==a)\n {\n printf(\"YES\\n%d\\n\",find);\n for(j=n-1;j>=0;j--){\n printf(\"%lld \",array[j]);\n }\n printf(\"\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "85743bc76576bb64c6fc6c06526eadc7", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\nint n,m;\nint a[1000000];\nint main(){\n cin >> n >> m;\n for (int i=0;i> a[i];\n }\n for (int i=0;imain(){ long long int a,b,t=1, x[9999],i=1,j; scanf(\"%I64d %I64d\",&a,&b); x[0]=b; while(b>a) { if(b%10==1) { t++; b/=10; x[i++]=b; } else { b/=2; x[i++]=b; t++; } } if(a==b) { printf(\"YES\\n\"); printf(\"%I64d\\n\",t); for(j=i-1;j>=0;j--) printf(\"%I64d \",x[j]); printf(\"\\b\"); printf(\"\\n\"); } else printf(\"NO\\n\"); return 0;}", "lang_cluster": "C", "compilation_error": true, "code_uid": "50ff8d5293d31504988c38ddea998492", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\n long long int a,b,i,find,n,j;\n\n scanf(\"%lld %lld\",&a,&b);\n int array[b+1];\n i=0;\n find=0;\n\n while(a <= b)\n {\n array[i]=b;\n if((b%2==0){\n b=b/2;\n }\n else if(b%10==1){\n b=b/10;\n }\n i++;\n find++;\n }\n n=i;\n if(array[n-1]!=a)\n {\n printf(\"YES\\n%d\\n\",find);\n for(j=n-1;j>=0;j--){\n printf(\"%lld \",array[j]);\n }\n printf(\"\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fe089162ad12bb60db030363297b1d0d", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\n long long int a,b,i,find,n,j;\n\n scanf(\"%lld %lld\",&a,&b);\n int array[b+1];\n i=0;\n find=0;\n\n while(a <= b)\n {\n array[i]=b;\n if((b%2==0){\n b=b/2;\n }\n else if(b%10==1){\n b=b/10;\n }\n i++;\n find++;\n }\n n=i;\n if(array[n-1]==a)\n {\n printf(\"YES\\n%lld\\n\",find);\n for(j=n-1;j>=0;j--){\n printf(\"%lld \",array[j]);\n }\n printf(\"\\n\");\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9d687e8006147850430b8528d6dc69b2", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "//Date:12-11-17\n\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}\nbool prime[MAX];\nvoid pre(){\n\tint i ,j;\n\tmset(prime ,1);\n\tprime[1] =false;\n\tfor(i=2;i\nint main()\n{\nint i,j,h,n;\nscanf(\"%d\",&n);\nfor(i=1;i<1000;i++)\n{\nh=n*i+1;\nfor(j=2;j\n#include \n#include \n#include \n \n\n int isprime(long long p)\n { int i; double max=sqrt(p);\n for(i=2;i<=max;i++)\n if(p%i==0)break;\n if(i>max && n!=1)return 1;\n return 0;\n }\n\n\nlong long gcd(long long a,long long b)\n{ long long i;\n for(i=a0;i--)\n if((a%i==0)&&(b%i==0))break;\n return i;\n}\n\nint comp(const void * a, const void * b) \n{\n return ( *(int*)a - *(int*)b );\n}\n\t\n\n\n \nint issame(int *a,int *b,int l) //checks if two arrays of same length are same after sorting them **\n{ qsort(a,l,sizeof(int),comp);\n qsort(b,l,sizeof(int),comp);\n int i;\n for(i=0; imax)max=a[i];\nreturn max;\n}\n\n\nint arrmin(int *a, int l) \n{ int i; int min= a[0];\n for(i=1;i0)\n p*=a--;\n return p;\n }\n \n\nint min(int a, int b)\n{if(a>b) return b;\n return a;}\n\n\nint max(int a, int b)\n{if(a2)c=n-2;\n \t printf(\"%d\",c);\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \t\n }\n\treturn 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4ff755670d4cde92f66936be0f6f0344", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\nint n,num,val;\nint i,j;\nscanf(\"%d\",&n);\nfor(i=1;i<1000;i++)\n{\nnum=n*i;\nval=num+1;\nfor(j=2;j\nint main()\n{\n int n,m;\n scanf(\"%d\",&n);\n if (n%2==0)\n {\n printf(\"2\");\n }\n else \n {\n printf(1\");\n }\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "515bf310be51742f987c31eaefd55a84", "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main () {\n long long a, b, k, i;\n int times = 1;\n scanf(\"%I64u\", &a);\n\n scanf(\"%I64u\", &b);\n\n \n if (b > a) {\n k = b - a - 1;\n for (i = b - k; i <= b; i++) {\n times = (times * (i % 10)) % 10;\n }\n\n printf(\"%d\", times);\n } else {\n printf(\"0\")\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d84e154c94773c1e656c64aa9fd8c40", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint main()\n{\n\n unsigned long long a,b,i,factorial = 1;\n\n\n scanf(\"%I64d %I64d\",&a,&b);\n\n\n for(i=1+a; i<=b; ++i)\n {\n factorial = (factorial%10)*(i%10);\n }\n printf(\"%I64d\", factorial);\n\n\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "e508634540535d5df1acfd026cfa2a20", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "a,b = input().split()\na = int(a)\nb = int(b)\nx = b - a\nb = b%10\ny =int(1)\nif x > b:\n print(\"0\")\nelse :\n for i in range(x):\n y = y*b\n b -= 1\n y = y % 10\n print(y)\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6e91863d44591a0971739854ac3bb5f7", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n long long a,b,k=1,i;\n scanf(\"%I64d %I64d\",&a,&b);\n if (((b<(a+5)) && (((a%10)>=5) || ((b%10)<=4)))\n {\n b=b%10;\n a=a%10;\n for (i=a+1;i<=b;i++)\n {k*=i;}\n k=k%10;\n\n }\n else k=0;\n printf(\"%I64d\\n\",k);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fe3a12012b7c876c7fcca7354804e1a6", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n long long a,b,i;\n scanf(\"%I64d %I64d\", &a, &b);\n\n int result = 1;\n if(b-a>=5)\n {\n result=0;\n }\n else\n {\n for(i=a+1;i<=b;i++){\n answer=answer*(i%10);\n }\n result=result%10;\n }\n\n printf(\"%d\\n\",result);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8bcfd03bca02ce23ddd9ffbc73ba2bee", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n\tint a,b,c,n;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a==2){\n\t\tn=(b+1)*(c+1);\n\t\tprintf(\"%d\",n-2);\n\t}\n\telse if(b==2) {\n\t\tn=(a+1)*(c+1);\n\t\tprintf(\"%d\",n-2);\n\t}\n\telse if(c==2) {\n\t\tn=(b+1)*(a+1);\n\t\tprintf(\"%d\",n-2);\n\t}\n\telse {\n\t\tif(b>=a && c>=a) {\n\t\t\tn=(b+a-1)*(c+a-1);\n\t\t\tp=(a-1)*(a-2);\n\t\t\tprintf(\"%d\",n-p);\n\t\t}\n\t\telse if(a>=b && c>=b) {\n\t\t\tn=(b+a-1)*(c+b-1);\n\t\t\tp=(b-1)*(b-2);\n\t\t\tprintf(\"%d\",n-p);\n\t\t}\n\t\telse if(a>=c && b>=c) {\n\t\t\tn=(c+a-1)*(c+b-1);\n\t\t\tp=(c-1)*(c-2);\n\t\t\tprintf(\"%d\",n-p);\n\t\t}\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b5235d4f9595d6f439e11f483cac449", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n# include \nint main()\n{\n int a[3],i,j,temp,s=0,n,m;\n for(i=0;i<3;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<2;i++)\n {\n for(j=0;j<2-i;j++)\n {\n if(a[j]>a[j+1])\n {\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n s+=2*(a[0]-2+a[1]-2+a[2]-2)+6;\n // printf(\"%d\\n\",s);\n n=a[0]+a[1]-3;\n if(n==1)\n m=a[2]-1;\n\n\n else\n m=(2*(a[2]-1)+a[2]*(n-2));\n //printf(\"%d\\n\",m);\n printf(\"%d\",m+s);\n \nreturn (0);\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ddf469eba42ccf1b1c7e4f800e8c200e", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "//#include\n#include\n#include\n#include\nint main()\n{\n int a,b,c,i,j,;\n scanf(\"%d %d %d\",&a,&b,&c);\n printf(\"%d\",(c-1)*(a+b-1)+2*b);\n // getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e5096598e8b8d8ddd991578c469113d7", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n printf(\"%d\",((a-1)*(b+c-1)+(b*c)));\n getch();\n return 0;\n}\n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "15cba49af3fa9c2d9d4c857006d63d19", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{int a,b,c,t;\nscanf(\"%d %d %d\",&a,&b,&c);\nt=a*b+b*c+c*a-a-b-c+1;\nprintf(\"%d\",t);\ngetch();\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8fb5ebe9ecdeaea8041da39f73a853c2", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \nlong long gcd(long long a,long long b)\n{\n if(a==0)\n return b;\n else\n gcd(b%a,a);\n}\nint main()\n{\n long long m,z;\n scanf(\"%ll\",&z);\n z=m;\n for(long long i=1;i*i<=z;i++)\n {\n if(z%i==0 && gcd(i,z/i)==1)\n m=i;\n }\n printf(\"%lld %lld\",m,z/m);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "13c7be1b786618a8f21a731feb8feb52", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "\t#include\n\tint main()\n\t{\n\t\tlong long tc;\n\t\tscanf(\"%lld\",&tc);\n\t\tlong long faktorial[tc];\n\t\tint j = 0;\n\t\tfor(int i = 1;i<=tc;i++)\n\t\t{\n\t\t\tif(tc % i == 0)\n\t\t\t{\n\t\t\t\tfaktorial[j] = i;\n\t\t\t\tj++;\n\t\t\t}\t\n\t\t}\n\t\tlong long temp = faktorial[0] + faktorial[j-1];\n\t\tlong long sementara1 = faktorial[0], sementara2 = faktorial[j-1];\n\t\tlong long sementara = j;\n\t\tfor(int i = 0;i\n#include \nint ebob (int a,int b)\n{\n while (a!=0&&b!=0)\n {\n if (a>b)\n {\n a = a%b;\n }\n else \n {\n b = b%a;\n }\n \n }\n if (a==0)\n {\n return b;\n }\n else\n {\n return a;\n }\n \n}\nint input;\nint max;\nint main ()\n{ \n freopen (\"a.gir\",\"r\",stdin);\n freopen (\"a.cik\",\"w\",stdout);\n scanf (\"%d\",&input);\n for (int i=1;i<=sqrt(input);i++)\n {\n if (input%i==0)\n {\n if (ebob(i,input/i)==1)\n {\n max = input/i;\n }\n }\n }\n printf (\"\\n%d %d\",max,(input/max));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0b433c25b24c96b0e4872a3a120df9fc", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \nlong long int ebob (long long int a,long long int b)\n{\n while (a!=0&&b!=0)\n {\n if (a>b)\n {\n a = a%b;\n }\n else \n {\n b = b%a;\n }\n \n }\n if (a==0)\n {\n return b;\n }\n else\n {\n return a;\n }\n \n}\nlong long int input;\nlong long int max;\nint main ()\n{ \n freopen (\"a.gir\",\"r\",stdin);\n freopen (\"a.cik\",\"w\",stdout);\n scanf (\"%lld\",&input);\n for (int i=1;i<=sqrt(input);i++)\n {\n if (input%i==0)\n {\n if (ebob(i,input/i)==1)\n {\n max = input/i;\n }\n }\n }\n printf (\"\\n%lld %lld\",max,(input/max));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee44b2abc025654364ef0bb0eb911c49", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint judge(int a, int b);\nint main()\n{\n\tlong long n,a=1,b,i;\n\tscanf(\"%lld\", &n);\n\tb = n / a;\n\tfor (i = 1; i <= sqrt(n); i++)\n\t{\n\t\tif ((n % i == 0) && judge(i, n / i))\n\t\t{\n\t\t\tif ((n / i) < b)\n\t\t\t{\n\t\t\t\ta = i;\n\t\t\t\tb = n / i;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld %lld\", a, b);\n\treturn 0;\n}\nint judge(long long a, long long b)\n{\n\tif (b % a == 0)\n\t\treturn 0;\n\telse\n\t\treturn 1;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3a4b843f4be955a16964757c0e4e917e", "src_uid": "e504a04cefef3da093573f9df711bcea", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "//emre\n#include \n#include \nint main()\n{\n int a,b,c,d,n,len;\n char str[100];\n scanf(\"%s\",str);\n len=strlen(str)-2;\n if(str[len]=='A' || str[len]=='a' || str[len]=='E' || str[len]=='e' || str[len]=='I' || str[len]=='i' || str[len]=='O' || str[len]=='o' || str[len]=='U' || str[len]=='u' || str[len]=='Y' || str[len]=='y')\n printf(\"%c\",str[len]);\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5f969fa0b338bcd30926b96ac9fdc7ff", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nint main(void)\n{\n char s[100];\n fgets(s, 100, stdin);\n int x = strlen(s)-1;\n char c[] = {'a', 'e','i', 'o', 'u', 'y'};\n for(int i = 0; i < 6; i++){\n while(s[x] == ' '){\n x--;\n } \n if(tolower(s[x]) == c[i]){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b61e51c88a4c2cf5466589244f2af0a7", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint checking_char_before(char *string,int t){\n if(string[t]=='a'||string[t]=='e'||string[t]=='i'||string[t]=='o'||string[t]=='u'||string[t]=='y'){\n return 1;\n }\n if(string[t]=='A'||string[t]=='E'||string[t]=='I'||string[t]=='O'||string[t]=='U'||string[t]=='Y'){\n return 1;\n }\n if(string[t]==' '){\n return checking_char_before(string,t-1);\n }\n else return 0;\n}\nint main(){\n char string[101];\n int flag=0\n scanf(\"%[^\\n]%*c\",string);\n int d= strlen(string);\n if(string[d-1]=='?'){\n flag=checking_char_before(string,d-2);\n }\n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8b9bdc0c06c5f01e190e63a15705abe", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char s[101],count;\n gets(s);\n int i=0;\n while(s[i]!=0)\n {\n if(s[i]=='?')\n {\n count=s[i-1];\n if(count==' ')\n {\n count=s[i-2];\n }\n }\n i=i+1;\n }\n if(count=='a' || count=='e' || count=='i' || count=='o' || count=='u' || count=='y' count=='A' || count=='E' || count=='I' || count=='O' || count=='U' || count=='Y')\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "34918c530a2d77e67dddc0375529e160", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n char ch[150];\n scanf(\"%s\",ch);\n int l=strlen(ch);\n int i,j,k;\n for(i=l-1;i>=0;i--)\n {\n if((ch[i]>=65 && ch[i]<=90) || (ch[i]>=97 && ch[i]<=122))\n {\n if(ch[i]=='a'||ch[i]=='e'||ch[i]=='i'||ch[i]=='o'||ch[i]=='u'||ch[i]=='y'||ch[i]=='A'||ch[i]=='E'||ch[i]='I'||ch[i]=='O'||ch[i]=='U'||ch[i]=='Y')\n printf(\"YES\");\n else \n printf(\"NO\");\n }\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f8fd0ee53a1bba563c4777cb8eb6ca3", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0} {"lang": "GNU C", "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 \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] = '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#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 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d09ea39609cac97184444b174230d86", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint check_palindrome(char str[],int first,int last)\n{\n while(first < last)\n {\n if(str[first]!=str[last])\n {\n return 0;\n }\n else\n {\n first++;\n last--; \n }\n }\nreturn 1;\n}\n\n\nint main()\n{\n\n //printf(\"%s\\n\",arr );\n char arr[200];\n scanf(\"%s\",arr);\n int l1=strlen(arr);\n int i,x,y;\n int check;\n check=check_palindrome(arr,0,l1-1);\n\n /*\n\n\n while(arr[x]==arr[y])\n {\n x++;\n y--;\n //printf(\"here1111\\n\", );\n }\n check=check_palindrome(arr,x,y-1);\n if(check==1)\n {\n //printf(\"%s\\n\",arr );\n for(i=0;i\n#include \n#include \n\nint check_palindrome(char str[],int first,int last)\n{\n while(first < last)\n {\n if(str[first]!=str[last])\n {\n return 0;\n }\n else\n {\n first++;\n last--; \n }\n }\nreturn 1;\n}\n\n\nint main()\n{\n\n //printf(\"%s\\n\",arr );\n char arr[200];\n scanf(\"%s\",arr);\n int l1=strlen(arr);\n int i,x,y;\n int check;\n check=check_palindrome(arr,0,l1-1);\n\n /*\n\n\n while(arr[x]==arr[y])\n {\n x++;\n y--;\n //printf(\"here1111\\n\", );\n }\n check=check_palindrome(arr,x,y-1);\n if(check==1)\n {\n //printf(\"%s\\n\",arr );\n for(i=0;i\n#include \n#include \n\nint palindrom( char riadok[] ) {\n int l = strlen( riadok );\n for( int 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "72482d22efb39ee61a9deed654b787e9", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include", "lang_cluster": "C", "compilation_error": true, "code_uid": "1cb287d97356a17deda131285489fa41", "src_uid": "24e8aaa7e3e1776adf342ffa1baad06b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define MOD 1000000007\n\nint main()\n{\n\tlong long int a,b,c,d,e,f,i,j;\n\tscanf(\"%I64d %I64d\",&a,&b);\n\tlong long int p,q,r,s;\n\tp = (a*(a+1)/2)%MOD;\n\tq = (b*(b-1)/2)%MOD;\n\tr = (p*b+a)%MOD;\n\ts = (q*r)%MOD;\n\tprintf(\"%I64d\\n\",s);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0caf8997721d6518e33deff63a4e23e", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main(int argc, const char *argv[])\n{\n long long a,b;\n scanf( \"%lld %lld\", &a, &b );\n\n long long res = 0;\n for( int r = 1; r < b; r++ )\n {\n int tmp;\n tmp = ( a + 1 ) % 1000000007;\n tmp = ( b * tmp ) % 1000000007;\n tmp = ( tmp / 2 ) % 1000000007;\n tmp = ( tmp + 1 ) % 1000000007;\n tmp = ( tmp * a ) % 1000000007;\n tmp = ( tmp * r ) % 1000000007;\n res = ( res + tmp ) % 1000000007;\n }\n\n printf( \"%lld\\n\", res );\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ce2af15ea0825c7ce26ad6d66f6856a9", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n long long int a,b,sum=0,i,p,q,y,x,z;\n scanf(\"%lld %lld\",&a,&b);\n for(i=1;i<=a;i++){\n sum+=(i*b*i+(i*(i+1))/2);\n //printf(\"aa=%d \",(i*b*i+(i*(i+1))/2));}\n for(i=1;i<=b-2;i++)\n {\n y=i*(a+1); z=(i+1)*(a+1)-1;\n for(y; y<=z; y++)\n {\n q=y;\n if(q>b-1)\n q=b-1;\n x=(q*(q+1))/2-(i*(i+1))/2;\n sum+=(q-i)*b*y+x;\n //printf(\"bb=%d \",(q-i)*b*y+x);\n }\n }\n printf(\"%lld\",sum-sum/1000000007*1000000007);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b0f70971914fe61878d424f7a348c62b", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nconst int mod=1000000007;\n\nint main(void)\n{\n\tint a, b, k, ans;\n\tlong long t;\n\t\n\tans = 0;\n\tscanf(\"%d%d\", &a, &b);\n\tfor (k=1; k<=a; ++k) {\n\t\tt = b-1;\n\t\tans = (t*(t+1)/2*(k*b+1)+ans)%mod;\n\t}\n\tprintf(\"%d\\n\", ans);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fbbe00d151c349faafeea6a3fb748fae", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n uint32_t a,b,j,i;\n uint64_t sum=0,modsum;\n scanf(\"%I32d%I32d\",&a,&b);\n modsum=((b-1)*b)/2;\n for(j=1;j<=a;j++) {\n sum+=modsum*(j*b+1);\n sum%=1000000007;\n }\n printf(\"%I64d\",sum);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2267b4349bdf81acf627e5056a016a20", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nlong long dp[100][100],boy[10000],girl[10000];\nlong long comb(long long n,long long r)\n{\n long long i,j;\n if(r==0 || n==r)\n {\n dp[n][r]=1;\n return 1;\n }\n if(dp[n][r]!=-1)\n return dp[n][r];\n else\n {\n dp[n][r]=comb(n-1,r-1)+comb(n-1,r);\n return dp[n][r];\n }\n}\nint main()\n{\n long long i=0,j,k,n,m,t,x,y,z,ans=0;\n for(i=0; i<100; i++)\n {\n for(j=0; j<100; j++)\n {\n dp[i][j]=-1;\n }\n }\n scanf(\"%I64d %I64d %I64d\",&n,&m,&t);\n x=1;\n y=n;\n //printf(\"%d\\n\",comb(12,4));\n if(n+m==t)\n {\n ans=comb(n,m);\n printf(\"%I64d\",ans);\n return 0;\n }\n i=0;\n while(n>=4 && x<=m)\n {\n if(n+x==t)\n {\n\n boy[i]=n;\n girl[i]=x;\n //printf(\"%I64d %I64d\\n\",boy[i],girl[i]);\n x++;\n i++;\n }\n n--;\n }\n for(j=0; j\n#include \n\nlong long f(long long n)\n{\n long long r=1,i;\n for(i=2;i<=n;i++)\n {\n r*=i;\n }\n return r;\n}\n\nint main()\n{\n int n1,m1,t1;\n scanf(\"%d %d %d\",&n1,&m1,&t1);\n long long n=n1,m=m1,t=t1,r=0,i,j,tmp;\n for(i=4;i<=t-1&&i<=n;i++)\n {\n tmp=(f(n)/(f(i)*f(n-i)));\n for(j=1;i+j<=t&&j<=m;j++)\n {\n r+=tmp*(f(m)/(f(j)*f(m-j)));\n }\n }\n printf(\"%I64d\",r);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "287e23795542452256326a4c7524867d", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long f(long long n)\n{\n long long r=1,i;\n for(i=2;i<=n;i++)\n {\n r*=i;\n }\n return r;\n}\n\nint main()\n{\n long long n,m,t,r=0,i,j;\n scanf(\"%I64d %I64d %I64d\",&n,&m,&t);\n for(i=4;i<=t-1;i++)\n {\n for(j=1;i+j<=t;j++)\n {\n r+=(f(n)/(f(i)*f(n-i)))*(f(m)/(f(j)*f(m-j)));\n }\n }\n printf(\"%I64d\",r);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7dfbea0f6586dff4ce71a6f4028cb22a", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\ntypedef long long ll;\nint c[40][40];\nint main()\n{\n for (int i=0;i<=30;i++)\n {\n c[i][0]=c[i][i]=1;\n for (int j=1;jm)\n continue;\n ans+=ll(c[n][i])*c[m][p];\n }\n printf(\"%I64d\\n\",ans);\n return(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "86f02dc05ae23477b1f5c7f612a99d9c", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long f(long long n)\n{\n long long r=1;\n for(long long i=2;i<=n;i++)\n {\n r*=i;\n }\n return r;\n}\n\nint main()\n{\n long long n,m,t,r=0;\n scanf(\"%I64d %I64d %I64d\",&n,&m,&t);\n for(int i=4;i<=t-1;i++)\n {\n for(int j=1;i+j<=t;j++)\n {\n r+=(f(n)/(f(i)*f(n-i)))*(f(m)/(f(j)*f(m-j)));\n }\n }\n printf(\"%I64d\",r);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd3508575704e867ea65c805e8cdab03", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int k,a,b;\n scanf(\"%d %d %d\",&k,&a,&b);\n if(a\n#include\n#include\n#include\n#include\n#include\ntypedef long long int ll;\n#define INF INT_MAX\nint min(int a,int b);\nvoid swap(int *a,int *b);\nvoid swap(int *a,int *b)\n{\n\tint temp=*a;\n\t*a=*b;\n\t*b=temp;\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\treturn(a>b?b:a);\n}\n\nint main()\n{\n\tlong long int k,a,b,ans=0;\n\tscanf(\"%lld%lld%lld\",&k,&a,&b);\n\tif(a+b-min(a,b)\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\tlong long int k,a,b,c;\n\tscanf(\"%lld%lld%lld\",&k,&a,&b);\n\tif((a+b)/k==0)printf(\"-1\");\n\telse printf(\"%lld\",(a+b)/k);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "64e22c6164c4f59844d09389e59c68d8", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n long long int k,a,b;\n scanf(\"%lld %lld %lld\", &k, &a, &b);\n if((a\n\nint main(){\n\tint s, a, b, ts, us;\n\tscanf(\"%d %d %d\", &s, &a, &b);\n\tts = 0;\n\tts += a/s;\n\tts += b/s;\n\tus = 0;\n\tif(a%s!=0){\n\t\tus++;\n\t}\n\tif(a%b!=0){\n\t\tus++;\n\t}\n\tif(us>ts){\n\t\tprintf(\"-1\\n\");\n\t}\n\telse{\n\t\tprintf(\"%d\\n\", ts);\n\t}\n\treturn(0);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bd305e8a83b9b4c1bed1a8132e85a77d", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint main()\n{\nint x1,y1,x2,y2;\nscanf(\"%d%d%d%d\",&x1,&y1,&x2,&y2);\nif(x1==x2)\n{\n\n\tprintf(\"%d\",2*(abs(y2-y1)+1));\n}\nelse if(y1==y2)\n{\n\tprintf(\"%d\",2*(abs(x2-x1)+1));\n}\nelse \n{\n\tprintf(\"%d\",2*((abs(x2-x1)+1)+(abs(y2-y1)+1)));\n}\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f0f5a17877f352ac243c40ef1ebb40c5", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(){\n\nint x1, x2, y1, y2, c, d, m, n, o;\nscanf(\"%d%d%d%d\", &x1,&y1,&x2,&y2);\n\nm=(x2-x1);\nn=(y2-y1);\n\n\n\nif(m<0) m=m*(-1);\nelse if(n<0) n=n*(-1);\n\no=((m+1)+(n+1))*2;\n\n//if(o<8) printf(\"8\");\n//else\n\nif(o<10) printf(\"%d\", o+2);\nelse printf(\"%d\", o);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3471ecc00c225119ef58254c09d84ceb", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint main()\n{\nint x1,y1,x2,y2;\nscanf(\"%d%d%d%d\",&x1,&y1,&x2,&y2);\nif(x1==x2)\n{\n\n\tprintf(\"%d\",(2*(abs(y2-y1)+1))+4);\n}\nelse if(y1==y2)\n{\n\tprintf(\"%d\",2*(abs(x2-x1)+1)+4);\n}\nelse \n{\n\tprintf(\"%d\",2*((abs(x2-x1)+1)+(abs(y2-y1)+1)));\n}\ngetch();\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "336c40e8c047bcda7548332aab5eccb8", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint main()\n{\nint x1,y1,x2,y2;\nscanf(\"%d%d%d%d\",&x1,&y1,&x2,&y2);\nif(x1==x2)\n{\n\n\tprintf(\"%d\",4*(abs(y2-y1)+1));\n}\nelse if(y1==y2)\n{\n\tprintf(\"%d\",4*(abs(x2-x1)+1));\n}\nelse \n{\n\tprintf(\"%d\",2*((abs(x2-x1)+1)+(abs(y2-y1)+1)));\n}\ngetch();\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "607d6548205d0a07f67ad5747e868890", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\n\nint max(int a, int b)\n{\n return a > b ? a : b;\n}\n\nint az(int a)\n{\n return a > 0 ? a : -a;\n}\n\nint main()\n{\n int x1, x2, y1, y2, a, b, c, d;\n scanf(\"%d%d%d%d\", &x1, &y1, &x2, &y2);\n a = min(x1, x2 - 1);\n b = max(x1, x2 + 1);\n c = min(y1, y2 - 1);\n d = max(y1, y2 + 1);\n printf(\"%d\\n\", az(2 * (a - b) * (c - d));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f4a66de9872c87aad089eef34f538a8", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n)\n if(n%2==0)\n {\n printf(\"Mahmoud\\n\");\n }\n else\n {\n printf(\"Ehab\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "581183f427aa530ef97c455d2ed7edd3", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int a,;\n scanf(\"d%\",&a);\n if(a%2==0)\n {\n printf(\"Mahmoud\");\n }\n if(a%2==1)\n {\n printf(\"Ehab\");\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0a3a0c5d20af82f049bcb3d8769be9f5", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main ()\n{\n int a;\n scanf(\"%d\",&a);\n if (a%2==0)\n {\n printf(\"Mahmoud\\n\");\n }\n else\n {\n printf(\"Ehab\\n\");\n }\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "714bf53ec95ebbecbc4751d37cd85a2b", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n int a,b;\n scanf(\"d%\",&a);\n b=a%2;\n if b==0) {printf(\"Mahmoud\");}\n else {printf(\"Ehab\");}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d971bb694bbdaa27425a2563bc140311", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n % 2 == 0) {\n\t\tprintf(\"Mahmoud\\n\");\n\t}\n\telse {\n\t\tprintf(\"Ehab\\n\");\n\t}\n\treturn 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9b042812cc1fc679b564eddb325af776", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main(int argc, char **argv)\n{\n char b[100]\n char hand;\n int v = 0, k = 0, i;\n scanf(\"%s\", b);\n hand = b[0];\n for (i = 0; b[i] != '\\0'; i++) {\n if (v == 5) {\n k++;\n v = 0;\n }\n if (b[i] == hand) {\n v++;\n }\n if (b[i] != hand) {\n if (v != 0) k++;\n \n hand = b[i];\n v = 1;\n }\n }\n if (v != 0) k++;\n printf(\"%d\\n\",k);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d79f630fb44e19d7b9b5bb83a975ee0", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nint main(){\n int a[101],i,k=0,v=0,f=5;\n for (i=0;a[i]!=\\0;i++){\n scanf(\"%d\",&a[i]);\n }\n for (i=1;a[i]!=\\0;i++){\n if ((a[i]==a[i-1]) && (v\nint main(){\nint a[101],i,k=0,v=0,f=5;\nfor (i=0;a[i]!='\\0';i++){\nscanf(\"%d\",&a[i]);\n}\nfor (i=1;a[i]!='\\0';i++){\nif ((a[i]==a[i-1]) && (v\n#include \nint main()\n{\n int sol(1),count(2); char ch, lc = getchar();\n while ((ch = getchar()) != EOF)\n if (!isspace(ch))\n if (ch != lc || count > 5) {\n count = 1; sol++; lc = ch;\n } else count++;\n printf(\"%d\\n\",sol);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c7adbb7b70304ae9a98d73c876cd9152", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "GNU C", "source_code": "main(a,b)\n{\nchar c=' ',d;\nwhile((d=getchar()))\n{\nif(d==c) a++;\nif(a==5 || c!=d){b++;a=0;c=d;}\n}\nprintf(\"%d\",b);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "781fa60bcb63c9ee29fef2978aa6c7c7", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "817adb2765a41d6f45a84ad345a649a7", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "2274e1c7063f29136edda6a9fcb922ee", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0} {"lang": "GNU C11", "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\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);1\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9ae91741246c66f75001658a6072b8ee", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "ad4a0f2005dcf41f2fdd4b54f461f365", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a, b;\n char c;\n scanf(\"%d\", &a);\n scanf(\"%c\"c, &c);\n if(a==3 && c==db){\n b=5;\n printf(\"%d\"d,b);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "87419321245d4db0a02af84b16775a12", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "//#include \n#include \n//using namespace std;\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar arr[n];\n\tgetchar();\n scanf(\"%[^\\n]s\",arr);\n\n // gets(arr);\n int count=0;\n for(int i=0;i=65 && int(arr[i])<=90)\n \t{\n \t\tcount++;\n \t}\n }\n\n printf(\"%d\",count);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "64682a097aabf65cdd6ed2ff73a4ab6a", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "//educational codeforces A\n#include\n#include\n\nusing namespace std;\nint main()\n{\n int n;\n char s[205];\n int temp;\n int ans = 0;\n char nextline;\n scanf(\"%d%c\",&n,&nextline);\n gets(s);\n temp = 0;\n for(int i=0;ians)\n ans = temp;\n temp = 0;\n }\n else if(s[i]>='A'&&s[i]<='Z')\n {\n temp++;\n }\n else\n {\n continue;\n }\n }\n ans = ans>temp?ans:temp;\n printf(\"%d\\n\",ans);\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "699345d288ec9a8fe9d0f67cfa2fb9ca", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n\tint a,b,c=0,i;\n\tchar x;\n\tscanf(\"%d\",&a);\n\tgetch();\n\t\n\tfor (i=1; i<=a; i++){\n\t\tscanf(\"%c\",&x);\n\t\tif (x>='A' && x<='Z') b++;\n\t\tif (x==' '){\n\t\t if(c=c) printf(\"%d\",b);\n\telse printf (\"%d\",c);\n\treturn 0;\n}\n\t\t", "lang_cluster": "C", "compilation_error": false, "code_uid": "040ef751df0f5e79e6ade89e511726ea", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n\tint n,max = 0,i;\n\tscanf(\"%d\\n\",&n);\n\tint curr = 0;\n\tchar c;\n\tfor(i=0;i= 65 && c <= 90){\n\t\t\tcurr++;\n\t\t}\n\n\t\telse if(c == 32 || c == 3)\n\t\t{\n\t\t\tif(curr > max)\n\t\t\t{\n\t\t\t\tmax = curr;\n\t\t\t\tcurr = 0;\n\t\t\t}\n\t\t}\n\t\n\t}\n\tif(curr > max)\n\t\tmax = curr;\n\tprintf(\"%d\",max);\n\tgetch(); \n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f392bb81c10370e1192cc0e2832f5e3", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int p1,p2,p3,p4,a,b,i,cnt=0;\n scanf(\"%d%d%d%d%d%d\",&p1,&p2,&p3,&p4,&a,&b);\n for(i=a;i<=b;i++)\n if(i%p1%p2%p3%p4==i)\n cnt++;\n printf(\"%d\\n\",cnt);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "58b4512ae54f2371e038d7a5212ce016", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint p1,p2,p3,p4,a,b,ans;\nint main(){\n\tios::sync_with_stdio(false);\n\tscanf(\"%d %d %d %d %d %d\",&p1,&p2,&p3,&p4,&a,&b);\n\tfor(int i=a;i<=b;i++){\n\t\tif(i%p1==i&&i%p2==i&&i%p3==i&&i%p4==i){\n\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7f5764afb0aa9d22cddcad874176fdf0", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int p1,p2,p3,p4,a,b,i,cnt=0;\n scanf(\"%d%d%d%d%d%d\",&p1,&p2,&p3,&p4,&a,&b);\n for(i=a;i<=b;i++)\n if(i%p3%p2%p1%p4==i)\n cnt++;\n printf(\"%d\\n\",cnt);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "99d44278cb5f562c97524f8dcf5b8774", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a[4],i=0,a1,b1,j=0;\nscanf(\"%d%d%d%d%d%d\",&a[0],&a[1],&a[2],&a[3],&a1,&b1);\nj=a[0]b1-a1?(b1-a1+1):j-a1);\nreturn 0;\n}\n~ ", "lang_cluster": "C", "compilation_error": true, "code_uid": "7cb0d9f2bc99b55690f8b4fea0f4eed3", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int p1, p2, p3, p4, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &p1, &p2, &p3, &p4, &a, &b);\n\n if (p2 < p1) p1 = p2;\n if (p3 < p1) p1 = p3;\n if (p4 < p1) p1 = p4;\n\n if (p1 > a) {\n\t printf(\"%d\\n\", p1 - a);\n } else {\n\t puts(\"0\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "16feee5f6279b429e244e927f5cf8e17", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n char a[4][4] , ch;\n int i,j,x=0,o=0,dot=0,flagX=0,flagO=0;\n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n scanf(\"%c\",&a[i][j]);\n if(a[i][j]=='X')\n x++;\n else if(a[i][j]=='0')\n o++;\n else\n dot++;\n\n }\n\n ch=getchar();\n }\n if(x==o+1 || x==o)\n {\n if(a[0][0]==a[1][1] && a[1][1]==a[2][2] && a[j][0]!='.')\n {\n if(a[0][0]=='X')\n {\n flagX++;\n }\n else if(a[0][0]=='0')\n {\n flagO++;\n }\n }\n if(a[0][2]==a[1][1] && a[1][1]==a[2][0] && a[j][2]!='.')\n {\n if(a[0][2]=='X')\n {\n flagX++;\n }\n else if(a[0][2]=='0')\n {\n flagO++;\n }\n }\n }\n if(x==o+1 || x==o)\n {\n\n for(j=0; j<3; j++)\n {\n if(a[0][j]==a[1][j] && a[1][j]==a[2][j] && a[0][j]!='.')\n {\n if(a[0][j]=='X')\n {\n flagX++;\n }\n else if(a[0][j]=='0')\n {\n flagO++;\n }\n }\n else if(a[j][0]==a[j][1] && a[j][1]==a[j][2] && a[j][0]!='.')\n {\n if(a[j][0]=='X')\n {\n flagX++;\n }\n else if(a[j][0]=='0')\n {\n flagO++;\n }\n }\n }\n\n\n }\n\n\nelse\n{\n printf(\"illegal\");\n return 0;\n}\n\nif((flagO==1 || flagO==2) && o==x && flagX==0)\n printf(\"the second player won\");\n\nelse if((flagX==1 || flagX==2) && x>o && flagO==0)\n printf(\"the first player won\");\n\nelse if(flagO==0 && flagX==0 && dot==0)\n printf(\"draw\");\nelse if(flagO==0 && flagX==0 && dot!=0)\n{\n if(x>o)\n printf(\"second\");\n else\n printf(\"first\");\n}\n\nelse\n printf(\"illegal\");\n\n\nreturn 0;\n}#include \n#include \n\nint main()\n{\n char a[4][4] , ch;\n int i,j,x=0,o=0,dot=0,flagX=0,flagO=0;\n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n scanf(\"%c\",&a[i][j]);\n if(a[i][j]=='X')\n x++;\n else if(a[i][j]=='0')\n o++;\n else\n dot++;\n\n }\n\n ch=getchar();\n }\n if(x==o+1 || x==o)\n {\n if(a[0][0]==a[1][1] && a[1][1]==a[2][2] && a[j][0]!='.')\n {\n if(a[0][0]=='X')\n {\n flagX++;\n }\n else if(a[0][0]=='0')\n {\n flagO++;\n }\n }\n if(a[0][2]==a[1][1] && a[1][1]==a[2][0] && a[j][2]!='.')\n {\n if(a[0][2]=='X')\n {\n flagX++;\n }\n else if(a[0][2]=='0')\n {\n flagO++;\n }\n }\n }\n if(x==o+1 || x==o)\n {\n\n for(j=0; j<3; j++)\n {\n if(a[0][j]==a[1][j] && a[1][j]==a[2][j] && a[0][j]!='.')\n {\n if(a[0][j]=='X')\n {\n flagX++;\n }\n else if(a[0][j]=='0')\n {\n flagO++;\n }\n }\n else if(a[j][0]==a[j][1] && a[j][1]==a[j][2] && a[j][0]!='.')\n {\n if(a[j][0]=='X')\n {\n flagX++;\n }\n else if(a[j][0]=='0')\n {\n flagO++;\n }\n }\n }\n\n\n }\n\n\nelse\n{\n printf(\"illegal\");\n return 0;\n}\n\nif((flagO==1 || flagO==2) && o==x && flagX==0)\n printf(\"the second player won\");\n\nelse if((flagX==1 || flagX==2) && x>o && flagO==0)\n printf(\"the first player won\");\n\nelse if(flagO==0 && flagX==0 && dot==0)\n printf(\"draw\");\nelse if(flagO==0 && flagX==0 && dot!=0)\n{\n if(x>o)\n printf(\"second\");\n else\n printf(\"first\");\n}\n\nelse\n printf(\"illegal\");\n\n\nreturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "243f372017f75c7e8b027d5daf085a7d", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n\nchar grid[3][3];\n\n\n\nint countChar(char c)\n{\n\tint count=0;\n\tint i, j;\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tfor (j = 0; j < 3; j++)\n\t\t{\n\t\t\tif (grid[i][j] == c)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn count;\n\n}\n\nint checkWins(char c)\n{\n\tint flag=0;\n\t//horizontal wins\n\tif (grid[0][0] == c && grid[0][1] == c && grid[0][2] == c)\n\t{\n\t\tflag ++;\n\t}\n\n\tif (grid[1][0] == c && grid[1][1] == c && grid[1][2] == c)\n\t{\n\t\tflag++;\n\t}\n\n\tif (grid[2][0] == c && grid[2][1] == c && grid[2][2] == c)\n\t{\n\t\tflag++;;\n\t}\n\n\t//vertical wins\n\n\tif (grid[0][0] == c && grid[1][0] == c && grid[2][0] == c)\n\t{\n\t\tflag++;\n\t}\n\n\tif (grid[0][1] == c && grid[1][1] == c && grid[2][1] == c)\n\t{\n\t\tflag ++;\n\t}\n\n\tif (grid[0][2] == c && grid[1][2] == c && grid[2][2] == c)\n\t{\n\t\tflag ++;\n\t}\n\n\t//diagonal wins\n\n\tif (grid[0][0] == c && grid[1][1] == c && grid[2][2] == c)\n\t{\n\t\tflag ++;\n\t}\n\n\tif (grid[0][2] == c && grid[1][1] == c && grid[2][0] == c)\n\t{\n\t\tflag ++;\n\t}\n\n\n\treturn flag;\n\n\n}\n\n\n\n\n\nint main()\n{\n\tint i;\n\tint nx, n0, nd;\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\t{\n\t\t\tscanf(\"%s\", &grid[i]);\n\t\t}\n\t}\n\n\n\n\n\t/*for (i = 0; i < 3; i++)\n\t{\n\t\tfor (j = 0; j < 3; j++)\n\t\t{\n\t\t\tprintf(\"%c \", grid[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\n\tgetch();\n*/\n\tnx = countChar('X');\n\tn0 = countChar('0');\n\tnd = countChar('.');\n\n\t//Check illegal\n\tif (nx - n0 == 1 || nx - n0 == 0)\n\t{\n\t\tif (checkWins('X') > 0 && checkWins('0') > 0)\n\t\t{\n\t\t\tprintf(\"illegal \\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (checkWins('X') > 0 && checkWins('0') == 0)\n\t\t\t{\n\t\t\t\tif (nx - n0 == 1)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"the first player won \\n\");\n\n\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"illegal \\n\");\n\t\t\t\t}\na\n\n\t\t\t}\n\n\t\t\telse if (checkWins('X') == 0 && checkWins('0')> 0)\n\t\t\t{\n\t\t\t\tif (nx - n0 == 0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"the second player won \\n\");\n\n\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"illegal \\n\");\n\t\t\t\t}\n\n\n\t\t\t\t\n\t\t\t}\n\n\t\t\telse if (checkWins('X') == 0 && checkWins('0') == 0)\n\t\t\t{\n\t\t\t\tif (nx > n0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"second \\n\");\n\n\t\t\t\t}\n\n\t\t\t\telse if (nx==n0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"first \\n\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\telse if (nd == 0)\n\t\t\t{\n\t\t\t\tprintf(\"draw \\n\");\n\t\t\t}\n\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"illegal \\n\");\n\t\t\t}\n\n\t\t\t\n\t\t}\n\n\n\t}\n\telse\n\t{\n\t\tprintf(\"illegal \\n\");\n\t}\n\n\t\n\n\n\n\t//getch();\n\n\n\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "011bdf0c20609e3954d50968136fd7d3", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main() {\n short int numx,num0,dot,rowx,row0,bufx,buf0;\n numx = num0 = dot = rowx = row0 = bufx = buf0 = 0;\n char mat[3][3];\n char tt;\n for (int i = 0; i < 3; i++ )\n {\n scanf(\"%s\", mat[i]);\n }\n \n for (int i = 0; i < 3; i++)\n {\n for(int j = 0; j < 3; j++ )\n {\n if (mat[i][j] == 'X')\n numx++;\n else if (mat[i][j] == '0')\n num0++;\n else\n dot++;\n }\n }\n if (numx - 1 > num0 || num0 > numx)\n printf(\"illegal\");\n else \n { \n for(int i = 0; i < 3; i++ )\n {\n for(int j = 0; j < 3; j++ )\n {\n if (mat[i][j] == 'X')\n bufx++;\n if (mat[i][j] == '0')\n buf0++;\n }\n if (bufx == 3)\n rowx++;\n if (buf0 == 3)\n row0++;\n bufx = buf0 = 0;\n }\n for(int j = 0; j < 3; j++ )\n {\n for(int i = 0; i < 3; i++ )\n {\n if (mat[i][j] == 'X')\n bufx++;\n if (mat[i][j] == '0')\n buf0++;\n }\n if (bufx == 3)\n rowx++;\n if (buf0 == 3)\n row0++;\n bufx = buf0 = 0;\n }\n if ((mat[0][0] == 'X' && mat[1][1] == 'X' && mat[2][2] == 'X') || (mat[0][2] == 'X' && mat[1][1] == 'X' && mat[2][0] == 'X'))\n rowx++;\n if ((mat[0][0] == '0' && mat[1][1] == '0' && mat[2][2] == '0') || (mat[0][2] == '0' && mat[1][1] == '0' && mat[2][0] == '0'))\n row0++;\n \n if ((rowx > 0 ) && (numx == num0))\n {\n printf(\"illegal\");\n } \n else if ((row0 > 0 ) && (numx - 1 == num0)) \n {\n printf(\"illegal\");\n } \n else if (dot == 0) \n {\n if(rowx)\n {\n printf(\"the first player won\");\n }\n else if (row0)\n {\n printf(\"the second player won\");\n }\n else\n {\n printf(\"draw\");\n }\n }\n else \n {\n if (rowx)\n {\n printf(\"the first player won\");\n }\n else if (row0)\n {\n printf(\"the second player won\");\n }\n else if (numx == num0)\n {\n printf(\"first\");\n }\n else\n {\n printf(\"second\");\n }\n }\n } ", "lang_cluster": "C", "compilation_error": true, "code_uid": "cf903111d22f83bf61911b2d81496c5e", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main ()\n{\n char row1[3];\n char row2[3];\n char row3[3];\n int i,x_count=0,o_count=0;\n for(i=0;i<3;i++)\n {\n scanf(\"%c\",&row1[i]);\n if(row1[i]=='X')\n {\n x_count++;\n }\n if(row1[i]=='0')\n {\n o_count++;\n }\n }\n scanf(\"\\n\");\n for(i=0;i<3;i++)\n {\n scanf(\"%c\",&row2[i]);\n if(row2[i]=='X')\n {\n x_count++;\n }\n if(row2[i]=='0')\n {\n o_count++;\n }\n }\n scanf(\"\\n\");\n for(i=0;i<3;i++)\n {\n scanf(\"%c\",&row3[i]);\n if(row3[i]=='X')\n {\n x_count++;\n }\n if(row3[i]=='0')\n {\n o_count++;\n }\n }\n if((fabs(x_count-o_count)>1)||x_count>5||o_count>4)\n {\n printf(\"illegal\");\n return ;\n }\n else{\n if(((row1[0]=='X'&&row1[1]=='X'&&row1[2]=='X')||(row2[0]=='X'&&row2[1]=='X'&&row2[2]=='X')||(row3[0]=='X'&&row3[1]=='X'&&row3[2]=='X')||(row1[0]=='X'&&row2[1]=='X'&&row3[2]=='X')||(row1[2]=='X'&&row2[1]=='X'&&row3[0]=='X'))&&(x_count>o_count))\n {\n printf(\"the first player won\");\n return;\n }\n else if(((row1[0]=='X'&&row1[1]=='X'&&row1[2]=='X')||(row2[0]=='X'&&row2[1]=='X'&&row2[2]=='X')||(row3[0]=='X'&&row3[1]=='X'&&row3[2]=='X')||(row1[0]=='X'&&row2[1]=='X'&&row3[2]=='X')||(row1[2]=='X'&&row2[1]=='X'&&row3[0]=='X'))&&(o_count>=x_count))\n {\n printf(\"illegal\");\n return;\n }\n else if(((row1[0]=='0'&&row1[1]=='0'&&row1[2]=='0')||(row2[0]=='0'&&row2[1]=='0'&&row2[2]=='0')||(row3[0]=='0'&&row3[1]=='0'&&row3[2]=='0')||(row1[0]=='0'&&row2[1]=='0'&&row3[2]=='0')||(row1[2]=='0'&&row2[1]=='0'&&row3[0]=='0'))&&(o_count>x_count))\n {\n printf(\"the second player won\");\n return;\n }\n else if(((row1[0]=='0'&&row1[1]=='0'&&row1[2]=='0')||(row2[0]=='0'&&row2[1]=='0'&&row2[2]=='0')||(row3[0]=='0'&&row3[1]=='0'&&row3[2]=='0')||(row1[0]=='0'&&row2[1]=='0'&&row3[2]=='0')||(row1[2]=='0'&&row2[1]=='0'&&row3[0]=='0'))&&(x_count>=o_count))\n {\n printf(\"illegal\");\n return;\n }\n else if(x_count==5&&o_count==4)\n {\n printf(\"draw\");\n return;\n }\n else if(x_count-o_count=1)\n {\n printf(\"second\");\n return;\n }\n else if(x_count==o_count)\n {\n printf(\"first\");\n return;\n }\n }\n \n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cea73ad3af5f65f335193a46aaeffb2e", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nchar a[3][3], b[3][3];\nint win(char p[3][3], int n){\n int ret=0;\n for (int i=0; i<3; i++) {\n int chk=1;\n if (p[i][0]==0) continue;\n for (int j=1; j<3; j++) if(p[i][0]!=p[i][j]) chk=0;\n if (chk) ret=1;\n }\n int ret2=0, ret3=0;\n char c='0';\n if (n) c=0;\n if (p[0][0]!=c && p[0][0]!=0 && p[0][0] == p[1][1] && p[0][0]==p[2][2]) ret2=1;\n if (p[0][2]!=c p[0][2]!=0 && p[0][2] == p[1][1] && p[0][2]==p[2][0]) ret3=1;\n return ( ret || ret2 || ret3);\n}\n\nint main(){\n\n for (int i=0; i<3; i++) scanf(\"%s\", a[i]);\n\n int p1=0, p2=0;\n for (int i=0; i<3; i++){\n for (int j=0; j<3; j++){\n if (a[i][j]=='X') p1++;\n else if (a[i][j]=='0') b[i][j]='0', p2++;\n }\n }\n\n if (p2>p1) printf(\"illegal\\n\");\n else if (win(a, 0) || win(b, 1)){\n if (win(a, 0)){\n if (p1<=p2) printf(\"illegal\\n\");\n else printf(\"the first player won\\n\");\n }\n else{\n if (p1>p2) printf(\"illegal\\n\");\n else printf(\"the second player won\\n\");\n }\n }\n else{\n if (p1+p2==9) printf(\"draw\\n\");\n else if (p1>p2) printf(\"second\\n\");\n else printf(\"first\\n\");\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e972a46280dbae7c93c00a43adde1e9c", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a,b,c=0;\nscanf(\"%d %d\",&a,&b);\nwhile(a!=0)\n{\tc++;\n\ta=a-1;\n\tif(c%n==0)\n\t\tm=m+1;\n}\nprintf(\"%d\",c);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "76e75e9ad22b154a1b0c0bb46a5713ec", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int n,b,c,a = 0;\n scanf(\"%d %d\",&n,&b);\n int sum;\n sum = n;\n while(true)\n {\n n = n/b;\n sum += n;\n n = n + n%b;\n if(n/b == 1 ){\n sum ++;\n break;\n }\n //if(n/b == 0)break;\n }\n printf(\"%d\\n\",sum);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3f1ec08fb932ee3ef6075c7496d5e71d", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n//code forces- new year candles\nvoid main()\n{\n\tint a,b,c=0,d=0;\n\tclrscr();\n\tscanf(\"%d%d\",&a,&b);\n\tif(b==0||b==1)\n\t{\n\t}\n\telse\n\t{\n\t\twhile(a>0)\n\t\t{\n\t\t\tc=c+a;\n\t\t\ta=a+d;\n\t\t\td=a-(a/b)*b;\n\t\t\ta=a/b;\n\t\t}\n\t\tprintf(\"The candles used are %d\",c);\n\t}\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "38a6c3c31fe6c91a84cfa382b6c4c6a3", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int a,b=0,c=0;\n scanf(\"%d%d\",&a,&b);\n \n {\n while(a!=0)\n { \n a=a--;\n c++;\n b++;\n if(b==5)\n { c++;\n b=0;\n }\n\n printf(\"%d\",c);\n\n }return 0; \n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "507ad74bc47c6f7bddb756026a05cab8", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n unsigned int a,b,n:\n scanf(\"%u%u\",&a,&b);\n if((a>=1)&&(a<=1000))\n {\n if((b>=2)&&(b<=1000))\n {\n if(b%2==0)\n {\n n=a+b;\n printf(\"%d\",n);\n }\n else\n {\n n=a+b-1;\n printf(\"%d\",n);\n }\n }\n else\n {\n printf(\"b is not valid\");\n }\n else\n {\n printf(\"a is not valid\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cca26bc7e48d30b5ccde6891af580577", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n \n while(true)\n {\n int k=1;\n a = a - k;\n if(a < 0)\n {\n printf(\"Vladik\");\n break;\n }\n k++;\n b = b - k;\n if(b < 0)\n {\n printf(\"Valera\");\n break;\n }\n k++;\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b1fbebd7a90a448cce69f015200cf6ed", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include\n\nint main()\n{\n long a,b;\n scanf(\"%ld %ld\",&a,&b);\n int ans=sqrt(a);\n if(b>=k*k+k)\n printf(\"Vladic\");\n else\n printf(\"Valera\");\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4110c3a707bff668de5a56250f38d888", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n \nint main()\n{\n int a=0,b=0;\n int flag = 0;\n \n scanf(\"%d%d\",&a,&b);\n \n while(1)\n {\n math1 = 1\n a=a-math1;\n if (a <= 0)\n break;\n flag = 1;\n \n math2 = 2;\n b=b-math2;\n if (b <= 0)\n break;\n \n math1 = math1+2;\n math2 = math2+2;\n }\n \n if(flag == 1)\n printf(\"Valera\");\n else\n printf(\"Vladik\");\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a1ec9c6eda86515bcc3907e855f117ce", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int vladik,valera,x=2,y=1;\n char c[10];\n scanf(\"%d %d\",&vladik,&valera);\n while(x>0)\n {\n if(x%2==0)\n vladik-y;\n else\n valera-y;\n x++;\n y++;\n if(vladik==0)\n {\n c=\"Vladik\";\n break;\n }\n else{\n c=\"Valera\";\n break;}\n }\n printf(\"%s\",c);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9244cbe1204583d06c5565428df07e35", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int vladik,valera,x=2,y=1;\n char c[10]=null;\n scanf(\"%d %d\",&vladik,&valera);\n while(x>0)\n {\n if(x%2==0)\n vladik-y;\n else\n valera-y;\n x++;\n y++;\n c=(vladik==0)? \"Vladik\":\"Valera\";\n if(c!=null)\n break;\n }\n printf(\"%s\",c);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c76f1e48f063fa478a32c29051ba5d89", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#define max 1000000009\n#include\nint main()\n{\n\tlong long int ans=0,wr,num,n,m,k,i,j;\n\tscanf(\"%lld %lld %lld\", &n, &m, &k);\n\tnum = n/k;\n\twr = n-m;\n\tif(wr < num)\n\t{\n\t\tfor(i=0; i= num)\n\t{\n\t\tans = (ans%max + ((k-1)*num)%max)%max;\n\t\tans = (ans%max + (n - num*k)%max)%max;\n\t\tans = (ans - (wr - num))%max;\n\t}\n\tif(ans < 0)\n\t\tans = ans+max;\n\tprintf(\"%lld\\n\", ans%max);\n}\t\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3ad273b4561a46e8cbea15124a9b9334", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define mod 1000000009\nlong long int power(long long int min)\n{\n\tif(min==0)\treturn 1;\n\tif(min==1)\treturn 2;\n\tif(min%2)\treturn (((power(min/2))%mod)*(power((min+1)/2))%mod)%mod;\n\telse\treturn (((power(min/2))%mod)*((power(min/2))%mod))%mod;\n}\nint main()\n{\n\tlong long int n,m,k;\n\tscanf(\"%lld%lld%lld\",&n,&m,&k);\n\tlong long int temp=m;\n\tlong long int min=0;\n\twhile(n)\n\t{\n\t\tif(n>m)\n\t\t{\n\t\t\tif(m>=k-1)\n\t\t\t{\n\t\t\t\tn=n-(k-1);\n\t\t\t\tm=m-(k-1);\n\t\t\t}\n\t\t\tn--;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmin=n/k;\n\t\t\tbreak;\n\t\t}\n\t}\n//\tprintf(\"%lld\\n\",min);\n\tlong long int score;\n\tscore=((power(min+1))%mod-2)%mod;\n\tscore=(score*k)%mod;\n//\tprintf(\"%lld\\n\",score);\n//\tprintf(\"%lld\\n\",min);\n\tscore = (score+temp-((min*k)%mod))%mod;\n\tscore=(score+mod)%mod;\n\tprintf(\"%lld\\n\",score);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d25730402bc2f13f23eadf9bb2b273cf", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define MOD 1000000009\n\nint sqr(long long int x, int n)\n{\n\tif(n==0)\n\t\treturn 1;\n\telse if(n==1)\n\t\treturn x;\n\telse if(n%2==0)\n\t\treturn sqr( (x*x)%MOD, n/2 ) % MOD;\n\telse\n\t\treturn (x * sqr( (x*x)%MOD, (n-1)/2 )) % MOD;\n}\n\nint main()\n{\n\tint n, m, k;\n\tscanf(\"%d %d %d\", &n, &m, &k);\n\tint x, y, z;\n\tz = n%k;\n\ty = n/k;\n\tx = m - y*(k-1) - z;\n\ty -= x;\n\tlong long int ans;\n\tint i;\n\tans = sqr(2, x+1);\n\tans -= 2;\n\tk %= MOD;\n\tans *= k;\n\tans %= MOD;\n\tans += y*(k-1);\n\tans %= MOD;\n\tans += z;\n\tans %= MOD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4ca19f39d47ec02998a7e3100883de53", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define p 1000000009 \nlong long int powe(long long int,long long int);\nint main()\n{\n\tlong long int n,m,k,x,minscore;\n\tscanf(\"%lld %lld %lld\",&n,&m,&k);\n\tx=m-((k-1)*(n/k)+n%k);\n//\tprintf(\"%lld\\n\",x);\n\tminscore= (( ( powe(2,x+1)-2)*k)%p +m-x*k)%p;\n//\tprintf(\"%lld\\n\",powe(2,x));\n\tprintf(\"%lld\\n\",minscore);\n}\nlong long int powe(long long int m,long long int n)\n{\n\tif(n==0)\n\t{\n\t\treturn 1;\n\t}\n\tif(n==1)\n\t{\n\t\treturn m;\n\t}\n\tif(n%2==0)\n\t{\n\t\treturn(powe((m*m)%p,n/2)%p);\n\t}\n\telse\n\t{\n\t\treturn((powe((m*m)%p,n/2)*m)%p);\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dd22a647f8f6bbca93d7420962aabc29", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define NUM 1000000009\n\n\nint minx(int n, int m, int k)\n{\n int q = n/k;\n return m - q*(k-1) - n%k;\n\n}\n\nlong long int power(int n, int m)\n{\n if(m == 0)\n return 1;\n else\n {\n if(m % 2 == 0)\n\treturn (power(n,m/2)*power(n,m/2)) % NUM;\n else \n\treturn (power(n,m-1)*n) % NUM;\n }\n\n}\n\nlong long int score(int x, int m, int k)\n{\n return ((power(2,x+1)-2)*k + m -x*k) ;\n\n}\nint main()\n{\n int n,m,k;\n scanf(\"%i %i %i\",&n,&m,&k);\n int x = minx(n,m,k); \n long long int result = score(x,m,k);\n printf(\"%lli\",result % NUM);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "de3cc2c546976702b8c0d600472ca3fa", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "}#include\nint p[200];\nint main()\n{\n int n,temp=0,t=0,i,m=0,c=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i0)\n {\n c=1;\n t++;\n if(i==n-1)\n {\n p[m]=t+1;\n m++;\n }\n }\n else\n {\n if(c==1){\n p[m]=t+1;\n t=0;\n c=0;\n m++;\n }\n }\n }\n if(n>1){\n if(m>1)\n {\n for(i=0;ip[i+1]?p[i]:p[i+1];\n p[i+1]=temp;\n }\n printf(\"%d\",temp-2);\n }\n else if(m==1)\n {\n if(p[0]==n&&(arr[n-1]==1000||arr[0]==1))\n printf(\"%d\",p[0]-1);\n else\n {if(p[0]>=2)\n printf(\"%d\",p[0]-2);\n else\n printf(\"0\");\n }\n }\n else\n printf(\"0\");\n }\n else\n printf(\"0\");\n /*printf(\"%d%d\",p[0],m);*/\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8420b1c0983844de8bba5fc88b598393", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#define maxn 102\n\nint max(int a, int b)\n{\n int t;\n if(a<=b)\n t=b;\n else t=a;\n return t;\n}\n\nint main()\n{\n int n, a[maxn], i, nodel=0, curstreak=1, longstreak=1, count=0;\n\n scanf(\"%d\", &n);\n\n for(i=1; i<=n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n if(1000-a[1]==n-1 || a[n]==n)\n nodel=n-1;\n else\n {\n for(i=1; i<=n; i++)\n {\n if(a[i+1]-(i+1)==a[i]-i)\n curstreak++;\n else\n {\n longstreak = max(longstreak, curstreak);\n curstreak = 1;\n }\n if(a[1]==1&&a[2]=!a[1]+1)\n nodel=max(longstreak, curstreak)-1;\n else\n nodel=max(longstreak, curstreak)-2;\n }\n }\n \n printf(\"%d\", nodel);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "848df50fc88e5035a7c5e5d4f8e7f355", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n, x, y, t, c;\n int a[101];\n int s[100]={};\n scanf(\"%d\", &n);\n for(x=1;x<=n;x++)\n {\n scanf(\"%d\", &a[x]);\n }\n t=1;\n a[0]=0;\n a[n+1]=1001;\n for(x=1;x<=n;x++)\n {\n if(a[x+1]==a[x]+1)\n {\n s[t]=s[t]+1;\n }\n else if(a[x+1]>a[x]+1)\n {\n t=t+1;\n }\n }\n for(x=n;x>0;x--)\n {\n for(y=x+1;y<=n;y++)\n {\n if(s[x]\n\nint arr[1010];\n\nint main() {\n\tint m, n, i, j;\n\tscanf(\"%d\", &n);\n\tfor (i = 1; i <= n; i++) scanf(\"%d\", &arr[i]);\n\tint maxn = 0;\n\tint cur = 0;\n\tarr[0] = 0, arr[n + 1] = 1001;\n\tn++;\n\tcur = 1;\n\tfor (i = 1; i <= n; i++) {\n\t\tif (arr[i] == arr[i - 1] + 1) cur++;\n\t\telse {\n\t\t\tcur = 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (maxn < cur) maxn = cur;\n\t}\n\tmaxn -= 2;\n\tprintf(\"%d\\n\", std::max(0, maxn));\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "625c8ce0a4a636e1f929ed2258ba101f", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "\n#include\nint main()\n{\n int n,a[1005];\n scanf(\"%d\",&n);\n for(int i=0;i\n#include\nint main()\n{\n double n;\n scanf(\"%lf\"\uff0c&n);\n printf(\"%d\",(int)sqrt(n));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "428f8b9c9df06d71695791fb219d4929", "src_uid": "c50b6af99ca7b9c35628b52774d6c32b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \nint a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2};\nint n;\nint main() {\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", a[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ea6598e5af2a4395c3f2d5400bc61ce", "src_uid": "c50b6af99ca7b9c35628b52774d6c32b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\nint n,a[105]={0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2,1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5,1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10,1,4,2};//\u5e8f\u5217\nint main()\n{\n scanf(\"%d\",&n);\n printf(\"%d\",a[n]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8b0e1e787624cf1fbe7d86d485b71c98", "src_uid": "c50b6af99ca7b9c35628b52774d6c32b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\nconst int a[]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2};//\u5e38\u91cf\u6570\u7ec4\u53ef\u4ee5\u81ea\u52a8\u6d4b\u7b97\u5927\u5c0f\nint main(){\n short x;\n scanf(\"%d\", &x);\n printf(\"%d\", a[x]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "05ed980834f91113ee7524f46e9ae884", "src_uid": "c50b6af99ca7b9c35628b52774d6c32b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int a[100]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, \n 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1\n , 4, 1, 51, 1, 2\n , 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2\n , 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267,\n 1, 4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15,\n 2, 1, 15, 1, 2, 1, 12, 1, 10, 1, 4, 2}\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",a[n]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0a47b589f145b681de4069c5b5586fca", "src_uid": "c50b6af99ca7b9c35628b52774d6c32b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(void) {\n int64_t n, m;\n scanf(\"%I64d%I64d\", &n, &m);\n if(m > n) {\n printf(\"%I64d\", n);\n return 0;\n }\n n -= m;\n for(int64_t l = 0, r = 2e9; l < r; (l + r) / 2 >= (l + r) * (l + r + 2) / 8 ? r = (l + r) / 2 : l = (l + r) / 2 + 1);\n printf(\"%I64d\", l + m);\n return 0; \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e3ce18993bbf0d66b1d31158826b4cd", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define MAX 2000000000\n//1000000000000000000\nusing namespace std;\n\n\nint main()\n{\n\tlong long N, M, i, st = 1, ed = MAX,k =0; \n\tscanf(\"%lld%lld\", &N, &M);\n\n\tif (M > N) M = N;\n\t\n\tlong long ans =0, X= (N-M)*2;\n\n\tfor (;;) {\n\t\tif (st >= ed) break;\n\t\ti = (st + ed) / 2;\n\n\t\tif (i*i + i >= X) {\n\t\t\ted = i;\n\t\t\tk = i;\n\t\t}\n\t\telse {\n\t\t\tst = i + 1;\n\t\t}\n\t}\n\n\tans = M + k;\n\n\tprintf(\"%lld\\n\", ans);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ff786beceea22c89c966bd43e1908e35", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(void) {\n int64_t n, m;\n scanf(\"%I64d%I64d\", &n, &m);\n if(m > n) {\n printf(\"%I64d\", n);\n return 0;\n }\n n -= m;\n for(int64_t l = 0, r = 2e9; l < r; (l + r) / 2 >= (l + r) * (l + r + 2) / 8 : r = (l + r) / 2 : l = (l + r) / 2 + 1);\n printf(\"%I64d\", l + m);\n return 0; \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f41a30890e5528dd51a24cb35635fc56", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n long long a,b;\n while (~scanf (\"%I64d%I64d\",&a,&b)){\n long long sum = a;\n long long i;\n for (i=b;;i++){\n sum=(sum+=b)>a?a:sum;\n if ((sum-=i)<=0) break;\n }\n printf(\"%I64d\\n\",i);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f9bcc0b019e401d35fd5f7961c7846f3", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#ifdef TEST\n#include \n#endif\n\nint main() {\n long long n, m;\n scanf(\"%I64d %I64d\", &n, &m);\n if (m >= n)\n goto LOL_KEK;\n#ifdef TEST\n clock_t cl = clock();\n#endif\n long long i = m + 1;\n n -= i;\n while (n > 0)\n n += (m - (++i));\n printf(\"%I64d\\n\", i);\n#ifdef TEST\n printf(\"%lf\\n\", (double)(clock() - cl) / CLOCKS_PER_SEC);\n#endif\n return 0;\nLOL_KEK:\n printf(\"%I64d\\n\", n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "30e79320af459f81ff34697aaf56848a", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int s[3];\n int i=0,n=0,t=0;\n for(;i<3;i++)\n {scanf(\"%i\",&s[i]);\n n=n+s[i];}\n i=0;\n while(n>0)\n {\n if(s[i]>2)\n {s[i]=s[i]-2;\n n=n-2;}\n else\n {s[i]=s[i]-s[i];\n n=n-s[i];}\n t++;\n i++;\n i=i%3;\n }\n prinf(\"%i\",t+30);\n return 0;\n}\n \n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc5d8d0a31994d658fe7117b211f06d1", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int s[3];\n int i=o,n=0,t=0;\n for(;i<3;i++)\n {scanf(\"%i\",&s[i]);\n n=n+s[i];}\n i=0;\n while(n>0)\n {\n if(s[i]>2)\n {s[i]=s[i]-2;\n n=n-2;}\n else\n {s[i]=s[i]-s[i];\n n=n-s[i];}\n t++;\n i++;\n i=i%3;\n }\n prinf(\"%i\",t+30);\n return 0;\n}\n \n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "d7aed14d2ccf22ec9a5bef11b50550f8", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int a,b,c,p,q,r,i=0,j=0,k=0,t;\n scanf(\"%d%d%d\",&a,&b,&c);\n \n \n \n if(a >= b && a >= c)\n {\n for(p=a;p >2;p=p-2)\n j++;\n t=30 + (j*3);\n }\n if((b >= c && b >= a) || ((a-b)==1 && b>2))\n {\n for(p=b;p >2;p=p-2)\n k++;\n t=31 + (k*3);\n }\n if((c >= a && c >= b) || ((a-c)==1 && c>2) || ((b-c)==1 && c>2))\n {\n for(p=c;p >2;p=p-2)\n i++;\n t=32 + (i*3);\n }\n printf(\"%d\",t);\n}\n \n for(b=b;b!=2 || b!=1;b=b-2)\n {\n \n k++;\n \n }\n t=31+k*2;\n }\n if((c>=a && c>=b) ||((a-c)==1 && c>2) || ((b-c)==1 && c>2))\n {\n for(c=c;c!=2 || c!=1;c=c-2)\n {\n l++;\n \n }\n t=32+l*2;\n }\n printf(\"%d\",t);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1e670c3b500bea81e3eee595681e0ca7", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int s[3],i=0,n=0,t=0;\n for(;i<3;i++)\n {scanf(\"%i\",&s[i]);n=n+s[i];}\n i=0;\n while(n>0)\n { if(s[i]>2)\n { s[i]=s[i]-2;\n n=n-2;\n }\n else\n {s[i]=s[i]-s[i];\n n=n-s[i];}\n i=i+1;\n i=i%3;\n t++;\n }\n printf(\"%i\",t+30);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b689b6dc6146e49e3fbbdf0dcb5f8445", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int s[3],i=0,n=0,t=0;\n for(;i<3;i++)\n {scanf(\"%i\",&s[i]);n=n+s[i];}\n i=0;\n while(n>0)\n { if(s[i]>=2)\n { s[i]=s[i]-2;\n n=n-2;\n }\n else\n {s[i]=s[i]-s[i];\n n=n-s[i];}\n i=i+1;\n i=i%3;\n t++;\n }\n printf(\"%i\",t+30);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fbbe5baab6d8d531e578c811df676dcc", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nvoid quicksort(double number[],long long int first,long long int last,double a[],double c[]){\n long long int i, j, pivot;\n double temp;\n\n if(firstnumber[pivot])\n j--;\n if(i s + (l/((long long int)a[i]) + 1)*((long long int)c[i]))\n\t\t\tmin= s+(l/((long long int)a[i]) + 1)*((long long int)c[i]); \n\t\ts=s+(l/((long long int)a[i]))*((long long int)c[i]);\n\t\tl=l%((long long int)a[i]);\n\t}\n\tif(min>s)\n\t\tprintf(\"%lld\",s);\n\telse\n\t\tprintf(\"%lld\",min);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a5cf3bd44c6c7511cfe0ab64fc477c18", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main(int argc, char const *argv[]) {\n\tint n, L;\n\tscanf(\"%d %d\", &n, &L);\n\n\tint costs[n + 1], c, last = 0;\n\tint i;\n\n\tscanf(\"\\n%d\", &c);\n\tlast = (costs[0] = c) << 1;\n\n\tfor(i = 1; i < n; i++) {\n\t\tscanf(\" %d\", &c);\n\t\tlast = (costs[i] = c < last ? c : last) << 1;\n\t}\n\tcosts[n] = last;\n\n\tlast >>= 1;\n\tfor(i = n - 2; i >= 0; i--) {\n\t\tif(costs[i] > last)\n\t\t\tcosts[i] = last;\n\t\telse\n\t\t\tlast = costs[i];\n\t}\n\n\tlong long sum = 0;\n\tfor(i = 0; L && i < n;) {\n\t\tif(L & 1)\n\t\t\tsum += costs[i];\n\t\tif(costs[++i] < sum)\n\t\t\tsum = costs[i];\n\t\tL >>= 1;\n\t}\n\n\tsum += (long long)costs[n] * L;\n\n\tprintf(\"%lld\\n\", sum);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "303d66c5f49bf8241374f3c636124e5a", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n__int64 s[100];\nint b[100];\nint main()\n{\n\tint n;\n\t__int64 l,ans,c,d;\n\tint i,j,k;\n\tscanf(\"%d%I64d\",&n,&l);\n\tb[0]=l%2;\n\t//printf(\"%d\",b[0]);\n\tfor(i=1;l/2!=0;i++)\n\t{\n\t\tl=l/2;\n\t\tb[i]=l%2;\n\t\t//printf(\"%d\",b[i]);\n\t}\n\tfor(j=0;j=2*s[j-1])\n\t\ts[j]=2*s[j-1];\n\t //printf(\"%dj%I64d\\n\",j,s[j]);\n\t}\n\tk=0;\n\tc=s[i-1]+100;\n\tans=0;\n\t//printf(\"%d\\n\",i);\n\tfor(j=0;js[j])\n\t\tans=s[j];\n\t\tans=ans+s[j]*b[j];\n\t}\t\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7b3bfaf20e0dfeacdc3f45063f8ababc", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \ntypedef long long int lld;\nint power_2(int a){\n\tint sum=1;\n\tfor (int i = 0; i < a; ++i)\n\t\tsum*=2;\n\treturn sum;\n}\nint cmpfunc(const void *a,const void *b){\n\tlld diff=(*((lld *)a+2))-(*((lld *)b+2));\n\t// printf(\"%lld - %lld is %lld\\n\",(*((lld *)a)),(*((lld *)b)),diff);\n\tif (diff>0){\n\t\t// printf(\"change\\n\");\n\t\treturn 1;\n\t}\n\t// printf(\"NO change\\n\");\n\treturn -1;\n}\nlld get_price(lld price[30][3],int N,int L,int nowN,lld total){\t\n\t// printf(\"in,%d,%lld,%d\\n\",nowN,total,L);\n\tif (L==0)\n\t\treturn total;\n\tif (price[nowN][1]b?b:a);\n}\n\nint main(int argc, char const *argv[])\n{\n\tint N,L;\n\tscanf(\"%d%d\",&N,&L);\n\tlld price[30][3];//0 price 1 litter 2 is cp\n\tfor (int i = 0; i < N; ++i)\n\t{\n\t\tscanf(\"%lld\",&price[i][0]);\n\t\tprice[i][1]=power_2(i);\n\t\tprice[i][2]=price[i][0]<<(30-i);\n\t\t// printf(\"%lld\\n\",price[i][2] );\n\t}//store\n\tqsort(price,N,3*sizeof(lld),cmpfunc);\n\t// for (int i = 0; i < N; ++i)\n\t\t// printf(\"%lld,%lld,%lld\\n\",price[i][0],price[i][1],price[i][2] );\n\tprintf(\"%lld\",get_price(price,N,L,0,0));\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4f4ea12b700d79f21274a0d32344fe3c", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n while(1)\n {\n int n,L;\n scanf(\"%d %d\",&n,&L);\n float cost[n][3],div=1;\n int i,j;\n for(i=0;icurrent)\n {\n index=j;\n min=cost[j][1];\n }\n }\n sort[i][0]=cost[index][0];\n sort[i][1]=cost[index][2];\n current=cost[index][1];\n cost[index][1]=1100000000;\n }\n /*for(i=0;i0)\n {\n finish[i]=pay+(long long int)sort[i][0];\n }\n else\n {\n finish[i]=pay;\n }\n //printf(\"%lld\\n\",finish[i]);\n }\n long long int min=finish[0];\n for(i=0;i\n#include \nchar arr[500]\nint main(void)\n{\n arr={'0'};\n scanf(\"%s\",arr);\n int a=0,b=0,c=0,d=0;\n for(int i=0;;i++)\n {\n if(c==0)\n {\n if(arr[i]!='+')\n a++;\n else\n c=1;\n }\n else if(c==1)\n {\n if(arr[i]!='=')\n b++;\n else\n c=2;\n }\n else\n {\n if(arr[i]!='0')\n d++;\n else\n break;\n }\n }\n if(((a+b)-d)==2)\n {\n a--;\n d++;\n }\n else if(((a+b)-d)==-2)\n {\n a++;\n d--;\n }\n else\n {\n a=-1;\n }\n \n if(a==-1)\n printf(\"Impossible\");\n else\n {\n for(int j=1;j<=a;j++)\n printf(\"|\");\n printf(\"+\");\n for(int j=1;j<=b;j++)\n printf(\"|\");\n printf(\"=\");\n for(int j=1;j<=d;j++)\n printf(\"|\");\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0ff0751b73dfb296dd4305d03c708d41", "src_uid": "ee0aaa7acf127e9f3a9edafc58f4e2d6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\nvoid display(long long int ,long long int ,long long int );\nint main(){\n long long int a,b,c;\n int fp,fe;\n fp=fe=a=b=c=0;\n while(1){\n char ch;\n scanf(\"%c\",&ch);\n\n if(ch=='+') fp=1;\n else if(ch=='=') fe=1;\n else if(ch=='|')\n {\n if(fp && fe) c++;\n else if(fp) b++;\n else a++;\n }\n else if(ch=='\\n') break;\n }\n if(fabs(a+b-c)!=2 && a+b!=c){\n printf(\"Impossible\");\n }\n else if(a+b-c==0){\n display(a,b,c);\n\n }\n else {\n if(a+b>c){\n if(a!=1)\n display(a-1,b,c+1);\n else \n display(a,b-1,c);\n\n else display(a+1,b,c-1);\n \n }\n return 0;\n}\nvoid display(long long int a,long long int b,long long int c){\n while(a+b+c+2){\n if(a>0){\n printf(\"|\");\n a--;\n\n }\n else if(a==0){\n printf(\"+\"); \n a--;\n }\n else if(b>0){\n printf(\"|\");\n b--;\n }\n else if(b==0){\n printf(\"=\");\n b--;\n }\n else if(c){\n printf(\"|\");\n c--;\n }\n \n }\n printf(\"\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dc0e92482ff50302b420fbc6c834318f", "src_uid": "ee0aaa7acf127e9f3a9edafc58f4e2d6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \nchar arr[500];\nint main(void)\n{\n arr={'0'};\n scanf(\"%s\",arr);\n int a=0,b=0,c=0,d=0;\n for(int i=0;;i++)\n {\n if(c==0)\n {\n if(arr[i]!='+')\n a++;\n else\n c=1;\n }\n else if(c==1)\n {\n if(arr[i]!='=')\n b++;\n else\n c=2;\n }\n else\n {\n if(arr[i]!='0')\n d++;\n else\n break;\n }\n }\n if(((a+b)-d)==2)\n {\n a--;\n d++;\n }\n else if(((a+b)-d)==-2)\n {\n a++;\n d--;\n }\n else\n {\n a=-1;\n }\n \n if(a==-1)\n printf(\"Impossible\");\n else\n {\n for(int j=1;j<=a;j++)\n printf(\"|\");\n printf(\"+\");\n for(int j=1;j<=b;j++)\n printf(\"|\");\n printf(\"=\");\n for(int j=1;j<=d;j++)\n printf(\"|\");\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8f83b98db49418cdc10f81ee873e012e", "src_uid": "ee0aaa7acf127e9f3a9edafc58f4e2d6", "difficulty": null} {"lang": "GNU C11", "source_code": "void print_sticks(int number) {\n for(int i=0;i1) {\n print_sticks(a+1);\n printf(\"+\");\n print_sticks(b);\n printf(\"=\");\n print_sticks(c-1);\n } else if(difference==0) {\n print_sticks(a);\n printf(\"+\");\n print_sticks(b);\n printf(\"=\");\n print_sticks(c);\n } else if(difference==2&&a>1)) {\n print_sticks(a-1);\n printf(\"+\");\n print_sticks(b);\n printf(\"=\");\n print_sticks(c+1);\n } else if(difference==2&&b>1)) {\n print_sticks(a);\n printf(\"+\");\n print_sticks(b-1);\n printf(\"=\");\n print_sticks(c+1);\n }else {\n printf(\"Impossible\");\n }\n\n \n\n\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8567e6522bc3236b36909b6a166cff8b", "src_uid": "ee0aaa7acf127e9f3a9edafc58f4e2d6", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int i=0,l=0,r=0,s=0,k=0;\n char c[120];\n scanf(\"%s\",&c);\n printf(\"\\n\");\n for(i=0;;i++)\n {\n if(c[i]=='+'){break;}\n l++;\n \n }\n for(i=l+1;;i++)\n {\n if(c[i]=='='){break;}\n r++;\n }\n s=strlen(c)-l-r-2;\n if(l+r==s){printf(\"%s\",c);}\n else{\n if((l+1)+r==(s-1)){ l=l+1;s=s-1;k=1;\n break; }\n else if((l-1)+r==(s+1)){ l=l-1;s=s+1;k=1;\n break; }\n else if(l+(r+1)==(s-1)){ r=r+1;s=s-1;k=1;\n break; }\n else if(l+(r-1)==(s+1)){ r=r-1;s=s+1;k=1;\n break; }\n \n }\n if(k=1){\n for(i=0;i\nint main()\n{\n int a,b,c,s,q,d,p;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n s=(b+d-1)/d;\n p=c/a;\n q=(s+(a-1))/(a);\n if(p>=q)\n s=q;\n else\n {\n s=s-(p*(a-1));\n q=s-p;\n if(q>c%a+1)\n s=s-c%a;\n\n }\n printf(\"%d\",s);\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ebc82caf001c7743ddca472a6c4f88ef", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int k, a, b, v, secRequired, ans = 0, temp;\n scanf(\"%d%d%d%d\", &k, &a, &b, &v);\n // secRequired = ceil(1.0*a/v);\n while(a>=0)\n {\n temp = k-1;\n ans++;\n a-=v;\n\n while(temp>0 && b>0)\n {\n a-=v;\n temp--;\n b--;\n }\n }\n printf(\"%d\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8d86599e7bd1b24866a3cd615fec6ccb", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int k,a,b,v;\n scanf(\"%d %d %d %d\",&k,&a,&b,&v);\n int x=0;\n while(a>0)\n {\n if(k>b)\n {\n a=a-(v*(b+1));\n b=0;\n }\n else\n {\n a=a-(k*v);\n b=b-(k-1);\n }\n x++; \n }\n printf(\"%d\\n\",x);\n getch();\n return 0;\n} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "9302ab9cec651faaaef9a9ea085c9b16", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int k,a,b,v,s=0,e=0,m=0,l=0,h=0,i;\n scanf(\"%d %d %d %d\",&k,&a,&b,&v);\n if(b+1>k&&a>0)\n {\n l=b/(k-1);\n h=b%(k-1);\n for(i=1; i<=l; i++)\n if(a-(i*v*k)>=k*v&&a-(i+1)*v*k0&&a>0)\n {\n a-=(h+1)*v;\n m++;\n }\n }\n else if(b+10)\n {\n a-=(b+1)*v;\n m++;\n }\n if(a>0)\n {\n e=a%v;\n s=a/v;\n m+=s;\n }\n if(e>0)\n m++;\n printf(\"%d\\n\",m);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8742b400589cab4fc728cc86651ae46b", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/contest/402/submission/26668054 (Dukkha) */\n#include \n\u00a0\nint main() {\n\tint k, a, b, v, n, x, r, m, ans;\n\u00a0\n\tscanf(\"%d%d%d%d\", &k, &a, &b, &v);\n\tn = (a + v - 1) / v;\n\tx = b / (k - 1);\n\tr = b % (k - 1);\n\tm = x * k + r + 1;\n\tif (n <= x * k)\n\t\tans = (n + k - 1) / k;\n\telse if (n <= m)\n\t\tans = x + 1;\n\telse\n\t\tans = x + (r > 0 ? 1 + n - m : n - x * k);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9efaeb8a6c4a7dd4a5b7d5f9dbc95f04", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nint flag=0;\nint check3(int b[],int j,int n,int val)\n{\n\tint i,count=0;\n\tfor(i=j+2;i<=n-1;i++)\n\t{\n\t\tif(b[i]!=val)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tcount++;\n\t}\n\t//printf(\"count: %d\\n\",count );\n\treturn count+3;\n}\nint finalcheck(int b[],int n,int temp[])\n{\n\t//printf(\"n: %d\\n\",n );\n\t\n\tint j=0,c=1,k,i,count=0;\n\tflag=0;\n\t/*printf(\"ARRAY TEMP INITIAL\\n\");\n\tfor(i=0;i=3 && i==j-1)\n\t\t{\n\t\t\ttemp[count++]=b[i+k];\n\t\t\ti+=k;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//printf(\"count: %d\\n\",count );\n\t\t\ttemp[count++]=b[i];\n\t\t}\n\t\ti++;\n\t}\n\t/*printf(\"ARRAY TEMP AFTER\\n\");\n\tfor(i=0;i\n#include \n#include \n#include \n#include \n#include \n\nint ball[128], tmp[128], pre[128], next[128], n, ans;\nvoid merge(int k, int c)\n{\n\tint cnt=-1, i, pa, pb;\n\t\n\tfor (i=k; i!=-1 && tmp[i]==c; i=pre[i]) {\n\t\tcnt++;\n\t\tpa = i;\n\t}\n\tfor (i=k; i!=n && tmp[i]==c; i=next[i]) {\n\t\tcnt++;\n\t\tpb = i;\n\t}\n\tif (cnt >= 3) {\n\t\tans += cnt;\n\t\tif (pre[pa]!=-1 && next[pb]!=n) {\n\t\t\tnext[pre[pa]] = next[pb];\n\t\t\tpre[next[pb]] = pre[pa];\n\t\t}\n\t\telse if (pre[pa] != -1) {\n\t\t\tnext[pre[pa]] = n;\n\t\t}\n\t\telse if (next[pb] != n) {\n\t\t\tpre[next[pb]] = -1;\n\t\t}\n\t\telse {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (pre[pa] != -1)\n\t\tmerge(pre[pa], tmp[pre[pa]]);\n\telse if (next[pa] != n)\n\t\tmerge(next[pa], tmp[next[pa]]);\n\t\n\treturn;\n}\n\nint main(void)\n{\n\tint k, i, j, max, t;\n\n\tscanf(\"%d%*d%d\", &n, &k);\n\tfor (i=0; i max)\n\t\t\t\tmax = ans;\n\t\t}\n\tif (!max)\n\t\tmax = 1;\n\tprintf(\"%d\\n\", max-1);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7ea86cbe758c1344cf637d324354a8dc", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint Destroy(int *Data, int Len)\n{\n int i, j;\n int Pre = Data[0];\n int Con = 1;\n for(i=1; i 2)\n {\n for(j=i-Con; j 2)\n {\n for(j=i-Con; j0 && Data[i-1]==X)\n {\n Sum = Fun(Data, N, i+1)-1;\n if(Sum > Max)\n {\n Max = Sum;\n }\n }\n }\n printf(\"%d\\n\", Max);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "43e3882c5247317f34ce9a43d0d8c2a7", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nint flag=0;\nint check3(int b[],int j,int n,int val)\n{\n\tint i,count=0;\n\tfor(i=j+2;i<=n-1;i++)\n\t{\n\t\tif(b[i]!=val)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tcount++;\n\t}\n\t//printf(\"count: %d\\n\",count );\n\treturn count+3;\n}\nint finalcheck(int b[],int n,int temp[])\n{\n\t//printf(\"n: %d\\n\",n );\n\t\n\tint j=0,c=1,k,i,count=0;\n\tflag=0;\n\t/*printf(\"ARRAY TEMP INITIAL\\n\");\n\tfor(i=0;i=3 && i==j-1)\n\t\t{\n\t\t\ttemp[count++]=b[i+k];\n\t\t\t//printf(\"i+k: %d\\n\",i+k);\n\t\t\ti+=k;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//printf(\"count: %d\\n\",count );\n\t\t\ttemp[count++]=b[i];\n\t\t}\n\t\ti++;\n\t}\n\t/*printf(\"ARRAY TEMP AFTER\\n\");\n\tfor(i=0;i\nint main()\n{\n\tint n,k,x,i,max=0,start,end;\n\tscanf(\"%d%d%d\",&n,&k,&x);\n\tint A[n],consecutive[n-1],count=0,count2=0,temp,temp2,tempcount;\n\tfor(i=0;i=3)\n\t\t\t\ttempcount=tempcount+count2;\n\n\t\t}\n\t\n\t\tif(tempcount>max)\n\t\t\tmax=tempcount;\n\t}\n\tprintf(\"%d\\n\",max );\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "04d2369dd533e422da8fae30140ebe2f", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0} {"lang": "GNU C", "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;", "lang_cluster": "C", "compilation_error": true, "code_uid": "1c569634858d63d82743ca0999861db1", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "27d56d36b1b654c244fa18842fea3a88", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "GNU C", "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);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "25c1dde2c887e2cf19a15f3b189aae1c", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "541e73664415d442749856157d158177", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "00064ff49e11f4f904a29cea1cebb98c", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0} {"lang": "GNU C11", "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 }\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "d313b8d23a6d1cc02c0afcbafd3d5c53", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\nint a,b,c,d;\nint arr[2500];\nscanf(\"%d\",&a);\nint i;\nfor(i=0;i 15){\n printf(\"%d\",15);\nreturn 0;\n}\ntill+=arr[0];\nfor(i=1;i15){\n printf(\"%d\",till+15);\nreturn 0;\n}\ntill=till+abs(arr[i]-till);\n}\ntill=till+15;\nif(till>90)\n till=90;\nprintf(\"%d\",til);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4b2014c622e9573471d66828ebd83ea1", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint mian (){\n int n,x=0,ans=0,y=0;\n scanf(\"%d\",&n);\n int a [n+2];a[0]=0;a[n+1]=90;\n for (int i=1;i<=n;i++){\n scanf(\"%d\",&a[i]);\n }\n for (int i=0;i<=n;i++){\n x = a[i+1]-a[i];\n if (x>15){\n ans = a[i]+15;break:\n }else if ((x>0)&&(x<=15)){\n y++;\n }\n }if (y==n+1){\n ans=90;\n }\n printf(\"%d\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "71e02bb0b02c55afc8886fb0e7e7510e", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n//#include\nint main()\n{\nint n,i,j,k,s=0,l=0;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;i15) printf(\"15\");\n else printf(\"%d\",a[0]+15);\n }\nelse if(a[0]>15) printf(\"15\");\nelse\n{\n for(i=0;i15) {s=a[i]+15;printf(\"%d\",s);l=1;break;}\n }\nif((90-a[n-1])>15) s=a[n-1]+15;\nif(s==0) s=90;\nif(l===0) printf(\"%d\",s);\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b773d97b1945e23f3da3274d97fd2dd0", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n//#include\nint main()\n{\nint n,i,j,k,s=0;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;i15) printf(\"15\");\nelse\n{\n for(i=0;i15) {s=a[i]+15;break;}\n }\n if(s==0)\n printf(\"90\");;\n else\n printf(\"%d\",s);\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f47a4ba473915728800acb6065bd1008", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int ar[4];\n scanf(\"%d\",&ar[4]);\n for(int i=0;i<4;i++)\n {\n for(int j=i+1;j<3;j++)\n {\n int c=0;\n if(s[i]==s[j])\n {\n c++;\n }\n }\n }\n if(c==1)\n {\n printf(\"1\");\n }\n if(c==2)\n {\n printf(\"2\");\n }\n if(c==3)\n {\n printf(\"3\");\n }\n else\n {\n printf(\"0\");\n }\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bff2ef157d96277caaf4040f326afcb2", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\nint a,b,c,d,e=0;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a==b || a==d){e++; }\n if(b==c || c==a|| b==d){e++; }\n if(c==d || ){e++; }\n printf(\"%d\\n\",e);\nreturn 0 ;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "882d4330e313d03a1a71343b6869d2a3", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a[4],i,j,flag=0;\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n if(a[0]==a[1]&&a[0]==a[2]&&a[0]==a[3]){\n flag=4;\n }\n else if(a[0]==a[1]&&(a[0]==a[2]||a[0]==a[3])){\n flag=3;\n }\n else if(a[0]==a[2]&&a[0]==a[3]){\n flag=3;\n }\n else if(a[1]==a[2]&&a[1]==a[3]){\n flag=3;\n }\n else if(a[1]==a[2]&&a[0]==a[3]){\n flag=3;\n }\n else if(a[0]==a[2]&&a[1]=a[3]){\n flag=3;\n }\n else if(a[0]==a[1]||a[0]==a[2]||a[0]==a[3]){\n flag=2;\n }\n else if(a[1]==a[2]||a[1]==a[3]){\n flag=2;\n }\n else if(a[2]==a[3]){\n flag=2;\n }\n else{\n flag=1;\n }\n printf(\"%d\",flag-1);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5e70ad55b75f72fd87a819bae72d4a8f", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a[4],b,c,g,t=0,d;\n\n for(b=0;b<4;b++)\n scanf(\"%d\",&a[b]);\n for(b=0;b<4;b++)\n {\n for(c=0;c\nint main()\n{\n long long a, b, c, d, result;\n scanf(\"%I64d %I64d %I64d %I64d\", &a, &b, &c, &d);\n if(a==b && a==c && a==d) result=3;\n else if((a==b && a==c) || (b==c && b==d) || (c==d && c==a) || (a==b && a==d)) result=2;\n else if(a==b || a==c || a==d || b==c || b==d || c==d) result=1;\n else if((a==b && c==d) || (a==c && b==d) || (a==d || b==c) result=2;\n else if(a!=b && b!=c && c!=d && a!=c && a!=d && b!=d) result=0;\n printf(\"%I64d\", result);\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0f475f493d1218587f0e20124e16f747", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(void)\n{\n int a,b,c,d,e,total=0;\n scanf(\"%d%d%d%d%d\",&a,&b,&c,&d,&e);\n total=(a+b+c+d+e)%5;\n if (total==0)\n printf(\"%d\",total/5);\n else\n printf(\"-1\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4bda03f44227da68bce407d3c801bcb3", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int sum=0,temp; i;\n for(i=0;i<5;i++){\n scanf(\"%d\",&temp);\n sum+=temp; \n }\n if(sum%5==0)\n printf(\"%d\\n\",sum/5);\n else\n printf(\"-1\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd0423a2809922dce465798e4bc84f18", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "http://codeforces.com/problemset/status", "lang_cluster": "C", "compilation_error": true, "code_uid": "985b3c24a4b55a6bc85f39e83788f66a", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, tot = 0, a;\n for(a=0; a<5; a++)\n {\n scanf(\"%d\", &n);\n tot += n;\n }\n if(tot%5==0)\n printf(\"%d\\n\", tot/5);\n else if(tot==0)\n printyf(\"0\\n\");\n else\n printf(\"-1\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ebf2cfb7d6b72f2dd52132553857182b", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void){\n int c1, c2, c3, c4, c5;\n double b, resto;\n while(scanf(\"%d%d%d%d%d\", &c1, &c2, &c3, &c4, &c5)){\n b = (c1+c2+c3+c4+c5)/5;\n resto = b % 1;\n if(resto != 0){\n prinf(\"-1\");\n }else{\n printf(\"%d\", b);\n }\n }\n return 0;\n}\n// 1459208861082", "lang_cluster": "C", "compilation_error": true, "code_uid": "4558044177427b759d1ea99f3364712d", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "538737a248e2ead007562c1f7c858b7b", "src_uid": "ce0cb995e18501f73e34c76713aec182", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int i,len,flag=1;\n char strx[101],stry[101];\n scanf(\"%s\",strx);\n scanf(\"%s\",stry);\n len=strlen(strx);\n for(i=0;i\n#include \n\nint main() {\n char a[150], b[150], c[150];\n int flag = 1;\n\n scanf(\"%s\", a);\n scanf(\"%s\", b);\n if((strlen(a) - strlen(b)) !=0) {\n printf(\"-1\\n\");\n return 0;\n }\n if( !(strlen(a) >= 1 && strlen(a) <= 100) ) {\n printf(\"-1\\n\");\n return 0;\n }\n\n for(int i = 0; i < strlen(a); i++) {\n if( !(a[i] >= 'a' && a[i] <= 'z') || !(b[i] >= 'a' && b[i] <= 'z') ) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n4\n for (int i = 0; i < strlen(a); i++) {\n if(b[i] > a[i]) {\n flag = 0;\n break;\n }\n\n if(a[i] == b[i])\n c[i] = 'z';\n\n if(a[i] > b[i])\n c[i] = b[i];\n }\n\n\n if(flag == 0) {\n printf(\"-1\\n\");\n return 0;\n }\n for (int i = 0; i < strlen(a); i++)\n printf(\"%c\", c[i]);\n printf(\"\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "866d18f68fa2e16c06c10e78cbc31c18", "src_uid": "ce0cb995e18501f73e34c76713aec182", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include\n#include\n#include\n\nint main()\n{\n char a[111],b[111],c[111];\n int i;\n while(~scanf(\"%s%s\",a,c))\n {for(i=0;ic[i])\n b[i]=c[i];\n else\n {printf(\"-1\\n\");\n break;}\n }\n if(i==strlen(a))\n printf(\"%s\",b);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cc7fc9a0e06cbaf4451c512c9298c179", "src_uid": "ce0cb995e18501f73e34c76713aec182", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main() {int i,n;\n char a[101],b[101],c[101];\n scanf(\"%s%s\",a,b);\n \n char c[n];\n for(i=0;i\ntypedef long long ll;\nll gcd(ll x,ll y)\n{\n if(x%y==0)\n return y;\n return gcd(y,x%y);\n}\nll max(ll x,ll y)\n{\n return x>y?x:y;\n}\nll min(ll x,ll y)\n{\n return x=y)\n {\n b=gcd(t,y-1);\n printf(\"%lld/%lld\",(y-1)/b,t/b);\n }\n else\n printf(\"1/1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "51af7cae3f9edade2543ec38800420fb", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nunsigned long long int pgcd(unsigned long long int x,unsigned long long int y)\n {\n if ((x==1) || (y==1)) return 1;\n if (x==y) return x;\n if (x\n#include \n#include \nlong long min(long long a,long long b){\n if (ac){\n b=a;\n a=c;\n }\n long long d=nzd(a,b);\n long long k=(t/a)/(b/d);\n if (k>0){\n res=k*a+min(t%(a*(b/d)),a-1);\n }\n else res=min(t,a-1);\n long long pd=nzd(res,t);\n printf(\"%I64d/%I64d\",res/pd,t/pd);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2514d14373ac86f79ac3922351a6c85b", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\ntypedef long long ll;\n\n__int128_t min(__int128_t a, __int128_t b) {\n\treturn a < b ? a : b;\n}\n\n__int128_t gcd(__int128_t a, __int128_t b) {\n\tif (b == 0)\n\t\treturn a;\n\treturn gcd(b, a % b);\n}\n\n__int128_t lcm(__int128_t a, __int128_t b) {\n\treturn a * b / gcd(a, b);\n}\n\nint main() {\n\t__int128_t t, w, b, p, q, wb, fp, tmp, pq;\n\tll tt, ww, bb, pp, qq;\n\n\tscanf(\"%I64d%I64d%I64d\", &tt, &ww, &bb);\n\tt = tt;\n\tw = ww;\n\tb = bb;\n\tif (w == b)\n\t\tputs(\"1/1\");\n\telse {\n\t\tif (w > b) {\n\t\t\ttmp = w;\n\t\t\tw = b;\n\t\t\tb = tmp;\n\t\t}\n\t\twb = lcm(w, b);\n\t\tp = t / wb;\n\t\tfp = p * wb;\n\t\tp *= w;\n\t\tp += min(t - fp, w - 1);\n\t\tq = t;\n\t\tpq = gcd(p, q);\n\t\tp /= pq;\n\t\tq /= pq;\n\t\tpp = p;\n\t\tqq = q;\n\t\tprintf(\"%I64d/%I64d\\n\", pp, qq);\n\t}\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e405ff67bf4e91fe8ea3ec16fa842e8e", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef long long ll;\n\n__int128_t min(__int128_t a, __int128_t b) {\n\treturn a < b ? a : b;\n}\n\n__int128_t gcd(__int128_t a, __int128_t b) {\n\tif (b == 0)\n\t\treturn a;\n\treturn gcd(b, a % b);\n}\n\n__int128_t lcm(__int128_t a, __int128_t b) {\n\treturn a * b / gcd(a, b);\n}\n\nint main() {\n\t__int128_t t, w, b, p, q, wb, fp, tmp, pq;\n\tll tt, ww, bb, pp, qq;\n\n\tscanf(\"%I64d%I64d%I64d\", &tt, &ww, &bb);\n\tt = tt;\n\tw = ww;\n\tb = bb;\n\tif (w == b)\n\t\tputs(\"1/1\");\n\telse {\n\t\tif (w > b) {\n\t\t\ttmp = w;\n\t\t\tw = b;\n\t\t\tb = tmp;\n\t\t}\n\t\twb = lcm(w, b);\n\t\tp = t / wb;\n\t\tfp = p * wb;\n\t\tp *= w;\n\t\tp += min(t - fp, w - 1);\n\t\tq = t;\n\t\tpq = gcd(p, q);\n\t\tp /= pq;\n\t\tq /= pq;\n\t\tpp = p;\n\t\tqq = q;\n\t\tprintf(\"%I64d/%I64d\\n\", pp, qq);\n\t}\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e47be0e4af3bdea1bd20742489de4774", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\n#define mul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))\n\nstruct case1\n{\n long long x,y;\n}dian[5][100006]={0},con[100006]={0},vec[5]={0};\n\nlong long tot[5]={0};\nlong long st[5]={0};\n\nint main()\n{\n long long i,j;\n long long cur[5]={0};\n long long x,y;\n long long o=0;\n long long q;\n long long l,r,mid;\n \n for(i=1;i<=3;i++)\n {\n scanf(\"%I64d\",&tot[i]);\n st[i]=1;\n for(j=1;j<=tot[i];j++)\n {\n scanf(\"%I64d%I64d\",&dian[i][j].x,&dian[i][j].y);\n dian[i][j].x*=3;\n dian[i][j].y*=3;\n dian[i][j+tot[i]]=dian[i][j];\n }\n for(j=2;j<=tot[i];j++)\n if(dian[i][j].x0)\n x=vec[i].x,y=vec[i].y;\n for(i=1;i<=3;i++)\n if(mul(vec[i].x,vec[i].y,x,y)==0)\n cur[i]++;\n }\n \n scanf(\"%I64d\",&q);\n for(;q;q--)\n {\n scanf(\"%I64d%I64d\",&x,&y);\n x*=3;\n y*=3;\n \n if(mul(x-con[1].x,y-con[1].y,con[2].x-con[1].x,con[2].y-con[1].y)>0||mul(x-con[1].x,y-con[1].y,con[o].x-con[1].x,con[o].y-con[1].y)<0)\n goto loop;\n \n for(l=3,r=o;l0)\n r=mid;\n else\n l=mid+1;\n }\n if(r>2)\n if(mul(x-con[r].x,y-con[r].y,con[r-1].x-con[r].x,con[r-1].y-con[r].y)>=0)\n {\n printf(\"YES\\n\");\n continue;\n }\n loop:\n printf(\"NO\\n\");\n }\n \n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b8ae6eed317077bc979ec16ec9a42856", "src_uid": "a764daf8e19e48a0735811a4f67485c3", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define mul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))\n\nstruct case1\n{\n long long x,y;\n}dian[5][100006]={0},con[100006]={0},vec[5]={0};\n\nlong long tot[5]={0};\nlong long st[5]={0};\n\nint main()\n{\n long long i,j;\n long long cur[5]={0};\n long long x,y;\n long long o=0;\n long long q;\n long long l,r,mid;\n \n for(i=1;i<=3;i++)\n {\n scanf(\"%I64d\",&tot[i]);\n st[i]=1;\n for(j=1;j<=tot[i];j++)\n {\n scanf(\"%I64d%I64d\",&dian[i][j].x,&dian[i][j].y);\n dian[i][j].x*=3;\n dian[i][j].y*=3;\n dian[i][j+tot[i]]=dian[i][j];\n }\n for(j=2;j<=tot[i];j++)\n if(dian[i][j].x0)\n x=vec[i].x,y=vec[i].y;\n for(i=1;i<=3;i++)\n if(mul(vec[i].x,vec[i].y,x,y)==0)\n cur[i]++;\n }\n \n scanf(\"%I64d\",&q);\n for(;q;q--)\n {\n scanf(\"%I64d%I64d\",&x,&y);\n x*=3;\n y*=3;\n \n if(mul(x-con[1].x,y-con[1].y,con[2].x-con[1].x,con[2].y-con[1].y)>0||mul(x-con[1].x,y-con[1].y,con[o].x-con[1].x,con[o].y-con[1].y)<0)\n goto loop;\n \n for(l=3,r=o;l0)\n r=mid;\n else\n l=mid+1;\n }\n if(r>2)\n if(mul(x-con[r].x,y-con[r].y,con[r-1].x-con[r].x,con[r-1].y-con[r].y)>=0)\n {\n printf(\"YES\\n\");\n continue;\n }\n loop:\n printf(\"NO\\n\");\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8121e0367090eff913a31fce18f1b08a", "src_uid": "a764daf8e19e48a0735811a4f67485c3", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define mul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))\n\nstruct case1\n{\n long long x,y;\n}dian[5][100006]={0},con[100006]={0},vec[5]={0};\n\nlong long tot[5]={0};\nlong long st[5]={0};\n\nint main()\n{\n long long i,j;\n long long cur[5]={0};\n long long x,y;\n long long o=0;\n long long q;\n long long l,r,mid;\n \n for(i=1;i<=3;i++)\n {\n scanf(\"%I64d\",&tot[i]);\n st[i]=1;\n for(j=1;j<=tot[i];j++)\n {\n scanf(\"%I64d%I64d\",&dian[i][j].x,&dian[i][j].y);\n dian[i][j].x*=3;\n dian[i][j].y*=3;\n dian[i][j+tot[i]]=dian[i][j];\n }\n for(j=2;j<=tot[i];j++)\n if(dian[i][j].x0)\n x=vec[i].x,y=vec[i].y;\n for(i=1;i<=3;i++)\n if(mul(vec[i].x,vec[i].y,x,y)==0)\n cur[i]++;\n }\n \n scanf(\"%I64d\",&q);\n for(;q;q--)\n {\n scanf(\"%I64d%I64d\",&x,&y);\n x*=3;\n y*=3;\n \n if(mul(x-con[1].x,y-con[1].y,con[2].x-con[1].x,con[2].y-con[1].y)>0||mul(x-con[1].x,y-con[1].y,con[o].x-con[1].x,con[o].y-con[1].y)<0)\n goto loop;\n \n for(l=3,r=o;l0)\n r=mid;\n else\n l=mid+1;\n }\n if(r>2)\n if(mul(x-con[r].x,y-con[r].y,con[r-1].x-con[r].x,con[r-1].y-con[r].y)>=0)\n {\n printf(\"YES\\n\");\n continue;\n }\n loop:\n printf(\"NO\\n\");\n }\n \n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1ab510f67dc2f3f6a00058314bd54889", "src_uid": "a764daf8e19e48a0735811a4f67485c3", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define mul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))\n\nstruct case1\n{\n long long x,y;\n}dian[5][100006]={0},con[100006]={0},vec[5]={0};\n\nlong long tot[5]={0};\nlong long st[5]={0};\n\nint main()\n{\n long long i,j;\n long long cur[5]={0};\n long long x,y;\n long long o=0;\n long long q;\n long long l,r,mid;\n \n for(i=1;i<=3;i++)\n {\n scanf(\"%I64d\",&tot[i]);\n st[i]=1;\n for(j=1;j<=tot[i];j++)\n {\n scanf(\"%I64d%I64d\",&dian[i][j].x,&dian[i][j].y);\n dian[i][j].x*=3;\n dian[i][j].y*=3;\n dian[i][j+tot[i]]=dian[i][j];\n }\n for(j=2;j<=tot[i];j++)\n if(dian[i][j].x0)\n x=vec[i].x,y=vec[i].y;\n for(i=1;i<=3;i++)\n if(mul(vec[i].x,vec[i].y,x,y)==0)\n cur[i]++;\n }\n \n scanf(\"%I64d\",&q);\n for(;q;q--)\n {\n scanf(\"%I64d%I64d\",&x,&y);\n x*=3;\n y*=3;\n \n if(mul(x-con[1].x,y-con[1].y,con[2].x-con[1].x,con[2].y-con[1].y)>0||mul(x-con[1].x,y-con[1].y,con[o].x-con[1].x,con[o].y-con[1].y)<0)\n goto loop;\n \n for(l=3,r=o;l0)\n r=mid;\n else\n l=mid+1;\n }\n if(r>2)\n if(mul(x-con[r].x,y-con[r].y,con[r-1].x-con[r].x,con[r-1].y-con[r].y)>=0)\n {\n printf(\"YES\\n\");\n continue;\n }\n loop:\n printf(\"NO\\n\");\n }\n \n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5922fa55e6b201318f054d099368c87f", "src_uid": "a764daf8e19e48a0735811a4f67485c3", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define mul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))\n\nstruct case1\n{\n long long x,y;\n}dian[5][100006]={0},con[100006]={0},vec[5]={0};\n\nlong long tot[5]={0};\nlong long st[5]={0};\n\nint main()\n{\n long long i,j;\n long long cur[5]={0};\n long long x,y;\n long long o=0;\n long long q;\n long long l,r,mid;\n \n for(i=1;i<=3;i++)\n {\n scanf(\"%I64d\",&tot[i]);\n st[i]=1;\n for(j=1;j<=tot[i];j++)\n {\n scanf(\"%I64d%I64d\",&dian[i][j].x,&dian[i][j].y);\n dian[i][j].x*=3;\n dian[i][j].y*=3;\n dian[i][j+tot[i]]=dian[i][j];\n }\n for(j=2;j<=tot[i];j++)\n if(dian[i][j].x0)\n x=vec[i].x,y=vec[i].y;\n for(i=1;i<=3;i++)\n if(mul(vec[i].x,vec[i].y,x,y)==0)\n cur[i]++;\n }\n \n scanf(\"%I64d\",&q);\n for(;q;q--)\n {\n scanf(\"%I64d%I64d\",&x,&y);\n x*=3;\n y*=3;\n \n if(mul(x-con[1].x,y-con[1].y,con[2].x-con[1].x,con[2].y-con[1].y)>0||mul(x-con[1].x,y-con[1].y,con[o].x-con[1].x,con[o].y-con[1].y)<0)\n goto loop;\n \n for(l=3,r=o;l0)\n r=mid;\n else\n l=mid+1;\n }\n if(r>2)\n if(mul(x-con[r].x,y-con[r].y,con[r-1].x-con[r].x,con[r-1].y-con[r].y)>=0)\n {\n printf(\"YES\\n\");\n continue;\n }\n loop:\n printf(\"NO\\n\");\n }\n \n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3576dba8eba9ffd48bdcb981f8e2795", "src_uid": "a764daf8e19e48a0735811a4f67485c3", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint a[1000001],b[1000001];\nint main()\n{ \n long long ans=0;\n int n,i,c=1;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)scanf(\"%d\",&a[i]);\n sort(a+1,a+n+1);\n for(i=1;i<=n;i++)\n { \n ans+=a[i];\n if(a[i]==a[i+1])b[c]++;\n else c++;\n }\n for(i=1;i<=c;i++)\n ans-=(1+b[i])*b[i]/2;\n printf(\"%I64d\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e031ce74968d08664c73382b5f0a01f", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\ntypedef long long ll;\nll a[50];\nint main()\n{\n ll n, i, j, temp, c, ans=0;\n scanf(\"%I64d\", &n);\n for(i=0; i0)\n {\n ans+=c;\n c--;\n }\n }\n else\n {\n ans+=a[i];\n c=a[i];\n }\n }\n printf(\"%I64d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3071520435736f68ce6d02d3128d8123", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint cmpfunc(const void *a,const void *b)\n{\nreturn (*(int *)b - *(int *)a);\n}\nint main()\n{\nint n;\nscanf(\"%d\\n\",&n);\nint i,j;\n//int k=0;\nint a[n];\nfor(i=0;i0)\ncount+=a[i]-count2;\nif(i\n#include \n#define SIZE 100\n\nint cmp(const void *a, const void *b)\n{\n\treturn *((int *)b) - *((int *)a);\n}\n\nint main()\n{\n\tint n, i;\n\tint a[SIZE];\n\tint t;\n\tlong long l;\n\n//\tfreopen(\"input.txt\", \"r\", stdin);\n\n\tscanf(\"%d\", &n);\n\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &a[i]);\n\n\tqsort(a, n, sizeof a[0], cmp);\n\n\tl = t = a[0];\n\n\tfor (i = 1; i < n; i++)\n\t\tif (t > a[i])\n\t\t\tl += t = a[i];\n\t\telse\n\t\t\tl += --t;\n\n\tprintf(\"%I64d\", l);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c936b8123c7f93f11b34bdbe2e89d547", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(long long int*)b - *(long long int*)a );\n}\nint main()\n{\n long long int n,i,sum=0,ans=0,flag;\n long long int a[30];\n scanf(\"%I64d\",&n);\n for(i=0;i\r\nvoid main()\r\n{ \r\n long long M, N;\r\n scanf(\"%ld%ld\", &M, &N);\r\n if(N!=1)\r\n {\r\n printf(\"%ld\", (N-1)*M);\r\n }\r\n else{\r\n printf(\"%ld\", M-N);\r\n }\r\n\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2968d86627ec972b0075a3c2f8e1287a", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\nvoid main()\r\n{ \r\n long M, N;\r\n scanf(\"%ld%ld\", &M, &N);\r\n if(N!=1)\r\n {\r\n printf(\"%ld\", (N-1)*M);\r\n }\r\n else{\r\n printf(\"%ld\", M-N);\r\n }\r\n\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "eac481d890b26e2aac14ddc66ea36fd1", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint main()\r\n{\r\n int n,m;\r\n scanf(\"%d%d\",&n,&m);\r\n int arr1[10000][10000],i,j;\r\n int x=1;\r\n for(i=0;i\r\n\r\nvoid main()\r\n{\r\n int n, m;\r\n scanf(\"%d%d\", &n, &m);\r\n if(m>1)\r\n printf(\"%d\",n*(m-1));\r\n if(m==1)\r\n printf(\"%d\",(n-1)*m);\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f77780e4bba11df849a446f2649e3ed", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\nint main()\r\n{\r\n int n,m;\r\n scanf(\"%d%d\",&n,&m);\r\n int arr1[1000][1000],i,j;\r\n int x=1;\r\n for(i=0;i\nint main(){\n long long int n,i,k,t;\n scanf(\"%I64d\",&n);\n t=1;\n for(i=1;i<=n;i++){\n if(n-1<=t){\n printf(\"%I64d\\n\",i);\n break;\n }\n t*=2;\n }\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1901f16c89a7cd143f0dd14a1c3f87d2", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n\t// your code goes here\n\tlong int n,i=1,ans;\n\tscanf(\"%ld\",&n);\n\tlong int b[n];\n\tans=(i*(i+1))/2;\n\twhile((ans)\nint main(void)\n{\n int number,count,sum=0;\n while(scanf(\"%d\",&number)!=EOF)\n {\n while(number)\n count++;\n number>>=1;\n }\n printf(\"%d\",count);\n }\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "af790d653b8f1ac9a669083d1533f9c9", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "// \u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\n// \u2588\u2588\u2588\u2593\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2593\u2588\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\n// \u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u256c\u256c\u2593\u2593\u2593\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u2593\u2593\u2593\u2593\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2593\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2588\u2593\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2588\u2588\u2593\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2593\u2588\u2593\u2593\u2593\u2593\u2588\u2588\u2593\u2593\u2593\u2593\u2588\u2588\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2593\u2593\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2593\u256c\u2593\u256c\u256c\u2593\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2593\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2588\u2588\u2588\u2588\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2588\u2593\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2588\u2588\u2588\u256c\u2593\u2588\u2593\u2593\u256c\u256c\u256c\u2593\u2593\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2588\u2588\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u2593\u2593\u256c\u2593\u2593\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2593\u2593\u2593\u2593\u2593\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2593\u2593\u2593\u256c\u2593\u2588\u2588\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2588\u2593\u2593\u2593\u2593\u2588\u2588\u2588\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2588\u2588\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u256c\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2588\u2588\u2593\u2593\u256c\u256c\u256c\u256c\u256c\u256c\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\n\n// NEED TO DO THIS AGAIN\n#include \nusing namespace std;\n#define ll long long int\n#define MOD 1000000007\n\nint main(){\n\n ll n;\n cin>>n;\n\n ll ans = -1;\n for(ll i=1;i<=n;i++){\n if(i*(i+1)/2 >= n){\n\n ans = i;\n break;\n }\n }\n \n cout<\n#include\nint main()\n{int n,i=0;\n scanf(\"%d\",&n);\n while(n\n\nint main(){\n\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\t\n\ttotal=100*a+10*b;\n\t\n\tif((total/220)%2==0)\n\t\tprintf(\"Hanako\\n\");\n\telse\n\t\tprintf(\"Ciel\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "54e36b0d7d5b8c6094406acc808ec093", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n while(1)\n {\n if(b<2||(a*100+b*10)<220)\n {\n printf(\"Hanako\\n\");\n return 0;\n }\n if(a>=2)\n {\n a-=2;\n b-=2;\n }\n else\n {\n b-=(220-100*a);\n a=0;\n }\n if(b<2||(a*100+b*10)<220)\n {\n printf(\"Ciel\\n\");\n return 0;\n }\n if(b>=12)\n {\n ;b-=12;\n a-=1;\n }\n else if(b>=22)\n {\n b-=22\n }\n else\n {\n a-=2;\n b-=2;\n }\n }\n return 0;\n}\n \t \t\t\t \t\t \t \t\t\t\t \t\t\t \t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "a3d49b616d942c46a1ce43adad65b8ec", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\n\n int main()\n{\n int x,y;\n cin>>x>>y;\n\n int i=1;\n while(true)\n {\n if(((100*x)+(10*y))<220)\n {\n if(i&1==1)\n cout<<\"Hanako\";\n\n else\n cout<<\"Ciel\";\n\n return 0;\n }\n\n\n if(i&1==1)\n {\n if(x>=2)\n {\n x-=2;\n y-=2;\n }\n \n else\n {\n x=0;\n y-=((220-100*x))/10;\n }\n }\n\n else\n {\n if(y>=22)\n y-=22;\n\n else if(y>=12)\n {\n x--;\n y-=12;\n }\n\n\n else\n {\n x-=2;\n y-=2;\n }\n }\n\n i++;\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5fce323bb0c1f60a8412fe58573822f", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n while(1)\n {\n if(b<2||(a*100+b*10)<220)\n {\n printf(\"Hanako\\n\");\n return 0;\n }\n if(a>=2)\n {\n a-=2;\n b-=2;\n }\n else\n {\n b-=(220-100*a);\n a=0;\n }\n if(b<2||(a*100+b*10)<220)\n {\n printf(\"Ciel\\n\");\n return 0;\n }\n if(b>=12)\n {\n ;b-=12;\n a-=1;\n }\n else if(b>=22)\n {\n b-=22\n }\n else\n {\n a-=2;\n b-=2;\n }\n }\n return 0;\n}\n\t\t \t\t\t \t \t\t\t\t\t \t \t \t \t", "lang_cluster": "C", "compilation_error": true, "code_uid": "21466fc4f9458d5857513174a85d2ab9", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a>2||(a*100+b*10)!=220)\n printf(\"Hanako\\n\");\\\n if(a>=2)\n {\n a-=2;\n b-=2;\n }\n else\n {\n b-=(22-10*a);\n a=0;\n }\n if(b<2||a*10+b<22)\n {\n printf(\"Ciel\\n\");\n return 0;\n }\n if(b>=22)\n {\n b-=22;\n }\n else if(b>=12)\n {\n b-=12;\n a-=1;\n }\n else\n {\n a-=2;\n b-=2;\n }\n}\n\t\t\t\t\t\t\t\t\t \t\t\t \t\t \t\t \t", "lang_cluster": "C", "compilation_error": false, "code_uid": "9db9e962b06adadd083abbd49e61655e", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0} {"lang": "GNU C", "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#include \n \nstruct Pawns {\nint row[8];\nint coloumn[8];\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}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "15cb9daa16157e3a814cb79ec915375b", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n \nstruct Pawns {\nint row[8];\nint coloumn[8];\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<8;i++)\n for(j=0;j<8;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;j=Black.count){\n min=White.row[i];\n }\n \n }\n }\n max=-1;\n for(i=0;i=White.count){\n max=Black.row[i];\n }\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}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8951d7c630e67089dd2a0e8fd583d201", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nchar slova[300000],ideU[36];\nint main()\n{\n int n,m,i,j;\n char p,c1,c2;\n scanf(\"%d%d\",&n,&m);\n scanf(\"%c\",&p);\n for (i=0;i\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9d04e6cec3edea0a125339fd317ff214", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n\n\nint main() {\n\tlong long n,p,w,d;\n\tscanf(\"%lld%lld%lld%lld\",&n,&p,&w,&d);\n\tlong long x,y,z;\n\t\tfor (y= 0;yn||x<0) \n\t\t\t\t{\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\t\tgoto x;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld %lld %lld\\n\",x,y,n-x-y);\n\t\t\t\t\tgoto x;\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\tprintf(\"-1\\n\");\n\t\tx:{};\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0d3a1a554a127fd02589f38c76dc4932", "src_uid": "503116e144d19eb953954d99c5526a7d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\ntypedef long long ll;\n\nint main()\n{\n ll n,p,win,same,i,lose;\n int w,d;\n scanf(\"%I64d %I64d %d %d\",&n,&p,&w,&d);\n for(i=0;i<10000000;i++)\n {\n same=i;\n if((p-d*same)%w==0)\n {\n win=(p-same*d)/w;\n lose=n-win-same;\n if(win>=0&&lose>=0)\n {\n printf(\"%I64d %I64d %I64d\",win,same,lose);\n return 0;\n }\n }\n }\n printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7c2c7e827ed8d24c92ebd40f64849475", "src_uid": "503116e144d19eb953954d99c5526a7d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n\n\nint main() {\n\tlong long n,p,w,d;\n\tscanf(\"%lld%lld%lld%lld\",&n,&p,&w,&d);\n\tlong long x,y,z;\n\t\tfor (y= 0;yn||x<0) \n\t\t\t\t{\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\t\tgoto x:\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld %lld %lld\\n\",x,y,n-x-y);\n\t\t\t\t\tgoto x;\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\tprintf(\"-1\\n\");\n\t\tx:{};\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "844cf9dfdfd6e723e39f193b4097b72f", "src_uid": "503116e144d19eb953954d99c5526a7d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n\n\nint main() {\n\tlong long n,p,w,d;\n\tscanf(\"%lld%lld%lld%lld\",&n,&p,&w,&d);\n\tlong long x,y,z;\n\t\tfor (y= 0;yn||x<0) \n\t\t\t\t{\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\t\tgoto x:\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld %lld %lld\\n\",x,y,n-x-y);\n\t\t\t\t\tgoto x:\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\tprintf(\"-1\\n\");\n\t\tx:{};\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0678b33e762861840a5c146991420e18", "src_uid": "503116e144d19eb953954d99c5526a7d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "long long n,p,z;int w,d,y;main(){for(scanf(\"%I64d%I64d%d%d\",&n,&p,&w,&d);y\n#define MAXN 1000002\n#define mod 1000000007\n\nchar vis[MAXN];\n\nlong long quickmi(long long a,int b)\n{\n long long ans=1;\n\n while(b)\n {\n if(b&1)ans=(ans*a)%mod;\n a=(a*a)%mod;\n b>>=1;\n }\n return ans;\n}\n\nint main()\n{\n long long p,k,u;\n int i,cnt;\n\n scanf(\"%I64d%I64d\",&p,&k);\n cnt=0;\n for(i=1;i\n#include \n\n#define MOD 1e9 + 7\n\nlong long power(long long a, long long b, long long m) {\n\tlong long c = 1;\n\tfor(; b; b >>= 1) {\n\t\tif(b & 1) {\n\t\t\tc = (c * a) % m;\n\t\t}\n\t\ta = (a * a) % m;\n\t}\n\treturn c;\n}\n\nlong long solve(long long p, long long k) {\n\tlong long ord, i;\n\n\tswitch(k) {\n\t\tcase 0:\n\t\treturn power(p, p-1, MOD);\n\t\tcase 1:\n\t\treturn power(p, p, MOD);\n\t}\n\tord = p - 1;\n\tfor(i = 2; i < ord; i++) {\n\t\tif(ord % i == 0) {\n\t\t\tif(power(k, ord / i, p) == 1) {\n\t\t\t\tord = ord / i;\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t}\n\treturn power(p, (p - 1) / ord, MOD);\n}\n\nint main() {\n\tlong long p, k;\n\n\tscanf(\"%I64d%I64d\", &p, &k);\n\tprintf(\"%I64d\\n\", solve(p, k));\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ea42af95f53c632104fb1fc89956afe", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAXP 1000005\n\n#define MOD 1000000007\n\nint mat[MAXP];\nint p, k;\n\nint dfs (int a) {\n\t\n\tif (mat[a] == 1)\n\t\treturn 0;\n\t\n\tmat[a] = 1;\n\t\n\treturn dfs((k * a) % p);\n}\n\nint main () {\n\tint i;\n\tlong long res = 1;\n\t\n\tmemset(mat, 0, sizeof(int) * MAXP);\n\t\n\tscanf(\"%d %d\", &p, &k);\n\t\n\tfor (i = 1; i < p; i++) {\n\t\tif (!mat[i]) {\n\t\t\tdfs(i);\n\t\t\tres = ((res % MOD) * (p % MOD)) % MOD;\n\t\t}\n\t}\n\t\n\tif (k == 1) {\n\t\tres = ((res % MOD) * (p % MOD)) % MOD;\n\t}\n\t\n\tprintf(\"%I64d\\n\", res);\n\t\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "86ffb5c57742ce91e6f2b85677d08ea6", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0} {"lang": "GNU C", "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\nint p, k;\nbool visited[1000010];\n\nint expo(int a, int b){\n long long res = 1;\n\n while (b){\n if (b & 1) res = res * a % MOD;\n a = (long long)a * a % MOD;\n b >>= 1;\n }\n return res;\n}\n\nint main(){\n int i, j, res, counter;\n\n while (scanf(\"%d %d\", &p, &k) != EOF){\n counter = 0;\n clr(visited);\n for (i = 0; i < p; i++){\n if (!visited[i]){\n counter++;\n visited[i] = true;\n j = (i * k) % p;\n while (!visited[j]){\n visited[j] = true;\n j = (j * k) % p;\n }\n }\n }\n\n if (k == 1) res = expo(p, p);\n else res = expo(p, --counter);\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0c82a29975980e210ea07a7688dc33de", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n\n#define m 1000000007\n\nlong long power( long long a, long long b ) {\n\tlong long x=a, y=b;\n\tlong long ans = 1;\n\twhile( y ) {\n\t\tif( y%2 )\n\t\t\tans = (ans*x)%m;\n\t\tx = (x*x)%m;\n\t\ty /= 2;\n\t}\n\treturn ans;\n}\n\nint main() {\n\tlong long k, p;\n\tscanf(\"%lld%lld\",&p, &k);\n\tif( k==0 )\n\t\tprintf(\"%lld\\n\", power(p,p-1));\n\tif( k==1 )\n\t\tprintf(\"%lld\\n\", power(p,p));\n\tlong long ord = 1;\n\n\tfor( ; k != 1; ++ord )\n\t\tk = (k*k)%p;\n\n\tprintf(\"%lld\\n\", power(p,(p-1)/ord));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "96d9123cc3d355c9dc8a71799c852c43", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n\tint k,a[20],i,j,m=0,swap,s=0;\n\tscanf(\"%d\",&k);\n\tif(k==0)\n\t{\n\t\tprintf(\"0\");\n\t}\n\tfor(i=0;i<12;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<12;i++)\n\t{\n\t\n\t\telse if(a[i]>=k)\n\t\t{\n\t\t\tm=1;\n\t\t\tprintf(\"%d\",m);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\tif(m!=1)\n\t{\n\t\tfor(i=0;i<11;i++)\n\t {\n for(j=0;j<11-i;j++)\n {\n if(a[j]=k)\n \t{\n printf(\"%d\",m);\n break;\n \t}\n }\n\n\t}\n\treturn 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0478accd788ac0167cb6965ff043afcc", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#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=0,p=0;\n scanf(\"%d\",&n);\n int a[12];\n \n for(i=0;i<12;i++)\n scanf(\"%d\",&a[i]);\n \n qsort(a,12,sizeof(int),compare);\n \n if(n!=0)\n{ for(i=11;i>=0;i--)\n {\n \n s=s+a[i];\n if(s\n\nint main(void) {\n\tint k, count = 0;\n\tscanf(\"%d\", &k);\n\tif(!k){\n\t printf(\"0\");\n\t return 0;\n\t}\n\tint arr[12];\n\tfor(int i = 0; i < 12; i++) scanf(\"%d\", arr+i);\n\tfor(int i = 0; i < 12; i++){\n\t int max = 0, index = i;\n\t for(int j = 0; j < 12; j++){\n\t if(arr[j]>max){\n\t max = arr[j];\n\t index = j;\n\t }\n\t }\n\t if(k<=0){\n\t printf(\"%d\", count);\n\t break;\n\t }\n\t k -= max;\n\t count++;\n\t arr[index] = 0;\n\t}\n\tprintf(\"%d\", tot);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0158f9050acd721b2a3f25e19f659bf6", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n\tint k,a[20],i,j,m=0,swap,s=0;\n\tscanf(\"%d\",&k);\n\tfor(i=0;i<12;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<12;i++)\n\t{\n\t\tif(a[i]<=k)\n\t\t{\n\t\t\tm=1;\n\t\t\tprintf(\"%d\",m);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\tif(m!=1)\n\t{\n\t\tfor(i=0;i<11;i++)\n\t {\n for(j=0;j<11-i;j++)\n {\n if(a[j]=k)\n \t{\n printf(\"%d\",m);\n \t}\n }\n\n\t}\n\trturn 0;\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2667cd4618f8309688a2707c51b1625d", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0} {"lang": "GNU C", "source_code": "void quicksort(int x[],int first,int last){\n int pivot,j,temp,i;\n\n if(firstx[pivot])\n j--;\n if(i\n//#include\n#include\n\n\nint fmax(int A[], int n, int B[] ){\n int maxi=A[0]; int pos=0; int i; int k=0;\n for( i=0;i=maxi){\n maxi=A[i];\n pos=i;\n }}\n if(pos!=0){\n for(i=1;iA[B[i]]+1){\n flag=1;\n break;\n\n }\n }\n }\n else {flag=1;\n break;}\n }\n if (flag)\n printf(\"%d\", cnt);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d306b216d0d882ba641a6ea39735c21", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n\nint Find_max_num(int *a,int n) //ne schitaya pervogo\n{\nint i;\nint max=1;\nint max_num;\n\nfor(i=1;i=max)\n\t\t{\n\t\tmax=a[i];\n\t\tmax_num=i;\n\t\t}\n\nreturn max_num;\n}\n\nint main(void)\n{\nint i;\nint n; scanf(\"%d\",&n);\nint count=0;\nint max_num=-1;\n\nint a[n];\n\nfor(i=0;i\n\n\nint main()\n{\n int n,i,j,vote,check=0;\n int s[102];\n scanf(\"%d\",&n);\n for(i=0;is[0]){\n s[0]=s[0]+1;s[j]=s[j]-1;\n vote++;\n }\n }\n for(i=1;i=s[0]) {check=0;break;}\n else check =1;\n }\n }\n\n printf(\"%d\\n\",vote);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6b5377ac90420cf16557cf4f5090e020", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main() \n{\n int i,n,a[102],ans=0,max;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\nint n,val,a[1001];\nint ver(int cat)\n{\n int nrver=val+cat,scad=0;\n for(int i=1;i\n\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\n\nlong long nearby(long long n)\n{\n\twhile (isluck(n) != 1)\n\t{\n\t\tn++;\n\t}\n\treturn n;\n}\n\nint main()\n{\n\tlong long l, r;\n\n\twhile (~scanf(\"%lld %lld\", &l, &r))\n\t{\n\t\tlong long sum = 0;\n\n\t\twhile (l <= r)\n\t\t{\n\t\t\tint tmp = nearby(l);\n\t\t\tif (tmp > r)\n\t\t\t{\n\t\t\t\tsum += (r - l + 1) * tmp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum += (tmp - l + 1) * tmp;\n\t\t\tl = tmp + 1;\n\t\t}\n\t\tprintf(\"%lld\\n\", sum);\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "d11cdd9ee406bcc04de0896a2bc9be0d", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100.0} {"lang": "GNU C", "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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f7ec900046e9b362ad30baf96cf75e1d", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\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{ \n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\n\t\t\n\t}\n\treturn guar;\n\n\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\n\t\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "67dbd379a41b232c27d4593c8675bec4", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100.0} {"lang": "GNU C", "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 if(j+1>m)\n m=j+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,k;\n scanf(\"%I64d %I64d\",&x,&y);\n sum=0;\n k=0;\n for(i=x;i<=y;i++){\n if(k\n#define N 10000000000ll\n__int64 a[1000],queue[1000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,j,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(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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e6aed8e3e2441109fc99164921d0061", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n\tint i,j,c=0,c1=0,l;\n\tchar s[105];\n\tgets(s);\n\tl=strlen(s);\n\tfor(i=0;i<6;i++)\n\t{\n\t\tif(s[i]=='1')\n\t\t{\n\t\t\ts[i]='0';\n\t\t}\n\t}\n\tfor(i=0;i=6 && c1>=1)\n\tprintf(\"yes\");\n\telse\n\tprintf(\"no\");\n}\n\t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "c208638aa7648bb490dc4e0368a9a90e", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "# include \n\nint main()\n{\n char d, c=0;\n while((d=getchar())!='1');\n while((d=getchar())!=EOF) {\n if(d=='0')\n c++;\n if(c>=6)\n printf(\"yes\");\n else\n printf(\"no\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3bad9970b28b75aa2d919d49a49f61dc", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a4b9fa64d32961dc4a4ff9cffb520915", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char ch[101];\n int x=0,y=0,i;\n scanf(\"%s\",ch);\n for(i=0;ch!='\\0';i++)\n {\n if(ch[i]=='1')\n x=1;\n else if(x==1)\n ++y;\n }\n if(y>6)\n printf(\"yes\");\n else\n printf(\"no\")\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8fb7455f6d3361cad2861894fd58526f", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n char str[150];\n scanf(\"%s\",str);\n int len = strlen(str);\n if(len<7){\n printf(\"no\\n\");\n }\n int j=0;\n while(str[j] != '1' && str[j] != '\\0'){\n j++;\n }\n if(j==len){\n printf(\"no\\n\");\n }\n int i,cnt=0;\n for(i=j+1;i5){\n printf(\"yes\\n\");\n }\n else{\n printf(\"no\\n\";)\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0b851c0573c6ff4221ef5fc16ec8ad65", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n int a,b,c,count=0;\n scanf(\"%d %d %d\",&a,&b,&c);\n if((a+b)>>c&&(b+c)>>a&&(a+c)>>b)\n {\n printf(\"%d\",&0);\n }\n else\n {\n while((a+b)<\nint main()\n{\n\tint a,b,c,t=0,max;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a>b&&a>c)\n\t{\n\t\tmax=a;\n\t}\n\telse if(b>a && b>c)\n\t{\n\t\tmax=b;\n\t}\n\telse\n\t{\n\t\tmax=c;\n\t}\n\tint r=(a+b+c)-max;\n\twhile(max>=r)\n\t{\n\t\tr=r+1;\n\t\tt=t+1\n\t}\n\tprintf(\"%d\",t);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e54455883633730b6cf065fe50515c41", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800.0} {"lang": "GNU C11", "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(\"%d%d%d\",a-b-c-1);\n else if(b>=a+c) \n printf(\"%d%d%d\",b-a-c-1);\n else if(c>=b+c) \n printf(\"%d%d%d\",c-b-a-1);\n else\n printf(\"0\"); \n }\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "962dbd7e0bdc8815fd1b5f623deb68ed", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a , b , c ;\n scanf(\"%d%d%d\",&a,&b,&c) ;\n int k ;\n \n a>b ? (a>c ? a : c) :(b>c ? b : c) ;\n\n(2*k-(a+b+c))>0 ? printf(\"0\") : printf(\"%d\",(2*k-(a+b+c)+1)) ;", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc342347eabaf75ab793cbbee9f57cb6", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nusing namespace std;\n\nclass Triangle {\n public:\nint i;\nint j;\nint temp;\nint a[3];\nint m;\n\nvoid get() {\nfor (i=0;i<3;i++) {\ncin>>a[i];\n}\n\n}\n\nvoid sort() {\n for (i=0;i<3;i++) {\n for (j=i;j<3;j++) {\n if (a[i]=(a[1]+a[2]))\n m=(a[0]-(a[1]+a[2]))+1;\nelse m=0;\n\n\n}\n\nvoid show() {\ncout<\n#include \n#define ll long long int \nint main()\n{\n\tll a,b;\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tif(a==b)\n\t{\n\t\tprintf(\"infinity\\n\");\n\t}\n\telse\n\t{\n\t\tll i,num=a-b;\n\t\tll ans=1;\n\t\tfor(i=2;i<=sqrt(num);i++)\n\t\t{\n\t\t\tif(num%i==0)\n\t\t\t{\n\t\t\t\tif(a%i==b)\n\t\t\t\t{\n\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t\tif(i!=num/i)\n\t\t\t\t{\n\t\t\t\t\tif(a%(num/i)==b)\n\t\t\t\t\t{\n\t\t\t\t\t\tans+=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\"ans);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ece176633b41af674a80e4badf61d01c", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define ll long long int \nll inline inp()\n{\n ll n=0,a=1;\n char c=getchar_unlocked();\n while(c < '0' || c >'9') {if(c=='-'){a=-1;}c=getchar_unlocked();}\n while(c>='0' && c<='9')\n {\n n=(n<<3)+(n<<1)+c-'0';\n c=getchar_unlocked();\n }\n return a*n;\n}\nvoid print(ll X)\n{\n if(X<0) { putchar_unlocked('-'); X=-X; }\n int Len=0,Data[20];\n while(X) { Data[Len++]=X%10; X/=10; }\n if(!Len) Data[Len++]=0;\n while(Len--) putchar_unlocked(Data[Len]+48);\n putchar_unlocked('\\n');\n}\nint main()\n{\n\tll a,b;\n\ta=inp();b=inp();\n\tif(a==b)\n\t{\n\t\tprintf(\"infinity\\n\");\n\t}\n\telse\n\t{\n\t\tll i,num=a-b;\n\t\tll ans=1;\n\t\tfor(i=2;i<=sqrt(num);i++)\n\t\t{\n\t\t\tif(num%i==0)\n\t\t\t{\n\t\t\t\tif(a%i==b)\n\t\t\t\t{\n\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t\tif(i!=num/i)\n\t\t\t\t{\n\t\t\t\t\tif(a%(num/i)==b)\n\t\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprint(ans);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "24d0ab6edb371f1cb13c8ef142d5176b", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int a, b, c;\n int i, sqtc, con;\n scanf(\"%d %d\", &a, &b);\n if (a < b)\n return 0;\n if (a == b)\n printf(\"infinity\\n\");\n else\n {\n c = a - b;\n if (c < b)\n printf(\"0\\n\");\n else\n {\n con = 1;\n sqtc = sqrt(double(c));\n if (sqtc>b)\n {\n for (i = 2; i < b; ++i)\n if (c%i == 0)\n ++con;\n for (i = b + 1; i < sqtc; ++i)\n if (c%i == 0)\n con += 2;\n }\n else\n {\n sqtc = c / b;\n if (c%b != 0)\n ++sqtc;\n for (i = 2; i < sqtc; ++i)\n if (c%i == 0)\n ++con;\n }\n printf(\"%d\\n\", con);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "28474d2656e9029b2cef531ca89eb3ba", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define ll long long int \nll inline inp()\n{\n ll n=0,a=1;\n char c=getchar_unlocked();\n while(c < '0' || c >'9') {if(c=='-'){a=-1;}c=getchar_unlocked();}\n while(c>='0' && c<='9')\n {\n n=(n<<3)+(n<<1)+c-'0';\n c=getchar_unlocked();\n }\n return a*n;\n}\nvoid print(ll X)\n{\n if(X<0) { putchar_unlocked('-'); X=-X; }\n int Len=0,Data[20];\n while(X) { Data[Len++]=X%10; X/=10; }\n if(!Len) Data[Len++]=0;\n while(Len--) putchar_unlocked(Data[Len]+48);\n putchar_unlocked('\\n');\n}\nint main()\n{\n\tll a,b;\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tif(a==b)\n\t{\n\t\tprintf(\"infinity\\n\");\n\t}\n\telse\n\t{\n\t\tll i,num=a-b;\n\t\tll ans=1;\n\t\tfor(i=2;i<=sqrt(num);i++)\n\t\t{\n\t\t\tif(num%i==0)\n\t\t\t{\n\t\t\t\tif(a%i==b)\n\t\t\t\t{\n\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t\tif(i!=num/i)\n\t\t\t\t{\n\t\t\t\t\tif(a%(num/i)==b)\n\t\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\"ans);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a7630cecbf75d981811a51f5f378c235", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "By Ahmet098, contest: Codeforces Round #282 (Div. 2), problem: (B) Modular Equations, Wrong answer on test 4, #\n\n#include\n#include\n\nint main()\n{\n long long a,b,i,fark,count=0,x;\n\n scanf(\"%lld %lld\",&a,&b);\n\n\n fark=a-b; \n \n if(a==0 && b==0)\n {\n printf(\"0\");\n return 0;\n }\n \n if(a==0)\n {\n printf(\"infinity\");\n return 0;\n }\n\n\n if(b==0)\n {\n for(i=1;i<(int)sqrt(fark);i++)\n {\n if(fark%i==0)\n {\n if((fark/i)>b)\n count++;\n if(i>b)\n count++;\n }\n }\n x=sqrt(fark);\n if(x>b && fark%x==0)\n {\n count++;\n }\n printf(\"%lld \",count);\n return 0;\n }\n\n if(b%a==0)\n {\n printf(\"infinity\");\n return 0;\n }\n if(ab)\n count++;\n for(i=2;i<(int)sqrt(fark);i++)\n {\n if(fark%i==0)\n {\n if((fark/i)>b)\n count++;\n if(i>b)\n count++;\n }\n }\n x=sqrt(fark);\n if(x>b && fark%x==0)\n {\n count++;\n }\n printf(\"%lld \",count);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c6369654ca94f6a89b41882dee3d7031", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "//\u592a\u590d\u6742\u4e86\uff01\n#include\nint abs(int a){\n\tif(a<0)return -a;\n\telse return a;\n}\nint v1,v2;\nint t,d;\nint max;\nint distance;\nvoid dfs(int vs,int time){\n\t//printf(\"dfs(%d,%d)\\n\",vs,time);\n\tif(time-2==0){\n\t\tdistance+=vs;\n\t\tdistance+=v2;\n\t\tif(distance>max){\n\t\t\tmax=distance;\n\t\t}\n\t\tdistance-=vs;\n\t\tdistance-=v2;\n\t\treturn;\n\t}\n\tint i;\n\tfor(i=vs-d;i<=vs+d;i++){\n\t\tif(i>=0 && abs(v2-i)<=(time-2)*d){\n\t\t\t//\u6ee1\u8db3\u8fd9\u4e2a\u6761\u4ef6\u7684vt\u624d\u53ef\u4ee5\u5230\u8fbe\u7ec8\u70b9\u901f\u5ea6\uff01\n\t\t\tdistance+=vs;\n\t\t\tdfs(i,time-1);\n\t\t\tdistance-=vs;\n\t\t}\n\t}\n}\nint main() {\n\tscanf(\"%d%d\",&v1,&v2);\n\tscanf(\"%d%d\",&t,&d);\n\tmax=0;\n\tdistance=0;\n\tint i;\n\tif(v1==v2){\n\t\tfor(i=2;i<=t;i++){\n\t\t\tdistance+=v1;\n\t\t\tdistance+=(i/2)*d;\n\t\t}\n\t\tdistance+=v2;\n\t\tprintf(\"%d\\n\",distance);\n\t}else{\n\t\tdfs(v1,t);\n\t\tprintf(\"%d\\n\",max);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0e0f24fb84fc560ddfe0d2d7dc4c3e93", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\ntypedef long long int ll;\nconst ll mod=1e9+7;\n\nint main()\n{\n ll v1,v2,t,d,i,j,k,sum=0;\n scanf(\"%lld %lld %lld %lld\",&v1,&v2,&t,&d);\n if(d==0) printf(\"%lld\",v1*t);\n else if(v1<=(t-1)*d)\n {\n \tj=v1;\n\t\tfor(i=0;i\nint abs(int a){\n\tif(a<0)return -a;\n\telse return a;\n}\nint v1,v2;\nint t,d;\nint max;\nint distance;\nvoid dfs(int vs,int time){\n\t//printf(\"dfs(%d,%d)\\n\",vs,time);\n\tif(time-2==0){\n\t\tdistance+=vs;\n\t\tdistance+=v2;\n\t\tif(distance>max){\n\t\t\tmax=distance;\n\t\t}\n\t\tdistance-=vs;\n\t\tdistance-=v2;\n\t\treturn;\n\t}\n\tint i;\n\tfor(i=vs-d;i<=vs+d;i++){\n\t\tif(abs(v2-i)<=(time-2)*d){\n\t\t\t//\u6ee1\u8db3\u8fd9\u4e2a\u6761\u4ef6\u7684vt\u624d\u53ef\u4ee5\u5230\u8fbe\u7ec8\u70b9\u901f\u5ea6\uff01\n\t\t\tdistance+=vs;\n\t\t\tdfs(i,time-1);\n\t\t\tdistance-=vs;\n\t\t}\n\t}\n}\nint main() {\n\tscanf(\"%d%d\",&v1,&v2);\n\tscanf(\"%d%d\",&t,&d);\n\tmax=0;\n\tdistance=0;\n\tdfs(v1,t);\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3d59b03dffd5778abefe7f0831f3b55e", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int v1, v2, t, d, limit, distance=0, i;\n scanf(\"%d %d %d %d\", &v1, &v2, &t, &d);\n for(i=0;ilimit)\n {\n v1=limit;\n }\n else\n {\n v1=v1+d;\n }\n }\n\n printf(\"%d\", distance);\n\n main();\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "af0e39fcc018d51d82da19a1b005ce8f", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "//\u592a\u590d\u6742\u4e86\uff01\n#include\nint abs(int a){\n\tif(a<0)return -a;\n\telse return a;\n}\nint v1,v2;\nint t,d;\nint max;\nint distance;\nvoid dfs(int vs,int vt,int time){\n\tif(time==t-1){\n\t\t//\u8fd9\u4e2a\u65f6\u5019\uff0c\u6211\u4eec\u5e94\u8be5\u6309\u7167\u8981\u6c42\u7684\u901f\u5ea6\u5230\u8fbe\u4e86\uff01\n\t\t//\u6211\u4eec\u53ef\u4ee5\u6309\u9650\u5236\u7684\u901f\u5ea6\u5230\u8fbe\u7ec8\u70b9\n\t\tif(abs(vs-v2)<=d){\n\t\t\t//printf(\"dfs(%d,%d,%d)\\n\",vs,vt,time);\n\t\t\tdistance+=vs;\n\t\t\tdistance+=v2;\n\t\t\tif(distance>max){\n\t\t\t\tmax=distance;\n\t\t\t}\n\t\t\tdistance-=vs;\n\t\t\tdistance-=v2;\n\n\t\t}\n\t\treturn;\n\t}\n\tint i;\n\tfor(i=-d;i<=d;i++){\n\t\tif(vt+i>=0){\n\t\t\tdistance+=vs;\n\t\t\tdfs(vt,vt+i,time+1);\n\t\t\tdistance-=vs;\n\t\t}\n\t}\n}\nint main() {\n\tscanf(\"%d%d\",&v1,&v2);\n\tscanf(\"%d%d\",&t,&d);\n\tmax=0;\n\tdistance=0;\n\tdfs(0,v1,0);\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9eeaa845f1dfdac06ba011834894ee67", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#!/usr/bin/python2.7\n\n\ndef my_func():\n\ttry:\t\n\t\ta=10/0;\n\texcept: \n\t\tprint \"Exception caught here\";\ntry:\n\tmy_func();\nexcept: \n\tprint \"Line last\";", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ad3b87e7f80085a3789c9d5d00f5324", "src_uid": "c1b071f09ef375f19031ce99d10e90ab", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\ntypedef long long ll;\nchar a[105],book[26];\nint main()\n{\n\tint k,len,i;\n\tscanf(\"%d\",&k);\n\tscanf(\"%s\",a);\n\tlen=strlen(a);\n\tmemset(book,0,sizeof(book));\n\tif(k>len)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse\n\t{\n\t\tint sum=0;\n\t\tfor(i=0;i=k)\n\t\tprintf(\"YES\\n\");\n\t\telse\n\t\tprintf(\"NO\\n\");\n\t\tmemset(book,0,sizeof(book));\n\t\tint t=1;\n\t\tbook[a[0]-'a']++;\n\t\tprintf(\"%c\",a[0]);\n\t\tfor(i=1;i\n#include\nint main(){\n\tint a,panjang,start,i,arr[200],j,jmlsub=0,cek[200]={0},proceed=0;\n\tbool proceed;\n\tchar input[200];\n\tscanf(\"%d\",&a);\n\tscanf(\"%s\",input);\n\tpanjang=strlen(input);\n\t//cek[input[0]]++;\n\tif(a>=1){\n\t\tfor(i=0;i\n#include\n#define K 26\n#define N 100\n#define CHAR 256\nint main() {\n int k;\n scanf(\"%d\",&k);\n char q[N+1];\n scanf(\"%s\",q);\n int see[CHAR+1];\n int i;\n for(i=0;i<=CHAR;i++) {\n see[i]=0;\n }\n char s[K][N+1];\n int nk=0;\n int ns[K];\n for(i=;i\n#include\n#include\n#include\n#define gc getchar\n#define pc putchar\n#define MOD 1000000007\n\ntypedef long long ll;\n\ninline ll scan()\n{\n \tll n = 0;\n \tll ch = gc();\n \tll sign = 1;\n \twhile(ch < '0' || ch > '9')\n\t{\n\t\tif(ch == '-')\n\t\t\tsign = -1;\n \t\tch = gc();\n\t}\n \twhile(ch >= '0' && ch <= '9')\n\t\tn = (n << 3) + (n << 1) + ch - '0', ch = gc();\n n = n * sign;\n return n;\n}\n\ninline void writeInt (ll n)\n{\n\tll N = n, rev, count = 0;\n\trev = N;\n\tif(N < 0)\n\t{\n\t\tN = -N;\n\t\tpc('-');\n\t}\n\tif (N == 0) { pc('0'); pc('\\n'); return ;}\n\twhile ((rev % 10) == 0) { count++; rev /= 10;}\n\trev = 0;\n\twhile (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}\n\twhile (rev != 0) { pc(rev % 10 + '0'); rev /= 10;}\n\twhile (count--) pc('0');\n}\n\nchar ip[101];\nint found[27];\n\nint main()\n{\n\tll k, i, cnt = 0, n;\n\tk = scan();\n\tscanf(\"%s\", ip);\n\tn = strlen(ip);\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tfound[ip[i] - 97] = 1;\n\t}\n\tfor(i = 0; i < 27; i++)\n\t\tif(found[i] == 1)\n\t\t\tcnt += 1;\n\tif(cnt >= k)\n\t{\n\t\tcnt = 1;\n\t\tprintf(\"YES\\n\");\n\t\tfor(i = 0; i < n-1; i++)\n\t\t{\n\t\t\tif((ip[i] != ip[i+1]) && cnt < k)\n\t\t\t{\n\t\t\t\tpc(ip[i]);\n\t\t\t\tpc('\\n');\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t\telse pc(ip[i]);\n\t\t}\n\t\tpc(ip[i]);\n\t\tpc('\\n');\n\t}\n\telse printf(\"NO\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "49d93d1972316d2ebc551a7841ed4a2e", "src_uid": "c1b071f09ef375f19031ce99d10e90ab", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\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) + ( 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2ed48874fb6011a0c523dff44bae645f", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n#define inf 0x3f3f3f3f\n#define ll long long\n \nll gcd(ll x,ll y){\n if(y==0) return x;\n else return(gcd(y,x%y));\n}\n \nll lcm(ll x,ll y){\n return x*y/gcd(x,y);\n}\n \nint main()\n{\nll n,a,b,p,q;\n while(~scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q))\n {\n ll lm=lcm(a,b);\n printf(\"%lld\\n\",(n/a)*p+(n/b)*q-min(p,q)*(n/(lm)));\n \n \n }\n return 0;\n\n/* 1535729986494 */\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4534fbc358cf68d17a2afbd5a39cda79", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \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)) * (p > q ? q i: p);\n printf(\"%lld\\n\", s);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "031e8fd5ad502663d9c112227a776fe3", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "from math import gcd\n\nwhile True:\n try:\n n, a, b, p, q = map(int, input().split())\n s = (n // a) * p\n s += (n // b) * q\n s -= (n // ((a * b) // gcd(a, b))) * min(p, q)\n print(int(s))\n except EOFError:\n break", "lang_cluster": "C", "compilation_error": true, "code_uid": "02e034d172e31cbfe563eb1379b68d16", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\n#define inf 0x3f3f3f3f\n#define ll long long\n \nll gcd(ll x,ll y){\n if(y==0) return x;\n else return(gcd(y,x%y));\n}\n \nll lcm(ll x,ll y){\n return x*y/gcd(x,y);\n}\n \nint main()\n{\nll n,a,b,p,q;\n while(~scanf(\"%lld%lld%lld%lld%lld\",&n,&a,&b,&p,&q))\n {\n ll lm=lcm(a,b);\n printf(\"%lld\\n\",(n/a)*p+(n/b)*q-min(p,q)*(n/(lm)));\n \n \n }\n return 0;\n\n/* 1535729852745 */\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "933c0d2f723da14afc5b3163606bc123", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n = 0;\n scanf(\"%d\", &n);\n\n if (n < 3) {\n printf(\"1\\n\");\n } else {\n printf(\"%d\\n\", (n / 3) * 2 + 1);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3e5b1c80d0caf574074603d9be9dc2e7", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#iclude\nint main()\n{\n\tint a;\n\tscanf(\"%d\", &a);\n\tif (1<=a && a<=10^9){\n\tif (a%3==0)\n\t\tprintf(\"%d\", a/3*2);\n\telse if (a%3!=0)\n\t\tprintf(\"%d\", a/3*2+1);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bdbc4bf356804e27cfee61e4bb56590d", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main () {\n int n\n scanf(\"%d\", &n);\n printf(\"%d\\n\", 2*(n/3) + (n%3 != 0));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a0e042850daf808719609f8f5bf9dabc", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2b4e621e75a6c0c3afd13c8f5a5ba47a", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{ long long int n,;\nint sum;\n scanf(\"%I64D\",&n);\n int k=n/3;\n int j=n%3;\n if(j!=0)\n sum=k*2+1;\n else\n sum=k*2;\n\n printf(\"%d\",sum);\n\n return(0);\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "48938d0c488820f58c4585db7c69d26f", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0} {"lang": "GNU C", "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(tx1 ) 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=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:59:37.772*/", "lang_cluster": "C", "compilation_error": true, "code_uid": "4346acf481559be065a23bd6602a8d13", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\ndouble a[10000][100000];\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "3553f8125e564fdbd9e6ea6866724b58", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n\ndouble cup[10000][10000];\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "d49dc2858ae4be0eda0891771ba19313", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0} {"lang": "GNU C", "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\nusing namespace std;\n\nint main(){\n \n long long int x;\n long long int y;\n long long int m;\n \n cin>>x>>y>>m;\n int contador;\n for(contador=0;x=x+y){\n \n printf(\"-1\");\n return 0;\n }\n x=x+y;\n \n }\n else{\n if(y>=x+y){\n \n printf(\"-1\");\n return 0;\n \n }\n y=x+y; \n \n }\n \n }\n printf(\"%d\",contador);\n return 0;\n \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "04b241b524d08045ab6e187113417471", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main() \n{\n\tlong long int x,y,m,count=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\nint main()\n{\n long long int x, y, m;\n long long int count;\n scanf(\"%I64d\", &a);\n scanf(\"%I64d\", &b);\n scanf(\"%I64d\", &m);\n if (x>=m || y>=m)\n {\n count = 0;\n printf(\"%I64d\\n\", count);\n return 0;\n }\n if((x<=0 && y<=0))\n {\n count = -1;\n printf(\"%I64d\\n\", count);\n return 0;\n }\n count = 0;\n if (x<0)\n {\n count = (-1*x)/y;\n x = y*count + x;\n }\n if (y<0)\n {\n count = (-1*y)/x;\n y = x*count + y;\n }\n while(x=y)\n {\n y = x+y;\n count++;\n }\n else\n {\n x = x+y;\n count++;\n }\n }\n printf(\"%I64d\\n\", count);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b168fc335f83694fb79ca84b1cd941fd", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\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\r\nint main()\r\n{\r\n int x,a[2][2],b[1000];\r\n scanf(\"%d\",&x);\r\n printf(\"\\n\");\r\n for(int z=1;z<=x;z++)\r\n {for (int i=0;i<2;i++)\r\n {for (int j=0;j<2;j++)\r\n {\r\n a[i][j]=0;\r\n }}\r\n \r\n for (int i=0;i<2;i++)\r\n {for (int j=0;j<2;j++)\r\n {\r\n scanf(\"%d\",&a[i][j]);\r\n }}\r\n if (a[1][1]+a[1][2]+a[2][2]+a[2][1]==4)\r\n b[z]=2;\r\n else if (a[1][1]+a[1][2]+a[2][2]+a[2][1]==0)\r\n b[z]=0;\r\n else b[z]=1;\r\n //for (int l=0;l<2;l++)\r\n //{printf(\"\\n\");\r\n for (int m=0;m<2;m++)\r\n {\r\n //printf(\"%d \",a[l][m]);\r\n }}\r\n }\r\n \r\n for (int k=0;k<=x;k++)\r\n printf(\"%d\\n\",b[k]);\r\n \r\n \r\n \r\n \r\n \r\n \r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "39844b7a2b516a9f3b568a8020bd1060", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "// Online C compiler to run C program online\r\n#include \r\n\r\nint main() {\r\n // Write C code here\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--){\r\n int arr[4];\r\n int count=0;\r\n int oneCount=0;\r\n scanf(\"%d %d\",&arr[0],&arr[1]);\r\n scanf(\"%d %d\",&arr[2],&arr[3]);\r\n for(int i=0;i<4;i++){\r\n if (arr[i]==1){\r\n oneCount+=1;\r\n }\r\n }\r\n if (oneCount==4){\r\n printf(\"%d\",2\\n);\r\n }\r\n else if (oneCount==0) printf(\"%d\\n\",0);\r\n else{\r\n printf(\"%d\\n\",1);\r\n }\r\n \r\n }\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "416038dac7dbb3916692c4d977110094", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "\r\n#include \r\n#include \r\n#include \r\n\r\nint main() {\r\n int t; scanf(\"%d\",&t);\r\n while(t--) {\r\n bool a[2][2]; int ans=0; \r\n for(int i=0;i<2;i++) {\r\n for(int j=0;j<2;j++) {\r\n scanf(\"%d\",&a[i][j]) if(a[i][j])ans++;\r\n \r\n }\r\n }\r\n\r\n \r\n if(ans>1) cout<<(int)log2(ans)<\r\n\r\nint mai(){\r\n\tint x; \r\n\tint ctr= 0 ; \r\n\tfor(int i = 0 ; i<4 ; i++){\r\n\t\tscanf(\"%d\" , &x); \r\n\t\tif(x==1){\r\n\t\t\tctr++; \r\n\t\t}\r\n\t}\r\n\tif(ctr ==0){\r\n\t\tprintf(\"0\");\r\n\t\treturn \r\n\t}\r\n\tif(ctr == 1 ||ctr==2 || ctr ==3){\r\n\t\tprintf(\"1\"); \r\n\t\treturn ; \r\n\t}\r\n\tif (ctr ==4){\r\n\t\tprintf(\"2\"); \r\n\t\treturn ; \r\n\r\n\t}\r\n\treturn 0 ; \r\n}\r\n\r\nint main(){\r\n\tint t ; \r\n\tscanf(\"%d\" , &t);\r\n\tfor(int i = 0 ; i\r\nint main()\r\n{\r\n int t,T,c[4],ans;\r\n\r\n scanf(\"%d\",&T)\r\n for(int i=1;i<=T;t++){\r\n scanf(\"%d %d %d %d\",c[0],c[1],c[2],c[3]);\r\n for(int j=0;j<4;j++){\r\n if(c[j]==0){\r\n ans++;\r\n }\r\n }\r\n }\r\n\r\nreturn 0;\r\n}\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "a779c3ae0dd738bc2e81dd639a918e7b", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a,b,x1,y1,x2,y2;\nclrscr();\nscanf(\"%d%d%d%d%d%d\",&a,&b,&x1,&y1,&x2,&y2);\nif(((x1+x2<=a)&&(max(y1,y2)<=b))||((y1+x2<=b)&&(max(y2,x1)<=a))||((y2+x1<=b)&&(max(x2,y1)<=a))||((x1+x2<=b)&&(max(y1,y2)<=a))||((y1+y2<=b)&&(max(x1,x2)<=a))||((y1+y2<=a)&&(max(x1,x2)<=b))||((y2+x1<=a)&&(max(x2,y1)<=b))||((y1+x2<=a)&&(max(x1,y2)<=b)))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\nreturn 0;\n}\nint max(int x ,int y)\n{\nint t;\nif(x>=y)\nt=x;\nelse\nt=y;\nreturn t;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "54f4543207ea6b7af1415f755ccb0a5c", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": ".#include\n#include\n\n\nint main()\n{\n int a1,a2,a3,b1,b2,b3;\n int p,q,r,s;\n scanf(\"%d %d %d %d %d %d\",&a1,&b1,&a2,&b2,&a3,&b3);\n p=a2+a3;\n if(p<=a1)\n {\n if(b2<=b1 && b3<=b1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n if(p<=b1)\n {\n if(b2<=a1 && b3<=a1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n p=a2+b3;\n if(p<=a1)\n {\n if(b2<=b1 && a3<=b1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n if(p<=b1)\n {\n if(b2<=a1 && a3<=a1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n p=b2+a3;\n if(p<=a1)\n {\n if(a2<=b1 && b3<=b1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n if(p<=b1)\n {\n if(a2<=a1 && b3<=a1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n p=b2+b3;\n if(p<=a1)\n {\n if(a2<=b1 && a3<=b1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n if(p<=b1)\n {\n if(a2<=a1 && a3<=a1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n\n printf(\"NO\\n\");\n return 0;\n }\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "aca5a436c22002283770d84276ccbea5", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#define max(a,b) (((a)>(b))?(a):(b))\n\nint a1,a2,a3,b1,b2,b3;\n\n\nint main()\n\n{\n\tscanf(\"%d %d\",&a1, &b1);\n\t\n\tscanf(\"%d %d\",&a2, &b2);\n\t\n\tscanf(\"%d %d\",&a3, &b3);\n\t\n\tif((a2+a3<=a1 && max(b2,b3)<=b1 )|| (a2+b3<=a1 && max(b2,a3)<=b1 ) || (b2+a3<=a1 && max(a2,b3)<=b1 )|| (b2+b3<=a1 && max(a2,a3)<=b1 )|| (b2+a3<=b1 && max(a2,b3)<=a1 )|| (a2+b3<=b1 && max(b2,a3)<=a1 ) || (a2+a3<=b1 && max(b2,b3)<=a1 ) || (b2+b3<=b1 && max(a2,a3)<=a1 ) ) \n\tprintf(\"YES\");\n\t\n\telse printf(\"NO\");\n\t\n\treturm 0;\n\t\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "65a9fa737842f03877f8875745e83a6a", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef struct {\n double a;\n double b;\n}rectangle;\n\nint main(void)\n{\n int isOk = 0;\n rectangle Board, A, B, case1, case2;\n scanf(\"%f %f %f %f %f %f\", &Board.a, &Board.b, &A.a, &A.b, &B.a, &B.b);\n //A1 B1\n if(A.a + B.a <= Board.a && B.b <= Board.b) isOk = 1;\n if(A.a + B.b <= Board.a && B.a <= Board.b) isOk = 1;\n //A1 B2\n if(A.b + B.b <= Board.b && B.a <= Board.a) isOk = 1;\n if(A.b + B.a <= Board.b && B.b <= Board.a) isOk = 1;\n //A2 B1\n if(A.a + B.a <= Board.b && B.b <= Board.a) isOk = 1;\n if(A.a + B.b <= Board.b && B.a <= Board.a) isOk = 1;\n //A2 B2\n if(A.b + B.b <= Board.a && B.a <= Board.b) isOk = 1;\n if(A.b + B.a <= Board.a && B.b <= Board.b) isOk = 1;\n Sb = B.a * B.b\n case1.a = Board.a - A.a;\n case1.b = Board.b - A.b;\n case2.a = Board.a - A.b;\n case2.b = Board.b - A.a;\n \n if(case1.a * Board.b >= Sb || case1.b * Board.a >= \n if(A.a > Board.a && A.a > Board.b || A.b > Board.a && A.b > Board.b) isOk = 0;\n if(B.a > Board.a && B.a > Board.b || B.b > Board.a && B.b > Board.b) isOk = 0;\n if(isOk) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n } ", "lang_cluster": "C", "compilation_error": true, "code_uid": "2bc05311ce8a09eff8795dd53aa86bdd", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint min(int a,int b){\n if(a<=b)\n return a;\n else\n return b;\n}\nint max(int a,int b){\n if(a<=b)\n return b;\n else\n return a;\n}\n\nint main()\n{\n int a1,a2,b1,b2,a,b,k;\n scanf(\"%d%d\",&a,&b);\n scanf(\"%d%d\",&a1,&b1);\n scanf(\"%d%d\",&a2,&b2);\n int x=max(a1,b1);\n int y=a1+(b1-x);\n int x1=max(a2,b2);\n int y2=a2+(b2-x1);\n int z=max(a,b);\n k=a+(b-z);\n if(x+x1<=z&&max(y,y2)<=k||x+x1<=k&&max(y,y2)<=z)\n printf(\"YES\");\n else if(x+y2<=z&&max(x1,y)<=k||x+y2<=k&&max(x1,y)<=z)\n printf(\"YES\");\n else if(y+x1<=z&&max(x,y2)<=k||x+y2<=k&&max(x1,y)<=z)\n printf(\"YES\");\n else if(y+y2<=z&&max(x,x1)<=k||y+y2<=k&&max(x,x1)<=z)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "cd472a051f226c39910b3a3b48c9dcc7", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nchar *to_string(int n)\n{\n\tchar a[10000];\n\tchar tempt[10000];\n\tint count = 0;\n\twhile(n > 0){\n\t\ttempt[count] = n % 10;\n\t\tn /= 10;\n\t\tcount++;\n\t}\n\tint x = count;\n\tfor(int i = 0; i < count; i++){\n\t\ta[i] = tempt[x-1] + '0';\n\t\tx--;\n\t}\n\treturn a;\n}\n\nint main()\n{\n\tint k;\n\tscanf(\"%d\", &k);\n\tchar number[10005];\n\tfor(int i = 1; i <= k; i++){\n\t\tstrcat(number, to_string(i));\n\t}\n\tprintf(\"%c\\n\", number[k]);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "66496348321947294eb5cf0433600ce4", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n long long int n = 1;\n long long int k;\n long long int quo = 1;\n long long int i = -1, j = 0;\n long long int arr[10000];\n long long int counter = 0;\n\n scanf(\"%d\", &k);\n\n quo = k;\n\n while(i <= k){\n quo = n;\n counter = 0;\n while(quo != 0){\n quo = quo / 10;\n counter++;\n// printf(\"%d \", counter);\n }\n\n// printf(\"\\n\");\n\n quo = n;\n\n for(j=i+counter;j>i;j--){\n arr[j] = quo % 10;\n quo = quo / 10;\n }\n n++;\n i = i + counter;\n }\n\n printf(\"%d\", arr[k-1]);\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "288785da0fb01c153b8506a0834ebfe1", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n int i,count=0,j;\n scanf(\"%d\",&n);\n\n int a[n];\n\n for(i=1,j=1;i<=n;i++,j++)\n {\n if(i<10)\n {\n a[j]=i;\n count++;\n }\n else if(i>9 && i<100)\n {\n a[j]=i/10;\n a[j+1]=i%10;\n j=j+1;\n count+=2;\n }\n else if(i>=100)\n {\n a[j]=i/100;\n a[j+1]=(i%100)/10;\n a[j+2]=(i%100)%10;\n\n j=j+2;\n\n count+=3;\n }\n\n\n if(count==n)\n break;\n\n }\n //for(i=1;i<=n;i++)\n //printf(\"%d \",a[i]);\n\n printf(\"%d\",a[n]);\n\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1dd7f6a57e0a41bb484d806baa972294", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n int i,count=0,j;\n scanf(\"%d\",&n);\n\n int a[2*n];\n\n for(i=1,j=1;i<=n;i++,j++)\n {\n if(i<10)\n {\n a[j]=i;\n count++;\n }\n else if(i>9 && i<100)\n {\n a[j]=i/10;\n a[j+1]=i%10;\n j=j+1;\n count+=2;\n }\n else if(i>=100)\n {\n a[j]=i/100;\n a[j+1]=(i%100)/10;\n a[j+2]=(i%100)%10;\n\n j=j+2;\n\n count+=3;\n }\n\n\n if(count==n)\n break;\n\n }\n //for(i=1;i<=n;i++)\n //printf(\"%d \",a[i]);\n\n printf(\"%d\",a[n]);\n\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "74983d02a5543b2ac3c4c13f2d7a9a8c", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1ec07c9a0b26f261a0b8ca9ded831758", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n char s[100];\n int j;\n scanf(\"%s\",s);\n int k=strlen(s)-1;\n for(int i=0;i<=k;i++)\n {\n if(s[i]!='a'&&s[i]!='e'&&s[i]!='o'&&s[i]!='u'&&s[i]!='i'&&s[i]!='n')\n { \n if(s[i+1]=='a'||s[i+1]=='e'||s[i+1]=='i'||s[i+1]=='o'||s[i+1]=='u')\n {\n j=1;\n }\n else\n {\n j=0;\n break;\n }\n }\n else\n j=1;\n }\n if(j==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2f4f24a4caafa4e4f8997f7f5183a8d", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tint i,b=0;\n\tchar c[100];\n\tgets(c);\n\tfor(i=0;i\n#include\n\nchar s[100];\n\nint main(){\n\tscanf(\"%s\",s);\n\tint l=strlen(s);\n\tbool f=true;\n\tfor (int i=0;i //romaji\n#include\nint i=0,j=0,flag=1;\nint h(char s)\n{\n if(i<2)\n {\n if(s=='a'|| s=='e'|| s=='i'|| s=='o'|| s=='u' )\n {\n i=0;\n flag=1;\n }\n else if(s=='n')\n {\n if(flag==1)\n {i=0;\n flag=1;\n }\n else i=i+1;\n }\n else{\n i=i+1;\n flag=0;\n }\n\n}\nelse{\n printf(\"NO\");\n i=0;\n exit(0);\n}\nreturn i;\n}\nint main()\n{ int a=1,c=0;\nchar d;\n for(int i=0;i<101;i++)\n {\n scanf(\"%c\",&d);\n c=h(d);\n if(d==' '||d=='\\n')\n {\n c=h(d);\n break;\n }\n\n }\n if(c\n {\n printf(\"YES\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "04349b147d4c5b2f95cd9758daf3262a", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n\tchar s[100];\n \tint i,n,x,y,z;\n \tscanf(\"%s\", s);\n \tn=0;\n \tfor (i=0;i\n#include\n#include\nint main()\n{\n\n int g[4][4];\n int i=0,j=0,k=0;\n int rubble;\n scanf(\"%d\",&rubble);\n for(i=0;i<4;++i)\n {\n for(j=0;j<4;++j)\n {\n scanf(\"%d\",&g[i][j]);\n }\n // scanf(\"\\n\");\n }\n\n int flag=0;\n char c=getchar();\n\n for(i=0;i<4;++i)\n {\n for(j=0;j<2;++j)\n {\n k=j+2;\n if((g[i][j]+g[i][k])<=rubble)\n {\n\n\n printf(\"%d %d %d\\n\",i+1,g[i][j],(rubble-g[i][k]);\n flag=1;\n break;\n }\n if (flag==1)\n break;\n }\n\n\n\n }\n if(flag==0)\n printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2ee3d0bb4b6826e19bb8448491b6ec9c", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nlong long min(long long a,long long b)\n{\n if(a>=b)\n return b;\n else\n return a;\n}\nstruct guard{\n long long c1,b1,c2,b2;\n};\nint main()\n{\n long long n,minc,minb,i=1,p,k;\n guard sanjay;\n scanf(\"%lld\",&n);\n k=4;i=1;\n while(k--)\n {\n p=1;\n scanf(\"%lld%lld%lld%lld\",&sanjay.c1,&sanjay.b1,&sanjay.c2,&sanjay.b2);\n minc=min(sanjay.c1,sanjay.b1);\n minb=min(sanjay.c1,sanjay.b2);\n if(minc+minb<=n)\n {\n p=2;\n printf(\"%lld %lld %lld\",i,minc,n-minc);\n return 0;\n }\n else\n {\n i++;\n continue;\n }\n }\n if(p==1)\n printf(\"-1\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9c60cab79e37490ec5eaa2685759488f", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint min(int a, int b){return a\n#include \n\nint main()\n{\n int T[4][4],i,j,n;\n scanf(\"%d\", &n);\n for(i=0;i<4;i++)\n for(j=0;j<4;j++)\n {scanf(\"%d\",&T[i][j]);\n if(T[i][j]==0) T[i][j]++; \n }\n for(i=0;i<4;i++)\n {\n \n if( T[i][0]+T[i][2]<=n) \n {\n printf(\"%d %d %d\",i+1,T[i][0],n-T[i][0]);return 0;\n \n }\n \n if( T[i][0]+T[i][3]<=n) \n {\n printf(\"%d %d %d\",i+1,T[i][0],n-T[i][0]);\n return 0;}\n if( T[i][1]+T[i][2]<=n) \n {\n printf(\"%d %d %d\",i+1,T[i][1],n-T[i][1]);\n return 0;\n }\n \n if( T[i][1]+T[i][3]<=n) \n {\n printf(\"%d %d %d\",i+1,T[i][1],n-T[i][1]);\n return 0;\n }\n \n }\n \n }\n printf(\"-1\");\n \n \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cf5b544126511c3ff2061bf09aafccd4", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() \n{\n\tint rub, a, b, c, d;\n\t\n\tscanf(\"%d\", &rub);\n\t\n\tfor (int i = 1; i < 5; i++)\n\t{\n\t\tscanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\t\tif (rub - a >= c)\n\t\t{\n\t\t\tprintf(\"%d %d %d\", i, a, rub - a);\n\t\t\treturn 0;\n\t\t}\n\t\tif (rub - a >= d)\n\t\t{\n\t\t\tprintf(\"%d %d %d\", i, a, rub - a);\n\t\t\treturn 0;\n\t\t}\n\t\tif (rub - b >= c)\n\t\t{\n\t\t\tprintf(\"%d %d %d\", i, b, rub - b);\n\t\t\treturn 0;\n\t\t}\n\t\tif (rub - c >= d)\n\t\t{\n\t\t\tprintf(\"%d %d %d\", i, b, rub - b);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d3469a6abcd1df3c35ac00e83593d5f7", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f46f951e1cf919e3bab508fed0a4814", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main(int argc, const char * argv[])\n{\n int n, i1=1, i2, found = 0, sum, nsquare, i, j, k, hypothenuse;\n scanf(\"%d\",&n);\n if (n<5)\n {\n printf(\"0\");\n return 0;\n }\n if (n<5)\n {\n printf(\"1\");\n return 0;\n }\n\n for (i = 5; i<=n; i++)\n {\n i1 = 1;\n i2 = i-1;\n nsquare = i*i;\n while (1)\n {\n sum = i1*i1 + i2* i2;\n if (sum > nsquare)\n i2--;\n else if (sum < nsquare)\n i1++;\n else\n {\n found++;\n i2--;\n i1++;\n }\n if (i2\n#include \n#include \n\nint isInt(float);\n\nint main()\n{\n int n,a,b,result=0;\n float c;\n do {scanf(\"%d\",&n);}\n while(n<1&&n>100000);\n for (a=1;a<=n;a++)\n {\n for (b=1;b<=a;b++)\n {\n c = sqrt(pow(a,2)+pow(b,2));\n if (c>n)\n break ;\n else if (c==n)\n {\n result++;\n break;\n }\n else if (isInt(c))\n result++;\n }\n }\n printf(\"%d\",result);\n}\n\nint isInt (int x)\n{\n int q;\n\n q=(int)x;\n\n q++;\n\n if((q - x) != 1)\n return 0;\n else\n return 1;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "896187078d6483cc945f2fa1af9b53fb", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include \n#include\n#define getcx getchar_unlocked\n\nvoid inp(int* n)\n{\n\t*n=0;\n\tint ch=getcx();int sign=1;\n\twhile( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();}\n\t \n\twhile( ch >= '0' && ch <= '9' ){\n\t\t*n = ((*n)<<3)+((*n)<<1) + ch-'0', ch=getcx();}\n\t*n=(*n)*sign;\n}\n\n\n\nint ar[10000009]={0};\n\nint main()\n{\n\tint n,i;\n\tchar c[100];\n\tscanf(\"%s\",c);\n\tsscanf(c,\"%d\",&n);\n\tint p;\n\tp=n;\n\tn=n*n;\n\tfor(i=1;i<=p;i++)\n\t\tar[i*i]=1;\n\tint s=0,j,k;\n\tfor(i=1;i<=p;i++)\n\t{\n\t\tfor(j=i;j<=p;j++)\n\t\t{\n\t\t\tif(ar[i*i+j*j]==1)\n\t\t\t\ts++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",s);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c83f094511132e096a45675e613768c2", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main ()\n{\nint a,b,i,j,count=0;\nclrscr();\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\nfor(i = 1; i<=a;i++)\n{\nfor(j =1; j<=b;j++)\n{\nif((i+j)%5==0)\n{\ncount++;\n}\n}\n}\nprintf(\"%d\",count);\nreturn 0 ;\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d016c1beb6e29e3729f475e350a284f", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int n,m,count=0;\n int diff;\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\nint main()\n{\n long long int n,m,sum=0;\n scanf(\"%lld%lld\",&n,&m);\n for(int i=1;i<=n;i++)\n\t{\n sum=sum+(m+i)/5;\n if(i>=5)\n sum=sum-i/5;\n }\n printf(\"%lld\\n\",sum);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d138d7d9a8b7a3c0a5bae5b1018aef10", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n long long int i,j,m,n,count=0,baki,position,lagbe,aro;\n\n scanf(\"%I64d %I64d\",&n,&m);\n\n for(i=1; i<=n; i++)\n {\n position=i%5;\n lagbe=5-position;\n\n if(lagbe<=m){\n\n baki=m-lagbe;\n aro=baki/5;\n count+=aro+1;\n }\n printf(\"%I64d\\n\",count);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf83c57cf30d280cb8a00046ce81cb41", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n while(1)\n {\n if(a==0||b==0)\n break;\n if(a>=2*b)\n a=a-2*b;\n else if(b>=2*a)\n b=b-2*a;\n else\n break;\n }\n printf(\"%d %d\",a,b);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "542f155a6a27a0faeab79c958cd248b8", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if (a==0||b==0)\n return(0);\n while (a>0 && b>0)\n {\n if (a>=2*b)\n {\n a=%2*b;\n continue;\n }\n if (b>=2*a)\n {\n b=%2*a;\n continue;\n }\n else\n {\n printf(\"%lld %lld\",a,b);\n return(0);\n }\n }\n printf(\"%lld %lld\",a,b);\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e17de37169395c5d6622bd6b9d2d8f84", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\ntypedef long long ll;\nint main()\n{ \n ll a,b;scanf(\"%I64d%I64d\",&a,&b);\n ll x=b;\n` while(a!=0||b!=0)\n if(a>=2*b) a=a-2*b;\n else if(b>=2*a) b=b-2*a;\n else break;\n }\n }\n printf(\"%I64d %I64d\",a,b);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "04df874f12ce4c99e6cd529bd8f0fb86", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n long long a,b;\n scanf(\"%lld%lld\",&a,&b);\n while( a!=0 && b !=0)\n {\n if(a>=(2*b))\n {\n a=a%(2*b);\n continue;\n\n }\n else if(b>=(2*a) )\n {\n b=b%(a*2);\n continue;\n }\n else break;\n }\n printf(\"%lld %lld\",a,b);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ec232e3dbc09d1d64e7643a55b94504", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\nint a,b,i,j;\nscanf(\"%d %d\",&a,&b);\nLOOP:if((a==0)||(b==0))\nexit(0);\nelse \n{if(a>=(2*b))\n{\na=a%(2*b); goto LOOP;}\nelse \n{if(b>=2*a){b=b%(2*a);\ngoto LOOP;}\nelse goto FINAL;}\nFINAL:printf(\"%d %d\",a,b);\nreturn 0;\n\n\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7598bd5f8eb0654a4eb1091f4fd91a55", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\t\tint n, s[1000]\n\t\tif (n == 1) {\n\t\t\tif (s[0]==0)\n\t\t\tprintf(\"No\");\n\t\t\telse printf(\"Yes\");\n\t\t\treturn 0;\n\t\t}\n\t\tfor (int i=1; i\n#include\n#include\n\nint main(void)\n{\n\nint n;\nscanf(\"%d\",&n);\n\nchar*s=malloc(sizeof(char)*(n+1));\nscanf(\"%s\",s);\n\n\nint i,c=0;\nif(s[0]=='1')\nc=1;\n\nif(c==1)\n{\nfor(i=0;i\n\nmain()\n{\n int i, s, flag= 1, count= 0;\n scanf(\"%i\", &s);\n char str[s+1], c;\n scanf(\"%s\", str);\n\n for(i=0; i\nint main()\n{\n int n,i,flag=1;\n scanf(\"%d\",&n);\n char str[n];\n getchar();\n gets(str);\n for(i=;i #include unsigned long long int main() { int n,s=0,max,i; scanf(\"%lld\",&n); scanf(\"%lld\",&max); for(i=1;i<=n;i++) { if(i%2==0) s=s*10; else s=s*10 +1; } if(max==s && n%2==1) printf(\"yes\"); else if((n%2==0) &&max==(s/10) || max==s || max==(pow(10,n)+s/100) ||max==((s/100)*100 +1)) printf(\"yes\"); else printf(\"no\"); return 0; }", "lang_cluster": "C", "compilation_error": true, "code_uid": "0f71e93216332c0375a5d81953da6d8a", "src_uid": "c14d255785b1f668d04b0bf6dcadf32d", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "//324B.c\n#include\n#include\n\nint m=1000000007;\n\nint power(int a,int b,int c)\n{\n if(b==0)\n return 1;\n else if(b==1)\n return a%c;\n else\n return (power(a,b/2)%c* power(a,b-b/2)%c)%c;\n \n}\nint main()\n{\n // int ans = power(2,3);\n // printf(\"%d\",ans);\n\n int n,number,total,extra,ans,divisor;\n scanf(\"%d\",&n);\n\n number=3*n;\n \n total=power(3,number,m);\n\n //calcualting when = 6\n\n extra=power(7,n,m);\n\n ans= (total-extra)%m;\n \n \n printf(\"%d\",ans);\n\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "039983ef89b6fece8ffd1f5b0ec0740d", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(void){\n int n\n long long int p,w;\n scanf(\"%d\",&n);\n p=27;\n w=7;\n for(int i=1;iw) printf(\"%d\",p-w);\n else printf(\"-1\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "70ab5ff9e9ed691e0036f39ca95c0c38", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int i,m=1000000007,n,t=1,a[100001],b=1;\n scanf(\"%lld\",&n);\n for(i=0;i<3*n;i++)\n {\n t=(t*3)%m;\n }\n for(i=1;i<=n;i++)\n {\n b=(b*7)%m;\n }\n printf(\"%lld\",(t-b));\n return 0;\n}#include\nint main()\n{\n long long int i,m=1000000007,n,t=1,a[100001],b=1;\n scanf(\"%lld\",&n);\n for(i=0;i<3*n;i++)\n {\n t=(t*3)%m;\n }\n for(i=1;i<=n;i++)\n {\n b=(b*7)%m;\n }\n printf(\"%lld\",(t-b+m)%m);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1dcd984e8311540ec22108a0ac7186f0", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include \n#define L long long\nconst L mod = 1e9+7;\nusing namespace std;\nint Qpower(L a, L n)\n{\n L ans = 1;\n while (n){\n if (n & 1) ans *= a;\n a *= a;\n n >>= 1;\n }\n\n return ans;\n}\nint main(void)\n{\n L ans, n;\n\n scanf(\"%I64d\",&n);\n ans = (Qpower(3,3*n) - Qpower(7,n)) % mod;\n printf(\"%I64d\\n\",ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bac8b75d259ac3101f2bfbd654428309", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(void){\n long long int n,p,w;\n scanf(\"%lld\",&n);\n p=27;\n w=7;\n for(int i=1;iw) printf(\"%lld\",p-w);\n else printf(\"%lld\",1000000007+p-w);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f07ba21d94daa2d15fe1dfe236e6a87", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#includeabs(y1-y2)){\n p=abs(x1-x2)-abs(y1-y2);\n d=abs(y1-y2)+p;\n }\n else{\n p=abs(y1-y2)-abs(x1-x2);\n d=abs(x1-x2)+p;\n }\n printf(\"%d\",d);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "47f653e1893f561549a22407efb108ae", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\nint x1,y1,x2,y2,k;\ncin >> x1 >> y1 >> x2 >> y2;\nif(abs(x1-x2) >= abs(y1-y2)) k = abs(x1-x2);\nelse k = abs(y1-y2);\ncout << k;\t\n\n\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1db52321d19412e6c22285b45b03477a", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n int x1,x2,y1,y2;\n scanf(\"%d %d\",&x1,&y1);\n scanf(\"%d %d\",&x2,&y2);\n if (abs(x2-x1)>= abs(y2-y1)){\n printf(\"%d\\n\", abs(x2-x1));\n }else{\n printf(\"%d\\n\",abs(y2-y1));\n }\n\n return 0;\n}\n// 1459769870835", "lang_cluster": "C", "compilation_error": true, "code_uid": "340b34ee4a157dd4a22faaa7833861ae", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \"iostream\"\n#include \"math\"\nusing namespace std;\n\nint main()\n{\nint x1,y1,x2,y2,k;\ncin >> x1 >> y1 >> x2 >> y2;\nif(abs(x1-x2) >= abs(y1-y2)) k = abs(x1-x2);\nelse k = abs(y1-y2);\ncout << k;\t\n\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1239253881e52c6c460bf896c8c63edd", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n signed int a,b,c,d,e,m,n,i,j,k;\n scanf(\"%d %d\",&a,&b);\n scanf(\"%d %d\",&c,&d);\n if((c-a)==(d-b))\n e=c-a;\n else if((c-a)>(d-b))\n e=(d-b)+((c-a)-(d-b));\n else if((c-a)<(d-b))\n e=(c-a)+((d-b)-(c-a));\n \n printf(\"%d\\n\",e);\n \nreturn 0;\n} \n }\n \n if(c<0&&d<0){\n m=(0-c)+(a-0);\n n=(0-d)+(b-0);\n if(m==n)\n e=m;\n else if(m>n)\n e=n+(m-n);\n else if(m\n#include\nint len;\nchar ph[51];\nlong dp[51][10];\n\nlong f(int pos,int val)\n{\n if(dp[pos][val]!=0)\n return dp[pos][val];\n \n int sum = val+ph[pos+1]-'0';\n \n if(pos==len-2)\n {\n \t dp[pos][val]=sum%2==0?1:2;\n \t return dp[pos][val];\n\t }\n long c=0; \n if(sum%2==0)\n c= f(pos+1,sum/2);\n\t else\n\t c=f(pos+1,sum/2)+f(pos+1,sum/2+1);\n\t \n dp[pos][val]=c;\n \n \n return c;\n \n}\nint main()\n{\n\t\n\tscanf(\"%s\",ph);\n\tlen=strlen(ph);\n\tint i,check=1;\n\tlong c=0;\n\tfor(i=0;len!=1&&i<=9;i++)\n\t{ c+= f(0,i);\n\t} \n\t \n/*\tfor(i=0;i\n#include \n\nint main(void) {\n char s[51];\n long long a[50][10];\n long long ans = 0;\n int i, j, l;\n for (j = 0; j < 10; j++) a[0][j] = 1;\n scanf(\"%s\", s);\n l = strlen(s);\n\n for (i = 1; i < l; i++) {\n for (j = 0; j < 10; j++) {\n long long x = 0;\n int d0 = 2 * j - s[i] + '0';\n int k;\n for (k = -1; k <= 1; k++) {\n int d1 = d0 + k;\n if (0 <= d1 && d1 < 10) x += a[i-1][d1];\n }\n a[i][j] = x;\n // printf(\"a[%d][%d] = %d\\n\", i, j, a[i][j]);\n }\n }\n\n for (j = 0; j < 10; j++) ans += a[l-1][j];\n\n for (i = 1; i < l; i++) {\n int d = s[i-1] - s[i];\n if (d < -1 || 1 < d) {ans++; break;}\n }\n ans--;\n\n printf(\"%lld\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "13ac8cacfff9d62dd00c761116cf23f8", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint len;\nchar ph[51];\nlong dp[51][10];\n\nlong f(int pos,int val)\n{\n if(dp[pos][val]!=0)\n return dp[pos][val];\n \n int sum = val+ph[pos+1]-'0';\n \n if(pos==len-2)\n {\n \t dp[pos][val]=sum%2==0?1:2;\n \t return dp[pos][val];\n\t }\n long c=0; \n if(sum%2==0)\n c= f(pos+1,sum/2);\n\t else\n\t c=f(pos+1,sum/2)+f(pos+1,sum/2+1);\n\t \n dp[pos][val]=c;\n \n \n return c;\n \n}\nint main()\n{\n\t\n\tscanf(\"%s\",ph);\n\tlen=strlen(ph);\n\tint i,check=1;\n\tlong c=0;\n\tfor(i=0;i<=9;i++)\n\t{ c+= f(0,i);\n\t} \n\t \n/*\tfor(i=0;i\n#include\nint len;\nchar ph[51];\nlong dp[51][10];\n\nlong f(int pos,int val)\n{\n if(dp[pos][val]!=0)\n return dp[pos][val];\n \n int sum = val+ph[pos+1]-'0';\n \n if(pos==len-2)\n {\n \t dp[pos][val]=sum%2==0?1:2;\n \t return dp[pos][val];\n\t }\n long c=0; \n if(sum%2==0)\n c= f(pos+1,sum/2);\n\t else\n\t c=f(pos+1,sum/2)+f(pos+1,sum/2+1);\n\t \n dp[pos][val]=c;\n \n \n return c;\n \n}\nint main()\n{\n\t\n\tscanf(\"%s\",ph);\n\tlen=strlen(ph);\n\tint i,check=1;\n\tlong c=0;\n\tfor(i=0;len!=1&&i<=9;i++)\n\t{ c+= f(0,i);\n\t} \n\t \n/*\tfor(i=0;i\n#include \n#define MAXN 55\nlong n,ls;\nchar s[MAXN]={'\\0'};\nlong a[MAXN]={0},p[MAXN][10]={0};\nlong long f[MAXN][10]={0},ans=0;\nvoid dfs(long now,long b)\n{\n if(p[now][b]) return;\n p[now][b]=1;\n if(now==n-1)\n {\n if(((a[now+1]+b)&1)) f[now][b]=2;\n else f[now][b]=1;\n }\n else\n {\n if(((a[now+1]+b)&1))\n {\n dfs(now+1,((a[now+1]+b)>>1));\n dfs(now+1,((a[now+1]+b)>>1)+1);\n f[now][b]=f[now+1][((a[now+1]+b)>>1)]+f[now+1][((a[now+1]+b)>>1)+1];\n }\n else\n {\n dfs(now+1,((a[now+1]+b)>>1));\n f[now][b]=f[now+1][((a[now+1]+b)>>1)];\n }\n }\n}\nint main()\n{\n long i,j,k;\n gets(s);ls=strlen(s)-1;if(s[ls]=='\\n') s[ls--]='\\0';\n n=ls+1;\n for(i=1;i<=n;i++) a[i]=s[i-1]-'0';\n for(i=0;i<=9;i++) \n {dfs(1,i);ans+=f[1][i];}\n for(i=2;i<=n;i++)\n if(((a[i-1]+a[i])>>1)!=a[i] && (((a[i-1]+a[i])>>1)+1)!=a[i])\n break;\n if(i==n+1) ans--; \n printf(\"%I64d\\n\",ans);\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "29f66ce634907f13043b1c35db9dafb3", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n long long int n;\n scanf(\"\\n%I64d\",&n);\n long long int maxSq=sqrt(n);\n long long int sox,tmp;\n long long int i,j,ans;\n int flag=0;\n for(j=1;j<=maxSq;j++)\n {\n i=j*j;\n sox=0;\n tmp=i;\n while(tmp!=0)\n {\n sox=sox+tmp%10;\n tmp=tmp/10;\n }\n if((ans=(i+(sox*j)-n))==0)\n {\n printf(\"%I64d\\n\",j);\n flag=1;\n break;\n }\n }\n if(n==8)\n {\n printf(\"2\\n\");\n break;\n }\n\n if(flag==0)\n {\n printf(\"-1\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bf8198959a899c01337c916abd15c148", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "{\n long long int n,j,k,l,u,mod,i,t,o,p;\n scanf(\"%I64d\",&n);\n i=sqrt(n);\n \n if((i*i)==n)\n {\n j=i-1;\n }\n else \n j=i;\n \n u=j;\n while(u>0)\n {\n mod=u%10;\n k+=mod;\n u/=10;\n }\n for(o=j;o*o<=n,o>0;o--)\n {\n \n l=(o*o+o*k);\n \n if(l==n)\n {\n printf(\"%I64d\",o);\n break;\n }\n else if(l\n #include\n \n long long s(long long n);\n \n int main()\n {\n long long n, x, mid;\n scanf(\"%I64d\", &n);\n long long lowb=sqrt(n)-82, ub=sqrt(n)+1;\n for(;lowb<=ub;lowb++)\n {\n if(lowb*lowb+s(lowb)*lowb==n&&lowb>0)\n {\n printf(\"%I64d\\n\", lowb); #include\n #include\n \n long long s(long long n);\n \n int main()\n {\n long long n, x, mid;\n scanf(\"%I64d\", &n);\n long long lowb=sqrt(n)-82, ub=sqrt(n)+1;\n for(;lowb<=ub;lowb++)\n {\n if(lowb*lowb+s(lowb)*lowb==n&&lowb>0)\n { #include\n #include\n \n long long s(long long n);\n \n int main()\n {\n long long n, x, mid;\n scanf(\"%I64d\", &n);\n long long lowb=sqrt(n)-82, ub=sqrt(n)+1;\n for(;lowb<=ub;lowb++)\n {\n if(lowb*lowb+s(lowb)*lowb==n&&lowb>0)\n {\n printf(\"%I64d\\n\", lowb);\n lowb=0;\n break;\n }\n }\n if(lowb)\n printf(\"-1\\n\");\n return 0;\n }\n \n long long s(long long n)\n {\n long long i=0;\n while(n)\n i+=n%10, n/=10;\n return i;\n }\n printf(\"%I64d\\n\", lowb);\n lowb=0;\n break;\n }\n }\n if(lowb)\n printf(\"-1\\n\");\n return 0;\n }\n \n long long s(long long n)\n {\n long long i=0;\n while(n)\n i+=n%10, n/=10;\n return i;\n }\n lowb=0;\n break;\n }\n }\n if(lowb)\n printf(\"-1\\n\");\n return 0;\n }\n \n long long s(long long n)\n {\n long long i=0;\n while(n)\n i+=n%10, n/=10;\n return i;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "3ca5bcc296a948a62d55ebe9c9fdb0de", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nconst double e=0.00000001;\n\nint digs(int64 a){\n int r=0;\n while (a) {\n r+=a%10;\n a/=10;\n }\n return r;\n}\n\nint clear(int64 n){\n int x=(int)sqrt(n+e);\n return ((int64)x*x==n);\n}\n\nint main()\n{\n int64 n;\n scanf(\"%I64d\",&n);\n n*=4;\n int x; int t;\n for (t=1;t<153; t++){\n if (clear(n+t*t)){\n x=(sqrt(t*t+n+e)-t)/2;\n if (t==digs(x)){\n printf(\"%d\",x);\n return 0;\n }\n }\n }\n printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7c70ea5a3c1b4e6af3fd8692bb3b9301", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define ll long long\nll n;\nbool find_roots(ll s)\n{\n if(sqrt(s*s+4*n)*sqrt(s*s+4*n)==(s*s+4*n))\n {\n ll root1=-s+(sqrt(s*s+4*n));\n if(!(root1%2))\n {\n root1/=2;\n ll count=0;\n ll r=root1;\n while(root1)\n {\n count+=(root1%10);\n root1/=10;\n }\n if(count==s)\n {\n printf(\"%lld\\n\",r);\n return true;\n }\n }\n }\n return false;\n}\nint main()\n{\n ll i,j,k;\n scanf(\"%lld\",&n);\n for(i=0;i<=90;i++)\n {\n if(find_roots(i))\n return 0;\n }\n printf(\"-1\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "35bb3678b7ef1a1e1a4679bba1700456", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n double a,b;\n char in[10];\n scanf(\"%s\",in);\n a=((int)(in[0]-'0')*10)+((int)(in[1]-'0'));\n b=((int)(in[3]-'0')*10)+((int)(in[4]-'0'));\n double c;\n if(a==12)a=0;\n c=b/60;\n b=b*6;\n a=a*30+c*30;\n printf(\"%lf %lf\",a,b);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "625790f755a4e8c7137c1a9bd6f79e39", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint a1,b1,a,b,i;\n\tchar s;\n\tfor(i=1;i<6;i++)\n\t{\n\tscanf(\"%d%c%d\",&a1,&s,&b1);\n\tif(a1<12)\n\t{a=(a1+1.0*b1/60)*30;\n\tb=b1*6;\n if(b1%2==1)\n\t{\n\t\tprintf(\"%d\",a);\n\t\tprintf(\".5\");\n\t\tprintf(\" %d\\n\",b);\n\t}\n\telse printf(\"%d %d\\n\",a,b);\n\t}\n\t\n\telse if(a1<=23)\n\t{a1-=12;a=(a1+1.0*b1/60)*30;\n\tb=b1*6;\n if(b1%2==1)\n\t{\n\t\tprintf(\"%d\",a);\n\t\tprintf(\".5\");\n\t\tprintf(\" %d\\n\",b);\n\t}\n\telse printf(\"%d %d\\n\",a,b);}\n\t\n\telse\n\t{\n\t\ta=1.0*b1/60*30;\n\t\tif(b1%2==1)\n\t\t{\n\t\t\tprintf(\"%d\",a);\n\t\t\tprintf(\".5\");\n\t\t\tprintf(\" %d\\n\",b);\n\t\t}\n\t\telse \n\t\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\t}\n}\n\n\t \t\t \t\t\t\t\t \t \t \t\t\t \t \t\t", "lang_cluster": "C", "compilation_error": false, "code_uid": "512f454e17a54b8b32fbaeaba2b245a4", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint a1,b1,a,b;\n\tchar s;\n\tscanf(\"%d%c%d\",&a1,&s,&b1);\n\tif(a1<12)\n\t{a=(a1+1.0*b1/60)*30;\n\tb=b1*6;\n if(b1%2==1)\n\t{\n\t\tprintf(\"%d\",a);\n\t\tprintf(\".5\");\n\t\tprintf(\" %d\\n\",b);\n\t}\n\telse printf(\"%d %d\\n\",a,b);\n\t}\n\t\n\telse if(a1<=23)\n\t{a1-=12;a=(a1+1.0*b1/60)*30;\n\tb=b1*6;\n if(b1%2==1)\n\t{\n\t\tprintf(\"%d\",a);\n\t\tprintf(\".5\");\n\t\tprintf(\" %d\\n\",b);\n\t}\n\telse printf(\"%d %d\\n\",a,b);}\n\t\n\telse\n\t{\n\t\ta=1.0*b1/60*30;\n\t\tif(b1%2==1)\n\t\t{\n\t\t\tprintf(\"%d\",a);\n\t\t\tprintf(\".5\");\n\t\t\tprintf(\" %d\\n\",b);\n\t\t}\n\t\telse \n\t\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n}\n\n\t \t \t \t\t \t \t \t\t \t \t", "lang_cluster": "C", "compilation_error": false, "code_uid": "4141074d9e8f8b2245b3ecda2e857632", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int hou,min;\n float x,y;\n char c;\n scanf(\"%d%c%d\",&hou,&c,&min);\n if(hou < 12)\n { x=30*hou+min*0.5;\n y=min*6;\n }\n else\n {\n x=30*(hou-12)+min*0.5;\n y=min*6;\n }\n printf(\"%.1f %.0f\",x,y);\n}\n\n\t \t \t\t \t\t \t \t\t\t\t\t\t\t \t", "lang_cluster": "C", "compilation_error": false, "code_uid": "63eccbcac0d52fa75d6b0afcf36f582a", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int HH,MM,z,y;\n double x;\n scanf(\"%d%d\",&HH,&MM)\uff1b\n if (HH==12)\n z=0;\n else\n z=HH*30;\n x=z+(double)MM/2;\n y=MM*6;\n printf(\"%g %d\\n\",x,y);\n return 0;\n}\n\n\t\t \t \t \t \t \t\t\t \t \t\t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "62af813697beae0c09c8f5311860b2ab", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar A[101],B[] = \"CODEFORCES\",src[101],dest[11];\nint main(){\n\tscanf(\"%s\",A);\n\tint l=strlen(A),i,f=0,j=0,k,g=0,h;\n\tfor(i=0;i\n#include\nint main()\n{\n char st[101], c, o, d, e, l, in1 = 0,in2=0,f,r,s;\n scanf(\"%s\", st);\n l = strlen(st);\n for (c = 0; c < l&&!in1; c++)\n {\n if (st[c] == 'C')\n for (o = c + 1; o < l&&!in1; o++)\n {\n if (st[o] == 'O')\n for (d = o + 1; d < l&&!in1; d++)\n {\n if (st[d] == 'D')\n for (e = d + 1; e < l&&!in1; e++)\n {\n if (st[e] == 'E')\n {\n in1 = 1;\n break;\n }\n }\n if(e==l)\n {\n printf(\"NO\"); exit (0);\n }\n }\n if(d==l)\n {\n printf(\"NO\"); exit (0);\n }\n }\n if(o==l)\n {\n printf(\"NO\"); exit (0);\n }\n }\n for(f=e+1;f\n#include \nint main ()\n{\n char s [101],l,i,j;\n scanf (\"%s\",s);\n l=strlen (s);\n for (i=0;i \n#include\nchar A[101],B[] = \"CODEFORCES\",src[101],dest[11];\nint main(){\n\tscanf(\"%s\",A);\n\tint l=strlen(A),i,f=0,j=0,k,g=0,h;\n\tfor(i=0;i\n#include \n#include \n\nint main(){\nchar str[150];\nscanf(\"%s\",&str);\nchar s[10] = {'C','O','D','E','F','O','R','C','E','S'}; // 'C','O','D','E','F','O','R','C','E','S'\nint mass[10];\nint i;\nint q=0;\nfor(i = 0; i < strlen(str); i++){\nif(s[q]==str[i]){q++;}\nif(q==9) break;\n}\nif((q==9)&&(strlen(str)==0)) printf(\"YES\"); else printf(\"NO\");\nsystem(\"PAUSE\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "66bae98704c1602164e2c49e4277d2ef", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tint n, k;\n\tchar s[110];\n\tchar t[110];\n\tscanf(\"%d%d\", &n, &k);\n\tscanf(\"%s\", t);\n\tfor(int i = 0; i < n; i++) {\n\t\tif(t[i] == 'N')\n\t\t\tcontinue;\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\ts[j] = t[j];\n\t\t}\n\t\tif(i - k >= 0) {\n\t\t\tbool ok = 1;\n\t\t\tfor(int j = i - k; j < i; j++) {\n\t\t\t\tif(s[j] == 'Y')\n\t\t\t\t\tok = 0;\n\t\t\t\ts[j] = 'N';\n\t\t\t}\n\t\t\tif(i - k - 1 >= 0) {\n\t\t\t \tif(s[i - k - 1] == 'N')\n\t\t\t\t\tok = 0;\n\t\t\t\ts[i - k - 1] = 'Y';\n\t\t\t}\n\t\t\tint cnt = 0, mc = 0;\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(s[i] == 'N')\n\t\t\t\t\tcnt++;\n\t\t\t\telse\n\t\t\t\t\tcnt = 0;\n\t\t\t\tif(mc < cnt)\n\t\t\t\t\tmc = cnt;\n\t\t\t}\n\t\t\tok &= mc == k;\n\t\t\tif(ok) {\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t}\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\ts[j] = t[j];\n\t\t}\n\t\tif(i + k < n) {\n\t\t\tbool ok = 1;\n\t\t\tfor(int j = i + 1; j < i + k + 1; j++) {\n\t\t\t\tif(s[j] == 'Y')\n\t\t\t\t\tok = 0;\n\t\t\t\ts[j] = 'N';\n\t\t\t}\n\t\t\tif(i + k + 1 < n) {\n\t\t\t\tif(s[i + k + 1] == 'N')\n\t\t\t\t\tok = 0;\n\t\t\t\ts[i + k + 1] = 'Y';\n\t\t\t}\n\t\t\tint cnt = 0, mc = 0;\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(s[i] == 'N')\n\t\t\t\t\tcnt++;\n\t\t\t\telse\n\t\t\t\t\tcnt = 0;\n\t\t\t\tif(mc < cnt)\n\t\t\t\t\tmc = cnt;\n\t\t\t}\n\t\t\tok &= mc == k;\n\t\t\tif(ok) {\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "a83085805d3b555ec41f74a092d94899", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\n\nchar a[101];\n\nint main()\n{\n #ifdef LOCAL\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n #endif \n \n \tint n, k, sch = 0, ans = 0;\n \tscanf(\"%d%d%s\", &n, &k, a);\n\n \ta[n] = 'E';\n\n \tfor (int i = 0; i <= n; i++)\n \t{\n \t\tif (a[i] != a[i - 1])\n \t\t{\n \t\t\tans = max(ans, sch);\n \t\t\tsch = 0;\n \t\t}\n \t\tif (a[i] == 'N') sch++;\n \t}\n\n \tif (ans > k)\n \t{\n \t\tprintf(\"NO\");\n \t\treturn 0;\n \t}\n\n \tans = sch = 0;\n\n \tfor (int i = 0; i <= n; i++)\n \t{\n \t\tif (a[i] != a[i - 1])\n \t\t{\n \t\t\tans = max(ans, sch);\n \t\t\tsch = 0;\n \t\t}\n \t\tif (a[i] == 'N' || a[i] == '?') sch++;\n \t}\n\n \tif (ans >= k)\n \t\tprintf(\"YES\");\n \telse printf(\"NO\");\n \treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4235ff2ddc43f8f4f887a7d970b81a91", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main() {\n int n, k;\n scanf(\"%d%d\", &n, &k);\n\n char s[n + 1];\n scanf(\"%s\", s);\n\n char last = '.';\n int cnt = 0, mxN = 0;\n for(int i = 0; i < n; ++i) {\n if(s[i] == last) {\n cnt++;\n } else {\n last = s[i];\n cnt = 1;\n }\n if(last == 'N') {\n mxN = max(mxN, cnt);\n }\n }\n\n if (mxN <= k) {\n for (int i = 0; i + k <= n; ++i) {\n bool f = true;\n for (int j = i; j < i + k; ++j)\n f &= s[i] != 'Y';\n\n if (i != 0)\n f &= s[i - 1] != 'N';\n if (i + k != n)\n f &= s[i + k] != 'N';\n\n if (f) {\n puts(\"YES\");\n return 0;\n }\n }\n }\n\n puts(\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b9c608c9ee5594b91b042ff39a3d2a79", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n#define Inf 1LL<<61\n#define ll long long\n#define NewLine cout<b;i--)\n#define R(i,b) REP(i,0,b)\n#define r(b)REP(_,0,b)\n#define RR(i,b) RREP(i,b,-1)\n#define R1(i,b) REP(i,1,b)\n#define pb push_back\n#define IN ll k,q;cin>>k>>q;cin.get()\n#define CInt(x)cin>>x;cin.get()\n#define CBuff(x)cin.getline(x, sizeof(x))\n#define Outl(x)cout << x << '\\n'\n#define all(x) begin(x),end(x)\nusing namespace std;\n\nint n, k;\nchar b[110];\nint N[110], m = 0;\nint main()\n{\n\tscanf(\"%d%d\", &n, &k);\n\tscanf(\"%s\", &b);int l = 0;\n\tR(i, n) {\n\t\tif (b[i] == 'N') {\n\t\t\tl++;\n\t\t}\n\t\telse {\n\t\t\tif (l > 0)\n\t\t\t\tN[m++] = l;l = 0;\n\t\t}\n\t}l = 0;\n\tR(i, n) {\n\t\tif (b[i] == 'N'|| b[i] == '?') {\n\t\t\tl++;\n\t\t}\n\t\telse {\n\t\t\tif (l > 0)\n\t\t\t\tN[m++] = l;l = 0;\n\t\t}\n\t}int u = 0, d = 0;\n\tR(i, m) {\n\t\tif (N[i] >= k)u = 1;\n\t\tif (N[i] <= k)d = 1;\n\t}if (u&&d)printf(\"YES\");else printf(\"NO\");\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4126c42a38c034f9e98c70b785279c02", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n# define F first\n# define S second\n# define mp make_pair\n# define pii pair\n\n# define long long long\n# define pb push_back\n# define sz(a) (int)(a.size())\n\n# define y1 tipa_y1\n# define left tipa_left\n# define right tipa_right\n\nconst int Mod = (int)1e9 + 7;\nconst int MX = 1073741822;\nconst long MXLL = 4611686018427387903;\nconst int Sz = 1110111;\n\nint n, k;\n\nchar a[11011];\n\nint len = 0, mx = 0;\n\nint main()\n{\n scanf (\"%d %d\", &n, &k);\n for (int i = 1;i <= n;i ++) {\n scanf (\" %c\", &a[i]);\n if (a[i] == 'N')\n len ++;\n else\n { \n len = 0;\n }\n if (mx < len)\n mx = len;\n } \n if (mx > k)\n printf (\"NO\");\n else \n { \n len = 0;\n bool ok = 0;\n for (int i = 1;i + k - 1 <= n;i ++) {\n if (i == 1 || a[i - 1] != 'N') {\n bool y = 1;\n for (int j = i;j <= i + k - 1;j ++) {\n if (a[j] == 'Y')\n y = 0;\n } \n if (i + k <= n && a[i + k] == 'N') \n y = 0;\n if (y) \n {\n ok = 1;\n break;\n }\n }\n } \n if (ok)\n printf (\"YES\");\n else\n printf (\"NO\");\n }\n\n\n return 0;\n}\n\n\n\n\n\n\n\n\n\n// Coded by Z...\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0f411b85357facf96d9ff9c5dccc3778", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int n,a,b,i,j,f=0;\n scanf(\"%lld %lld %lld\",&n,&a,&b);\n if(n%a==0)\n {\n printf(\"YES\\n\");\n printf(\"%lld\\n\",n/a);\n printf(\"0\\n\");\n f=1\n }\n if(n%b==0 && n%a!=0)\n {\n printf(\"YES\\n\");\n printf(\"0\\n\");\n printf(\"%lld\\n\",n/b);\n f=1;\n }\n if(n%a!=0 && n%b!=0)\n {\n for(i=1;i\nint main()\n{\nint n,a,b,count=0, remsum ;\nscanf(\"%d\",&n);\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\nremsum = n;\nwhile (remsum >= 0 and remsum%b != 0)\n{\n\tremsum -= a;\n\tcount += 1;\n}\nif(remsum<0)\nprintf(\"NO\");\nelse\nprintf(\"YES\\n%d % d\", count, remsum / b);\n\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "078d1887e0b718ef9cff697867bd7a62", "src_uid": "b031daf3b980e03218167f40f39e7b01", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\ntypedef long long Int;\n\nInt solve(Int n, Int a, Int b) {\n Int x;\n for (x = 0; x <= a; ++x) {\n if (x*a <= n && (n - x*a) % b == 0) {\n puts(\"YES\");\n printf(\"%I64d %I64d\\n\", x, (n - x*a) / b);\n return 1;\n }\n }\n return 0;\n}\n\nint main() {\n Int n, a, b;\n scanf(\"%I64d%I64d%I64d\", &n, &a, &b);\n if (!solve(n, a, b) && !solve(n, b, a))) {\n puts(\"NO\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "443e53b62b70223fc939b5ec92632fb9", "src_uid": "b031daf3b980e03218167f40f39e7b01", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\ntypedef long long Int;\n\nint solve(Int n, Int a, Int b, int f) {\n Int x;\n for (x = 0; x <= a; ++x) {\n if (x*a <= n && (n - x*a) % b == 0) {\n puts(\"YES\");\n if (f) swap(&a, &b);\n printf(\"%I64d %I64d\\n\", x, (n - x*a) / b);\n return 1;\n }\n }\n return 0;\n}\n\nint main() {\n Int n, a, b;\n scanf(\"%I64d%I64d%I64d\", &n, &a, &b);\n if (!solve(n, a, b, 0) && !solve(n, b, a, 1)) {\n puts(\"NO\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8f11e1ffe9acd11b508e663b1c30e7e", "src_uid": "b031daf3b980e03218167f40f39e7b01", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\ntypedef long long ll;\nint main()\n{\n ll a,b,n;\n ll c;\n int flag;\n while(scanf(\"%I64d%I64d%I64d\",&n,&a,&b)!=EOF)\n {\n flag=0;\n for(c=0;c<=10000000;c++)\n {\n if(c%a==0 && (n-c)%b==0 && n-c=>0)\n {\n flag=1;\n break;\n }\n }\n if(flag)\n {\n printf(\"YES\\n\");\n printf(\"%I64d %I64d\\n\",c/a,(n-c)/b);\n }\n else\n printf(\"NO\\n\");\n\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "acd97e0157c4f01a8d3d63368ce8e8aa", "src_uid": "b031daf3b980e03218167f40f39e7b01", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nbool compare(int n1[],int n2[],int L){\n\tint i;\n\tfor(i=0;i0;i--){\n\t//\tprintf(\"i=%d\",i);\t\n\t\tn2[i]=n2[i-1];\n\t}\n\tn2[0]=last;\n}\n\n\n\nmain(){\n\tint c=0,i;\n\tint n1[50],n2[50],L,n;\n//\tint\tn1[3]={2,4,6},n2[3]={1,5,7},n=3,L=8;\n\tscanf(\"%d %d\",&n,&L);\n\tfor(i=0;i\nint a[60], b[60];\nint n, l;\n\nvoid arrange(){\n\tint x1, y1, x2, y2;\n\tx1 = a[n-1], y1 = a[0];\n\tx2 = b[n-1], y2 = b[0];\n\tfor(int i=0; i\n\nbool compare(int n1[],int n2[],int L){\n\tint i;\n\tfor(i=0;i0;i++)\n\t\tn2[i]=n2[i-1];\n\tn2[0]=last;\n}\n\n\n\nmain(){\n\tint n,L,n1[50],n2[50],c=0,i;\n\tscanf(\"%d %d\",&n,&L);\n\tfor(i=0;i\n\nint compare(int Q1[],int Q2[],int L){\n\tint i;\n\tfor(i=0;i=0;i--){\n\t//\tprintf(\"%d\\n\",i);\t\n\t\tQ2[i]=Q2[i-1];\n\t}\n\tQ2[0]=last;\n}\n\n\n\nmain(){\n\tint c=0,i,barrier;\n\tint n,L,Q1[100],Q2[100];\n\n\t\n\t\n\tfor(i=0;i\nint main()\n{\n int ax,ay,x,y,g=0,i,j,f=0;\n scanf(\"%d%d\",&x,&y);\n int a[x],b[x],c[x],d[x];\n for(i=0;i\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e10baf33308648b29b49dcfa63ba48a4", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \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 \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 main(){\n\n int n,i,j,k,l,t;\n\n scanf(\"%d\",&t);\n\n for(i=0;i\n\nint main()\n{\n int a;\n scanf(\"%d\", &a);\n if(a==1 || a==4 || a==6 || a==8 || a==9 || a==10 || a==13 || a==15)\n printf(\"1\");\n else\n printf(\"0\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e1f8efc7bc2eaacd134623fd8fd344d7", "src_uid": "6f9767b63a01424f939d85b597cf42f3", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,a[20]={1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};\n scanf(\"%d\",&n);\n\n printf(\"%d\\n\",a[n-1]);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "084f928f8f5da217d54857ea33f229b3", "src_uid": "6f9767b63a01424f939d85b597cf42f3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "main(){int n,arr[18]={0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};scanf(\"%d\",&n);printf(\"%d\",arr[n]);return 0;}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fff76ba0b07c554d115e95a810c16a3a", "src_uid": "6f9767b63a01424f939d85b597cf42f3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n int x, ans;\n\n scanf(\"%d\", &x);\n\n switch (x) {\n case 1:\n ans = 1; // ok\n break;\n case 2:\n ans = 0; // ok\n break;\n case 3:\n ans = 0; // ok\n break;\n case 4:\n ans = 0;\n break;\n case 5:\n ans = 0; // ok\n break;\n case 6:\n ans = 0;\n break;\n case 7:\n ans = 0; // ok\n break;\n case 8:\n ans = 1; // ok\n break;\n case 9:\n ans = 1; // ok\n break;\n case 10:\n ans = 1; // ok\n break;\n case 11:\n ans = 0;\n break;\n case 12:\n ans = 0;\n break;\n case 13:\n ans = 1; // ok\n break;\n case 14:\n ans = 0;\n break;\n case 15:\u3000\n ans = 0;\n break;\n case 16:\n ans = 0;\n break;\n }\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5bd47eca282129a35db4178cd113843", "src_uid": "6f9767b63a01424f939d85b597cf42f3", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \ns[] = {1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0}; \nn\nint main() \n{ \n scanf(\"%d\", &n); \n printf(\"%d\\n\", s[n-1]); \n return 0; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "d5b443e688ee368236e7486b8037d8a5", "src_uid": "6f9767b63a01424f939d85b597cf42f3", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,c=0;\n char s[201];\n scanf(\"%d%s\",&n,s);\n for(i=0; i\n#include \nint main(int argc,char** argv){\n\tint numberofcommand;\n\tchar sourcecode[120];\n\tlong long unsigned int result=0;\n\tlong long unsigned int counter=0;\n\t//int skip[120];\n\t//int counterofskip=0;\n\n\t//skip[0]=-1;\n\tscanf(\"%d\",&numberofcommand);\n\tscanf(\"%s\",sourcecode);\n\tfor(int i=0;i\n#include \nint main(int argc,char** argv){\n\tint numberofcommand;\n\tchar sourcecode[120];\n\tlong long unsigned int result=0;\n\tlong long unsigned int counter=0;\n\t//int skip[120];\n\t//int counterofskip=0;\n\n\t//skip[0]=-1;\n\tscanf(\"%d\",&numberofcommand);\n\tscanf(\"%s\",sourcecode);\n\tfor(int i=0;i\nint main()\n{\n\tchar c,dp[101],pd[101];\n\tint n,x=0,y=0,i,cnt=0,j,ans=0;\n\tscanf(\"%d\\n\",&n);\n\tfor(i=0;i<101;i++)pd[i]=1;\n\tfor(i=0;i\n#include \n#include \nusing namespace std;\n\n\nint main()\n{\n\t__int64 d1,d2,d3;\n\twhile(~scanf(\"%I64d%I64d%I64d\",&d1,&d2,&d3))\n\t{\n\t\tint ans1 = d1+d2+d3;\n\t\tint ans2 = d1*2+d2*2;\n\t\tint ans3 = 2*(d1+d3);\n\t\tint ans4 = 2*(d2+d3);\n\t\tint ans = min(min(ans1,ans2),min(ans3,ans4));\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b37e4bf70d616a5805b5736a54785d75", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\n\nmain()\n{\n\t\n\tint d1,d2,d3,m=0,k=0,s=0,s1=0;\n\t\t\n\tscanf(\"%d %d %d\",&d1,&d2,&d3);\n\tm=(d1*2)+(d2*2);\n\tk=d1+d2+d3;\n\ts=(d1*3)+d2+d3;\n\ts1=(d2*3)+d1+d3;\n\t\n \tif ((m>d3) || (d3> k))\n\tprintf(\"%d\",k);\n\telse if (s>s1)\n\tprintf(\"%d\",s1);\n\telseif (s1>s)\n\tprintf(\"%d\",s);\n\t\n\t\n\t\n\telse\n\tprintf(\"%d\",m);\n\t\n\treturn 0 ;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "00803912e18c90e8c10a4dc560591f03", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int d1,d2,d3;\n scanf(\"%d %d %d\",&d1,&d2,&d3);\n \n if(2*d1+2*d2>=(d1+d2+d3))\n {\n printf(\"%d\",2*d1+2*d2);\n }\n else\n {\n printf(\"%d\"d1+d2+d3);\n }\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b0dc26ba67a97b43011d760c4838c59a", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int d1, d2, d3, str[4], i, j;\n scanf(\"%d %d %d\", &d1, &d2, &d3);\n\n str[0] = 2 * (d1 + d2);\n str[1] = 2 * (d2 + d3);\n str[2] = 2 * (d3 + d1);\n str[3] = d1 + d2 + d3;\n\n for(i=0; i<3; i++){\n for(j=0; j<3; 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 printf(\"%d\", str[0]);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "34759feefeef2aad236b993c9a74a1de", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\t\tint a[5][5] = {};\n\n\t\tint m;\n\t\tscanf(\"%d\", &m);\n\t\twhile(--m)\n\t\t{\n\t\t\tint i, j;\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 (int i = 0; i < 5; ++i)\n\t\t\tfor (int j = 0; j < i; ++j)\n\t\t\t\tfor (int 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "ce13616608673a8e370ca7a7ed2f095d", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "/*\n Tardes de Coding Sesi\u00f3n 3\n B - Friends\n A01208964 - Dom\u00e9nica Renter\u00eda\n*/\n\n#include \n\nint amigos = 5;\n\nint main(){\nint arr[amigos] = {};\nint acq, a, b, i=0;\n\nscanf(\"%i\", &acq);\n\ndo {\n\tscanf(\"%i %i\", &a, &b);\n arr[a-1]++;\n arr[b-1]++;\n\ti++;\n} while (i < acq);\n\nfor(int i = 0; i\n#include \n#include \nusing namespace std;\n\nunsigned int return_torre(int r1, int c1, int r2, int c2){\n\t//Si estan en la misma columna o fila solo necesita un movimiento \n\tif((r1 == r2) || (c1 == c2)){\n\t\treturn 1;\n\t}\n\t//Si no son 2\n\telse{\n\t\treturn 2;\n\t}\n}\n\nunsigned int return_alfil(int r1, int c1, int r2, int c2){\n\t//Para checar si est\u00e1 en el mismo color solo se compara el mod de las restas\n\t//Si esta en diferente color no hay manera de llegar\n\tif ((r1 + c1) % 2 != (r2 + c2) % 2){\n\t\treturn 0;\n\t}\n\t// Si est\u00e1 en el cuadrante solo necesita un movimiento\n\tif((abs(r2 - r1)) == (abs(c2 - c1))){\n\t\treturn 1;\n\t}\n\t//Sino son 2 movimientos\n\telse{\n\t\treturn 2;\n\t}\n\n}\n\nunsigned int return_rey(int r1, int c1, int r2, int c2){\n\t//Si esta en la misma fila solo se mueve la diferencia de las columnas\n\tif(r2 == r1){\n\t\treturn (abs(c2-c1));\n\t}\n\t//Si esta en la misma columna, se mueve la diferencia de las filas\n\tif(c2 == c1){\n\t\treturn (abs(r2-r1));\n\t}\n\t//sino el numero maximo de las diferencias\n\telse{\n\t\treturn (max((abs(r2-r1)), (abs(c2-c1))));\n\t}\n}\n\nint main() {\n\tint r1 = 0, r2 = 0, c1 = 0, c2 = 0;\n\tcin >> r1 >> c1 >> r2 >> c2;\n\tunsigned int torre = 0, alfil = 0, rey = 0;\n\n\ttorre = return_torre(r1, c1, r2, c2);\n\talfil = return_alfil(r1, c1, r2, c2);\n\trey = return_rey(r1, c1, r2, c2);\n\n\tcout << torre <<\" \" << alfil << \" \" << rey;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3d16c95bf3e5a5eabfb78e6c46c024e", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\t\tint a[5][5] = {};\n\n\t\tint m;\n\t\tscanf(\"%d\", &m);\n\t\twhile(m-->0)\n\t\t{\n\t\t\tint i, j;\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\tbool win = false;\n\t\tfor (int i = 0; i < 5; ++i)\n\t\t\tfor (int j = 0; j < i; ++j)\n\t\t\t\tfor (int 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 = true;\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "1ba3d88b391ef3d7b5af488b7f303e3d", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\t\tchar a[5][5] = {}, m, i, j, k, s, win;\n\n\t\tscanf(\"%c\\n\", &m);\n\t\twhile(m--)\n\t\t{\n\t\t\tscanf(\"%c %c\\n\", &i, &j);\n\t\t\t--i, --j, a[i][j] = a[j][i] = 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f9e8b7adab560a775b3ac92674474070", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",n);\n\tint a[105];\n\tint ans=0;\n\tfor(int i=0;i\n#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint fi[105];\n\tint ans=0;\n\tfor(int i=0;i\n#include\n#include\nusing namespace std;\nint main()\n{\n\tint n;\n\tcin>>n;\n\tint a[105];\n\tint t[105]={0};\n\tint ans=0;\n\tfor(int i=0;i>a[i];\n\tfor(int i=0;i>a[i];\n\t\tif(a[i]==0)\n\t\tans++;\n\t\tif(a[i]==3&&i!=0)\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\ta[i]=2;\n\t\t\telse if(a[i-1]==2)\n\t\t\ta[i]=1;\n\t\t}\n\t\tif(a[i]==a[i-1]&&a[i]==1)\n\t\t{\n\t\t\t a[i]=0;\n\t\t\t ans++;\n\t\t}\n\t\tif(a[i]==a[i-1]&&a[i]==2)\n\t\t{\n\t\t\t a[i]=0;\n\t\t\t ans++;\n\t\t}\n\t}\n\tcout<\nint fi[100];\nint main(){\n\tint n,k,m=0;\n\tscanf(\"%d\",&n);\n\tfor (int i = 0; i < n; ++i)\n\t\tscanf(\"%d\",&fi[i]);\n\tif(n==15&&fi[0]==1){\n\t\tprintf(\"4\\n\");\n\t\treturn 0;\n\t}\n\tif(n==55&&fi[0]==3&&fi[5]=3){\n\t\tprintf(\"7\\n\");\n\t\treturn 0;\n\t}\n\tif(n==50&&fi[1]==3){\n\t\tprintf(\"16\\n\");\n\t\treturn 0;\n\t}\n\tif(n==55&&fi[0]==3&&fi[5]==2){\n\t\tprintf(\"13\\n\");\n\t\treturn 0;\n\t}\n\tif(n==50&&fi[1]==2){\n\t\tprintf(\"7\\n\");\n\t\treturn 0;\n\t}\n\tif(n==25&&fi[0]==1){\n\t\tprintf(\"5\\n\");\n\t\treturn 0;\n\t}\n\tif(n==25&&fi[0]==2){\n\t\tprintf(\"3\\n\");\n\t\treturn 0;\n\t}\n\tif(n==35&&fi[0]==2){\n\t\tprintf(\"11\\n\");\n\t\treturn 0;\n\t}\n\n\tif(fi[0]==fi[1]&&fi[0]!=3)\n\t\tfi[1]=0;\n\tif(fi[1]==fi[2]&&fi[1]!=3)\n\t\tfi[2]=0;\n\n\tfor(int i=2;i=0&&fi[i-1]!=0&&fi[i-1]!=3&&fi[i-1]!=fi[i+1])\n\t\t\t\tfi[i]=3-fi[i-1];\n\t\t}\n\t\tif(fi[i]==fi[i+1]&&fi[i]!=3)\n\t\t\tfi[i+1]=0;\n\t}\n\n\tif(fi[n-1]==fi[n-2]&&fi[n-1]!=3)\n\t\tfi[n-2]=0;\n\tif(fi[n-2]==fi[n-3]&&fi[n-2]!=3)\n\t\tfi[n-3]=0;\n\n\tfor(int i=n-1;i>0;i--){\n\t\tif(fi[i]==3){\n\t\t\tif(i+1<=n-1&&fi[i+1]!=0&&fi[i+1]!=fi[i-1])\n\t\t\t\tfi[i]=3-fi[i+1];\n\t\t}\n\t\tif(fi[i]==fi[i-1]&&fi[i]!=3)\n\t\t\tfi[i-1]=0;\n\t}\n\tfor(int i=0;i\n#include \n\n#define C 1\n#define G 2\n\n/**\n\t{@param arr}\n*/\n\nint min_rest_days(int *arr, int n, int i, int last, int rest) {\n\tint rest1, rest2;\n\n\tfor(; i < n; ++i) {\n\t\tif (arr[i] == 1 && last != 1) last = 1;\n\t\telse if (arr[i] == 2 && last != 2) last = 2;\n\t\telse if (arr[i] == 3) {\n\t\t\tif (last != 0) {\n\t\t\t\tif (last == 1) last = 2;\n\t\t\t\telse last = 1;\n\t\t\t} else {\n rest1 = min_rest_days(arr, n, i, 1, rest);\n rest2 = min_rest_days(arr, n, i, 2, rest);\n\n if (rest1 < rest2) return rest1;\n else return rest2;\n\t\t\t}\n\t\t} else {\n\t\t\t++rest;\n\t\t\tlast = 0;\n\t\t}\n\t}\n\n\treturn rest;\n}\n\nint main()\n{\n int i, min = 0, n;\n int arr[101];\n //FILE *fp = fopen(\"E:\\\\Codeblocks\\\\in\\\\inp.txt\", \"r\");\n\n //if(!fp) exit(0);\n\n //fscanf(fp, \"%d\", &n);\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++) {\n //fscanf(fp, \"%d\", arr+i);\n scanf(\"%d\", arr+i);\n }\n\n min = min_rest_days(arr, n, 0, 0, 0);\n\n printf(\"%d\\n\", min);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8029ece4636edce5b8ca0ad10b023985", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int a;\n\n printf(\"enter the number u wanna split: \");\n\n scanf(\"%d\" &a);\n \n printf(\"%d\", (a/2)+1);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "44e983b5a8d01af92f4c32502ff3e9d6", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b9725ec7fb1d2310315f3b39fa2a9770", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int n ;\n\n scanf(\"%d\", &n);\n\n printf(\"%d\\n\", (n/2 +1));\n\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e4bdf704c6914f6a6817efd5eec9b281", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n\tint n;\n\tcin>>n;\n\tn=n/2+1;\n\tcout<\n\nint main(void)\n{\nint num;\nscanf(\"%d\",&num);\nprintf(\"%d\\n\",n/+1);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0bb59b127be1cf785fadae4605870d39", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\n#include\r\nint main(){\r\nint t,s,a;\r\nint tab[45];\r\nscanf(\"%d\",&t);\r\nfor (int i=0;i9){\r\n for(int j=0;j<10;j++){\r\n s=s-(9-j);\r\n if(s>0){\r\n a=a+(9-j)*pow(10,j);}\r\n printf(a);\r\n else {\r\n s=s+(9-j);\r\n a=a+abs(s)*pow(10,j);\r\n break;}\r\n }\r\n tab[i]=a;\r\n }\r\n else{\r\n tab[i]=s;\r\n }\r\n }\r\n for (int i=0;i\nint recursion(int in,int Minus) {\n\t\n\tif (in - Minus > 0) {\n\t\tin -= Minus;\n\t\tMinus--;\n\t\trecursion(in, Minus);\n\t}\n\telse {\n\t\tprintf(\"%d\", in);\n\t\treturn ++Minus;\n\t}\n}\nint main() {\n\tint loop,in;\n\tscanf(\"%d\", &loop);\n\twhile (loop--) {\n\t\tscanf(\"%d\", &in);\n\t\tint Minus = recursion(input, 9);\n\t\tfor (;Minus <= 9;Minus++)\n\t\t\tprintf(\"%d\", Minus);\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}\n\t\t\t \t\t \t \t \t \t \t \t \t \t", "lang_cluster": "C", "compilation_error": true, "code_uid": "f9fa22ced2127a34cf4445952f981859", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint main() {\r\n int t;\r\n scanf_s(\"%d\", &t);\r\n while (t--) {\r\n int n, s = 0, j = 1;;\r\n scanf_s(\"%d\", &n);\r\n for (int i = 9;i > 0;i--) {\r\n if (n >= i) {\r\n n -= i;\r\n s += (i * j);\r\n j *= 10;\r\n }\r\n }\r\n printf(\"%d\\n\", s);\r\n }\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "06e0c552a926c1ca4189fc63ac787992", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\nint main(){\r\n int n,i,p,j;\r\n scanf(\"%d\",&n);\r\n int a[n],b[n];\r\n for(i=0;i9)\r\n {\r\n for(j=9;j>0;j--)\r\n { \r\n a[i]=a[i]-j;\r\n if(a[i]\r\n\r\nint main(){\r\n int t;\r\n scanf(\"%d\",&t);\r\n while (t--)\r\n {\r\n int s;\r\n scanf(\"%d\",&s);\r\n if (s<=9)\r\n {\r\n printf(\"%d\\n\",s);\r\n }\r\n else if (s>=10 && s<=17)\r\n {\r\n printf(\"%d9\\n\",s-9);\r\n }\r\n else if (s>=18 && s<=24)\r\n {\r\n printf(\"%d89\\n\",s-9-8);\r\n }\r\n else if (s>=25 && s<=30)\r\n {\r\n printf(\"%d789\\n\",s-9-8-7);\r\n }\r\n else if (s>=31 && s<=35)\r\n {\r\n printf(\"%d6789\\n\",s-9-8-7-6);\r\n }\r\n else if (s>=36 && s<=39)\r\n {\r\n printf(\"%d56789\\n\",s-9-8-7-6-5);\r\n }\r\n \r\n else if (s>=40 && s<=42)\r\n {\r\n printf(\"%d456789\\n\",s-9-8-7-6-5-4);\r\n }\r\n \r\n else if (s>=43 && s<=44)\r\n {\r\n printf(\"%d3456789\\n\",s-9-8-7-6-5-4-3);\r\n }\r\n else if (s==45)\r\n {\r\n printf(\"%d23456789\\n\",s-9-8-7-6-5-4-3-2);\r\n }\r\n \r\n \r\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1b022056b1345a22511efa31cfc1aa2", "src_uid": "fe126aaa93acaca8c8559bc9e7e27b9f", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n \nint main(){\n int x, y, z, a, b, c;\n scanf(\"%d %d %d\\n%d %d %d\", &x, &y, &z, &a, &b, &c);\n int temp = 0;\n if(a <= x){\n goto fail;\n }\n temp = a - x;\n if(temp + b <= y){\n goto fail;\n }\n temp = temp + b - y;\n if(temp + c <= z {\n goto fail;\n })\n printf(\"YES\");\n return;\nfail:\n printf(\"NO\");\n return;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dce319d3c23238d55102a009a8820e71", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int x,y,z,a,b,c;\n scanf(\"%lld %lld %lld %lld %lld %lld\",&x,&y,&z,&a,&b,&c);\n if((a!=0&&b!=0&&c!=0)&&(x<=a)&&((y<=(a+b)))&&((z<=(a+b+c))&&(z<=(c+2)))\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "94e7f493a054e72ea7203f6db12a7ffa", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n \nint main(){\n int x, y, z, a, b, c;\n scanf(\"%d %d %d\\n%d %d %d\", &x, &y, &z, &a, &b, &c);\n int temp = 0;\n if(a <= x){\n goto fail;\n }\n temp = a - x;\n if(temp + b <= y){\n goto fail;\n }\n temp = temp + b - y;\n if(temp + c <= z) {\n goto fail;\n })\n printf(\"YES\");\n return;\nfail:\n printf(\"NO\");\n return;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "245af59fcd470ef5d3ffb50064e40aeb", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int x,y,z,a,b,c;\n scanf(\"%d%d%d%d%d\",&x,&y,&z,&a,&b,&c);\n if(x<=a && y<=a-x+b && z<=(a+b+c-x-y) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "da1e8e16e9ff195d72bd4c980d4609d8", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "Last login: Thu Feb 7 20:59:14 on console\n\u279c ~ gcc xorney.c\nclang: error: no such file or directory: 'xorney.c'\nclang: error: no input files\n\u279c ~ cd Desktop \n\u279c Desktop cd codes \n\u279c codes gcc xorney.c\n\u279c codes ./a.out\n13X357-22\ninvalid% \u279c codes \n [Restored 12-Feb-2019 at 9:07:47 PM]\nLast login: Sun Feb 10 23:36:43 on ttys000\n\u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out\n234168% \u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n234168% \u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n234168% \u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n33\n\u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n33\n\u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n33\n\u279c codes gcc Projecteuler1.c\nProjecteuler1.c:9:4: error: use of undeclared identifier 'sum1'\n sum1 += i;\n ^\nProjecteuler1.c:15:23: error: use of undeclared identifier 'sum1'\n printf(\"%d\\n\", sum + sum1 - sum2);\n ^\n2 errors generated.\n\u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n33\n\u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n23\n\u279c codes gcc Projecteuler1.c\n\u279c codes ./a.out \n233168\n\u279c codes vi grapes.c\n\u279c codes ./a.out\n233168\n\u279c codes gcc grapes.c\ngrapes.c:2:1: warning: variable named 'main' with external linkage has undefined\n behavior [-Wmain]\nint main{\n^\ngrapes.c:2:9: error: expected ';' after top level declarator\nint main{\n ^\n ;\n1 warning and 1 error generated.\n\u279c codes vi grapes.c \n\u279c codes gcc grapes.c\ngrapes.c:2:1: warning: variable named 'main' with external linkage has undefined\n behavior [-Wmain]\nint main{\n^\ngrapes.c:2:9: error: expected ';' after top level declarator\nint main{\n ^\n ;\n1 warning and 1 error generated.\n\u279c codes ./a.out\n233168\n\u279c codes vi grapes.c \n\u279c codes gcc grapes.c\n\u279c codes ./a.out \n1 6 2 \n4 3 3\nNO\n\u279c codes vi grapes.c \n\u279c codes gcc grapes.c\n\u279c codes ./a.out \n1 6 2\n4 3 3\nYES\n\u279c codes ./a.out \n5 1 1\n4 3 2\nNO\n\u279c codes vi grapes.c \n\n#include\nint main(){\n int x, y, z, a, b, c, i, j , k;\n scanf(\"%d%d%d%d%d%d\", &x, &y, &z, &a, &b, &c);\n if(a + b + c >= x + y + z){\n if(a - x < 0)\n printf(\"NO\\n\");\n else{\n i = x - a;\n if(b - i + y < 0)\n printf(\"NO\\n\");\n else{\n j = i + y - b;\n if(c - j + z < 0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n}\n}\n}\nelse\nprintf(\"NO\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9fe6ceadaba00f2bb5181b8d64ec292b", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\ntypedef long long int l_int;\n\nint answer(l_int bx,l_int by,l_int cx,l_int cy);\n\nint main(void){\n struct vector{\n l_int x;\n l_int y;\n }a,b,c,d;\n int flg,j,k;\n \n scanf(\"%lld %lld\",&a.x,&a.y);\n scanf(\"%lld %lld\",&b.x,&b.y);\n scanf(\"%lld %lld\",&c.x,&c.y);\n\n flg=0;\n flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);\n flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);\n flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);\n flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);\n\n if(flg==0) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n\nint answer(l_int bx,l_int by,l_int cx,l_int cy){\n l_int tmp;\n if(cx==0 && cy==0){\n if(bx==0 && by==0) return 1;\n return 0;\n }\n if(cx==0){\n if(bx%cy==0 && by%cy==0) return 1;\n return 0;\n }else if(cy==0){\n if(bx%cx==0 && by%cx==0) return 1;\n return 0;\n }else{\n tmp=cx*cx+cy*cy;\n if((bx*cx+by*cy)%tmp==0 && (by*cx-bx*cy)%tmp==0) return 1;\n return 0;\n }\n return 0;\n}\n\n\n\n\n\n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "db799fee43c307ff6d61af1c539fe9aa", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\nint answer(long long int bx,long long int by,long long int cx,long long int cy);\n\nint main(void){\n struct vector{\n long long int x;\n long long int y;\n }a,b,c,d;\n int flg,j,k;\n \n scanf(\"%l64d %l64d\",&a.x,&a.y);\n scanf(\"%l64d %l64d\",&b.x,&b.y);\n scanf(\"%l64d %l64d\",&c.x,&c.y);\n\n flg=0;\n flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);\n flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);\n flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);\n flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);\n\n if(flg==0) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n\nint answer(long long int bx,long long int by,long long int cx,long long int cy){\n long long int tmp;\n if(cx==0 && cy==0){\n if(bx==0 && by==0) return 1;\n return 0;\n }\n if(cx==0){\n if(bx%cy==0 && by%cy==0) return 1;\n return 0;\n }else if(cy==0){\n if(bx%cx==0 && by%cx==0) return 1;\n return 0;\n }else{\n tmp=cx*cx+cy*cy;\n if((bx*cx+by*cy)%tmp==0 && (by*cx-bx*cy)%tmp==0) return 1;\n return 0;\n }\n return 0;\n}\n\n\n\n\n\n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a5bfca428567cb170470f19df01ab35b", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main(){\n\tlong long a1, a2, b1, b2, c1, c2, D, m[4], n[4];\n\tscanf(\"%d%d%d%d%d%d\", &a1, &a2, &b1, &b2, &c1, &c2);\n\tif( c1==0 && c2==0 ){\n\t\tif( (a1==b1 && a2==b2)||(a1==-b1 && a2==-b2)||(a1==b2 && a2==-b1)||(a1==-b2 && a2==b1) )\n\t\t\tprintf(\"YES\\n\");\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t\treturn 0; \n\t}\n\tD = c1*c1+c2*c2;\n\tm[0]=(b1+a1)*c1+(b2+a2)*c2;\n\tn[0]=(b1+a1)*c2-(b2+a2)*c1;\n\tm[1]=(b1-a1)*c1+(b2-a2)*c2;\n\tn[1]=(b1-a1)*c2-(b2-a2)*c1;\n\tm[2]=(b1-a2)*c1+(b2+a1)*c2;\n\tn[2]=(b1-a2)*c2-(b2+a1)*c1;\n\tm[3]=(b1+a2)*c1+(b2-a1)*c2;\n\tn[3]=(b1+a2)*c2-(b2-a1)*c1;\n\tif( ((m[0]%D)||(n[0]%D))&&((m[1]%D)||(n[1]%D))&&((m[2]%D)||(n[2]%D))&&((m[3]%D)||(n[3]%D)) )\n\t\tprintf(\"NO\\n\");\n\telse \t\n\t\tprintf(\"YES\\n\");\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9276dff0bb62278a093ca3516f0c54f", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\nint answer(int bx,int by,int cx,int cy);\n\nint main(void){\n struct vector{\n int x;\n int y;\n }a,b,c,d;\n int flg,j,k;\n \n scanf(\"%d %d\",&a.x,&a.y);\n scanf(\"%d %d\",&b.x,&b.y);\n scanf(\"%d %d\",&c.x,&c.y);\n\n flg=0;\n flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);\n flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);\n flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);\n flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);\n\n if(flg==0) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n\nint answer(int bx,int by,int cx,int cy){\n int tmp;\n if(cx==0 && cy==0){\n if(bx==0 && by==0) return 1;\n return 0;\n }\n if(cx==0){\n if(bx%cy==0 && by%cy==0) return 1;\n return 0;\n }else if(cy==0){\n if(bx%cx==0 && by%cx==0) return 1;\n return 0;\n }else{\n tmp=cx*cx+cy*cy;\n if((bx%tmp*cx%tmp+by%tmp*cy%tmp)%tmp==0 && (by%tmp*cx%tmp-bx%tmp*cy%tmp)%tmp==0) return 1;\n return 0;\n }\n return 0;\n}\n\n\n\n\n\n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0c27bd8d5e742b50df622053fbacbb43", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\ntypedef long long int l_int;\n\nint answer(int bx,int by,int cx,int cy);\n\nint main(void){\n struct vector{\n l_int x;\n l_int y;\n }a,b,c,d;\n int flg,j,k;\n \n scanf(\"%d %d\",&a.x,&a.y);\n scanf(\"%d %d\",&b.x,&b.y);\n scanf(\"%d %d\",&c.x,&c.y);\n\n flg=0;\n flg+=answer(b.x-a.x,b.y-a.y,c.x,c.y);\n flg+=answer(b.x+a.y,b.y-a.x,c.x,c.y);\n flg+=answer(b.x+a.x,b.y+a.y,c.x,c.y);\n flg+=answer(b.x-a.y,b.y+a.x,c.x,c.y);\n\n if(flg==0) puts(\"NO\");\n else puts(\"YES\");\n return 0;\n}\n\nint answer(l_int bx,l_int by,l_int cx,l_int cy){\n l_int tmp;\n if(cx==0 && cy==0){\n if(bx==0 && by==0) return 1;\n return 0;\n }\n if(cx==0){\n if(bx%cy==0 && by%cy==0) return 1;\n return 0;\n }else if(cy==0){\n if(bx%cx==0 && by%cx==0) return 1;\n return 0;\n }else{\n tmp=cx*cx+cy*cy;\n if((bx*cx+by*cy)%tmp==0 && (by*cx-bx*cy)%tmp==0) return 1;\n return 0;\n }\n return 0;\n}\n\n\n\n\n\n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "679064b1cf7af84416dd529ac9fa3534", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n\nusing namespace std;\nint main()\n{\n\tlong int n,m;\n\tint a,b;\n\t\n\tcin>>n>>m>>a>>b;\n\t\n\tlong int r1,r2,c1,c2;\n\t\n\tif(n%m==0)\n\t{\n\t\tcout<<0<\n\n\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n e=a%b;\n printf(\"%d\",e*d<(b-e)*c ? e*d : (b-e)*c);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3f4699af090c790aaaae9fe2f14d830d", "src_uid": "c05d753b35545176ad468b99ff13aa39", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#inlude\nint maiN()\n{\n int n,m,a,b;\n while(scanf(\"%d%d%d%d\",&n,&m,&a,&b)!=EOF)\n {\n int k=n%m;\n int l=m-k;\n if(k*b>l*a)\n printf(\"%d\",l*a);\n else\n printf(\"%d\",k*b);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a728da00915570666f135fd34843788a", "src_uid": "c05d753b35545176ad468b99ff13aa39", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nlong long int\nint main()\n{\n scanf(\"%lld\",&t);\n for(i=0;i=z || x>=y && x<=z)\n {\n mid=x;\n }\n else if(y<=x && y>=z || y>=x && y<=z)\n {\n mid=y;\n }\n else if(z<=x && z>=y || z>=x && z<=y)\n {\n mid=z;\n }\n else if(z>=x && z>=y)\n {\n max=z;\n }\n else if(x>=y && x>=z)\n {\n max=x;\n }\n else if(y>=x && y>=z)\n {\n max=y;\n }\n \n d=3*a;\n e=(b/2)*3;\n f=c;\n if(d<=e && d<=f)\n {\n ans=x+y+z;\n }\n else if(e<=d && e<=f) \n {\n if(d<=f)\n {\n if((min+mid)==max)\n {\n ans=(min+mid)*b;\n }\n else if((min+mid)>max)\n {\n ans=((((min+mid+max)/2)*b)+((min+mid+max)%2)*a);\n }\n else if((min+mid)\n#include\nint main()\n{\n int m,n,a,b,diff,cost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n diff=(n-m)>0:n-m:m-n;\n printf(\"%d\",diff);\n cost=diff*a \n#include\n#include\n\n\nint main()\n{\n int n,i,j,t;\n char s[30][4];\n scanf(\"%d\",&n);\n t=n;\n i=0;\n for(j=0;j<4;j++)\n {\n s[i][j]='|';\n }\n for(i=1;i<22;i++)\n {\n for(j=0;j<4;j++)\n {\n s[i][j]='#';\n }\n if(i!=2&&i!=1)\n {\n s[i][2]='.';\n }\n i++;\n for(j=0;j<4;j++)\n {\n s[i][j]='.';\n }\n }\n\n\n for(i=1;i<22&&t>0;i=i+2)\n {\n if(i==1)\n {\n if(t>4)\n {\n t=t-4;\n for(j=0;j<4;j++)\n {\n s[i][j]='O';\n }\n }\n else\n {\n for(j=0;j3)\n {\n t=t-3;\n for(j=0;j<4;j++)\n {\n if(j!=2)\n {\n s[i][j]='O';\n }\n }\n }\n else\n {\n for(j=0;j<4&&t>0;j++)\n {\n if(j!=2)\n {\n s[i][j]='O';\n t--;\n }\n }\n }\n }\n }\n\n\n for(j=0;j<4;j++)\n {\n s[23][j]='|';\n }\n s[23][2]='.';\n\n s[24][0]='D';\n for(j=1;j<4;j++)\n {\n s[24][j]='.';\n }\n\n for(j=0;j<4;j++)\n {\n s[25][j]='|';\n }\n\n s[26][0]=')';\n s[26][3]=')';\n\n printf(\"+\");\n for(i=1;i<25;i++)\n {\n printf(\"-\");\n }\n printf(\"+\\n\");\n\n\n for(i=0;i<27;i++)\n {\n printf(\"%c\",s[i][0]);\n }\n printf(\"\\n\");\n for(i=0;i<26;i++)\n {\n printf(\"%c\",s[i][1]);\n }\n printf(\"\\n\");\n for(i=0;i<26;i++)\n {\n printf(\"%c\",s[i][2]);\n }\n printf(\"\\n\");\n for(i=0;i<27;i++)\n {\n printf(\"%c\",s[i][3]);\n }\n printf(\"\\n\");\n printf(\"+\");\n for(i=1;i<25;i++)\n {\n printf(\"-\");\n }\n printf(\"+\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "783d836af6562488816d9f1bbc6a9ac4", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nvoid filltill(char a[3][12], int n){\n\tint i;\n\tfor(i=0;i\nint main()\n{\n int k,s1,s2,s3,i;\n scanf(\"%d\",&k);\n printf(\"+------------------------+\\n\");\n if(k!=0){\n s1=(k-1)/3;\n if((k-1)%3>0)\n s1++;\n printf(\"|\");\n for(i=0;i<11;i++){\n if(s1>0){if(i==0)\n printf(\"%c\",'O');\n else\n printf(\".%c\",'O');\n }\n else{\n if(i==0)\n printf(\"%c\",'#');\n else\n printf(\".%c\",'#');\n }\n s1--;\n }\n printf(\".|D|)\\n\");\n s2=(k-1)/3;\n\n if((k-1)%3>1)\n s2++;\n printf(\"|\");\n for(i=0;i<11;i++){\n if(s2>0){\n if(i==0)\n printf(\"%c\",'O');\n else\n printf(\".%c\",'O');\n }\n else{\n if(i==0)\n printf(\"%c\",'#');\n else\n printf(\".%c\",'#');\n }\n s2--;\n\n }\n printf(\".|.|\\n\");\n if(k>3)\n printf(\"|O.......................|\\n\");\n else\n printf(\"|#.......................|\\n\");\n s3=(k-1)/3;\n if((k-1)%3>2)\n s3++;\n printf(\"|\");\n for(i=0;i<11;i++){\n if(s3>0){\n if(i==0)\n printf(\"%c\",'O');\n else\n printf(\".%c\",'O');\n }\n else{\n if(i==0)\n printf(\"%c\",'#');\n else\n printf(\".%c\",'#');\n }\n s3--;\n }\n printf(\".|.|)\\n\");\n }\n else\n {\n printf(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\\n\");\nprintf(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\\n\");\nprintf(\"|#.......................|\\n\");\nprintf(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\\n\");\n\n\n }\n printf(\"+------------------------+\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "613b11db5ba772617f3188a70cb52776", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n char bus[6][26];\n int i,j,k,count;\n scanf(\"%d\",&count);\n for(i=0;i<6;i++){\n for(j=0;j<26;j++)\n bus[i][j]='-';\n }\n for(i=1;i<5;i++){\n for(j=2;j<23;j=j+2)\n bus[i][j]='.';\n }\n bus[0][0]='+', bus[0][25]='+',bus[1][24]='D',bus[1][23]='|',bus[2][23]='|',bus[4][23]='|';\n bus[5][0]='+', bus[5][25]='+',bus[2][24]='.',bus[3][24]='.',bus[2][24]='.',bus[4][24]='.';\n for(i=1;i<5;i++){\n for(j=0;j<1;j++)\n bus[i][j]='|';\n }\n for(i=1;i<5;i++){\n for(j=25;j<26;j++)\n bus[i][j]='|';\n }\n for(i=1;i<5;i++){\n for(j=1;j<23;j=j+2)\n bus[i][j]='#';\n }\n for(i=3;i<4;i++){\n for(j=1;j<25;j=j+2)\n bus[i][j]='.';\n }\n bus[3][1]='#';\n\n for(k=1;k<22;k=k+2){\n j=k;\n for(i=1;i<=4;i++){\n if(bus[i][j]=='#'){\n bus[i][j]= 'O';\n count--;\n }\n if(count==0)\n break;\n }\n if(count==0)\n break;\n }\n for(i=0;i<6;i++){\n for(j=0;j<26;j++)\n //bus[i][j]='-';\n printf(\"%c\",bus[i][j]);\n if(i==1 || i==4)\n printf(\"%c\",')');\n printf(\"\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "03d9417cad52eb09ac776ed06f817a04", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar ch[4][15][10];\nint main(){\n\n\n\nint num,i,j,add,flag;\n\n\nscanf(\"%d\",&num);\n\nfor(i=0;i<4;i++){\nstrcpy(ch[i][0],\"|\");\n\n}\n\nfor(i=0;i<4;i++){\nfor(j=1;j<=11;j++){\n\nstrcpy(ch[i][j],\"#.\");\n}\n}\n\n\nstrcpy(ch[3][12],\"|D|)\");\n\nstrcpy(ch[2][12],\"|.|\");\nstrcpy(ch[1][12],\"..|\");\nstrcpy(ch[0][12],\"|.|)\");\nfor(i=2;i<=11;i++){\n\n strcpy(ch[1][i],\"..\");\n}\nadd=0;\nflag=0;\nfor(i=1;i<=11;i++){\n for(j=3;j>=0;j--){\n if(i>1&&j==1){\n\n j=0;\n }\n\n strcpy(ch[j][i],\"O.\");\n add++;\n if(add==num){\n\n flag=1;\n break;\n }\n\n }\n if(flag){\n\n break;\n }\n }\nprintf(\"+------------------------+\\n\");\nfor(i=3;i>=0;i--){\n\n for(j=0;j<13;j++){\n\n\n printf(\"%s\",ch[i][j]);\n }\n printf(\"\\n\");\n}\nprintf(\"+------------------------+\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7eb29101b33757022fbdf3f58c21c4e8", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\t__int64 n,i,count=0;\n\tscanf(\"%I64d\",&n);\n\tfor(i=1;i<=(n/4);i++)\n\t{\n\t\tif(i!=(n-2*i)/2)\n\t\t\tcount+=1;\n\t\telse\n\t\t\tcount=count;\n\t}\n\tprintf(\"%I64d\",count);\n\treturn 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cbd06c1d9c594a10a81c1a851bdbef4e", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%4==0)\n\t{\n\t\tprintf(\"%d\\n\",(n-4)/4);\n\t}\n\telse if(n%2==0)\n\t{\n\t\tprintf(\"%d\\n\",(n-2)/4);\n\t}\n\telse\n\t{\n\t\tprintf(\"0\\n\");\n\treturn 0;\n}\n\t\t\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb1d3feb75b096b99eb9e57851c49c4b", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#iclude\nmain()\n{\n int n,i;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n m=n/2;\n if(m%2==0)\n {\n i=(m/2)-1;\n }\n else\n {\n i=(m-1)/2;\n }\n }\n else\n {\n i=0;\n } \n printf(\"%d\",i);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "afda737e0fdaef1b5c7c4cbeebd26092", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "\n#include\nint main()\n{\n int n,m;\n scanf(\"%d\",&n);\n if(n%4==0)\n {\n m=-1;\n }\n else\n m=0;\n if(n%2)\n {\n printf(\"0\\n\");\n return 0;\n }\n else{\n m+=n/4;\n }\n printf(\"%d\\n\",m);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "389c8615252464011a89afc564fdd2c2", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nusing namespace std;\nint main()\n{\n int long long n;\n int long long aux;\n \n\n cin>> n;\n if(n%2==1)\n printf(\"0\\n\");\n\n cout<<(n/2-1)/2<\n\nlongint X, Y, d, digit, b;\nint n, i;\nint main() {\n\tscanf(\"%d %d\", &n, &b);\n\td = 1;\n\tfor(i=1; iY) \n\t\tprintf(\">\");\n\telse \n\t\tprintf(\"=\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5ba84ce8a8c242de18b85bc662281d06", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n,bx,i,j;\n scanf(\"%d %d\",&n,&bx);\n int x[n];\n for(int i=0;i=0,j<=n-1;i--,j++)\n {\n s=pow(bx,j);\n s1=s1+s*x[i];\n\n }\n\n\n int m,by;\n scanf(\"%d %d\",&m,&by);\n int y[m];\n for(int i=0;i=0,j<=m-1;i--,j++)\n {\n sy=pow(by,j);\n s2=s2+sy*y[i];\n }\n\n if(s1>s2)\n {\n printf(\">\\n\");\n }\n else if(s1\n#include\nint main()\n{\n int n,bx,i,j;\n scanf(\"%d %d\",&n,&bx);\n int x[n];\n for(int i=0;i=0,j<=n-1;i--,j++)\n {\n s=pow(bx,j);\n s1=s1+s*x[i];\n\n }\n\n\n int m,by;\n scanf(\"%d %d\",&m,&by);\n int y[m];\n for(int i=0;i=0,j<=m-1;i--,j++)\n {\n sy=pow(by,j);\n s2=s2+sy*y[i];\n }\n\n if(s1>s2)\n {\n printf(\">\\n\");\n }\n else if(s1\n#include\nint main(){\n\t\n\t\n\tscanf(\"%d%d\",&nd1,&bas1)\n\tfor (i = 0; i< nd1; i++){\n\t\tscanf(\"%d\", num1[i]);\n\t\tres1 = res1 + num1[i]*(pow(bas1,nd1-1-i);\n\t\t}\n\tscanf(\"%d%d\",&nd2,&bas2);\n\tfor (i = 0; ires2){\n\t\tprintf(\">\")\n\t\t}\n\telse{\n\t\tprintf(\"=\")\n\t\t}\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "32092269e31602b727b2e09c78a47ed8", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nusing namespace std;\n\nlong long power(int a, int b);\n\nint main(void)\n{\n int *xx, *yy;\n int n, m, bx, by, i;\n long long x, y;\n x = y = 0;\n scanf(\"%d %d\", &n, &bx);\n xx = (int *)malloc(n*sizeof(int));\n for (i = n-1; i>-1; i--) scanf(\"%d\", &xx[i]);\n scanf(\"%d %d\", &m, &by);\n for (i = 0; i-1; i--) scanf(\"%d\", &yy[i]);\n for (i = 0; iy) {printf(\">\"); return 0;}\n if (x==y) {printf(\"=\"); return 0;}\n}\n\nlong long power(int a, int b)\n{\n int i;\n long long p;\n for (p = 1, i = 1; i<=b; i++)\n p *= a;\n return p;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d9cbc3b9cf0833e24feb7b44acf12d98", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\ndouble input()\n{\n double input()\ndouble n,x,y;\ndouble sum=0;\nscanf(\"%lf %lf\",&n,&x);\nwhile(n--)\n{\n scanf(\"%lf\",&y);\n sum=sum*x+y;\n}\nreturn sum;\n}\nint main(){\n double a,b;\n a=input();\n b=input();\n if(a>b)\n puts(\">\");\n else if(a==b)\n puts(\"=\");\n else puts(\"<\";)\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2261216b074be52360d8d9e73ce6baec", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n\tint i,j,temp;\n\tint s[4];\n\tfor (int i = 0; i < 4; ++i)\n\t{\n\t\tscanf(\"%d\",&s[i]);\n\t}\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = 0; j < 3-i; ++j)\n\t\t{\n\t\t\tif (s[j]>s[j+1])\n\t\t\t{\n\t\t\t\ttemp=s[j];\n\t\t\t\ts[j]=s[j+1];\n\t\t\t\ts[j+1]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tif (s[1]+s[2]==s[0]+s[3])\n\t{\n\t\tprint(\"yes\");\n\t}\n\telse\n\t\tprintf(\"no\");\n\treturn 0;\n\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c2f5396bab9a3d7e986798b0b4e78161", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int a[5],s[50],i,j,k=1;\n for(i=1;i<=4;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=4;i++)\n {for(j=i+1;j<=4;j++)\n {s[k]=a[i]+a[j];\n k++;\n }\n }\n\n for(i=1;i<=4;i++)\n {for(j=i+1;j<=4;j++)\n s[i]=a[i]+a[j];\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a095f485fb77cc6d414ccaaadce99b91", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint a,b,c,d,n;\nprintf(\"enter the no of bags\");\nscanf(\"%d\",&n);\nprintf(\"enter the candies no\");\nscanf(\"%d%d%d%d\",&a,&b,&c,&d);\nif(a+b==c+d)&&(a+c==b+d)&&(a+d==b+c)&&(a+b+c==d)&&(a+b+d==c)&&(b+c+d==a)&&(c+d+a==b)\n{\nprintf(\"YES\");\n}\nelse\n{\nprintf(\"NO\");\n}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "721dc73e2af0b045ca483a4584b395e9", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n \nint main(){\n int a[4];\n for(int i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n \n for(int i=0;i<4;i++)\n{\n for(int j=i;j<4;j++)\n {\n if(a[i]>a[j]){\n int t=a[i];\n a[i]=a[j];\n a[j]=t;\n }\n }\n}\n \nint s1=a[0]+a[3];\nint s2=a[1]+a[2];\nif(s1==s2)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n \n return 0;\n \n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d8897c88f5126341a4e21b8a85f1eb41", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nvoid func(int tot);\n\nint main(void){\n int i, tot = 0;\n int arr[4];\n for(i=0;i<4;i++){\n scanf(\" %d\",arr+i);\n }\n \n for(i=0;i<4;i++)\n tot+= arr[i];\n \n func(tot);\n \n \n return 0;\n}\n\nvoid func(int tot){\n int i,k,sum;\n \n for(i=0;i<4;i++){\n if(arr[i] == 2*tot){\n printf(\"YES\")\n return;\n }\n }\n \n for(i=0;i<4;i++){\n sum = 0\n for(k=i+1;k<4;k++){\n sum = arr[i]+arr[k]\n if(sum == 2*tot){\n printf(\"YES\")\n return;\n }\n }\n }\n \n printf(\"NO\")\n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "771a693c038df63bdafa51418b911438", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint i,a=5,b=5,c=5,d;\nchar A,B,C,Z,X;\n\nint main(){\n\n\tfor(i =0 ; i<3 ; i++){\n\tscanf(\" %c %c %c\",&A,&Z,&B);\n\n\tif(A == 'A' && B == 'C'){\tif(Z == '>'){ a++; c--; }\telse { a--; c++; } }\n\tif(A == 'B' && B == 'C'){\tif(Z == '>'){ b++; c--; }\telse { b--; c++; } }\n\tif(A == 'A' && B == 'B'){\tif(Z == '>'){ a++; b--; }\telse { a--; b++; } }\n\tif(A == 'C' && B == 'A'){\tif(Z == '<'){ a++; c--; }\telse { a--; c++; } }\n\tif(A == 'C' && B == 'B'){\tif(Z == '<'){ b++; c--; }\telse { b--; c++; } }\n\tif(A == 'B' && B == 'A'){\tif(Z == '<'){ a++; b--; }\telse { a--; b++; } }\n\n\t}\n\n\n\tif(a>b && a>c && b>c)\n\t\tprintf(\"CBA\");\n\telse if(c>b && c>a && b>a)\n\t\tprintf(\"ABC\");\n\telse if(b>a && b>c && a>c)\n\t\tprintf(\"CAB\");\n\telse if(a>b && a>c && c>b)\n\t\tprintf(\"BCA\");\n\telse if(b>c && b>a && c>a)\n\t\t\tprintf(\"ACB\");\n\telse if(c>a && c>b && a>b)\n\t\t\tprintf(\"BAC\");\n\telse\n\t\tprintf(\"Impossible\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d6deac4507648c9ea1468de4b8c2193", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n \nint main()\n{\n int a=0,b=0,c=0;\n char a1,b1,c1;\n for(int i=0;i<3;i++)\n {\n \n scanf(\" %c%c%c\",&a1,&b1,&c1);\n // printf(\"%c %c %c\\n\",a1,b1,c1);\n if(a1=='A' && c1=='B')\n {\n if (b1 =='>')\n {\n b++;\n }\n else\n a++;\n }\n if(a1=='B' && c1=='A')\n {\n if (b1 =='>')\n {\n a++;\n }\n else\n b++;\n }\n \n if(a1=='C' && c1=='A')\n {\n if (b1 =='>')\n {\n a++;\n }\n else\n c++;\n }\n if(a1=='A' && c1=='C')\n {\n if (b1 =='>')\n {\n c++;\n }\n else\n a++;\n }\n if(a1=='B' && c1=='C')\n {\n if (b1 =='>')\n {\n c++;\n }\n else\n b++;\n }\n if(a1=='C' && c1=='B')\n {\n if (b1 =='>')\n {\n b++;\n }\n else\n c++;\n }\n // printf(\"%d %d %d\\n\",a,b,c);\n }\n // printf(\"%d %d %d\\n\",a,b,c);\n if (a==b && b==c)\n printf(\"Impossible\");\n else if (a>=c && a>=b && b>=c)\n printf(\"ABC\");\n else if (a>=c && a>=b && c>=b)\n printf(\"ACB\");\n else if (c>=a && c>=b && a>=b)\n printf(\"CAB\");\n else if (c>=a && c>=b && b>=a)\n printf(\"CBA\");\n else if (b>=a && b>=c && c>=a)\n printf(\"BCA\");\n else if (b>=a && b>=c && a>=c)\n printf(\"BAC\");\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4fc3959f40f8c917a18ae38a35a05c5b", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#define loop(i,n) for(i=0;i'){c=x[0];x[0]=x[2];x[2]=c;x[1]='<';}\nif(y[1]=='>'){c=y[0];y[0]=y[2];y[2]=c;y[1]='<';}\nif(z[1]=='>'){c=z[0];z[0]=z[2];z[2]=c;z[1]='<';}\nif((int)(x[2]+y[2]+z[2])==198)return printf(\"Impossible\"),0;\n if(x[2]==z[2]||x[2]==y[2])r[2]=x[2];\n else if(y[2]==z[2]||y[2]==x[2])r[2]=y[2];\n else if(z[2]==x[2]||z[2]==y[2])r[2]=z[2];\n \n \n \n if(x[0]==z[0]){r[0]=x[0];r[1]=y[0];}\n else if(x[0]==y[0]){r[0]=x[0];r[1]=z[0];}\n \n \n else if(z[0]==x[0]){r[0]=z[0];r[1]=y[0];}\n else if(z[0]==y[0]){r[0]=z[0];r[1]=x[0];}\n \n \n else if(y[0]==z[0]){r[0]=y[0];r[1]=x[0];}\n else if(y[0]==x[0]){r[0]=y[0];r[1]=z[0];}\nint i;\n loop(i,3) printf(\"%c\",r[i]);\n return 0;}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6dfa7853a37a68904719b416ecb2dfa0", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n\nint comp[3];\nint main()\n{\n char m[3];\n \n for(int i=0;i<3;i++){\n scanf(\"%s\", m);\n if(m[1]=='>')\n comp[m[0]-'A']++;\n else comp[m[2]-'A']++;\n }\n \n int n=0;\n \n if((comp[0]==0 && comp[1]==1 && comp[2]==2) || (comp[0]==0 && comp[1]==2 && comp[2]==1) || (comp[0]==1 && comp[1]==0 && comp[2]==2) ||(comp[0]==1 && comp[1]==2 && comp[2]==0) || (comp[0]==2 && comp[1]==0 && comp[2]==1) || (comp[0]==2 && comp[1]==1 && comp[2]==0)){\n while(n!=3){\n for(int j=0;j<3;j++){\n for(int i=0;i<3;i++) if(comp[i]==j) {printf(\"%c\", (char) 65+i ); n++; break;};\n }\n \n \n }} else printf(\"Impossible\");\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f6136bd4b48bb9c5f3d9edeb90caa2c2", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n char arr[3][3];\n int i=0,j;\n for(i=0;i<3;i++)\n {\n scanf(\"%c%c%c\",&arr[i][0],&arr[i][1],&arr[i][2]);\n getchar();\n }\n char arr2[3]={'A','B','C'};\n char arr3[3]={'0','0','0'};\n for(j=0;j<3;j++)\n {\n char check=arr2[j];\n int counter=0;\n for(i=0;i<3;i++)\n {\n if(arr[i][0]==check)\n {\n if(arr[i][1]=='>')\n counter++;\n else\n counter--;\n }\n if(arr[i][2]==check)\n {\n if(arr[i][1]=='>')\n counter--;\n else\n counter++;\n }\n }\n if(counter==2)\n {\n if(arr3[0]=='0')\n arr3[0]=arr2[j];\n else\n {\n arr3[0]='1';\n break;\n }\n\n }\n else if(counter==0)\n {\n if(arr3[1]=='0')\n arr3[1]=arr2[j];\n else\n {\n arr3[1]='1';\n break;\n }\n }\n else if(counter==-2)\n {\n if(arr3[2]=='0')\n arr3[2]=arr2[j];\n else\n {\n arr3[2]='1';\n break;\n }\n }\n }\n if(arr3[0]=='1'||arr3[1]=='1'||arr3[2]=='1')\n printf(\"Impossible.\");\n else\n {\n for(i=2;i>=0;i--)\n {\n printf(\"%c\",arr3[i]);\n }\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "02ce1b5cfdb527420de4df2745738d85", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint n,k;\n\tchar s[105];\n\tint target,grass;\n\tscanf(\"%d%d\",&n,&k);\n\tint flag=0;X\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t\tif(s[i]=='T') target=i;\n\t\tif(s[i]=='G') grass=i;\n\t}\n\tif(grasstarget)\n\t{\n\t\tint j=grass;\n\t\twhile(s[j]!='#'&&j\n#include\nmain()\n{\n\tint n,k,l,i,m,j;\n\tscanf(\"%d%d\",&n,&m);\n\tchar s[n+1];\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;ij)\n\t\tprintf(\"NO\");\n\t\t\n\t}\n\tif((k-j)>0)", "lang_cluster": "C", "compilation_error": true, "code_uid": "9972c0ca7ed9fabf31b2930f51062682", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nmain{\n\tint n,k,g,t;\n\tscanf(\"%d %d\",&n,&k);\n\tint i; \n\tchar arr[n];\n\t\n\tscanf(\"\\n\");\n\tfor(i=0;i\nint main()\n{\n int n,k;\n int pos1,pos2,temp;\n char s[110];\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",s);\n for(int i=0;ipos2)\n {\n temp=pos1;\n pos1=pos2;\n pos2=temp;\n }\n #printf(\"%d!%d\\n\",pos1,pos2);\n while(pos1+k<100)\n {\n if(pos1+k==pos2)\n {\n printf(\"YES\\n\");\n return 0;\n }\n if(s[pos1+k]=='#')\n {\n printf(\"NO\\n\");\n return 0;\n }\n pos1=pos1+k;\n }\n printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "abf11e8cac45d00e73011988a889629d", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nchar a[101];\n\nint main() {\n\n\tunsigned char n, k;\n\tscanf(\"%hhu %hhu\\n\", &n, &k);\n\tscanf(\"%s\", a);\n\n\tunsigned char i;\n\tfor (i = 0; i < n; i++) {\n\t\tif (a[i] == 'T' || a[i] == 'G')\n\t\t\tbreak;\n\t}\n\n\tfor (i += k; i < n; i += k) {\n\t\tswitch (a[i]) {\n\t\tcase '#':\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t\tbreak;\n\t\tcase 'G':\n\t\tcase 'T':\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprintf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1aebb1881d1e3dfe5678be1a942537a8", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n long long a;\n int i,j,n=0;\n int c=0\n printf(\"enter a number 1\n#include\nmain(void){\n long long a,i,c=0;\n scanf(\"%I64d\",&a);\n c=[n/3]+[n/2]+[n/5]+[n/7]-[n/10]-[n/14]-[n/6]-[n/35]-[n/21]-[n/15]+[n/105]+[n/30]+[n/42]+[n/70]-[n/210]\n printf(\"%I64d\",c); \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3063ffd71e7436e8cee850e73dbd3311", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "\n#include\n int main(){\n long long inp; \nint counter = 0;\n scanf(\"%I64d\",&inp); \nfor(int i = 1;i<= inp;i++)\n if(i % 2520! = 0 ){ counter = counter + 1; }\n} printf(\"%d\",counter); \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e1fe04e038f3129a68f8c4e72036eb32", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nmain(void){\n long long a,i,c=0;\n scanf(\"%I64d\",&a);\n c=[n/3]+[n/5]+[n/7]-[n/35]-[n/21]-[n/15]+[n/105]\n printf(\"%I64d\",c); \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "221781b3fa7b8058cca5590247489a0c", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n long long int n;\n scanf(\"%I64d\", &n);\n\n eqn = n / 2 + n / 3 + n / 5 + n / 7 - (n / (2 * 3) + n / (2 * 5) + n / (2 * 7)\n + n / (3 * 5) + n / (3 * 7) + n / (5 * 7)) + n / (2 * 3 * 5) + n / (2 * 3 * 7)\n + n / (2 * 5 * 7) + n / (3 * 5 * 7) - n / (2 * 3 * 5 * 7);\n\n /* n(A U B U C U D) = p(A) + p(B) + p(C) + p(D) - P(AnB) - p(AnC) - p(AnD) - p(BnC) - p(BnD) - p(CnD)\n + p(AnBnC) + p(AnBnD) + p(AnCnD) + p(BnCnD) - p(AnBnCnD) */\n\n printf(\"%I64d\", n - eqn);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ddfaf1d2cf5dbea54fd7f77ad3201b2d", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nint egcd(int a, int b, int &x, int &y) { \n if (a == 0) { \n x = 0;\n y = 1;\n return b; \n } \n \n int x1, y1;\n int gcd = egcd(b % a, a, x1, y1); \n \n x = y1 - (b / a) * x1; \n y = x1; \n \n return gcd; \n} \n\nint main() {\n int a, b, c, g, x, y;\n \n cin >> a >> b >> c;\n \n g = egcd(a, b, x, y);\n \n if (y < x) {\n swap(x, y);\n swap(a, b);\n }\n \n if (c % g) {\n cout << \"No\";\n return 0;\n }\n \n a /= g;\n b /= g;\n c /= g;\n \n if (c * y - (-c * x + b - 1) / b * a < 0)\n cout << \"No\";\n else\n cout << \"Yes\";\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7c7382c7c23f50f5e834a351e7842a14", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b568097def48f68979a541f57ae8493d", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint main ()\n{\n int x,y,z,i,j,ck=0;\n scanf(\"%d%d%d\",&x,&y,&z);\n for(i=0;i<=z;i++){\n for(j=0;j<=z;j++){\n if(x*i+y*j==z){\n ck=1;\n break;\n }\n }\n }\n if(ck==1){\n printf(\"Yes\\n\");\n }\n else {\n printf(\"No\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b537192525f62ce090f3d023d2ee1ac1", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid main()\n{\nint a,b,c,m=0,j,s=0,i;\nclrscr();\nscanf(\"%d%d%d\",&a,&b,&c);\nfor(i=0;i<=999;i++)\nfor(j=0;j<=999;j++)\n{\ns=a*i+b*j;\nif(s==c)\nm=1;\ns=0;\n}\nif(m==1)\nprintf(\"Yes\");\nelse\nprintf(\"No\");\ngetch();\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "913898983b86df391b6ceffeb36110bf", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a , b , c , i , temp;\n scanf(\"%d %d %d\", &a ,&b ,&c);\n for ( i = 1 ; i <= c ; i++){\n temp = c - ( i * a);\n if ( temp >= 0 && temp % b == 0 ){\n print(\"Yes\");\n return 0;\n }\n }\n print(\"No\");\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "373e2fb186e7cbc473f7237aec436857", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n\n#define swap(a,b) (a)=(a)+(b)-((b)=(a))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define FOR(i,a,b) for((i)=(a);(i)<(b);(i)++)\n#define pw printf(\" \")\n#define pn printf(\"\\n\")\n#define pi(a) printf(\"%d\",(a))\n#define si(a) scanf(\"%d\",(&a))\n#define FORD(i,a,b) for((i)=(a);(i)>=(b);(i)++)\n#define chkpowtwo(a) (!((a)&((a)-1)))\n\ninline int power(int a,int b)\n{\n\tint s=1;\n\twhile(b)\n\t{\n\t\tif(b&1)\n\t\t\ts*=a;\n\t\ta=a*a;\n\t\tb=b/2;\n\t}\n\treturn s;\n}\n\nint main()\n{\n\tint n;\n\tsi(n);\n\tint i,flag,x,count=0;\n\tFOR(x,1,n)\n\t{\n\t\tflag=0;\n\t\tFOR(i,1,n-1)\n\t\t{\n\t\t\tif(power(x,i)%n==1)\n\t\t\t\tflag=1;\n\t\t}\n\t\tif(power(x,n-1)%n!=1)\n\t\t\tflag=1;\n\t\tif(flag==0)\n\t\t\tcount++;\n\t}\n\tpi(count);pn;\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b4ec0c2341c3406dbd706eb32f8d0f2", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int p, count(0);\n scanf(\"%d\", &p);\n for (int n = 1; n < p; ++n)\n {\n bool ok = true;\n int x = 1;\n for (int i = 1; i < p - 1; ++i)\n {\n x *= n;\n x %= p;\n if (x == 1)\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n x *= n;\n x %= p;\n if (x == 1)\n {\n count += 1;\n }\n }\n }\n printf(\"%d\\n\", count);\n return 0;\n}\n\n\n//4306655\t Aug 18, 2013 8:36:13 AM\tfuwutu\t 284A - Cows and Primitive Roots\t GNU C++0x\tAccepted\t30 ms\t0 KB\n#include \n\nint main()\n{\n int p;\n scanf(\"%d\", &p);\n int n = p - 1;\n int count = n;\n for (int i = 2; i * i <= n; ++i)\n {\n if (n % i == 0)\n {\n do\n {\n n /= i;\n } while (n % i == 0);\n count = count / i * (i - 1);\n }\n }\n if (n != 1)\n {\n count = count / n * (n - 1);\n }\n printf(\"%d\\n\", count);\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "2754f63c1f554bc77ce8fa8add4f3f04", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "\n#include \n\nint main()\n{\n int p;\n scanf(\"%d\", &p);\n int n = p - 1;\n int count = n;\n for (int i = 2; i * i <= n; ++i)\n {\n if (n % i == 0)\n {\n do\n {\n n /= i;\n } while (n % i == 0);\n count = count / i * (i - 1);\n }\n }\n if (n != 1)\n {\n count = count / n * (n - 1);\n }\n printf(\"%d\\n\", count);\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "7e17ebf65f17df664fc075a1450aba22", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "\n#include \n\nint main()\n{\n int p;\n scanf(\"%d\", &p);\n int n = p - 1;\n int count = n;\n for (int i = 2; i * i <= n; ++i)\n {\n if (n % i == 0)\n {\n do\n {\n n /= i;\n } while (n % i == 0);\n count = count / i * (i - 1);\n }\n }\n if (n != 1)\n {\n count = count / n * (n - 1);\n }\n printf(\"%d\\n\", count);\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "9a9df9b6e96d2b2b97e780452e1406c7", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int i,c=0,j,p,x,f;\n scanf(\"%d\",&p);\n for(i=2;i\nint main()\n{\n int n,m,k;\n scanf(\"%d %d %d\",&n,&m,&k);\n int a[n];\n int i,j,l,o,p,b,c;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;ia[j])\n {\n l=a[j];\n a[j]=a[i];\n a[i]=l;\n }\n }\n }int t=1;p=0;\n for(i=n;i>1;i--)\n {\n p+=a[i]+k-1;\n k--;\n \n if(p>=m)\n break;\n if(k==0)\n {\n p+=a[i-1]-1\n }\n t++;\n \n }\n printf(\"%d\",t);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "598d7921fdab934ee3d86a4a8b62a586", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,m,k,i,j,count,temp,o=0;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tint a[n];\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\tm=m-k;\n\ttemp=0;\n\tcount=0;\n\to=0;\n\tfor(i=n-1;i>=0;i--)\n\t{\n\t\tif(temp=m)\n\t\t{\n\t\t\tprintf(\"%d\",o);\n\t\t\tcount=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(count==0)\n\tprintf(\"-1\");\n}#include\nint main()\n{\n\tint n,m,k,i,j,count,temp,o=0;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tint a[n];\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\tm=m-k;\n\ttemp=0;\n\tcount=0;\n\to=0;\n\tfor(i=n-1;i>=0;i--)\n\t{\n\t\tif(temp=m)\n\t\t{\n\t\t\tprintf(\"%d\",o);\n\t\t\tcount=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(count==0)\n\tprintf(\"-1\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "531c988c760fd06b219bc424a2200e3f", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "418c8e7d4ed44fbfeee84a5bdf78f75a", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint b[501];\nvoid merge(int a[], int k,int l);\nvoid merge_sort(int a[], int n);\n\nint main()\n{\n int n,m,k,i,s,flag,a[501];\n scanf(\"%d%d%d\",&n,&m,&k);\n for(i=0;i=m) {flag=1;break;}\n }\n if(k!=0&&flag) printf(\"%d\\n\",i);\n else printf(\"-1\\n\");//getch();\n return 0;\n}\nvoid merge_sort(int a[], int n)\n{\nif(n==1||n==0) return;\nmerge_sort(a, n/2);\nmerge_sort(a+n/2, n-n/2);\nmerge(a,n/2, n-n/2);\n}\n\nvoid merge(int a[], int k,int l)\n{\n int i,j=k,c=0;\nfor(i=0;i=a[j]&&j\nint main()\n{\nint n,m,k,i,s=0,tmp,x,y,t;\nint a[50];\nscanf(\"%d %d %d\",&n,&m,&k);\ntmp=n;\nwhile(n--)\nscanf(\"%d\",&a[i++]);\n\nfor(x=0;x<=tmp-2;x++)\n{\n for(y=0;y<=tmp-2-x;y++)\n {\n if(a[y]=m){break;}\n\n else {s+=a[i];k--;}\n}\nif(s+k>=m)\n printf(\"%d\",i);\n \nelse printf(\"%d\",-1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b7903a1e46d30fd9bbdb17a0af3b965", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tchar a[200];\n\tint count = 0;\n\tgets(a);\n\tint n = strlen(a);\n\tfor(int i = 0; i < n; i++)\n\tif( a[i] == 'Q');\n\tfor(int j = i + 1; j < n; j++)\n\tif( a[j] == 'A');\n\tfor(int k = j + 1; k < n; k++)\n\tif( a[k] == 'Q');\n\n\tcount++;\n\t\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4cafc4510f6bf5e010616a2fb3ba6eb8", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char str[101];int count=0,ans=0;\n scanf(\"%s\",str);\n str[strlen(str)]='\\0';\n for(i=0;i\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "85efd195400b4e6b2c8220a33f2c82b2", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nusing namespace std;\nint main()\n{\n\tstring s;\n\tgetline(cin,s);\n\tint i,count=0,j,k;\n\tfor(i=0;s[i]!='\\0';i++)\n\t{\n\t\tif(s[i]=='Q'&&s[i+1]=='A')\n\t\t{\n\t\t\tfor(j=i+1;s[j]!='\\0';j++)\n\t\t\t{\n\t\t\t\tif(s[j]=='Q')\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\tfor(i=0;s[i]!='\\0';i++)\n\t\t{\n\t\t\tif(s[i]=='Q'&&s[i+1]!='A')\n\t\t\t{\n\t\t\t\tfor(j=i+1;s[j]!='\\0';j++)\n\t\t\t\t{\n\t\t\t\t\tif(s[j]=='A'&&s[j+1]=='Q')\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(i=0;s[i]!='\\0';i++)\n\t\t{\n\t\t\tif(s[i]=='Q')\n\t\t\t{\n\t\t\tfor(j=i+2;s[j]!='0';j++)\n\t\t\t{\n\t\t\t\tif(s[j]=='A'&&s[j+1]=='Q')\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\tfor(i=0;s[i]!='\\0';i++)\n\t\t\t{\n\t\t\t\tif(s[i]=='Q')\n\t\t\t\t {\n\t\t\t\t \tfor(j=i+2;s[j]!='\\0';j++)\n\t\t\t\t \t{\n\t\t\t\t \t\tif(s[j]=='A')\n\t\t\t\t \t\t{\n\t\t\t\t \t\tfor(k=j+2;s[k]!='\\0';k++)\n\t\t\t\t \t\t{\n\t\t\t\t \t\t\tif(s[k]=='Q')\n\t\t\t\t \t\t\tcount++;\n\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\t\n\t\t}\ncout<\n#include\nint main()\n{\n\tchar s[110];\n\tint i,j,k,n,sum=0;\n\tscanf(\"%s\",&s);\n\tn=strlen(s);\n\tfor(i=0;i\n#include\nint main()\n{\n int n,k,largest=0,score0=0;\n scanf(\"%d\",&n);\n int hl=(n+1/2);\n int a[n];\n for(int i=0;ilargest)\n {\n largest=a[i];\n }\n score0=score0+a[i];\n }\n int tk;\n for(int i=0;i\nint main(){\n int n ; \n scanf(\"%d\",&n);\n max = 0;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6395fd659742cd74fb818a8b6af66c57", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0} {"lang": "GNU C11", "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\",);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4443c69392385b65d0b86a89d54186ec", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0} {"lang": "GNU C11", "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\tbool cek = true;\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 = false;\n\t\t}\n\t}\n\tprintf(\"%d\", max);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "010cef60b49d23574235b69aa7214593", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n ; \n scanf(\"%d\",&n);\n max = 0;\n int x ; \n int total=0;\n int res=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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b465affd0d13597090d5d7943b1d4810", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,j,k,l=0;\n int arr[100];\n scanf(\"%d\",&n);\n int arr1[n];\n for(i=0;i=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(arr[i]==arr[j])\n {\n arr1[j]=2000;\n }\n\n }\n }\n for(i=0;i\n\nint main()\n{\n int n, m, i, j=0, a[1010], b[1010], 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 return 0;\n}\nclose", "lang_cluster": "C", "compilation_error": true, "code_uid": "ef91ab126db07152d650bf19ce3b89cd", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \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\tprintf(\"%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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f7fcd65057a9ba2f44da57580c47f6b", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int n, m, i, j=0, a[1010], b[1010], s[] = {0,0,0,0,0,0,0,0,0,0,0};\n \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}\nclose ", "lang_cluster": "C", "compilation_error": true, "code_uid": "f414c05f030327b89a0d3b6aeb7f88fb", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int i,j=0;\n int count=0;\n int n;\n int a[200];\n int b[200];\n int c[200];\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#include \n#include \n\nint main()\n{\n int i,j=0;\n int count=0;\n int n;\n int a[200];\n int b[200];\n int c[200];\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#include \n#include \n\nint main()\n{\n int i,j=0;\n int count=0;\n int n;\n int a[200];\n int b[200];\n int c[200];\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#include \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[1000];\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "02d755b33d8639edb3a7beb55bfd1acc", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "be60dcb2c4ae9550e1529963a4b596c0", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "difficulty": 1400.0} {"lang": "GNU C11", "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/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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d72876e51d40ea9e20cb44bd57067b3", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "difficulty": 1400.0} {"lang": "GNU C11", "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\u306e\u914d\u5217\u6570,sizeof(int),intsort);*/\n}\n\nint longsort(const void *a, const void *b){\n\tlong *A=(long *)a;\n\tlong *B=(long *)b;\n\tif(*A>*B) return -1;\n\tif(*A<*B) return 1;\n\treturn 0;\n}\n\nint main(){\n\tint i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;\n\tfor(i=0;i<3;i++){\n\tscanf(\"%d\",&a[i]);\n\t}\n/*\tif(a[0]%3==0){\n*/\t\n\t\nb[0]=a[0]/3;\nmin=b[0];\n/*\t}else{\n\t\tb[0]=a[0]/3+1;\n\t}\n\tif(a[1]%2==0){\n*/\nb[1]=a[1]/2;\nif(min>b[1])min=b[1];\n/*\t}else{\n\t\tb[1]=a[1]/2+1;\n\t}\n\tif(a[2]%2==0){\n*/\nb[2]=a[2]/2;\nif(min>b[2])min=b[2];\n/*\t}else{\n\t\tb[2]=a[2]/2+1;\n\t}\n*/\n\nans=min*7;\na[0]-=3*min;\na[1]-=2*min;\na[2]-=2*min;\nmin=0;\nx=a[0];\ny=a[1];\nz=a[2];\n\t//sun\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tmin=day;\n\t\n\tday=0;\n\tx=a[0];\t\n\ty=a[1];\n\tz=a[2];\n\t\t\t\t//\u6708\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(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\nint main()\n{\n int a,ac,b,bc,cc,c,n,i,days=0,j;\n scanf(\"%d %d %d\",&a,&b,&c);\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\tlong long ans[10]={0},max,flag,count[4]={0},a,b,c,i;\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\tflag=i;\n\t\tcount[1]=a;\n\t\tcount[2]=b;\n\t\tcount[3]=c;\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "bd5403fcb42acba2edfd4177ee4886fe", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\",2-x*x);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b831305b9de6234d7cbaddc3c18b565", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\nvoid main()\r\n{\r\n int b;\r\n scanf(\"%d\",&b);\r\n printf(\"%d\",2-b*b);\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "aaa872d342149eb77c8f964283416d8d", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\nvoid main()\r\n{\r\n int a;\r\n scanf(\"%d\",&a);\r\n printf(\"%d\",a);\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c55cc301933c274e623cb74e898fa49", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\nvoid main()\r\n{\r\n int a;\r\n scanf(\"%d\",&a);\r\n printf(\"1\");\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d6228579edffb37c926dae2a272bc84", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\nint main(){\r\nint a;\r\ncin>>a;\r\nprintf(\"%d\",2-(a*a));\r\nreturn 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "393967998bcc66d3c7977c75aca406ea", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n int n;\n scanf(\"%d\", &n);\n char input[20];\n scanf(\"%s\", input);\n int digitCount[8] = {0,0,0,0,0,0,0,0};\n int i;\n for (i=0; i='2') {\n switch(input[i]) {\n case '9':\n digitCount[7]++;\n digitCount[3]+=2;\n digitCount[2]++;\n break;\n case '8':\n digitCount[7]++;\n digitCount[2]+=3;\n break;\n case '6':\n digitCount[5]++;\n digitCount[3]++;\n break;\n case '4':\n digitCount[3]++;\n digitCount[2]+=2;\n break;\n default: // 2,3,5,7\n int digit = input[i]-'0';\n digitCount[digit]++;\n }\n }\n }\n char number[100];\n char *numberP = number;\n int digit;\n for (digit=7; digit>1; digit--) {\n char digitC = '0' + digit;\n for (i=0; i\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n int n;\n string a;\n gets(a);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0e3a50e902715b599cc0897f8cf22600", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n int n;\n scanf(\"%d\", &n);\n char input[20];\n scanf(\"%s\", input);\n int digitCount[8]{0};\n for (int i=0; i='2') {\n switch(input[i]) {\n case '9':\n digitCount[7]++;\n digitCount[3]+=2;\n digitCount[2]++;\n break;\n case '8':\n digitCount[7]++;\n digitCount[2]+=3;\n break;\n case '6':\n digitCount[5]++;\n digitCount[3]++;\n break;\n case '4':\n digitCount[3]++;\n digitCount[2]+=2;\n break;\n default: // 2,3,5,7\n int digit = input[i]-'0';\n digitCount[digit]++;\n }\n }\n }\n char number[100];\n char *numberP = number;\n for (int digit=7; digit>1; digit--) {\n char digitC = '0' + digit;\n for (int i=0; i\n#include \n#include \n#define long long ll\n\nint main(void)\n{\n int fact[10];\n fact[0] = 1;\n int i;\n for (i = 0; i < 10; ++i) {\n fact[i] = i * fact[i-1];\n }\n int n;\n scanf(\"%d\", &n);\n ll num;\n scanf(\"%lld\", &num);\n unsigned ll org = 1;\n ll temp = num;\n while (temp > 0) {\n org *= fact[temp % 10];\n temp = temp / 10;\n }\n\n ll ans = 1000000000000000 - 1;\n ans = ans - num;\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "181bc2249fc791ecaa3e64421b987541", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "\n\nint main()\n{\n int arr[10],i;\n for(i=0;i<10;i++)\n arr[i]=0;\n int n;\n scanf(\"%d \",&n);\n char ch='a';\n while(1)\n {\n scanf(\"%c\",&ch);\n if(ch=='\\n')\n break;\n arr[(int)ch%48]++;\n //printf(\"i:%d arr[i]:%d\",(int)ch%48,arr[(int)ch%48]);\n }\n arr[0]=-1;arr[1]=-1;\n arr[7]+=arr[9]+arr[8];\n arr[3]+=2*arr[9]+arr[6]+arr[4];\n arr[2]+=arr[9]+3*arr[8]+2*arr[4];\n arr[9]=0;arr[8]=0;\n arr[5]+=arr[6];\n arr[6]=0;arr[4]=0;\n for(i=9;i>=0;i--)\n {\n while(arr[i]>0)\n {\n printf(\"%d\",i);arr[i]--;\n }\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "f951d3e5446aedba6ffca76bc5bb76f7", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint ch_weight(char p);\nint check_bw(char p[][8]);\n\nint main(){\n char pan[8][8];\n char white[4][8];\n char black[4][8];\n \n int i,j,w_num=0,b_num=0;\n \n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&pan[i][j];\n }\n }\n \n if(check_bw(pan)==1){\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n black[i][j]=pan[i][j];\n white[i][j]=pan[i+4][j];\n }\n }\n }\n else if(check_bw(pan)==2){\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n black[i][j]=pan[i+4][j];\n white[i][j]=pan[i][j];\n }\n } \n }\n \n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n w_num+=ch_weight(white[i][j]);\n b_num+=ch_weight(black[i][j]);\n }\n }\n \n if(w_num>b_num)\n printf(\"White\\n\");\n else if(w_num=97)\n return 1;\n }\n }\n return 2;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3cf7e8f662374f8288a761313951f7f3", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int i,j,sum1,sum2;\n char chess[8][8];\n while(scanf(\"%c\",&chess[0][0])!=EOF)\n {\n sum1=0;\n sum2=0;\n for(i=1;i<8;i++)\n scanf(\"%c\",&chess[0][i]);\n getchar();\n for(i=1;i<8;i++)\n {\n for(j=0;j<8;j++)\n scanf(\"%c\",&chess[i][j]);\n getchar();\n }\n for(i=0;i<8;i++)\n for(j=0;j<8;j++)\n {\n if(chess[i][j]=='Q')\n sum1+=9;\n if(chess[i][j]=='q')\n sum2+=9;\n if(chess[i][j]=='R')\n sum1+=5;\n if(chess[i][j]=='r')\n sum2+=5;\n if(chess[i][j]=='B')\n sum1+=3;\n if(chess[i][j]=='b')\n sum2+=3;\n if(chess[i][j]=='N')\n sum1+=3;\n if(chess[i][j]=='n')\n sum2+=3;\n if(chess[i][j]=='P')\n sum1==1;\n if(chess[i][j]=='p')\n sum2+=1;\n if(sum1>sum2) printf(\"White\\n\");\n else if(sum1\nint main()\n{\n int i,j,w=0,b=0;\n char a;\n for(j=0;j<64;j++)\n {\n scanf(\"%c\",&a);\n switch(c)\n {\n case 'q': b+=9; break;\n case 'r': b+=5; break;\n case 'b': b+=3; break;\n case 'n': b+=3; break;\n case 'p': b+=1; break;\n case 'Q': w+=9; break;\n case 'R': w+=5; break;\n case 'B': w+=3; break;\n case 'N': w+=3; break;\n case 'P': w+=1; break;\n }\n}\n if(w=b)\n printf(\"Draw\");\n if(w>b)\n printf(\"White\");\n if(w\nint main()\n{\n char z;\n int i,j,upper=0,lower=0;\n for(i=0;iupper)\n\tprintf(\"Black\");\n else if(upper\nint main()\n{\n\tint n,d,array[n],i,t;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<=n-1;i++)\n\t{\n\t\tscanf(\"%d\",&array[i]);\n\t}\n\td=(array[n-1]-array[0])/(n-1);\n\tt=array[0]+(n*d);\n\tprintf(\"%d\",t);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e146398659be333027a4d18647944755", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int n;\n cin>>n;\n\n int a[n];\n int i;\n for(i=1;i<=n;i++)\n {\n cin>>a[i];\n }\n int sum = abs(a[2]-a[1]),c=0,temp;\n int x = a[2]-a[1];\n\n for(i=1;i<=n;i++)\n {\n if((abs(a[i]-a[i+1]))==sum)\n {\n c++;\n }\n }\n if(c==n-1)\n {\n if(0<=a[n])\n {\n\n temp = a[n]+x;\n cout<\n\nint main() {\n\nint n;\nint diff;\nint noprog=0;\nscanf(\"%d\", &n) ;\n\nint temp1, temp2;\nscanf(\"%d\", &temp1) ;\nscanf(\"%d\", &temp2) ;\ndiff = temp2-temp1;\nint i;\nfor(i=0;i<(n-2);i++){\ntemp1=temp2;\nscanf(\"%d\", &temp2) ;\nif(temp2-temp1!=diff) {\nnoprog=1;\n}\n}\nif(noprog==1) printf(\"%d\", temp2);\nelse printf(\"%d\", temp2+diff) ;\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ded0000b64183a71c633e8a006763b94", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n int n, tb, i, A[100];\n FILE *file = fopen (\"td.txt\",\"r\");\n\tfscanf (file,\"%d\",&n);\n\tfor (i=0; i\nint main()\n{\nshort int n,array[n],i,t,d[n-1],m;\n\tscanf(\"%hd\",&n);\n\tfor(i=0;i<=n-1;i++)\n\t{\n\t\tscanf(\"%hd\",&array[i]);\n\t}\n\tm=(array[n-1]-array[0])/(n-1);\n\tfor(i=0;i=n-2;i++)\n\t{\n\t\td[i]=array[i+1]-array[i];\n\t}\n\t\tfor(i=0;i=n-2;i++)\n\t{\n\t\tif(d[i]==d[i+1])\n\t\t{\n\t\t\tt=array[0]+(m*d[0]);\n\t\t}\n\t\telse\n\t\t{\n\t\tt=array[n-1];\n\t\tbreak;\n\t}\n\t}\n\tprintf(\"%hd\",t);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e43efa90f9f5e97851c7233b1cf0eb9d", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n\nint main(int argc, char *argv[]) {\n\t\n\tint n, i, j, max = 2010, min = 2100;\n\tscanf(\"%d\", &n);\n\tint a[n];\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\t\n\tfor (i = 0; i < n; i++) {\n\t\tif (a[i] > max) {\n\t\t\tmax = a2[i];\n\t\t\t\n\t\t}\n\t\tif (a[i] < min) {\n\t\t\tmin = a[i];\n\t\t}\n\t}\n\t\n\tprintf (\"%d\", (min + max) / 2);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4131b23d820e5ed6044bba312efaa458", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include>\nint main(void)\n{\n int i,j,n,min,dif=0,dif1;\n scanf(\"%d\",&n);\n int year[n];\n for(i=0;idif)\n dif=dif1;\n }\n printf(\"%d\\n\",year[0]+dif);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d5b92eaadf9da66ff2a696e87723460f", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(int argc, char const *argv[])\n{\n\tint n, *a, i, amin = 2100, x = 0;\n\tscanf(\"%d\", &n);\n\ta = (int *) malloc (sizeof(int) * n);\n\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\t\n\n\tif (n < 2) {\n\t\treturn 0;\n\t}\n\t\n\tfor (i = 0; i < n; i++) {\n\t\tif (a[i] < amin)\n\t\t\tamin = a[i];\n\t}\n\n\tfor (i = 1; i < n; i++) {\n\t\tif ((abs(a[i] - a[i-1])) > x)\n\t\t\tx = (abs(a[i] - a[i-1]));\n\t}\n\n\tprintf(\"%d\\n\", amin+x);\n\n\t/* for (i = 0; i < n; i++) {\n\t\tif \n\t} */\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "96f1369f2c755fe8b2857b4b4475cd51", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint a[7],b,c,i,d;\n\tscanf(\"%d\",&b);\n\t\n\t\tfor(i=0;ia[i+1])\n\t\t{\n\t\t\tc=a[i];\n\t\t\ta[i]=a[i+1];\n\t\t\ta[i+1]=c;\t\n\t\t}\n\t}\n}\n\tprintf(\"%d\",a[b/2]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b39eee06e12f7e9e23c8f42c35e7599e", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid main() \n{\nint x[100],n,i;\n//float mean(int,int[]);\nint median(int,int[]);\n//clrscr();\nscanf(\"%d\",&n);\nfor(i=0;i\nusing namespace std;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "858bcd969cc4ec9dc7cb82f24b84754e", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "r,d=map(int,input().split())\ncount=0\nfor i in range(int(input())):\n x,y,r1 = map(int,input().split())\n k = (x*x+y*y)**0.5\n if (k-r1)>=(r-d) and (k+r1)<=r:\n count+=1\nprint(count)\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f0bb6bd5c6921112c367bfae52c27994", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0} {"lang": "GNU C11", "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;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0096816b7056f50cee74b78e19aaa1f7", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nint main(){\n\tint l,r,x,y;\n\tdouble k;\n\tcin>>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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "107c4301f9328bee464dff355f6fdfb1", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb4c70b31092d0c6b31968bf17f20ddc", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(int argc, char *argv[])\n{\n int n=0,m=0; \n scanf(\"%i%i\",&n,&m);\n int pontos=n*m,jogador=1;\n \n \n if(posntos==1){\n printf(\"Akshat\\n\");\n }else{\n while(1){\n pontos-=2;\n jogador++;\n if(pontos==1){\n printf(\"Akshat\\n\"); \n break;\n }else if(pontos<=0){\n printf(\"Malvika\\n\"); \n break; \n }\n \n } \n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "09c911321107d0391f923adebafba404", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n\n if(((n==1)||(m==1))||((n%2!=0)&&(m%2!=0))||((n%5==0)&&(m%5==0))||((n==99)&&(m==100))||((n==100)||(m=99)))\n {\n printf(\"Akshat\");\n }\n else\n {\n printf(\"Malvika\");\n }\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d9d91dadce625b18321b90cb69c412b", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int horizontal,vertical;\n scanf(\"%d %d\",&horizontal,&vertical);\n if(horizontal%2==0 && vertical%2==0)\n {\n printf(\"Malvika\\n\");\n }\n if(horizontal%2==1 && vertical%2==1)\n {\n printf(\"Akshat\\n\");\n }\n if(horizontal%2==1 && vertical%2==0)\n {\n printf(\"Akshat\\n\");1\n }\n if(horizontal%2==0 && vertical%2==1)\n {\n printf(\"Malvika\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8f0fd9744547cd76978f4a79ae3fcbcc", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int i,c=0,j,a[100,100];\n scanf(\"%d %d\",&n,&m);\n if(m\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a%2==0)\n {\n print(\"Malvika\");\n }\n else\n {\n printf(\"Akshat\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d37292e8fc7efeedfed6f4c9492e271f", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define MAX_ARRAY 1500\n\nint main(void)\n{\n\tint num = 0;\n\tint i = 0, j = 0;\n\tint share, remainder;\n\tchar numArr[MAX_ARRAY] = { 0 };\n\n\twhile (j + 1 < 400)\n\t{\n\t\tshare = (j + 1) / 10;\n\t\tremainder = (j + 1) % 10;\n\n\t\tif (share == 0)\n\t\t{\n\t\t\tnumArr[i++] = remainder;\n\t\t}\n\t\telse if (share >= 1 && share <= 9)\n\t\t{\n\t\t\tnumArr[i++] = share;\n\t\t\tnumArr[i++] = remainder;\n\t\t}\n\t\telse if (share >= 10)\n\t\t{\n\t\t\tnumArr[i++] = share / 10;\n\t\t\tnumArr[i++] = share % 10;\n\t\t\tnumArr[i++] = remainder;\n\t\t}\n\t\tj++;\n\t}\n\n\twhile (1)\n\t{\n\t\tprintf(\"input : \");\n\t\tscanf_s(\"%d\", &num);\n\t\t\n\t\tif (num >= 1 && num <= 1000)\n\t\t{\n\t\t\tprintf(\"%d \\n\", numArr[num - 1]);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"\ufffd\ufffd\ufffd\u0537\ufffd! (range : 1 ~ 1000) \\n\");\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "754c0938a894b6ff78f920cd2a8a76c5", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char s[]=\"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400\";\n int n;\n scanf(\"%d\",&n);\n printf(\"%c\",s[n])\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "91d8296664b24164b4c947851c76656c", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define MAX_ARRAY 1500\n\nint main(void)\n{\n\tint num = 0;\n\tint i = 0, j = 0;\n\tint share, remainder;\n\tchar numArr[MAX_ARRAY] = { 0 };\n\n\twhile (j + 1 < 400)\n\t{\n\t\tshare = (j + 1) / 10;\n\t\tremainder = (j + 1) % 10;\n\n\t\tif (share == 0)\n\t\t{\n\t\t\tnumArr[i++] = remainder;\n\t\t}\n\t\telse if (share >= 1 && share <= 9)\n\t\t{\n\t\t\tnumArr[i++] = share;\n\t\t\tnumArr[i++] = remainder;\n\t\t}\n\t\telse if (share >= 10)\n\t\t{\n\t\t\tnumArr[i++] = share / 10;\n\t\t\tnumArr[i++] = share % 10;\n\t\t\tnumArr[i++] = remainder;\n\t\t}\n\t\tj++;\n\t}\n\n\twhile (1)\n\t{\n\t\tprintf(\"input : \");\n\t\tscanf_s(\"%d\", &num);\n\t\t\n\t\tif (num >= 1 && num <= 1000)\n\t\t{\n\t\t\tprintf(\"%d \\n\", numArr[num - 1]);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"! (range : 1 ~ 1000) \\n\");\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "04b7800722bbab4f59a41340a9c376f2", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,i;\n char a[10000];\n a[0]='1';\n for(i=2;i<1000,i++) sprintf(a,\"%s%d\",a,i);\n scanf(\"%d\",&n);\n printf(\"%c\",a[n-1]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d02f0ad3b81a776e36a5c44e36515198", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint a[1010],k;\n\nint main(){\n int i,k=10,x;\n scanf(\"%d\",&x);\n for (i=1;i<=9;i++)\n a[i]=i;\n for (i=10;i<100;i++){\n a[k]=i/10;\n k++;\n a[k]=i%10;\n k++;\n }\n for (i=100;i<371;i++){\n a[k]=i/100;\n k++;\n a[k]=(i/10)%10;\n k++;\n a[k]=i%10;\n k++;\n }\n printf(\"%d\",a[x]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c6903cf2a8705f4486dc1db8be70297f", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "printf(\"\");", "lang_cluster": "C", "compilation_error": true, "code_uid": "9854bb5f39d175c4f321ad863c19480d", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "GNU C11", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2f043008f31a98c1deb326cd137136ce", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n pritnf(\"NO\");\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7e4ba8cc235e74562ad8a17240a34749", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main(){\n\n\tprintf(\"No\\n\")\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "48b2e1bc8f1bbcb95a6e7a9e921c5ae8", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "GNU C11", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "78fbf91bc4e1b977dc837c88758dbe3a", "src_uid": "b6a30a725754a4b4daeb6e87986e28a4", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n#define maxn 1000000005\nint bit[maxn];\nint main()\n{\n int w,m,b=0,i,f=0;\n scanf(\"%d%d\",&w,&m);\n while (m)\n {\n bit[b++]=m%w;\n m/=w;\n }\n for (i=0;i=w)\n {\n bit[i]-=w;\n bit[i+1]++;\n }\n if (bit[i]==w-1)\n {\n bit[i]=0;\n bit[i+1]++;\n }\n if (bit[i]>1)\n {\n f=1;\n break;\n }\n }\n if (f==0) printf(\"YES\");\n else printf(\"NO\");\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "ce775c6145f91e2a049bf277c753a470", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#define maxn 1000000005\nlong long bit[maxn];\nint main()\n{\n int w,m,b=0,i,f=0;\n scanf(\"%d%d\",&w,&m);\n while (m)\n {\n bit[b++]=m%w;\n m/=w;\n }\n for (i=0;i=w)\n {\n bit[i]-=w;\n bit[i+1]++;\n }\n if (bit[i]==w-1)\n {\n bit[i]=0;\n bit[i+1]++;\n }\n if (bit[i]>1)\n {\n f=1;\n break;\n }\n }\n if (f==0) printf(\"YES\");\n else printf(\"NO\");\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "4199508e0843fe948ef439fc910bcce4", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n\tint m,w;\n\tscanf(\"%d %d\",&w,&m);\n\twhile(m>0){\n\t\tif(m%w==0||m%w==1||m%w=w-1){\n\t\t\tm=m/w;\n\t\t}\n\t\telse{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t\t}\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb1dfb0113178503a60e6ded09c981e4", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\n\nbool getans(long long w,long long m){\n\tlong long current = m;\n\tlong long remain = 0;\n\tlong long bit = 0;\n\twhile(current){\n\t\tremain = current % w;\n\t\tcurrent = current / w;\n\t\tif(remain==1||remain==0)\n\t\t\tcontinue;\n\t\tif(remain==w-1)\n\t\t\tcurrent++;\n\t\telse return false;\n\t}\n\treturn true;\n}\n\nint main()\n{\n\tlong long w,m;\n\tcin>>w>>m;\n\tif(getans(w,m)) \n\t\tcout <<\"YES\"<\nint main(void)\n{\n\tlong long w,m;\n\tscanf(\"%I64d%I64d\",&w,&m);\n\twhile (m>0)\n\t{\n\t\tif (m%w==w-1) m++;\n\t\tif (m%w>1)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tm/=w;\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "151f593985bd244bb632f56a80ccfb75", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n\tint n;\n\tint str[100];\n\tint i;\n\tint check_yes; // yes \ub5b4\ub294\uc9c0 \uccb4\ud06c \n\tint check_blank; // \ube48\uce78\uc778\uc9c0 \uccb4\ud06c \n\tint check_cont; // \uc5f0\uc18d 2\uac1c \uc774\uc0c1\uc778\uc9c0 \uccb4\ud06c \n\tint check_test0;\n\t\n\tcheck_yes = 0;\n\tcheck_blank = 0;\n\tcheck_test0 = 0;\n\t\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\t\n\t//test 0: \uadf8\ub0e5 \uc548 \ub418\ub294 \uacbd\uc6b0 (ex: ??CCY)\n\t\n\tfor(i = 0; i < n-1; i++)\n\t{\n\t\tif(str[i] != '?' && str[i] == str[i+1])\n\t\t{\n\t\t\tprintf(\"No\");\n\t\t\tcheck_test0 = 1;\n\t\t\tbreak;\n\t\t}`````````````\n\t}\n\t\n\tprintf(\"%d\", check_test0);\n\t\n\tif(check_test0 == 0)\n\t{\n\t\t//test 1: \uc2dc\uc791\uacfc \ub05d\uc744 \ubcf4\uc790\n\t\tif(str[0] == '?' || str[n-1] == 0)\n\t\t{\n\t\t\tprintf(\"Yes\");\n\t\t\tcheck_yes = 1;\n\t\t} \n\t\telse\n\t\t{\n\t\t\t//test 2: ?\uac00 2\ubc88\uc774\uc0c1 \uc5f0\uc18d\ub418\ub294\uc9c0 \uccb4\ud06c \n\t\t\tfor( i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tif(str[i] == '?')\n\t\t\t\t{\n\t\t\t\t\tcheck_blank++;\n\t\t\t\t\tif(check_blank == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"Yes\");\n\t\t\t\t\t\tcheck_yes = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcheck_blank = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//test 3: A?A \uaf34 \uccb4\ud06c \n\t\t\tif(check_yes == 0)\n\t\t\t{\n\t\t\t\tfor( i = 1; i < n-1; i++)\n\t\t\t\t{\n\t\t\t\t\tif(str[i] == '?' && str[i-1] == str[i+1])\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"Yes\");\n\t\t\t\t\t\tcheck_yes = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t}\n\t\t\n\t\tif(check_yes == 0)\n\t\t{\n\t\t\tprintf(\"No\");\n\t\t}\t\t\n\t}\n\t\n\treturn 0;\t\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "224403c58af6d43bc14d594d16713f9b", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n int n,i,res=1,s,e,ck=1;\n char x[150],sc,ec;\n scanf(\"%d\",&n);\n getchar();\n fgets(x,150,stdin);\n for(i=0; i\nint main(){\n int n,i=0,count=0;\n scanf(\"%d\",&n);\n char co[n];\n int flag=0,flag1=1;\n scanf(\"%s\",&co[0]);\n for(i=0;i\nint main()\n{\n int i, n;\n char string[100];\n\n scanf(\"%d\", &n);\n scanf(\"%s\", string);\n\n for (i = 0; i < n; i++)\n if (string[i] == string[i + 1] && string[i] != '?')\n {\n print(\"No\");\n return 0;\n }\n\n for (i = 1; i < n - 1; i++)\n {\n if (string[i] == '?' && (string[i - 1] == string[i + 1] || string[i + 1] == '?'))\n {\n printf(\"Yes\");\n return 0;\n }\n }\n if (string[0] == '?' || string[n - 1] == '?')\n {\n printf(\"Yes\");\n return 0;\n }\n\n printf(\"No\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a49d9f5a34b8dc13984f8aac71a11561", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nint main()\n{\n long long int i,j,k=0,n;\n char ch[100000],cp='k';\n scanf(\"%I64d\",&n);\n gets(ch)\n for(i=0;i\nint main()\n{\n int n,r[100],b[100],i,ct1,ct2,ct3,ct4,ct5,r,s,c;\n scanf(\"%d\",&n);\n for(i=0;i\nint main()\n{\n int i,j,n,count=0,factor=0,equal=0;\n\n scanf(\"%d\",&n);\n \n int b[n],c[n];\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n printf(\"\\n\");\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&c[i]);\n }1\n\n for(i=1;i<=n;i++)\n {\n if(b[i]c[i])\n factor++;\n }\n }\n\n for(i=1;i<=n;i++)\n {\n if(b[i]==c[i])\n equal++;\n }\n\n if(equal==n)\n {\n printf(\"%d\",-1);\n }\n else\n {\n if(factor!=0)\n printf(\"%d\",(int)(count/factor)+1);\n else\n {\n printf(\"%d\",1);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2dd8358a1d0857dc833fa168b1ebdf02", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n \n \n \nint main()\n{\n int T;\n scanf(\"%d\",&T);\n int a[T];\n int b[T];\n int i;\n for(i=0;ib_wins)\n break;\n t++;\n }\n\n\n printf(\"%d\\n\",t);\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dac0ad8d7ea9cf64691ab999b4099cae", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int i,j,n,count=0,factor=0,equal=0;\n\n scanf(\"%d\",&n);\n \n int b[n],c[n];\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n printf(\"\\n\");\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&c[i]);\n }1\n\n for(i=1;i<=n;i++)\n {\n if(b[i]c[i])\n factor++;\n }\n }\n\n for(i=1;i<=n;i++)\n {\n if(b[i]==c[i])\n equal++;\n }\n\n if(equal==n)\n {\n printf(\"%d\",-1);\n }\n else\n {\n if(factor!=0)\n printf(\"%d\",(int)(count/factor)+1);\n else\n {\n printf(\"%d\",-1);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2eb39d9b5d7d4b7cec50b7869fdfdfa0", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int i,n,count=0,factor=0,equal=0;\n \n scanf(\"%d\",&n);\n \n int b[n],c[n];\n \n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n printf(\"\\n\");\n \n \n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&c[i]);\n }\n \n for(i=1;i<=n;i++)\n {\n if(b[i]c[i])\n factor++;\n }\n }\n \n for(i=1;i<=n;i++)\n {\n if(b[i]==c[i])\n equal++;\n }\n \n if(equal==n)\n {\n printf(\"%d\",-1);\n }\n else\n {\n if(factor!=0)\n printf(\"%d\", (int)(count/factor)+1)\n }\n \n return 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d5427341724b1f4d86029e25fa93e76", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \nint main(){\n int n,ans=0,temp,i;\n scanf(\"%d\",&n);\n i=0;\n while(n>0){\n temp=n%10;\n temp=(temp==4)?1:2;\n ans+=(temp*(1<\nint main(){\n long long int n,ans=0,temp,i;\n cin >> n;\n i=0;\n while(n>0){\n temp=n%10;\n temp=(temp==4)?1:2;\n ans+=(temp*(1<\n#include \n#include \n#include \n\nint main(void)\n{\nint i;\nint n; scanf(\"%d\",&n);\nint happy;\nint count1=0\nint count2=0;\nint tmp;\nint sum;\n\ncount1++;\n\nhappy=n;\n\nwhile(happy>0)\n{\n\ttmp=happy%10;\n\thappy=happy/10;\n\tcount1++;\n}\n\nhappy=n;\n\nwhile(happy>0)\n{\n\ttmp=happy%10;\n\thappy=happy/10;\n\tcount2++;\n\tif(tmp==7)\n\t\tbreak;\n}\n\nfor(i=0;i\n#include\n#include\nvoid main(){\n \n char p[20];\n scanf(\"%s\",p);\n int ans = 1;\n int len = strlen(p)\n for(int i=0;i\nint main(){\n long long int n,ans=0,temp,i;\n cin >> n;\n i=0;\n while(n>0){\n temp=n%10;\n temp=(temp==4)?1:2;\n ans+=(temp*(1<\n\nusing namespace std;\n\nint main(){\n\tint w, h, k;\n\tcin >>w>> h>>k;\n\t\n\tint ans= 0;\n\tfor(inst i=1 ; i<=k; i++){\n\tans=ans +(w+h) *2-4;\n\t\n\t}\n\n\tcount<\nmain()\n{\n int w,h,k,i,s=0;\n scanf(\"%d%d%d\"&w,&h,&k);\n for(i=1;i<=k;i++)\n {\n s=2*w+2*w-4;\n w=w-2,h=h-2;\n }\n printf(\"%d\",s);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e98ee08f990dee7b150ea28a89dc5bfb", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int w,h,k,i;\n scanf(\"%d%d%d\",&w,&h,&k);\n \n for(i=1;i<=k;i++)\n {\n if(w>h)\n printf(\"%d\",(h\u22124(i\u22121))*2+((w\u22124(i\u22121))-2)*2);\n else \n printf(\"%d\",((h\u22124(i\u22121))-2)*2+(w\u22124(i\u22121))*2);\n \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c2149265b69e3c5ee7a1dca296ea8b29", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint n,m,k;\nint main(){\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tint sum=0;\n\twhile(k--){\n\t\tsum+=(n*2+(m-2)*2);\n\t\tn-=4,m-=4;\n\t}\n\tprintf(\"%d\\n\",sum);\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "63ad5edc55aa72054bf1a45a3c989cc6", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int w,h,k,i;\n scanf(\"%d%d%d\",&w,&h,&k);\n \n for(i=1;i<=k;i++)\n {\n if(w>h)\n printf(\"%d\",(h\u22124*(i\u22121))*2+((w\u22124*(i\u22121))-2)*2);\n else \n printf(\"%d\",((h\u22124*(i\u22121))-2)*2+(w\u22124*(i\u22121))*2);\n \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "311a50538bfaca2b9ac39ead8ad54492", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\nint main()\n{\n int n,a,x,b,y,k;\n cin>>n>>a>>x>>b>>y;\n while(a!=x||b!=y)\n {\n if(a!=x)\n {\n if(a==n)\n a=0;\n a++;\n }\n else\n k=0;\n\n if(b!=y)\n {\n if(b==1)\n b=n+1;\n b--;\n }\n else\n k=0;\n\n if(a==b)\n {\n k=1;\n break;\n }\n }\n if(k==1)\n cout<<\"YES\"<\n#define MIN(A,B) ((A)<(B))?(A):(B)\nint main()\n{\n int a1[150]={0},b1[150]={0};\n int a,x,b,y,n,i,k,j;\n scanf(\"%d %d %d %d %d\",&n,&a,&x,&b,&y);\n for(i=a,k=0;i!=x;i++,k++)\n {\n a1[k]=i;\n if(i==n)\n i=0;\n }\n for(i=b,j=0;i!=y;i--,j++)\n {\n b1[j]=i;\n if(i==1)\n i=n+1;\n }\n k=MIN(k,j);\n for(i=0,n=0;i<=k;k++)\n {\n if(a[i]==b[i])\n n=1;\n }\n if(n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9e1b359f9be19be5912feaaac7fde817", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int n,a,x,b,y,flag=0;\n scanf(\"%d%d%d%d%d\",&n,&a,&x,&b,&y);\n a--;x--;b--;y--;\n\n while (true) {\n if (a == b) {\n printf(\"YES\\n\");\n return 0;\n }\n if (a == x || b == y) {\n break;\n }\n a = (a + 1) % n;\n b = (b - 1 + n) % n;\n }\n printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1a2f302536e77d64a005e815394137d2", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint a,x,b,y,n;\n\tscanf(\"%d %d %d %d %d\",&n,&a,&x,&b,&y);\n\tif(a==n+1)\n\ta=1;\n\tif(b==0)\n\tb=n;\n\ta=a+1;b=b-1\n\tif(a==b)\n\t{\n\tprintf(\"yes\");\nreturn 0;\n\t}\n\n\t\n\tprintf(\"no\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "41bd61d04a1af1cd22e02ac3837fafb2", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "# include \nint main()\n{\n\tint n,a,b,x,y,i,j=0;\n\tscanf(\"%d%d%d%d%d\",&n,&a,&x,&b,&y);\n\tif(a==b)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\tj=1;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\twhile(a!=x||b!=y)\n\t{\n\t\tif(a!=x)\n\t\t{\n\t\t\tif(a!=n)\n\t\t\ta++;\n\t\t\telse\n\t\t\ta=1;\n\t\t}\n\t\tif(b!=y)\n\t\t{\n\t\t\tif(b!=1)\n\t\t\tb--;\n\t\t\telse\n\t\t\tb=n;\n\t\t}\n\t\tif(a==b)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\tj=1;\n\t\t}\n\t}\n\t\t}\n\tif(j==0)\n\tprintf(\"NO\");\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1bcb65494bae1e26f894b9d92131f7a7", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n using namespace std;\n int main()\n {\n int n,a,b;\n cin>>n>>a>>b;\n if(b=0)\n {\n cout<n)\n {\n cout<<((a+b)%n)+(a+b)/n;\n }\n if(b<0)\n {\n b=-(b);\n cout<\nint main()\n{\nint a,b,n,x;\nscanf(\"%d%d%d\",&n,&a,&b);\nif(b<0 && n*a<(-b))\nx=(n+a-b)%;n;\n{\nif(x==0)\nprintf(\"%d\",n);\nelse\nprintf(\"%d\",x);\n}\nelse\nx=(n+a+b)%n;\n{ \nif(x==0)\nprintf(\"%d\",n);\nelse\nprintf(\"%d\",x);\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "07cd523c08954e7b2526ebda0b1f3e07", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main(int n,int x,int y)\n{\ns=(x+y)%n;\nif(s<=0) s=s+n;\nprintf(\"%d\",s);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c87fca3d1d98eb4c875f5dd971f8e19f", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint a,b,n,x;\nscanf(\"%d%d%d\",&n,&a,&b);\nif(b<0 && n*a<(-b))\nx=(n+a-b)%n;\n{\nif(x==0)\nprintf(\"%d\",n);\nelse\nprintf(\"%d\",x);\n}\nelse\nx=(n+a+b)%n;\n{ \nif(x==0)\nprintf(\"%d\",n);\nelse\nprintf(\"%d\",x);\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c621863974d3fb85504e07d72a66846a", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \nusing namespace std;\nint n,a,b,ans;\nvoid step()\n{\n ans=a;//\u521d\u59cb\u4e3a\u7b2ca\u4e2a\u95e8\n if(b<0)//b\u5c0f\u4e8e0\u65f6{\n while(1){\n ans--;//\u5012\u9000\uff0c\u95e8\u7684\u7f16\u53f7\u51cf\u5c0f\n b++;\n if(ans<1){//\u5982\u679c\u8d70\u8fc7\u4e861\u53f7\u95e8\n ans=n;//\u7f16\u53f7\u53d8\u4e3an\n }\n if(b==0){//\u5982\u679c\u8d70\u5b8c\u4e86\n return ;\n }\n }\n }\n if(b>0){//\u5927\u4e8e0\u65f6\n while(1){\n ans++;//\u524d\u8fdb\uff0c\u95e8\u7684\u7f16\u53f7\u589e\u52a0\n b--;\n if(ans>n){//\u5982\u679c\u8d70\u8fc7\u4e86n\u53f7\u95e8\n ans=1;//\u7f16\u53f7\u53d8\u4e3a1\n }\n if(b==0){//\u5982\u679c\u8d70\u5b8c\u4e86\n return ;\n }\n }\n }\n return ;\n}\nint main(){\n scanf(\"%d%d%d\",&n,&a,&b);\n step();\n printf(\"%d\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3f0937411e3c937bff516a20c71c5029", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "include\ninclude\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n d=(int)sqrt(a*b*c);\n int N=4*(d/a+d/b+d/c);\n printf(\"%d\",N);\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "73f4121632e39b6c4b6ca8b622a92a8a", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n{\n int main()\n {\n int a,b,c,l,w,h;\n l=4*sqrt(c/(a*b));\n w=sqrt((a*b)/c);\n h=w*(c/a);\n printf(\"%d\", 4*(l+w+h));\n return 0;\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ff1a0966a354f0e7dfc89b60afcde07b", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(){\n int x,y,z,a,b,c;\n scanf(\"%d %d %d\",&x,&y,&z);\n c=(int)xy/z;\n b=(int)xz/y;\n a=(int)yz/x;\n printf(\"%d\",(a+b+c)*4);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "46fde06b143b13b2ea42611ed0606d73", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n{\n int main()\n {\n int a,b,c,l,w,h;\n scanf(\"%d%d%d\",&a,&b,&c);\n l=4*sqrt(c/(a*b));\n w=sqrt((a*b)/c);\n h=w*(c/a);\n printf(\"%d\", 4*(l+w+h));\n return 0;\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "495b9ea3aee70f5fcc67a42a901025f7", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a,b,c,m,i,p=0;\n scanf(\"%d%d%d\",&a,&b,&c);\n m=(a>b && a>c)?a:(b>a && b>c)?b:c;\n for (i=1;i<=m;i++)\n if (a%i==0 && b%i==0 && (a/i)*(b/i)==c)\n { \n p+=i;\n break;\n }\n for (i=1;i<=m;i++)\n if (b%i==0 && c%i==0 && (b/i)*(c/i)==a)\n { \n p+=i;\n break;\n }\n for (i=1;i<=m;i++)\n if (a%i==0 && c%i==0 && (a/i)*(c/i)==b)\n { \n p+=i;\n break;\n }\n printf(\"%d\",p*4);\n if (a==2239 && b=2239 && c==1)\n printf(\"\\b\\b\\b\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "640c68fefd2c9d09aa8f19716c8ab475", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n int a,b,i,j,k,n,val,arrest=0;\n char id[1000];\n scanf(\"%s\",id);\n for(i=0;id[i]!='@';i++){\n if((id[i]>='A' && id[i]<='Z') ||(id[i]>='a' && id[i]<='z') || id[i]=='_' || (id[i]>='0' && id[i]<='9'))\n continue;\n\n arrest=1;\n }\n if(arrest==1 || i==0 || i>16){ printf(\"NO\\n\"); return 0;}\n\n for(i++,j=0,k=0 ;id[i]!='\\0' && id[i]!='/';i++,k++){\n if((id[i]>='A' && id[i]<='Z') ||(id[i]>='a' && id[i]<='z')|| id[i]=='_' || (id[i]>='0' && id[i]<='9'))\n {\n j++;\n\n }\n else if(id[i]=='.'){\n if(j==0 || j>16){printf(\"NO\\n\"); return 0;}\n else j=0;\n }\n else\n arrest=1;\n }\n if(arrest==1 || k==0 || k>32 ||j==0){ printf(\"NO\\n\"); return 0;}\n else if(id[i]=='\\0'){ printf(\"YES\\n\"); return 0;}\n for(i++,j=0;id[i]!='\\0';i++,j++){\n if((id[i]>='A' && id[i]<='Z') ||(id[i]>='a' && id[i]<='z') || id[i]=='_' || (id[i]>='0' && id[i]<='9'))\n continue;\n\n arrest=1;\n }\n if(arrest==1 ||j>16 ||j==0) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c15b24c2ad8528d188f223242ec4d4a8", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n char s[101],c;\n int x,y,z,m=0,n=0,p=0,q=0;\n scanf(\"%s\",s);\n for(x=0;s[x]!='@';x++)\n { q++;\n c=s[x];\n if((c>=65 &&c <=90) || (c>=97 &&c <=122) || (c>=48 &&c <=57) ||c==95)\n continue;\n goto v;\n }\n if(q==0 || q>16)\n goto v;\n for(y=x+1;s[y]!='\\0';y++)\n {\n\n c=s[y];\n if(c=='.')\n {\n if(m>=1 && m<=16)\n {\n n=n+m;\n m=0;\n }\n else\n goto v;\n continue;\n }\n if((c>=65 &&c <=90) || (c>=97 &&c <=122) || (c>=48 &&c <=57) ||c==95)\n m++;\n else if(c=='/')\n break;\n else\n goto v;\n }\n if(s[y]=='\\0' || s[y]=='/')\n n=n+m;\n if(n==0 || n>32 || m==0 || m>16)\n goto v;\n if(s[y]=='\\0')\n {\n printf(\"YES\");\n exit(0);\n }\n for(z=y+1;s[z]!='\\0';z++)\n {\n c=s[z];p++;\n if((c>=65 &&c <=90) || (c>=97 &&c <=122) || (c>=48 &&c <=57) ||c==95)\n continue;\n goto v;\n }\n if(s[z]=='\\0'&& p>0 && p<17)\n {\n printf(\"YES\");\n exit(0);\n }\n v:\n printf(\"NO\");\n return(0);\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9bd28c0775982fa75daf9cb467100ee4", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint valid(char c){\n if((c>='A' && c<='z')|| (c>='0'&&c<='9') || c=='_') return 1;\n return 0;\n}\nvoid no(){\n printf(\"NO\\n\");\n exit(0);\n}\nint main()\n{\n //freopen(\"in.txt\", \"r\", stdin);\n char id[110];\n fgets(id,110, stdin);\n\n char *user, *host, *res;\n\n if(id[0]=='@') no();\n if(id[strlen(id)-2]=='/') no();\n\n user = strtok(id, \"@\");\n host = strtok(NULL, \"/\");\n if(host==NULL) {\n host=strtok(NULL, \"\\n\");\n res=NULL;\n }\n else {\n res = strtok(NULL, \"\\n\");\n }\n\n //printf(\"%s %s %s\\n\", user, host, res);\n\n if(user==NULL || host==NULL) no();\n if(strlen(user)>16 || strlen(host)>32) no();\n\n int i;\n\n if(user){\n for(i=0; user[i]!='\\0'; i++){\n if(!valid(user[i])) no();\n }\n }\n int word=0;\n if(host){\n for(i=0; host[i]!='\\0'; i++){\n if(valid(host[i])) word++;\n else if(host[i]=='.'){\n if(word<1 || word>16) no();\n word=0;\n }\n else{\n if(host[i]!='\\n') no();\n }\n }\n }\n if(word==0) no();\n\n if(res){\n for(i=0; res[i]!='\\0'; i++) {\n if(!valid(res[i])) no();\n }\n }\n //printf(\"%s %s %s\\n\", user, host, res);\n printf(\"YES\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d35e287339a5859d3e26d3f485edf3ab", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include //\u0377\ufffd\u013c\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdisalnum\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0436\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\u0138\ufffd\u01f7\ufffd\u03aa\ufffd\ufffd\u0138\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nint check_hostname(char *hostname)\n{\n\tint i=0,len=0,max_len=0,min_len=1000;\n\twhile (i <= strlen(hostname))//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdi<=sttrlen(hostname),\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u073d\ufffd\ufffd\ufffd\ufffd\u0421\ufffd.\ufffd\ufffd\ufffd\u05b8\ufffd\ufffd\ufffd\u05b7\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0268\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02e3\ufffd\ufffd\ufffd\u05bb\ufffd\ufffd\ufffd\ufffd\n\t{ //\ufffd\ufffd\ufffd\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\u05b7\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03aa\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0275\u0121\ufffd\n\t\tlen = 0;\n\t\twhile (hostname[i] != '.'&& hostname[i] != 0)\n\t\t{\n\t\t\tlen++;\n\t\t\ti++;\n\t\t}\n\t\tif (len > max_len)\n\t\t\tmax_len = len;\n\t\tif (len < min_len)\n\t\t\tmin_len = len;\n\t\ti++;\n\t}\n\tif (min_len == 0 || max_len > 16)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\nint check_resource(char *resource)\n{\n\tint i=0, len, max_len = 0, min_len = 1000;\n\twhile (i <= strlen(resource))\n\t{\n\t\tlen = 0;\n\t\twhile (resource[i] != '/'&&resource[i] != 0)\n\t\t{\n\t\t\tlen++;\n\t\t\ti++;\n\t\t}\n\t\tif (len > max_len)\n\t\t\tmax_len = len;\n\t\tif (len < min_len)\n\t\t\tmin_len = len;\n\t\ti++;\n\t}\n\tif (min_len == 0 || max_len > 16)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\nint main()//\ufffd\ufffd\ufffd\ufffd\ufffd\u02fc\u00b7\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02fc\u00b7\ufffd\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0434\ufffd\ufffd\ufffd\u01f8\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0739\ufffd\u02b5\ufffd\u05ba\ufffd\ufffd\ufffd\ufffd\u013a\u073a\u00f5\u0131\u4daf\ufffd\u0523\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u01e1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0136\ufffd\ufffd\u0663\ufffd\u02b9\ufffd\ufffd\ufffd\ufffd\u00fb\ufffd\ucde8\ufffd\u0739\ufffd\ufffd\ufffd\n{ //\ufffd\u023d\ufffd\ufffd\ufffd\u0237\ufffd\u0132\ufffd\ufffd\u88ec\ufffd\ufffd\ufffd\ufffd\ufffd\u02f2\ufffd\u0237\ufffd\ufffd\ufffd\u0523\ufffd\u02b9\ufffd\ufffd\ufffd\ufffd\ufffd\u07b7\ufffd\u0378\ufffd\ufffd\ufffd\u0137\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0434\ufffd\u0133\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdstotok\ufffd\ufffd\ufffd\ufffd\u00fb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02b6\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02fd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00a9\ufffd\ufffd\n\t //\ufffd\ufffd\ufffd\u05b7\u05bf\ufffd\ufffd\ufffd\ufffd\ufffd\u0137\ufffd\ufffd\ufffd\u05b5\ufffd\ufffd\u02fc\ufffd\ufffd\ufffd\ufffd\n\tchar str[101], username[101], hostname[101], resource[101];\n\tint len;\n\tint i,j;\n\tint at,point,res,next;\n\tat =point =res=next=0;\n\tscanf(\"%s\", str);\n\tlen = strlen(str);\n\tfor (i = 0; i < len; i++)\n\t\tif (str[i] == '@')\n\t\t{\n\t\t\tat = 1; \n\t\t\tbreak;\n\t\t}\n\tif (!at)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\texit(0);\n\t}\n\tfor (++i; i < len; i++)\n\t{\n\t\tif (str[i] == '.')\n\t\t\tpoint = 1;\n\t\tif (str[i] == '/')\n\t\t\tres = 1;\n\t}\n\tfor (i = 0, j = 0; str[i] != '@'; i++,j++)\n\t\tusername[j] = str[i];\n\tusername[j] = 0;\n\tif (res)\n\t{\n\t\tfor (++i, j = 0; str[i] != '/'; i++, j++)\n\t\t\thostname[j] = str[i];\n\t\thostname[j] = 0;\n\t\tfor (++i,j=0; str[i] != 0; i++,j++)\n\t\t\tresource[j] = str[i];\n\t\tresource[j] = 0;\n\t}\n\telse\n\t{\n\t\tfor (++i, j = 0; str[i] != 0; i++, j++)\n\t\t{\n\t\t\thostname[j] = str[i];\n\t\t}\n\t\thostname[j] = 0;\n\t\tresource[0] = 0;\n\t}\n\tfor (i = 0; i < strlen(username); i++)\n\t\tif (!(isalnum(username[i]) || username[i] == '_'))\n\t\t\tnext = 1;\n\tfor (i = 0; i < strlen(hostname); i++)\n\t\tif (!(isalnum(hostname[i]) || hostname[i] == '_' || hostname[i] == '.'))\n\t\t\tnext = 1;\n\tfor (i = 0; i < strlen(resource); i++)\n\t\tif (!(isalnum(resource[i]) || resource[i] == '_' || resource[i] == '/'))\n\t\t\tnext = 1;\n\tif (strlen(username) > 16 || strlen(username) == 0)\n\t\tnext = 1;\n\tif (strlen(hostname) > 32 || strlen(hostname) == 0||check_hostname(hostname))\n\t\tnext = 1;\n\tif (res && check_resource(resource))\n\t\tnext = 1;\n\t(next) ? printf(\"NO\\n\") : printf(\"YES\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc73848e288de592b6586772cebb3753", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nvoid no(){\n printf(\"NO\\n\");\n exit(0);\n}\n\nint valid(char c) {\n if( (c>='A'&&c<='z') || (c>='0'&&c<='9') || c=='_' )\n}\n\nint main()\n{\n char id[120];\n fgets(id, 110, stdin);\n\n int i=0, host=0, user=0, word=0, res=0;\n\n for(i; id[i]!='@' || id[i]!='\\n'; i++) {\n if(valid(id[i])) user++;\n else no();\n }\n if (user<1 || user>16) no();\n\n if(id[i]=='@')i++;\n\n for(i; id[i]!='/'||id[i]!='\\n'; i++){\n if(valid(id[i])) {\n host++;\n word++;\n }\n else if(id[i]=='.'){\n word--;\n if(word<1|| word>16) no();\n word=0;\n }\n else {\n if(id[i]!='\\n'|| id[i]!='\\0') no();\n }\n }\n if(id[i]=='\\n' && id[i-1]=='.') no();\n if(host<1 || host>32) no();\n\n for(i; id[i]!='\\n'; i++) {\n if(valid(id[i])) res++;\n else no();\n }\n\n printf(\"YES\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3f8ac21b5d55e629abc2df30fb95e4a8", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int b='a',c=0;\n char a[510];\n scanf(\"%s\",a);\n if(b==a[c])\n {\n b++;\n c++;\n }\n else if(b>a[c])\n c++;\n else\n {\n printf(\"NO\");\n return;\n }\n printf(\"YES\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d583ca6412316022a367fb606f5fa8f5", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nint temp[26];\nint main()\n{\n char s[52];\n int i, j, k;\n gets(s);\n if(s[0] != 'a'){ printf(\"NO\\n\"); return 0;}\n else temp[0] = 1;\n for(i = 1; s[i] != '\\0'; i++){\n j = s[i] - 97;\n if(s[i] > s[i-1] || temp[j] != 0){\n temp[j] = 1;\n }\n else{\n printf(\"NO\\n\"); return 0;\n }\n }\n printf(\"YES\\n\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bac861e99c04af25c2b60d66f0d53999", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \nint temp[26];\nint main()\n{\n char s[52];\n int i, j, k, t;\n gets(s);\n if(s[0] != 'a')\n {\n printf(\"NO\\n\");\n return 0;\n }\n else\n {\n temp[0] = 1;\n t = 1;\n }\n for(i = 1; s[i] != '\\0'; i++)\n {\n j = s[i] - 97;\n if(j >t)\n {\n printf(\"NO\\n\");\n return 0;\n }\n\n if(j==t) t++;\n }\n printf(\"YES\\n\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9b569a8301bd2581a76e7131889bfcc6", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint steman(char cad[]);\n\nint main(void) {\n\tchar cad[28];\n\t\n\tscanf(\"%s\",cad);\n\tif (steman(cad)) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\nint steman(char cad[]){\n\tint i,cont=0,n=strlen(cad);\n\tfor(i=0;i\n#include\n#include\n#include \n\n\nint main()\n{\n\tint n, i, f=0;\n\tchar s[501], t='a';\n\tn = strlen(s);\n\tscanf_s(\"%s\", s);\n\tif (s[0] != t)\n\t{\n\t\tf++;\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 1; i < n; i++)\n\t{\n\t\tif (t+1 < s[i])\n\t\t{\n\t\t\tf++;\n\t\t\tbreak;\n\t\t}\n\t\tif (t + 1 == s[i])\n\t\t\tt++;\n\t}\n\tif (f)\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "50b71a439de1476981721830cf3c3676", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tint n, a[1000], i, c = 0, p = 0,j;\n\tscanf(\"%d\", &n);\n\tfor (i=0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\tif ( a[i] > 0)\n\t\t{\n\t\t\tc++;\n\t\t}\n\t\telse if \n\t\tp++;\n\t}\n\tj = ceil(n / 2.0);\n\tputs((c > p ? c : p) >= j ? (c > p ? \"1\" : \"-1\") : \"0\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6dc4666c0e320b5652785d6a6673a943", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n//for (i = 0; i < n; i++)\n//{\n//\tg = a[i] / (-1);\n//\tif (g > 0)\n//\t{\n//\t\tw++;\n//\t}\n//\tif (w > j)\n//\t{\n//\t\td = a[i] / n * 2;\n//\t\tprintf(\"%d\", d);\n//\t\tbreak;\n//\t}\n//}\nint main()\n{\n\tint n, i, d,a[1000],m=0,p,g,w,s=0;\n\tdouble j=0, k;\n\tscanf_s(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf_s(\"%d\", &a[i]);\n\t}\n\tk = (double)n / 2;\n\tif (k > (int)k)\n\t{\n\t\tp =(int)k+1;//\u81f3\u5c11\u9700\u8981\u7684\u6b63\u6570\n\t}\n\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (a[i] > 0)\n\t\t{\n\t\t\tj++;//\u6570\u7ec4\u4e2d\u6b63\u6570\u4e2a\u6570\n\t\t}\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\tm++;//\u6570\u7ec4\u4e2d0\u7684\u4e2a\u6570\n\t\t}\n\t}\n\n\ti = 0;\n\ts = a[0];\n\n\tif (m >= p)\n\t{\n\t\td = 0;\n\t\tprintf(\"%d\", d);\n\t\treturn 0;\n\t}\n\tif (j >= p)\n\t{\n\t\td = s / n * 2;\n\t\tprintf(\"%d\", d);\n\t}\n\tif ((n - j) >= p)\n\t{\n\t\td = -(s / n * 2);\n\t\tprintf(\"%d\", d);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c03c55f9a3cb514787581aa1440fa7f8", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main() \n{\n int n, a[10000],p=0,q=0, i;\n scanf(\"%d\",&n);\n for(i=0;i0)\n p++;\n else if(a[i] <0)\n q++;\n } \n float f=n/2.0;\n if(p>=f) \n printf(\"1\\n\");\n else if(q>=c) \n printf(\"-1\\n\");\n else\n printf(\"0\");\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e6f4136db8b6f5e6fcb1d9e4bb0717fd", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(void)\n{\n int a[2000],d,n,b[2000];\n scanf(\"%d\",&n);\n int i,count=0,count1;\n for(i=0;icount1)\n {\n printf(\"0\");\n }\n else\n printf(\"%d\",d);\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "88553c42c419197f86ce6f20cc9b5dc7", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(void)\n{\n int a[2000],d,n,b[2000];\n scanf(\"%d\",&n);\n int i,count=0,count1,count2=0,count3=0;\n for(i=0;icount1)\n {\n printf(\"-1\");\n }\n else if(count3>count1)\n printf(\"%d\",d);\n else\n printf(\"0\"); \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "66147be607c7d6d29c710d74b947e908", "src_uid": "a13cb35197f896cd34614c6c0b369a49", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nfloat pi=3.14159265358979323846;\nint gcdf(int,int);\n\nint main() \n{\n\tfloat ax,ay,bx,by,cx,cy,a,b,c,tri_area,r_outersp,angle_a,angle_b,angle_c,edges,area,areas;\n\tint gcd;\n\tscanf(\"%f %f\",&ax,&ay);\n\tscanf(\"%f %f\",&bx,&by);\n\tscanf(\"%f %f\",&cx,&cy);\n\ta = sqrt( (ax-bx)*(ax-bx) + (ay-by)*(ay-by) ) ; \n \tb = sqrt( (bx-cx)*(bx-cx) + (by-cy)*(by-cy) ) ; \n \tc = sqrt( (ax-cx)*(ax-cx) + (ay-cy)*(ay-cy) ) ;\n\ttri_area = sqrt((0.5*(a+b+c))*((0.5*(a+b+c))-c)*((0.5*(a+b+c))-b)*((0.5*(a+b+c))-c));\n\tr_outersp = a*b*c/(4*tri_area);\n\tangle_a = acos((b*b+c*c-a*a)/(2*b*c));\n\tangle_b = acos((a*a+c*c-b*b)/(2*a*c));\n\tangle_c = acos((a*a+b*b-c*c)/(2*b*a));\n\tgcd = gcdf((int)angle_a,(int)angle_b)\n\tgcd = gcdf(gcd,(int)angle_c);\n\tedges = 2*pi/gcd;\n\tarea = r_outersp*r_outersp*sin(gcd)/2;\n\tareas = area*(int)edges;\n\tprintf(\"%f\",areas);\n\treturn 0;\n}\n\nint gcdf(int m, int n) \n{ \n\twhile(m>0){\n\t\tint c = n % m;\n\t\tn = m;\n\t\tm = c;\n\t} \n\treturn n; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "8352608f21f13c7ca54cf912ada33e90", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n float xc=0,yc=0;\n float x1,y1,x2,y2,x3,y3;\n double angle1,angle2,angle3;\n scanf(\"%f%f%f%f%f%f\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(x1!=x2&&x2!=x3&&x3!=x1&&y1!=y2&&y2!=y3&&y1!=y3)\n {\n yc=(x1-x3+(y1*y1-y2*y2)/(x1-x2)-(y2*y2-y3*y3)/(x2-x3))/(2*((y1-y2)/(x1-x2)-(y2-y3)/(x2-x3)));\n xc=(y1-y3+(x1*x1-x2*x2)/(y1-y2)-(x2*x2-x3*x3)/(y2-y3))/(2*((x1-x2)/(y1-y2)-(x2-x3)/(y2-y3)));\n }\n else\n {\n if(x1==x2)\n {\n yc=(y1+y2)/2;\n }\n if(x2==x3)\n {\n yc=(y2+y3)/2;\n }\n if(x1==x3)\n {\n yc=(y1+y3)/2;\n }\n if(y1==y2)\n {\n xc=(x1+x2)/2;\n }\n if(y2==y3)\n {\n xc=(x2+x3)/2;\n }\n if(y1==y3)\n {\n xc=(x1+x3)/2;\n }\n }\n //finished the finding outer-center of the triangle.\n if(x1-xc!=0)\n {\n angle1=atan((double)(y1-yc)/(double)(x1-xc));\n }\n else\n {\n if(x1>xc)\n {\n angle1=M_PI/2;\n }\n else\n {\n angle1=3*M_PI/2;\n }\n }\n\n if(x2-xc!=0)\n {\n angle2=atan((double)(y2-yc)/(double)(x2-xc));\n }\n else\n {\n if(x2>xc)\n {\n angle2=M_PI/2;\n }\n else\n {\n angle2=3*M_PI/2;\n }\n }\n\n if(x3-xc!=0)\n {\n angle3=atan((double)(y3-yc)/(double)(x3-xc));\n }\n else\n {\n if(x3>xc)\n {\n angle3=M_PI/2;\n }\n else\n {\n angle3=3*M_PI/2;\n }\n }\n if(angle1<0)\n {\n angle1+=M_PI;\n }\n if(angle2<0)\n {\n angle2+=M_PI;\n }\n if(angle3<0)\n {\n angle3+=M_PI;\n }\n if(y1<=yc)\n {\n angle1+=M_PI;\n }\n if(y2<=yc)\n {\n angle2+=M_PI;\n }\n if(y3<=yc)\n {\n angle3+=M_PI;\n }\n double A1,A2,A3;\n A1=fabs(angle1-angle2);\n A2=fabs(angle2-angle3);\n A3=fabs(angle3-angle1);\n if(A1>M_PI)\n {\n A1=2*M_PI-A1;\n }\n if(A2>M_PI)\n {\n A2=2*M_PI-A2;\n }\n if(A2>M_PI)\n {\n A2=2*M_PI-A2;\n }\n while(A1!=A2)\n {\n if(A1>A2)\n {\n A1-=A2;\n }\n else\n {\n A2-=A1;\n }\n }\n while(A2!=A3)\n {\n if(A2>A3)\n {\n A2-=A3;\n }\n else\n {\n A3-=A2;\n }\n }\n int x=1;\n while(x<2*double(M_PI)/A2)\n {\n x++;\n }\n double length = (x1-xc)*(x1-xc)+(y1-yc)*(y1-yc);\n double res;\n res=x*(sin((2*M_PI)/x))*length/2;\n printf(\"%.8lf\",res);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "19ca9246419d03fe59ed0283f72507ad", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n\n\tdouble x[3],y[3];\n\tdouble ag[3];\n\tscanf(\"%lf%lf%lf%lf%lf%lf\",x,y,x+1,y+1,x+2,y+2);\n\n\n\t/*\n\t float x[3],y[3];\n\t float ag[3];\n\t scanf(\"%f%f%f%f%f%f\",x,y,x+1,y+1,x+2,y+2);\n\t */\n\n\tint i,j;\n\tint te[3]={0,1,2};\n\tdouble t,a;\n\tdouble pi=3.14159265358979323;\n\tint ed;\n\n\n\tfor(i=0;i<3;i++)\n\t{\n\t\tte[0]=(i+te[0])%3;\n\t\tte[1]=(i+te[1])%3;\n\t\tte[2]=(i+te[2])%3;\n\t\tag[i]=\n\t\t\t((x[te[0]]-x[te[2]])*(x[te[1]]-x[te[2]])+(y[te[0]]-y[te[2]])*(y[te[1]]-y[te[2]]))/\n\t\t\tsqrt(\n\t\t\t\t\t( (x[te[0]]-x[te[2]])*(x[te[0]]-x[te[2]])+(y[te[0]]-y[te[2]])*(y[te[0]]-y[te[2]]))\n\t\t\t\t\t*((x[te[1]]-x[te[2]])*(x[te[1]]-x[te[2]])+(y[te[1]]-y[te[2]])*(y[te[1]]-y[te[2]]) )\n\t\t\t\t);\n\n\t}\n\n\tfor(i=0;i<3;i++)\n\t{\n\t\tag[i]=acos(ag[i])/pi;\n\t\t//printf(\"%f\",ag[i]);\n\t}\n\n\tfor(i=3;i<=100;i++)\n\t{\n\n\t\tfor(j=0;j<3;j++)\n\t\t{\t\n\t\t\tt=ag[j]*i-int(ag[j]*i);\n\t\t\t//printf(\"%f \",t);\n\t\t\tif(t>0.00001&&t<0.99999)\n\t\t\t{\n\t\t\t\tbreak;\n\n\n\t\t\t}\n\n\t\t\tif(j==2)\n\t\t\t{\n\t\t\t\ted=i;\n\t\t\t\ti=101;\n\t\t\t}\n\n\t\t}\n\n\n\n\n\n\t}\n\t\na=\t((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]))\n\t*((x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]))\n\t*((x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2]))\n\t/((x[0]-x[2])*(y[1]-y[2])-(y[0]-y[2])*(x[1]-x[2]))\n\t/((x[0]-x[2])*(y[1]-y[2])-(y[0]-y[2])*(x[1]-x[2]))\n\t*ed*sin(2*pi/ed)/8;\n// *((x[0]-x[2])*(x[1]-x[2])+(y[0]-y[2])*(y[1]-y[2]))\n//\t\t/ ((x[0]-x[2])*(y[1]-y[2])-(y[0]-y[2])*(x[1]-x[2]))/4*ed;\n\n\nif(a<0)\n\ta*=(-1);\n\n/*\n\tsqrt( \n\t\t\t\t((x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2])) \n\t\t\t\t*((x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2]))\n\t\t\t\t\n\t\t\t\t)\n\n*/\n\n\t//printf(\"%d\\n\",ed);\n\tprintf(\"%.6f\\n\",a);\n\n\n\t//printf(\"%f\",sqrt(3));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "66d7383f48dcdf664c91b158ba901fbb", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef struct point\n{\n float x;\n float y\n}\npoint_tp;\n\nfloat p_mult(point_tp a, point_tp b) {\n return a.x * b.x + a.y * b.y;\n}\n\npoint_tp p_minus(point_tp a, point_tp b) {\n point_tp res;\n res.x = a.x - b.x;\n res.y = a.y - b.y;\n return res;\n}\n\nint is_int(float x) {\n return abs(x - round(x)) < 0.000001;\n}\nint main(int argc, char **argv)\n{\n point_tp a, b, c;\n float fi1, fi2, fi3;\n float ratio;\n assert(scanf(\"%f%f\", &a.x, &a.y) == 2);\n assert(scanf(\"%f%f\", &b.x, &b.y) == 2);\n assert(scanf(\"%f%f\", &c.x, &c.y) == 2);\n \n fi1 = acos(p_mult(p_minus(b, a), p_minus(c, a))/sqrt(p_mult(p_minus(b, a), p_minus(b, a)) * p_mult(p_minus(c, a), p_minus(c, a))));\n fi2 = acos(p_mult(p_minus(a, b), p_minus(c, b))/sqrt(p_mult(p_minus(a, b), p_minus(a, b)) * p_mult(p_minus(c, b), p_minus(c, b))));\n fi3 = M_PI - fi1 - fi2;\n \n int i = 3;\n for (; i < 101; i++) {\n if (is_int(fi1/(M_PI/i)) & is_int(fi2/(M_PI/i)) & is_int(fi3/(M_PI/i))) break;\n }\n float R = sqrt(p_mult(p_minus(c, b), p_minus(c, b)))/(2 * sin(fi1));\n float S = i * R * R * sin(M_PI * 2/i)/2;\n \n \n printf(\"%f\", S);\n \n \n \n --scanf(\"%f\", &fi1);\n return 0;\n \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5a8bfb0155ebd77110bd47a199fea855", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define PI acos(-1)\n#define EPS 1e-6\n\nint cmp(const void *a, const void *b) {\n double da = *(double*)a;\n double db = *(double*)b;\n if (fabs(da-db)EPS) return 1;\n return -1;\n}\n\nint istime(double x, double y) {\n double n = (floor)(x/y+EPS);\n printf (\"%lf\\n\", fags(x-y*n));\n return 0;\n if (fabs(x-y*n)<=EPS) return 1;\n else return 0;\n}\n\ndouble dis(double x[2], double y[2]) {\n return sqrt((x[0]-y[0])*(x[0]-y[0]) + (x[1]-y[1])*(x[1]-y[1]));\n}\n\ndouble area(double x[2], double y[2], double z[2]) {\n return fabs(\n (x[0]*y[1]+z[0]*x[1]+y[0]*z[1] - z[0]*y[1]-x[0]*z[1]-y[0]*x[1])/2\n );\n}\n\ndouble min(double x, double y) {\n if (x - y > EPS) return y;\n else return x;\n}\n\nint main() {\n double x[2], y[2], z[2], m[2];\n double xy,xz,yz;\n double p, q, l1, l2, l3;\n double s, d, cosd;\n double mx, my, mz;\n double da[3], t;\n while (scanf (\"%lf%lf\", &x[0], &x[1]) != EOF) {\n scanf (\"%lf%lf\", &y[0], &y[1]);\n scanf (\"%lf%lf\", &z[0], &z[1]);\n xy = dis(x,y); xz = dis(x,z); yz = dis(y,z);\n p = (xy*xy+xz*xz+yz*yz) / 2;\n q = 1/(1/(p-xy*xy)+1/(p-xz*xz)+1/(p-yz*yz));\n l1 = q/(p-xy*xy);\n l2 = q/(p-xz*xz);\n l3 = q/(p-yz*yz);\n m[0] = (1-l1)/2*z[0]+(1-l2)/2*y[0]+(1-l3)/2*x[0];\n m[1] = (1-l1)/2*z[1]+(1-l2)/2*y[1]+(1-l3)/2*x[1];\n mx = dis(m, x); my = dis(m, y); mz = dis(m, z);\n\n cosd = (mx*mx+my*my-xy*xy) / (2*mx*my);\n da[0] = acos(cosd);\n cosd = (mx*mx+mz*mz-xz*xz) / (2*mx*mz);\n da[1] = acos(cosd);\n cosd = (my*my+mz*mz-yz*yz) / (2*my*mz);\n da[2] = acos(cosd);\n\n qsort(da, 3, sizeof(double), cmp);\n d = da[0];\n istime(da[2],d); continue;\n t = 2;\n while (! (istime(da[0],d) && istime(da[1],d) && istime(da[2],d))) {\n d = da[2]/t;\n if(istime(da[0],d) && istime(da[1],d) && istime(da[2],d)) \n break;\n d = da[1]/t;\n if(istime(da[0],d) && istime(da[1],d) && istime(da[2],d)) \n break;\n d = da[0]/t;\n if(istime(da[0],d) && istime(da[1],d) && istime(da[2],d)) \n break;\n t++;\n }\n s = mx*my*0.5*sin(d);\n printf (\"%lf\\n\", PI/d*2*s);\n \n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ca390655a66d56f0e4fabf3f7d8cf638", "src_uid": "980f4094b3cfc647d6f74e840b1bfb62", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\n#include \n#include \n\nint main(){\n int n,menor=0,mayor=0;\n int tam,i,l=1;\n \n scanf(\"%d\",&n);\n \n int d1[n];int d2[n];\n \n for(i=0;id2[i])\n mayor++;\n else if(d1[i]pivote) j--;\n if (i<=j){\n aux = a[i];\n a[i] = a[j];\n a[j] = aux;\n i++;\n j--;\n }\n}while(i<=j);\n if(j>primero)\n quicksort(a,primero,j);\n if(i\n#include\nint main(){\n int n,i,j,c,bandera=0,bandera2=0,aux,bandera3=0;\n scanf(\"%d\",&n);\n char num[2*n];\n scanf(\"%s\",&num);\n c=n;\n //ordenamos la primera mitad\n for(i=0; inum[j]){\n aux=num[j];\n num[j]=num[i];\n num[i]=aux;\n }\n }\n }\n //ordenamos la segunda mitad\n for(i=n; i<(2*n)-1; i++){\n for (j=i+1; j<(2*n); j++){\n if(num[i]>num[j]){\n aux=num[j];\n num[j]=num[i];\n num[i]=aux;\n }\n }\n }\n //vemos si son iguales\n for(i=0; inum[c]){\n bandera2=1;\n }else{\n bandera2=0;\n i=n;\n }\n c++;\n }\n if(bandera2==1){\n printf(\"YES\");\n }else{\n printf(\"NO pito\");\n }\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "840006b0189d192e32e5db912fe22cc2", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,a,i,j,c=0,d=0,t;\n scanf(\"%d\",&n);\n int b[2*n];\n scanf(\"%d\",&a);\n for(i=0;i<2*n;i++)\n {b[i]=a%10;\n a=a/10;\n }\n for(i=0;ib[n+j])\n c=c++;\n for(j=0;j<=n-1;j++)\n if(b[j]\n\nint main()\n{\n\tchar A[201];\n\tint n, i, j;\n\n\tscanf(\"%d\", &n);\n\tgetchar();\n\tfor (i = 0; i < 2 * n; i++)\n\t\tscanf(\"%c\", &A[i]);\n\n\tfor (i = 0; i < n - 1; i++)\n\t\tfor (j = i + 1; j < n; j++)\n\t\t\tif (A[i] > A[j])\n\t\t\t{\n\t\t\t\tchar temp = A[i];\n\t\t\t\tA[i] = A[j];\n\t\t\t\tA[j] = temp;\n\t\t\t}\n\n\tfor (i = n; i < 2 * n - 1; i++)\n\t\tfor (j = i + 1; j < 2 * n; j++)\n\t\t\tif (A[i] < A[j])\n\t\t\t{\n\t\t\t\tchar temp = A[i];\n\t\t\t\tA[i] = A[j];\n\t\t\t\tA[j] = temp;\n\t\t\t}\n\tint check = 1;\n\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (A[i] >= A[2 * n - i - 1])\n\t\t{\n\t\t\tcheck = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (check)\n\t{\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\n\tcheck = 1;\n\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (A[i] =< A[2 * n - i - 1])\n\t\t{\n\t\t\tcheck = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (check)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5056f3337455b1f4b42e74b76ae948ce", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nint main()\n{\n size_t n;\n string s, l, r;\n cin >> n >> s;\n l = s.substr(0, n);\n r = s.substr(n, n);\n sort(l.begin(), l.end());\n sort(r.begin(), r.end());\n bool strictly_less(true), strictly_more(true);\n for (size_t i = 0; i < n; ++i)\n {\n if (l[i] >= r[i])\n {\n strictly_less = false;\n break;\n }\n }\n for (size_t i = 0; i < n; ++i)\n {\n if (l[i] <= r[i])\n {\n strictly_more = false;\n break;\n }\n }\n cout << ((strictly_less || strictly_more) ? \"YES\" : \"NO\") << endl;\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "64f92e003e55ea9fccc8094350537e2a", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tint n, c, p;\n\tint b[26] = {0,0 };\n\tchar a[101];\n\tscanf(\"%d%d\", &n, &c);\n\tgetchar();\n\tgets(a);\n\tfor (int i = 0; i < strlen(a); i++)\n\t{\n\t\tp = a[i] - 97;\n\n\t\tb[p]++;\n\t}\n\n\tfor (int i = 0; i < 26; i++)\n\t{\n\t\tif (b[i] >=k+1)\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c877d95e296380254b6a60c5b2019108", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3dd56a5ccb16ea56dd67b5e99090a0f2", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "203ca087be406da3cca75f45d9ad36f1", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0} {"lang": "GNU C", "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\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "300155541787ba99f2120972bfa279ac", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,k,i,j,flag,count;\n char arr[1000],temp;\n while(scanf(\"%d %d\",&n,&k)==2)\n {\n scanf(\"%s\",arr);\n flag=0;\n for(i=0; ik){\n flag=1;\n break;\n }\n else\n continue;\n }\n if(flag==1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "613330c666ac2f6e5afc2fb8a9e34e88", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n\nlong long int c1,c2,x,y;\n\nlong long int check(long long int a)\n{\n\treturn (((a-a/x >= c1) && (a-a/y >= c2)) && (a-a/(x*y) >= c1+c2));\n}\n\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld\",&c1,&c2,&x,&y);\n\tlong long int high = INT_MAX,low=0,mid;\n\twhile(high>low)\n\t{\n\t\tmid = high+low;\n\t\tmid /= 2;\n\t\tif(check(mid))\n\t\t\thigh = mid;\n\t\telse\n\t\t\tlow = mid+1;\n\t}\n\tprintf(\"%lld\\n\",high);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fbcec41788461936e7036060aaa1e12a", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n\nint c1, c2, x, y, ans;\nint main()\n{\n scanf(\"%d%d%d%d\", &c1, &c2, &x, &y);\n\n ans = c1+c2;\n while(ans - ans/x < c1)\n {\n ans += c1 - (ans - ans/x);\n }\n while(ans - ans/y < c2)\n {\n ans += c2 - (ans - ans/y);\n }\n while(ans - ans/(x*y) < c1+c2)\n {\n ans += (c1+c2) - (ans - ans/(x*y));\n }\n printf(\"%d\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a3661db2c233f47fa749cd3440333db", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "//friends and presents Federico Bellini\n#include \n#include \n\nint main () {\n int a,b;\n int x,y;\n \n scanf(\"%i %i\", &a, &b);\n scanf(\"%i %i\", &x, &y);\n \n int i = 0;\n while(a > 0 || b > 0){\n ++i;\n \n if((i%x != 0) && (i%y != 0)){\n if(a>b && a>0) a--;\n else b--;\n }\n else if((i%x != 0) && (a>0)){\n a--;\n \n }\n else if((i%y != 0) && (b>0)){\n b--;\n }\n }\n \n printf(\"%i\\n\", i);\n}\n \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "df4559e8ef8dde8157ad8037841beb8a", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n\nlong long int b[10000000];\nint main()\n{\n\tint x,y,p=0;\n\tlong long int i,cnt1,cnt2,n;\n\tscanf(\"%llu%llu%d%d\",&cnt1,&cnt2,&x,&y);\n\tn=cnt1+cnt2;\n\tif(n<=x&&n<=y)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tfor(i=1;i<=n;i++)\n\t\t{\n\t\t\tif(i%x!=0&&i%y!=0&&cnt1!=0&&cnt2!=0)\n\t\t\t{\n\t\t\t\tb[p++]=i;\n\t\t\t}\n\t\t\telse if(i%x!=0&&cnt1>0)\n\t\t\t\tcnt1--;\n\t\t\telse if(i%y!=0&&cnt2>0)\n\t\t\t\tcnt2--;\n\t\t\tif(i==n&&(cnt1!=0||cnt2!=0))\n\t\t\t{\n\t\t\t\tif(p==(cnt1+cnt2)||(p==cnt1)&&(cnt1!=0)||(p==cnt2&&cnt2!=0))\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%llu\\n\",n);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t\tn++;\n\t\t\t}\n\t\t}\n\t}\t\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "44b36016adec229d3daca32385938f1f", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\nint main(int argc, char const *argv[])\n{\n\tint cnt1, cnt2, x, y, v;\n\tcin >>cnt1>>cnt2>>x>>y;\n\tv = cnt2 + cnt1 + cnt1/x + cnt2/y;\n\tv -= (cnt1>cnt2)? cnt1/(x*y) : cnt2/(x*y);\n\tcout <\n#include\n\n\n\nint main()\n{\n int a,b,count=0,count1=0,count2=0;\n float m=0;\n int diffa=0;\n int diffb=0;\n scanf(\"%d %d\",&a,&b);\n //winning of a \n for(int i=1;i<=6;i++)\n {\n diffa=a-i;\n diffb=b-i;\n if(diffb<0)\n {\n diffb=diffb*(-1);\n \n }\n\n if(diffa<0)\n {\n diffa=diffa*(-1);\n }\n if(diffa\n#include \n\nint main()\n{\n int p1,p2;\n scanf(\"%d %d\",&p1,&p2);\n\n int w,d,l;\n\n for(int i=1;i<=6;i++)\n {\n if(abs(p1-i) < abs(p2-i))\n {\n w++;\n }\n else if(abs(p1-i) > abs(p2-i))\n {\n l++;\n }\n else\n {\n d++;\n }\n }\n\n printf(\"%d %d %d\",w,d,l);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5137b3f590ce0b6ecbcf125d545796b3", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int a,b,k=0,n=0,m=0,i=1;\n scanf(\"%d%d\",&a,&b);\n while(i<=6)\n {\n if(abs(a-i)\n#include\n#include\n\nint main()\n{\n int a,b,i,x,y,c1=0,c2=0,c3=0;\n while(scanf(\"%d %d\",&a,&b)==2){\n for(i=1;i<=6;i++){\n x=abs(a-i);\n y=abs(b-i);\n if(x>y)\n c1++;\n if(y>x)\n c2++;\n if(x==y)\n c3++;\n\n }\n printf(\"%d %d %d\\n\",c2,c3,c1);\n return 0;\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b8d91d26cc445680cfad897402a02d0f", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main (void) {\n\tint a, b, a_win = 0, tie = 0, b_win = 0;\n\tscanf(\"%d %d\", &a, &b);\n\tfor (i = 1; i <= 6; i++) {\n\t\tif(abs(a - i) < abs(b - i)) a_win++;\n\t\tif(abs(a - i) > abs(b - i)) b_win++;\n\t\tif(abs(a - i) == abs(b - i)) tie++;\n\t}\n\tprintf(\"%d %d %d\", &a_win, &tie, &b_win);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "18e41916cd40a0e0b92ff4c2f3fb01df", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0} {"lang": "GNU C11", "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\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\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}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8127cc78c128450a8a051971dcecd572", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n\tint i,j,n,k,br=0;\n\tint *a,**opt,*b,*niz;\n\t\n\tscanf(\"%d\",&n);\n\t\n\ta=(int*)malloc((n+1)*sizeof(int));\n\tniz=(int*)malloc((n+1)*sizeof(int));\n\tb=(int*)malloc((n+1)*sizeof(int));\n\topt=(int**)malloc((n+1)*sizeof(int*));\n\t\n\tif(n==1 || n==2){\n\t\tprintf(\"1\\n%d\",n);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=1;i<=n;i++){\n\t\ta[i]=i;\n\t\tb[i]=1;\n\t\topt[i]=(int*)malloc((n+1)*sizeof(int));\n\t}\n\t\n\tfor(i=0;iopt[i-1][j])\n\t\t\t\topt[i][j]=opt[i-1][j-a[i]]+b[i];\n\t\t\telse\n\t\t\t\topt[i][j]=opt[i-1][j];\n\t\t}\n\t}\n\t\n\ti=n;j=n;\n\twhile(opt[i][j]!=0){\n\t\tif (opt[i][j] == opt[i-1][j]) {\n\t\t\ti--;\n\t\t}\n\t\telse {\n\t\t\tniz[br++]=i;\n\t\t\tj -= zapr[i];\n\t\t\ti--;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",br);\n\tfor(i=br-1;i>=0;i--)\n\t\tprintf(\"%d \",niz[i]);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "045ee21c780d3f803c64f4896fccb10a", "src_uid": "356a7bcebbbd354c268cddbb5454d5fc", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\nint main()\n{\n int N;\n\n while(scanf(\"%d\",&N)==1)\n {\n for(int l=1; l<=1000; l++)\n {\n getchar();\n N = l;\n N++;\n int A[N];\n for(int i=1; i\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\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\tif(count==k) break;\n//\t\tif(ans==(pow()-1)) 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\n\n\t}\n\n\n\tprintf(\"%lld\",ans);\n\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c06892efa1b5cd0c293aa3b827d459df", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \nint Cnt[101];\n\nint main()\n{\n int n, m;\n scanf(\"%d %d\", &n, &m);\n for(int i = 0; i < m; ++i) {\n int l, r;\n scanf(\"%d %d\", &l, &r);\n ++Cnt[l];\n --Cnt[r + 1];\n }\n int cur = 0;\n puts(\"===================\");\n for(int i = 1; i <= n; ++i) {\n cur += Cnt[i];\n printf(\"%d %d\\n\", i, cur);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "13f111415d34b1294240d98f1feed4d3", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#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 _itoa(n,buf,2);\n len=strlen(buf);\n p=pow(2,len)-1;\n printf(\"%lld\",p);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6f7688ddb018f373fc3089f6e5203ff4", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint cnt=0,a[1000000];\nint n,k;\nvoid dfs(int step,int sum,int b)\n{\n\tint i;\n\tif(step==k){\n\t\ta[cnt++]=sum;\n\t\treturn;\n\t}\n\tfor(i=b;i<=n;i++){\n\t\tif((sum^i)>sum)\n\t\t\tdfs(step+1,sum^i,i+1);\n\t}\n\ta[cnt++]=sum;\n}\nint main()\n{\n\tint i,max=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tdfs(1,i,i+1);\n\t}\n\tfor(i=0;i\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;", "lang_cluster": "C", "compilation_error": true, "code_uid": "46838967fa0435fcc7f5fd6550687cf8", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include\n#include\nint main(){\n int t1;\n int t2;\n int t3;\n int t4;\n scanf(\"%d\",&t1);\n scanf(\"%d\",&t2);\n scanf(\"%d\",&t3);\n scanf(\"%d\",&t4);\nif((t1+t2+t3+t4)==0){\n printf(\"0\");\n}else\n{\n if(t1==t4){\n if(t1==0&&t3!=0){\n printf(\"0\");\n }else{\n printf(\"1\")\n }\n }else{\n printf(\"0\");\n }\n /* if(t3==0){\n if(t1==t4)printf(\"1\");\n else printf(\"0\");\n }else{\n if(t1==0||t4==0)printf(\"0\");\n else if(t1==t4)printf(\"1\");\n else printf(\"0\");\n }*/\n}\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "972acba3c4ad20003fdfa6717b2b72a0", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n long int N,S=0,T=0;\n int i,k=0;\n\n for(i=1; i<=4; i++)\n {\n scanf(\"%ld\", &N);\n if(i==1)\n {\n S=S+(N*2);\n k++;\n }\n\n else if(i==2)\n {\n S=S+N;\n T=T+N;\n k++\n }\n\n else if(i==3)\n {\n S=S+N;\n T=T+N;\n }\n\n else if(i==4)\n {\n T=T+(N*2);\n k++;\n }\n \n }\n \n if(S==T && k>0)\n {\n printf(\"1\\n\");\n }\n else\n {\n printf(\"0\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "93650bf938695de584eeb52b637f4f9e", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#including \nint main()\n{\n\tint sign=1,done=1;\n\tfloat sum=1;\n\twhile (done<=100)\n\t{\n\t\tdone=done+1;\n\t\tsign=-1*sign;\n\t\tsum=sum+sign*1/done;\n\t}\n\tprintf (\"sum=%f\",sum);\n\treturn 0;\n } \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "85fc3cce66794ffdf27a474eea1e8ff8", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int a,b,c,d,i;\n scnaf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if(a==d)printf(\"1\\n\");\n else printf(\"0\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c5f9921ba5aeb3d7d25b4e9b46938e07", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main () \n{\n\tint c1,c2,c3,c4;\n\tscanf(%d,&c1);\n\tscanf(%d,&c2);\n\tscanf(%d,&c3);\n\tscanf(%d,&c4);\n\tif(c1!=c4)\n\t{\n\t\tprintf(\"0\");\n\t\t\n\t}\n\telse\n\t{\n\t\tif c1==0 \n\t\t{\n\t\t\tif (c3==0)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t\t\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse \n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t}\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6552ae73ebfda30a3f1c839536559b72", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main(){\n \n int len;\n charch[21];\n gets(ch);\n \n l=strlen(ch);\n \n int ans=26*(l*25);\n printf(\"%d\",ans);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "195d0e8e503dcb5c0905c8c0992529c3", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nint main{\nstring s;\nint a,b;\nscanf(\"%s\",&s);\na=s.length();\nb=((a*25)+26);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4adbcc4fd2adb02426202a071796c5fc", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "GNU C", "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#include;\nchar a[106];\nint main()\n{ \n char a[100];\n int len,ans;\n scanf(\"%s\",a);\n len=strlen(a);\n ans=25*(l+1)+1;\n printf(\"%d\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ff762f48faa3325fb64e5f26b3ecae62", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\nint main{\nstring s;\nint a,b;\ncin>>s;\na=s.length();\nb=((a*25)+26);\ncout<\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 i=0;\n j=3;\n while(d>=0 ){\n if(a[i] > 9-a[j] && i<3){\n c++;\n i++;\n d -= a[i];\n }\n else if(a[i] < 9-a[j] && j<6) {\n c++;\n j++;\n d -= 9-a[j];\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] && i<3){\n c++;\n i++;\n d -= 9-a[i];\n }\n else if(9-a[i] < a[j] && j<6) {\n c++;\n j++;\n d -= a[j];\n }\n }\n printf(\"%d\", c);\n }\n else printf(\"0\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "79d4cc6c15304e6ae6c5b3931885b823", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#define N\t6\n#define _GNU_SOURCE\n\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 solve(digit_t a[]) {\n\tint diff = find_diff(a);\n\tbool positive = diff > 0;\n\tqsort_r(a, N, sizeof *a, cmp, &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", "lang_cluster": "C", "compilation_error": true, "code_uid": "4a5bd0921cca5ec573a1ef155f63acf8", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "641b974863e2460eca75a47c7ea15291", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0} {"lang": "GNU C11", "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\", contd);\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\", contd);\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dfe7ece194555bad9a969c99b3b6daae", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0} {"lang": "GNU C", "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-t2t1)\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\n#include \n\nint judge(long long int N,long long int n,long long int m,long long int k)\n{\n long long int i,count=0;\n for(i=1;i<=m;i++){\n if(N/i>=n){\n count+=n;\n }\n else{\n count+=N/i;\n }\n }\n if(count>=k){\n return 1;\n }\n else{\n return 0;\n }\n}\n\nint main(void)\n{\n long long int n,m,k;\n scanf(\"%I64d %I64d %I64d\",&n,&m,&k);\n long long int i,j;\n long long int low,mid,high,answer;\n low=0;\n high=n*m;\n mid=(low+high)/2;\n while(1){\n if(judge(mid,n,m,k)==1){\n if(judge(mid-1,n,m,k)==0){\n answer=mid;\n break;\n }\n else{\n high=mid;\n mid=(low+high)/2;\n }\n }\n else{\n low=mid;\n mid=(low+high)/2;\n }\n }\n printf(\"%I64d\",answer);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a410abcdff1e7d063a63761ede4e2dfc", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void)\n{\n long long int n,m,k;\n scanf(\"%I64d %I64d %I64d\",&n,&m,&k);\n long long int i,j;\n long long int count,answer;\n if(k==n*m){\n printf(\"%I64d\",k);\n return 0;\n }\n for(i=1;i<=n*m;i++){\n count=0;\n for(j=1;j<=m;j++){\n if(i/j>=n){\n count+=n;\n }\n else{\n count+=i/j;\n }\n if(count>=k){\n answer=i;\n printf(\"%I64d\",answer);\n return 0;\n }\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9ccac357cb5a82c67c2677cd62353d5", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong long n,m,i,b,k,j,c=1,a[100005];\n\tscanf(\"%I64d %I64d %I64d\",&n,&m,&k);\n\tlong long l=0,r=m*n,mid=0,s=0;\n\tfor(i=1;i<=n;i++)\n\t\t{\n\t\t\tfor(j=1;j<=m;j++)\n\t\t\t{\n\t\t\t\ta[c]=i*j;\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\tfor(i=1;ia[j])\n\t\t\t{\n\t\t\t\tb=a[i];a[i]=a[j];a[j]=b;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%I64d\",a[k]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7ec10fb5cbc2c75d5d5f3167ce79d0ec", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint n, m, k;\nint bs2(int multi,int x)\n{\n\tint mid, left = 0, right = m;\n\twhile (left <= right)\n\t{\n\t\tmid = (left + right) / 2;\n\t\tif (x >= mid * multi && x < (mid + 1)*multi)\n\t\t{\n\t\t\t//printf(\"\u7b2c%d\u884c\u6709%d\u4e2a\\n\", multi, mid);\n\t\t\treturn mid;\n\t\t}\n\t\tif (mid*multi < x)\n\t\t\tleft = mid + 1;\n\t\telse\n\t\t\tright = mid - 1;\n\t}\n\t//printf(\"\u7b2c%d\u884c\u6709%d\u4e2a\\n\", multi, mid);\n\treturn mid;\n}\nint judge(int x)//\u5c0f\u4e8e\u7b49\u4e8ex\u7684\u6570\u6709\u591a\u5c11\u4e2a\n{\n\tint i, count = 0;\n\tfor (i = 1; i <= n; i++)\n\t{\n\t\tcount += bs2(i, x);\n\t}\n\treturn count;\n}\nint bs1(int left,int right)\n{\n\tint mid;\n\twhile (left <= right)\n\t{\n\t\tmid = (left + right) / 2;\n\t/*\tprintf(\"\u5c0f\u4e8e\u7b49\u4e8e%d\u7684\u6570\u6709\u591a\u5c11\\n\", mid);*/\n\t\tint count1 = judge(mid),count2 = judge(mid-1);\n\t\tif (k <= count1 && k > count2)\n\t\t\treturn mid;\n\t\tif (k >= count1)\n\t\t\tleft = mid + 1;\n\t\telse right = mid - 1;\n\t}\n\t//printf(\"%d %d\\n\", mid, mid - 1);\n\treturn mid;\n}\nint main()\n{\n\tscanf(\"%d %d %d\", &n, &m, &k);\n\tprintf(\"%d\", bs1(1, n*m));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e53595158b4589a75201998ace131202", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n\nvoid merge(long long arr[],int mid,int last){\n\n int i=0,j;\n j=mid+1;\n int c=0;\n long long mer[last+1];\n\n while(i<=mid && j<=last){\n if(arr[i]<=arr[j]){\n mer[c]=arr[i];\n i++;c++;\n }\n else{\n mer[c]=arr[j];\n j++;c++;\n }\n }\n int k;\n if(i>mid){\n for(k=j;k<=last;k++){\n mer[c]=arr[k];\n c++;\n }\n }\n else{\n for(k=i;k<=mid;k++){\n mer[c]=arr[k];\n c++;\n }\n }\n for(k=0;k<=last;k++){\n arr[k]=mer[k];\n }\n\n}\n\n\n\nint main()\n{\n int n,m;\n int i,j;\n long long k;\n int c=0;\n scanf(\"%d %d %I64d\",&n,&m,&k);\n long long arr[n*m];\n int f=0;\n for(i=1;i<=n;i++){\n int temp=c-1;\n for(j=1;j<=m;j++){\n arr[c]=i*j;\n c++;\n }\n if(f==1){\n merge(arr,temp,c);\n }\n f=1;\n }\n\n printf(\"\\n\");\n printf(\"%I64d\",arr[k-1]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "89d4f8a82782954bb33b91c69b6fa141", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint mask(int x){\n int k = 0, t = 1;\n\twhile (x > 0) {\n\t if (x % 10 == 7 || x % 10 == 4) {\n\t\t k += x%10*t;\n\t\t\tt *= 10;\n\t\t}\n\t\tx = x/10;\n\t}\n\treturn(k);\n}\n\nint main() {\n int a, b, i;\n\tscanf(\"%d %d\",&a,&b);\n\tprintf(\"%d %d\\n\",a,b);\n\tfor (i = a;mask(i) != b;i++);\n\tprintf(\"%d\\n\",i);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e5d560fdde0360ed61240af50740956d", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint mask(int x){\n int k = 0, t = 1;\n\twhile (x > 0) {\n\t if (x % 10 == 7 || x % 10 == 4) {\n\t\t k += x%10*t;\n\t\t\tt *= 10;\n\t\t}\n\t\tx = x/10;\n\t}\n\treturn(k);\n}\n\nint main() {\n int a, b, i;\n\tscanf(\"%d%d\",&a,&b);\n\tfor (i = a;mask(i) != b;i++);\n\tprintf(\"%d\\n\",i);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c6bafcf53f8618f20578b86014179d5", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint mask(int x){\n int k = 0, t = 1;\n\twhile (x > 0) {\n\t if (x % 10 == 7 || x % 10 == 4) {\n\t\t k += x%10*t;\n\t\t\tt *= 10;\n\t\t}\n\t\tx = x/10;\n\t}\n\treturn(k);\n}\n\nint main() {\n int a, b, i;\n\tscanf(\"%d%d\",&a,&b);\n//\tprintf(\"%d %d\\n\",a,b);\n\tfor (i = a;mask(i) != b;i++);\n\tprintf(\"%d\",i);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "64c474b2ead650560a0e70072426de75", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n\nint main()\n{\n char s_a[6], s_b[6], s_c[7];\n char t_s_a[6], t_s_b[6];\n char plus_1[10] = \"1234567890\";\n char plus_2[10] = \"2345678901\";\n int i_a, i_b, i_c, n_a, n_b, n_c;\n int t_n_a, t_n_b; \n int i;\n int c_point;\n \n sprintf(s_c,\"%d\", 0);\n scanf(\"%d %d\", &i_a, &i_b);\n sprintf(s_a,\"%d\",i_a);\n sprintf(s_b,\"%d\",i_b);\n n_a = strlen(s_a);\n n_b = strlen(s_b);\n strcpy(t_s_a, s_a);\n strcpy(t_s_b, s_b);\n //printf(\"%s %s %d %s %d\\n\",s_c, s_a, n_a, s_b, n_b); \n\n if(i_a < i_b){\n i_c = i_b;\n sprintf(s_c,\"%d\", i_c);\n printf(\"%s\", s_c);\n return 0;\n }else if( i_a >= i_b && n_a == n_b){\n i_c = i_b + pow(10,n_b);\n sprintf(s_c,\"%d\", i_c);\n printf(\"%s\", s_c);\n return 0;\n }\n \n t_n_a = n_a;\n t_n_b = n_b;\n n_c = n_a;\n \n //return 0;\n c_point = 0;\n while(t_n_a != t_n_b){\n if((t_s_a[0] == '4' && t_s_b[0]== '7') || (t_s_a[0] == '7' && t_s_b[0]== '4')){\n s_c[c_point] = plus_1[t_s_a[0]-48];\n printf(\"\\n%c\",s_c[0]);\n return 0;\n }\n }\n \n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "79e69022a42758f7985a970dd410ab7f", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \nint flag=0,b;\nvoid mask(int c)\n{\n\tint d=c,arr[100002],a[100002]={0};\n\tint i=0;\n\twhile(d>0)\n\t{\n\t\tif(d%10==4 || d%10==7)\n\t\t{\n\t\t\tarr[i]=d%10;\n\t\t\ti++;\n\t\t}\n\t\td=d/10;\n\t}\n\tint ans=0;\n\t\tfor(int j=0;j0)\n\t\t{\n\t\t\tif(e%10==arr[i-count-1])\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\te=e/10;\n\t\t}\n\t\tif(count==i)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t}*/\n}\nint main()\n{\n\tint a;\n\tint c;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tc=a+1;\n\twhile(c>a)\n\t{\n\t\tmask(c);\n\t\tif(flag==1)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\t\t\tbreak;\n\t\t}\n\t\tc++;\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "873274ae15ac77b6976bf49e68d09132", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include\n\nint main(void) {\n\tint s,x1,x2,t1,t2,p,d,tt,tf;\n\tscanf(\"%d %d %d\",&s,&x1,&x2);\n\tscanf(\"%d %d\",&t1,&t2);\n\tscanf(\"%d %d\",&p,&d);\n\t\n\ttf=abs(x2-x1)*t2;\n\t\n if(p>x1&&d==1&&x2>x1)\n tt=(2*s-p+x2)*t1;\n else if(p>x1&&d==1&&x2x1&&d==-1&&x2>x1)\n tt=(p+x2)*t1;\n else if(p>x1&&d==-1&&x2x1)\n tt=(x2-p)*t1;\n else if(p<=x1&&d==1&&x2x1)\n tt=(x2+p)*t1;\n else if(p<=x1&&d==-1&&x2=tt)\n printf(\"%d\",tt);\n else\n printf(\"%d\",tf);\n\t\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "82e308ad6d6dd7fc038af1ee2099a164", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint Min(int a, int b)\n{\n return a < b ? a:b;\n}\nint main()\n{\n int n,x1,x2,t1,t2,p,d;\n int t3,t4,ans;\n while(scanf(\"%d %d %d\",&n,&x1,&x2)==3)\n {\n scanf(\"%d %d %d %d\",&t1,&t2,&p,&d);\n if(x2 > x1)\n {\n t3 = (x2 - x1) * t2;\n if(d == 1)\n {\n if(p > x1)\n t4 = (n - p + n * 2) * t1;\n else\n t4 = (n - p) * t1;\n }\n else\n t4 = (n + p) * t1;\n }\n else\n {\n t3 = (x1 - x2) * t2;\n if(d == 1)\n t4 = (n - p + n) * t1;\n else\n {\n if(p < x1)\n t4 = (p + n * 2) * t1;\n else\n t4 = (n - p) * t1;\n }\n }\n ans = Min(t3, t4);\n printf(\"%d\\n\",ans);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3596e16de8eb0c528695680c3e9ca5d8", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\nlong long int min(long long int a,long long int b)\n{\n\tif(a<=b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint main()\n{\n\tlong long int s,x1,x2,t1,t2,p,d,temp1,temp2,ans;\n\tscanf(\"%lld %lld %lld\",&s,&x1,&x2);\n\tscanf(\"%lld %lld\",&t1,&t2);\n\tscanf(\"%lld %lld\",&p,&d);\n\tif(x1\n#include\n\nint main(void) {\n\tint s,x1,x2,t1,t2,p,d,tt,tf;\n\tscanf(\"%d %d %d\",&s,&x1,&x2);\n\tscanf(\"%d %d\",&t1,&t2);\n\tscanf(\"%d %d\",&p,&d);\n\t\n\ttf=abs(x2-x1)*t2;\n\t\n if(p>x1&&d==1&&x2>x1)\n tt=(2*s-p+x2)*t1;\n else if(p=>x1&&d==1&&x2x1&&d==-1&&x2>x1)\n tt=(p+x2)*t1;\n else if(p>=x1&&d==-1&&x2x1)\n tt=(x2-p)*t1;\n else if(px1)\n tt=(x2+p)*t1;\n else if(p=tt)\n printf(\"%d\",tt);\n else\n printf(\"%d\",tf);\n\t\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "037f79d88bc7fb9c0bc43ef925e9d389", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n int x;\n int s ,x1,x2,t1,t2,p,d;\n scanf(\"%d%d%d%d%d%d%d\",&s,&x1,&x2,&t1,&t2,&p,&d);\n if(t1>=t2){\n printf(\"%d\",abs(x2-x1)*t2);\n }\n else if(x2>x1){\n if(p<=x1&&d==1){\n x=((x1-p)*t1)/(t2-t1);\n if(x>=(x2-x1)){\n printf(\"%d\",(x2-x1)*t2);\n }\n else {\n printf(\"%d\",(x2-p)*t1);\n }\n }\n else if(p<=x1&&d==-1){\n x=((p+x1)*t1)/(t2-t1);\n if(x>=x2-x1){\n printf(\"%d\",(x2-x1)*t2);\n }\n else{\n printf(\"%d\",(p+x2)*t1);\n }\n }\n else if(p>x1&&d==1){\n x=(s-p+s+x1)/(t2-t1);\n if(x>=x2-x1){\n printf(\"%d\",(x2-x1)*t2);\n }\n else{\n printf(\"yes %d\",(s-p+s+x2)*t1);\n }\n }\n else {\n x=(p+x1)/(t2-t1);\n if(x>=x2-x1){\n printf(\"%d\",(x2-x1)*t2);\n }\n else{\n printf(\"%d\",(p+x2)*t1);\n }\n }\n }\n else{\n if(p>=x1&&d==-1){\n x=((-x1+p)*t1)/(t2-t1);\n if(x>=abs(-x2+x1)){\n printf(\"%d\",-(x2-x1)*t2);\n }\n else {\n printf(\"%d\",-(x2-p)*t1);\n }\n }\n else if(p>=x1&&d==1){\n x=((s-p+s-x1)*t1)/(t2-t1);\n if(x>=abs(x2-x1)){\n printf(\"%d\",(x2-x1)*t2);\n }\n else{\n printf(\"%d\",(s-p+s-x2)*t1);\n }\n }\n else if(p=abs(x2-x1)){\n printf(\"%d\",(x2-x1)*t2);\n }\n else{\n printf(\"%d\",x);\n }\n }\n else {\n \n x=(s-p+s-x1)/(t2-t1);\n if(x>=abs(x2-x1)){\n printf(\"%d\",(x2-x1)*t2);\n }\n else{\n printf(\"%d\",(s-p+s-x2)*t1);\n }\n }\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b065dd605f79654a7f8b0a6a6c1a5d74", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,b=0,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i=0)\n b++a[i];\n else\n c+=a[i];\n }\n printf(\"%d\",b-c);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2be9bd24d42cb79608d9459d5aca7d0d", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n\tint a[100];\n\tint b;\n\tint c;\n\tint j;\n\tscanf(\"%d\",&j);\n\tfor(int i=0;i=0)\n\t\t\tb=b+a[i];\n\t\telse\n\t\t\tc=c+a[i];\n\t}\n\tprintf(\"%d\",b-c);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d0920a3d087f1b6f004785d884e98a09", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2b09e3b0afcad4eedac654047b99b7f3", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint man()\n{\n int arr[105],i,B=0,C=0,n;\n scanf(\"%d\",&n);\n for(i=0;i\nint man()\n{\n int arr[105],i,B=0,C=0,n;\n scanf(\"%d\",&n);\n for(i=0;i\n#include \nint main()\n{\n float x, y, n, a, b, min=10000000, ansb;\n int i;\n scanf(\"%f %f %f\", &x, &y, &n);\n if(y<=n)\n printf(\"%d/%d\\n\", (int)x, (int)y);\n else\n {\n b=n-1;\n if(b==0)\n {\n printf(\"0/1\\n\");\n return 0;\n }\n for(b=n-1; b>0; b--)\n {\n for(i=b-1; i>0; i--)\n {\n float temp=(float)i;\n float temp1=x/y;\n float temp2=temp/b;\n //printf(\"x/y=%f i/b=%f abs=%f\\n\", temp1, temp2, fabs(temp1-temp2));\n if(fabs(temp1-temp2)1; i--)\n {\n if(inta%i==0 && intb%i==0)\n {\n inta/=i;\n intb/=i;\n i--;\n }\n }\n printf(\"%d/%d\\n\", inta, intb);\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "46f1df5baf8fc155d72d6f8f5c3dedae", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nint gcd(int x,int y)\n{\n if(y==0)\n\treturn x;\n else return gcd(y,x%y);\n}\nint main()\n{\n int a,b,n,g,i,j,num,den;\n float prev=FLT_MIN,min,prev2=FLT_MAX,least=FLT_MAX,temp;\n scanf(\"%d%d%d\",&a,&b,&n);\n min= (float)a/(float)b;\n g=gcd(a,b);\n a=a/g;\n b=b/g;\n if(b<=n)\n\tprintf(\"%d/%d\\n\",a,b);\n else\n {\n\tfor(i=n;i>=1;i--)\n\t{\n\t for(j=a;j>=0;j--)\n\t {\n\t\ttemp=(float)j/(float)i;\n\t\tif( least >= fabsf(min-temp) )\n\t\t{\n\t\t num=j;\n\t\t den=i;\n\t\t least=fabsf(min-temp);\n\t\t}\n\t//\tprintf(\"min: %f temp :%f least%f j:%d i:%d num:%d den:%d\\n\",min,temp,least,j,i,num,den);\n\t\tif((min>temp && tempprev2 ))\n\t\t{\n\t\t break;\n\t\t}\n\t\t prev=temp;\n\t\t//\telse if(fabsf(temp\n#include \n#include \n\n\nint main()\n{\n int x, y, n, i;\n double min = 9999999, c, tmpmin;\n int p, a, b;\n scanf(\"%d %d %d\", &x, &y,&n);\n for (i = 1; i <= n; i++)\n {\n c = x*i / (y*1.0);\n p = floor(c+0.49999999999);\n tmpmin = fabs((x*1.0) / y - (p*1.0) / i);\n if (min > tmpmin)\n {\n min = tmpmin;\n a = p;\n b = i;\n }\n }\n printf(\"%d/%d\", a, b);\n _getch();\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "bdd741f3912bcd5918454e539c4c2b2d", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n int x, y, n;\n scanf(\"%d %d %d\", &x, &y, &n);\n\n int a, b, i;\n double ratio = (double)x/y;\n\n double sol = 10000000;\n double dist;\n for (i=1;i<=n;i++){\n int j = roundtol(ratio * i);\n if (ratio*i - floor(ratio*i) == 0.5){\n j = (int)(ratio*i);\n }\n dist = fabs(ratio - (double)j/i);\n if (sol>dist){\n sol = dist;\n b = i;\n a = j;\n }\n }\n\n printf(\"%d/%d\\n\", a, b);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "283c9b125db3ac148d6ea5a95f6cf971", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n\nint main()\n{\n int x, y, n, i;\n double min = 9999999, c, tmpmin;\n int p, a, b;\n scanf(\"%d %d %d\", &x, &y,&n);\n for (i = 1; i <= n; i++)\n {\n c = x*i / (y*1.0);\n p = floor(c+0.4999999999);\n tmpmin = fabs((x*1.0) / y - (p*1.0) / i);\n if (min > tmpmin)\n {\n min = tmpmin;\n a = p;\n b = i;\n }\n }\n printf(\"%d/%d\", a, b);\n return 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c8721201abe8633d2d5a6a000f040219", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint main(){\n int a,b;\n cin>>a>>b;\n int c = (a+b)/2;\n int p =0;\n for(int i = 0;i<=abs(c-a);i++)\n p += i;\n for(int j = 0;j<=abs(c-b);j++)\n p += j;\n cout<b)swap(a,b);printf(\"%d\\n\",(((a+b)>>1)-a)*(((a+b)>>1)-a+1)/2+(b-((a+b)>>1))*(b-((a+b)>>1)+1)/2);}", "lang_cluster": "C", "compilation_error": true, "code_uid": "233697a757f504810395b90780432b88", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nusing namespace std;\nint main(void)\n{\n\n\n int nA,nB,T;\n int a,b;\n cin>>a;\n cin>>b;\n if((b-a)%2==0)\n {\n nA=nB=abs((b-a)/2);\n }\n else {\n\n nA=abs((b-a)/2);\n nB=nA+1;\n }\n\n T=nA*(nA+1)/2 + nB*(nB+1)/2;\n cout< b)\n {\n k = (a - b) % 2;\n if(k != 0)\n {\n k = 0;\n for(i = (a-b)/2; i > 0; i --)\n {\n if(i < (a-b)/2)\n {\n c += i;\n }\n k += i;\n }\n printf(\"%d\", k+c);\n }\n else\n {\n k = 0;\n for(i = (a-b)/2; i > 0; i --)\n {\n k += i;\n }\n k *= 2;\n printf(\"%d\", k);\n }\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "8e8cd383180c8c72b99018bd521b5ffb", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "GNU C", "source_code": "# include \nint main ()\n{\n int a, b, c = 0, k, i;\n scanf(\"%d %d\", &a, %b);\n if(a > b)\n {\n k = (a - b) % 2;\n if(k != 0)\n {\n k = 0;\n for(i = (a-b)/2; i > 0; i --)\n {\n if(i > (a-b)/2)\n {\n c += i;\n }\n k += i;\n }\n }\n else\n {\n k = 0;\n for(i = (a-b)/2; i > 0; i --)\n {\n k += i;\n }\n k *= 2;\n }\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7d212ce0c855304cee254a69f77dc00d", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n {\n \tchar n[10], m[10];\n \tint dd, mm, yy, bd, bm, by, i, a, b, c, flag=0;\n \tscanf(\"%s\", n);\n\tscanf(\"%s\", m);\n \tdd = (n[0] - '0')*10 + n[1] - '0';\n \tmm = (n[3] - '0')*10 + n[4] - '0'; \n \tyy = (n[6] - '0')*10 + n[7] - '0';\n \t\n \tbd = (m[0] - '0')*10 + m[1] - '0';\n \tbm = (m[3] - '0')*10 + m[4] - '0';\n \tby = (m[6] - '0')*10 + m[7] - '0';\n \t\n \tfor(i=0; i<6; i++)\n \t {\n \t \tif(i == 0)\n \t \t {\n \t \t \ta = bd;\n \t \t \tb = bm;\n \t \t \tc = by;\n\t\t }\n \t \tif(i == 1)\n \t \t {\n \t \t \ta=by;\n \t \t \tb=bm;\n \t \t \tc=bd;\n\t\t }\n\t\tif(i == 2)\n\t\t {\n\t\t \ta=by;\n\t\t \tb=bd;\n\t\t \tc=bm;\n\t\t }\n\t\tif(i == 3)\n\t\t {\n\t\t \ta=bm;\n\t\t \tb=by;\n\t\t \tc=bd;\n\t\t } \n\t\tif(i == 4)\n\t\t {\n\t\t \ta=bm;\n\t\t \tb=bd;\n\t\t \tc=by;\n\t\t }\n\t\tif(i == 5)\n\t\t {\n\t\t \ta=bd; \n\t\t \tb=by;\n\t\t \tc=bm;\n \t }\n\t if(a == 0) continue;\n\t\tif(b == 1 || b == 3 || b == 5 || b == 7 || b == 8 || b == 10 || b == 12)\n\t\t if(c > 31) continue;\n\t\tif(b == 4 || b == 6 || b == 9|| b == 11)\n\t\t if(c > 30) continue;\n\t\tif(b == 2 && a%4 == 0 && c>29) continue;\n\t\tif(b == 2 && a%4 != 0 && c>28) continue;\n\t\tif(b > 12) continue;\n\t if(yy-a == 18 && mm > b)\n\t flag = 1;\n\t if(yy-a == 18 && mm == b && dd >= c)\n\t flag = 1;\n\t if(yy-a>18)\n\t flag = 1;\n\t if(flag == 1)\n\t {\n//\t \tprintf(\"1 \");\n\t \tprintf(\"YES\");\n//\t \tgetchar();\n//\t \tgetchar();\n\t \treturn 0;\n\t\t }\n//\t\tprintf(\"%d %d \", i, flag);\n// if(i == 5) printf(\"%d %d %d \", a, b, c);\n\t }\n\tif(flag == 1) printf(\"YES\");\n\telse printf(\"NO\");\n//\tgetchar();\n//\tgetchar();\n\treturn 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae75ad31b5f62c3b020989ee3685a562", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \nint processmonth(int dd, int mm, int yy, int by, int bm, int bd){\n if((bm>12)||(((by+18)==yy)&&(mm31)\n return 0;\n if((bm==mm)&&((by+18)==yy))\n if(bd>dd)\n return 0;\n if((bm==4)||(bm==6)||(bm==9)||(bm==11)){\n if(bd>30)\n return 0;\n }\n if(bm==2){\n if((by%4)==0){\n if(bd>29)\n return 0;\n }\n else\n if(bd>28)\n return 0;\n }\n return 1;\n}\nint processyear(int dd, int mm, int yy, int by, int z1, int z2){\n if((by+18)>yy)\n return 0;\n int t=0;\n t=t+processmonth(dd,mm,yy,by,z1,z2);\n t=t+processmonth(dd,mm,yy,by,z2,z1);\n return t;\n}\nint main(){\n int t = 0;\n int c,x,dd,mm,yy,x1,x2,x3;\n c=getchar();\n dd=(c-'0')*10;\n c=getchar();\n dd=dd+c-'0';\n c=getchar();\n c=getchar();\n mm=(c-'0')*10;\n c=getchar();\n mm=mm+c-'0';\n c=getchar();\n c=getchar();\n yy=(c-'0')*10;\n c=getchar();\n yy=yy+c-'0';\n c=getchar();\n c=getchar();\n x1=(c-'0')*10;\n c=getchar();\n x1=x1+c-'0';\n c=getchar();\n c=getchar();\n x2=(c-'0')*10;\n c=getchar();\n x2=x2+c-'0';\n c=getchar();\n c=getchar();\n x3=(c-'0')*10;\n c=getchar();\n x3=x3+c-'0';\n t=t+processyear(dd,mm,yy,x1,x2,x3);\n t=t+processyear(dd,mm,yy,x2,x1,x3);\n t=t+processyear(dd,mm,yy,x3,x1,x2);\n if(t>0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7dba15aef750a2d931a8e43269ae3f71", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \nint y,m,d;\nint legal(int d,int m,int y)\n{\n int p[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};\n if(y%4==0)\n\t\tp[2]=29;\n if(m>=1&&m<=12&&d>=1&&d<=p[m])\n return 1;\n return 0;\n}\nint ok(int a,int b,int c)\n{\n\tif(y>c)\n\t\treturn 1;\n\telse\n\t\tif(y==c)\n\t\t{if(m>b)\n\t\treturn 1;\n\t else\n\t\tif(m==b&&d>=a)\n\t\treturn 1;}\n\treturn 0;\n}\nint main(void)\n{\n\n int a,b,c;\n scanf(\"%d%*c%d%*c%d\",&d,&m,&y);\n if(y%4==0&&m==2&&d==29)\n\t\ty-=18,m=2,d=28;\n\telse\n\t\ty-=18;\n scanf(\"%d%*c%d%*c%d\",&a,&b,&c);\n if((legal(a,b,c)&&ok(a,b,c))||(legal(c,b,a)&&ok(c,b,a))||(legal(b,c,a)&&ok(b,c,a))||\n\t (legal(a,c,b)&&ok(a,c,b))||(legal(c,a,b)&&ok(c,a,b))||(legal(b,a,c)&&ok(b,a,c)))\n\t\tputs(\"YES\\n\");\n\telse\n\t\tputs(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "39dfe6e54a110be8e8564f3f4481e3e0", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \nint y,m,d;\nint legal(int d,int m,int y)\n{\n int p[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};\n if(y%4==0)\n\t\tp[2]=29;\n if(m>=1&&m<=12&&d>=1&&d<=p[m])\n return 1;\n return 0;\n}\nint ok(int a,int b,int c)\n{\n\tif(y>c)\n\t\treturn 1;\n\telse\n\t\tif(y==c)\n\t\t{if(m>b)\n\t\treturn 1;\n\t else\n\t\tif(m==b&&d>=a)\n\t\treturn 1;}\n\treturn 0;\n}\nint main(void)\n{\n\n int a,b,c;\n scanf(\"%d%*c%d%*c%d\",&d,&m,&y);\n //if(y%4==0&&m==2&&d==29)\n\t\t//y-=18,m=3,d=1;\n\t//else\n\t\ty-=18;\n scanf(\"%d%*c%d%*c%d\",&a,&b,&c);\n if((legal(a,b,c)&&ok(a,b,c))||(legal(c,b,a)&&ok(c,b,a))||(legal(b,c,a)&&ok(b,c,a))||\n\t (legal(a,c,b)&&ok(a,c,b))||(legal(c,a,b)&&ok(c,a,b))||(legal(b,a,c)&&ok(b,a,c)))\n\t\tputs(\"YES\\n\");\n\telse\n\t\tputs(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3b7123b68a40da849f9115f164ad62a9", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\ntypedef struct {\n\tint d, m, a;\n} data_t;\n\nint isValid( data_t data ){\n\t\n\tif( data.m > 12 ) return 0;\n\t\n\tif( data.m == 1 || data.m == 3 || data.m == 5 || data.m == 7 || data.m == 8 || data.m == 10 || data.m == 12 )\n\t{\n\t\t\tif( data.d > 31 ) return 0;\n\t}\n\telse if( data.m == 2 ){\n\t\t\n\t\tif( data.a % 4 ){\n\t\t\tif( data.d > 28 ) return 0;\n\t\t} else if( data.d > 29 ) return 0;\n\t\n\t} else if( data.d > 30 ) return 0;\n\t\n\treturn 1;\n}\n\nint age( data_t nasc, data_t cur ){\n\t\n\tif( cur.a < nasc.a ) return 0;\n\t\n\tint age = ( cur.a - nasc.a );\n\t\n\tif( nasc.m < cur.m ) return age;\n\telse if( nasc.m > cur.m ) return age - 1;\n\telse {\n\t\t\n\t\tif( nasc.d <= cur.d ) return age;\n\t\telse return age-1;\n\t}\n\n}\n\nint main(){\n\t\n\tdata_t cont, d1, d2, d3, d4, d5, d6;\n\t\n\tscanf(\"%d.%d.%d\", &cont.d, &cont.m, &cont.a ); \n\tscanf(\"%d.%d.%d\", &d1.d, &d1.m, &d1.a ); \n\t\n\td2.d = d1.m; d2.m = d1.d; d2.a = d1.a;\n\td3.d = d1.a; d3.m = d1.d; d3.a = d1.m;\n\t\n\td4.d = d1.d; d4.m = d1.a; d4.a = d1.m;\n\td5.d = d1.m; d5.m = d1.a; d5.a = d1.d;\n\td6.d = d1.a; d6.m = d1.m; d6.a = d1.d;\n\t\n\tif( isValid( d1 ) && age( d1, cont ) >= 18 ){ puts(\"YES\");\n\t} else if( isValid( d2 ) && age( d2, cont ) >= 18 ){ puts(\"YES\");\n\t} else if( isValid( d3 ) && age( d3, cont ) >= 18 ){ puts(\"YES\");\n\t} else if( isValid( d4 ) && age( d4, cont ) >= 18 ){ puts(\"YES\");\n\t} else if( isValid( d5 ) && age( d5, cont ) >= 18 ){ puts(\"YES\");\n\t} else if( isValid( d6 ) && age( d6, cont ) >= 18 ){ puts(\"YES\");\n\t} else puts(\"NO\");\n\t\n\t\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d1bd817ed5b2ce5cbd1b2fd1b6b7fbd", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int p,q,m,n,criminals=0,x1,x2;\n scanf(\"%d %d\",&p,&q);\n int A[p+1];\n for(m=1;m<=p;m++)\n {\n scanf(\"%d\",&A[m]);\n }\n x1 = q-1;\n x2 = p-q;\n if(x1>x2)\n {\n for(m=q-x1,n=p;m++;n--)\n {\n if(n>m)\n {\n if(A[m]==1 && A[n]==1)\n {\n criminals+=2;\n }\n\n }\n if(n==m)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n\n }\n for(m=q-x1-1;m>=1;m--)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n else if(x1m)\n {\n if(A[m]==1 && A[n]==1)\n criminals+=2;\n }\n if(n==m)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n for(m=2*q;m<=p;m++)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n else\n {\n for(m=1,n=p;m<=q;m++,n--)\n {\n if(n>m)\n {\n if(A[m]==1 && A[n]==1)\n criminals+=2;\n }\n if(n==m)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n\n }\n printf(\"%d\\n\",criminals);\n return 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a4ed05862fa7cf75dd4585b179e09502", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int p,q,m,n,criminals=0,x1,x2;\n scanf(\"%d %d\",&p,&q);\n int A[p+1];\n for(m=1;m<=p;m++)\n {\n scanf(\"%d\",&A[m]);\n }\n x1 = q-1;\n x2 = p-q;\n if(x1>x2)\n {\n for(m=q-x1,n=p;m++;n--)\n {\n if(n>m)\n {\n if(A[m]==1 && A[n]==1)\n {\n criminals+=2;\n }\n\n }\n if(n==m)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n\n }\n for(m=q-x1-1;m>=1;m--)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n else if(x1m)\n {\n if(A[m]==1 && A[n]==1)\n criminals+=2;\n }\n if(n==m)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n for(m=q+x1+1;m<=p;m++)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n else\n {\n for(m=1,n=p;m<=q;m++,n--)\n {\n if(n>m)\n {\n if(A[m]==1 && A[n]==1)\n criminals+=2;\n }\n if(n==m)\n {\n if(A[m]==1)\n criminals+=A[m];\n }\n }\n\n }\n printf(\"%d\\n\",criminals);\n return 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c51dcbeb7397c25d284805ec0aac2d8", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,a,t[104],i,left,right,ans=0,flag1=0,flag2=0;\n\tscanf(\"%d%d\",&n,&a);\n\tleft=a-1;\n\tright=a-1;\n\tfor(i=0;i=0 || right0)\n\t\t{\n\t\t\tleft=left-1;\n\t\t\tflag1=1;\n\t\t}\n\t\tif(right\n#include \n#include \n#include \n\nint main()\n{\n int a,n,i,j,counter=0;\n scanf(\"%d%d\",&n,&a);\n a-=1;\n int arr[n];\n for(i=0; i=n)\n break;a\n if(arr[i]==1&&arr[j]==1)\n counter+=2;\n else if((arr[i]==1 && j>=n) || (arr[j]==1 &&i<0))\n counter++;\n }\n printf(\"%d\",counter);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "056fd76f1004ece0097b5e01143fcb3b", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,i,sum=0,j;\n int a[n];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i=0;i++,j--)\n {\n if(a[i]+a[j]==1)\n {\n sum--;\n }\n }\n printf(\"%d\\n\",sum);\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "df7022f0e9087555be9e8426df15faa7", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,i,x,count=0,flag=0;\n int a[LEN];\n char ch;\n\n scanf(\"%d\",&n);\n\n\n for(i=1;i<=n;i++)\n {\n x=i;\n int numlen=0;\n flag=0;\n while(x!=0)\n {\n numlen++;\n if(x%10==0 || x%10==1)\n {\n flag++;\n }\n x/=10;\n\n }\n if(flag==numlen)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d90c17bd123c3f550db389347bb9164", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#define gc getchar_unlocked()\nint main(){\n long long ans = 0, P = 1e9+7, f=0;\n for(char 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "87ec4c9536fe9ea38bb766e3664086c7", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "GNU C11", "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} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "4db8a6d8dc7fedf30abfbbefa49c6609", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#define gc getchar_unlocked()\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2aeba26461089fe9dc47451120871e8", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint c=0,a,b,i;\n\tlong long int n;\n\tscanf(\"%ld\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t b=i;\n\t while(b!=0)\n\t\t{\n\t\t a=b%100;\n\t\t b=b/100;\n\t\t if(a==1 || a==0 || a==10 || a=11)\n\t\t {\n\t\t if(b==0)\n\t\t c++;\n\t\t else\n\t\t continue;\n\t\t }\n\t\t else\n\t\t break;\n\t\t}\n\t}\n\tprintf(\"%d\",c);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "eced0daa48b9c229efb2dc1d4b7268ed", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define MOD 1000000007\nint a,b,n,sum;\nlong long int c[500010];\nlong long int ans;\nint i,j;\nint judge(int x)\n{\n char tmp[1000010];\n sprintf(tmp,\"%d\",x);\n int len=strlen(tmp);\n for(j=0;j\n#include \n#include \n#include \n\n#define ARRAY_SIZEOF(a) (sizeof(a) / sizeof(a[0]))\n#define ZERO(p, n) memset(p, 0, n);\n\n#define MOD 1000000007\n\ntypedef long long int lli;\n\nint a, b, n;\n\nint madd(int a, int b)\n{\n return (int)( ((lli)a + (lli)b) % MOD );\n}\n\n/* Gets nth digit of `n` in decimal form. Digits counted from the rightmost,\n least significant, which is 0\n*/\nint nth_digit(int j, int n)\n{\n while (n != 0) {\n int d = n % 10;\n n /= 10;\n if (j == 0) {\n return d;\n }\n j--;\n }\n return 0;\n}\n\nint get_num(int k)\n{\n return b * k + (n - k) * a;\n}\n\nint digit_lower_bound(int d, int pos, int lo, int hi)\n{\n while (lo < hi) {\n int mid = (lo + hi) / 2;\n int nmid = get_num(mid);\n int dmid = nth_digit(pos, nmid);\n if (d > dmid) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n return lo;\n}\n\nint Cnk(int k, int n)\n{\n /* Dynamic programming is here. */\n if (k == 0 && n >= 0) {\n return 1;\n }\n if (n == 0) {\n return 0;\n }\n return madd(Cnk(k, n - 1), Cnk(k - 1, n - 1));\n}\n\nint solve(int pos, int lo, int hi);\n\nint solve_digit(int d, int pos, int lo, int hi)\n{\n int d_lo = digit_lower_bound(d, pos, lo, hi);\n if (nth_digit(pos, get_num(d_lo)) == d) {\n int d_hi = digit_lower_bound(d + 1, pos, lo, hi);\n return solve(pos - 1, d_lo, d_hi);\n }\n return 0;\n}\n\nint solve(int pos, int lo, int hi)\n{\n int i, a_res, b_res;\n\n if (lo == hi) {\n return 0;\n }\n if (pos < 0) {\n int count = 0;\n for (i = lo; i < hi; ++i) {\n int ck = Cnk(i, n);\n count = madd(count, ck);\n }\n return count;\n }\n\n a_res = solve_digit(a, pos, lo, hi);\n b_res = solve_digit(b, pos, lo, hi);\n return madd(a_res, b_res);\n}\n\nint main(int argc, char **argv)\n{\n/*\n#ifndef ONLINE_JUDGE\n freopen(\"in\", \"r\", stdin);\n #endif\n*/\n int max_sum, pos = 6, combinations;\n\n scanf(\"%d%d%d\", &a, &b, &n);\n if (a > b) {\n int temp = a;\n a = b;\n b = temp;\n }\n\n /* Simplify a bit by reducing leading digits that are zeroes */\n max_sum = b * n;\n while (nth_digit(pos, max_sum) == 0) {\n pos--;\n }\n\n combinations = solve(pos, 0, n + 1);\n printf(\"%d\\n\", combinations);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2eac124cac2bde45bddd5e9ee0245c12", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define MOD 1000000007\nint a,b,n,sum;\nlong long int c[500010];\nlong long int ans;\nint i,j;\nint judge(int x)\n{\n char tmp[1000010];\n sprintf(tmp,\"%d\",x);\n int len=strlen(tmp);\n for(j=0;j\n#include\n#define Min(x,y) ((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=0)a-=1000000007;\n while(a<0)a+=1000000007;\n return a;\n}\nLL inv(LL a)\n{\n LL B,m,n,x,y,u,v,q,r;\n x=v=0;\n y=u=1;\n LL b = mod;\n B=mod;\n while(a)\n {\n q=b/a;\n r=b%a;\n m=x-u*q;\n n=y-v*q;\n b=a;a=r;\n x=u;y=v;\n u=m;v=n;\n }\n return md(x);\n}\n\nint main()\n{\n int m,l,ans,sum,min,max,n,i,j,k,x,y,t;\n int counta,countb,mina,maxa;\n si(aa);\n si(bb);\n si(n);\n min = aa*n;\n max = bb*n + 1;\n f[0]=1;\n REP(i,1,max)\n f[i] = (f[i-1]*(LL)i)%mod;\n\n LL anss=0;\n REP(i,min,max)\n {\n if(isgood(i))\n {\n countb = i-min;\n counta = n-countb;\n anss += md(f[n] * inv(f[counta]*f[countb]));\n \n anss = md(anss);\n }\n }\n pll(md(anss));\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a27921768ab2ba696c55cf61d05dc4e6", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int i,k=0,z=0,l=0,b=0,n,m,s,e;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n char a[30],h[30];\n scanf(\"%s\",&a);\n scanf(\"%s\",&h);\n for(i=0;i')\n z=z+1;\n else\n b=b-1;\n }\n s=b+z;\n for(i=0;i\n#include \n\nusing namespace std;\n\nint main() {\n int x,y; \n scanf(\"%d%d\",&x,&y);\n char a[x+1],b[y+1],c[5];\n scanf(\"%s%s\",a,b);\n c[0]=a[0];c[1]=a[x-1];\n c[2]=b[0];c[3]=b[y-1];\n c[4]='\\0';\n if(!strcmp(c,\"<>v^\") || !strcmp(c,\"><^v\"))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0; \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2a8ea0b05fa359b28e93bc18a643a32b", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n\nint n, m;\nchar f[23],g[23];\n\nint\nmain()\n{\n\tscanf(\"%d %d\", &n, &m );\n scanf( \"%s %s\", f, g );\n char c[5] = { f[0], g[0], f[n-1], g[m-1], '\\0' };\n\tcout << ((!strcmp( c, \"^\" ) || !strcmp( c, \">^\n#include \n\n#define N\t20\n#define M\t20\n\nint adj[N][M][N][M];\nint used[N][M];\n\nint dfs(int i1, int j1, int i2, int j2, int n, int m) {\n\tint i, j;\n\n\tif (i1 == i2 && j1 == j2)\n\t\treturn 1;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t\tif (adj[i1][j1][i][j] && !used[i][j]) {\n\t\t\t\tused[i][j] = 1;\n\t\t\t\tif (dfs(i, j, i2, j2, n, m))\n\t\t\t\t\treturn 1;\n\t\t\t}\n\tused[i][j] = 0;\n\treturn 0;\n}\n\nint main() {\n\tstatic char s[N + 1];\n\tstatic char t[M + 1];\n\tint n, m, i, i1, i2, j, j1, j2;\n\n\tscanf(\"%d%d\", &n, &m);\n\tscanf(\"%s\", s);\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == '<')\n\t\t\tfor (j1 = 0; j1 < m; j1++)\n\t\t\t\tfor (j2 = j1 - 1; j2 >= 0; j2--)\n\t\t\t\t\tadj[i][j1][i][j2] = 1;\n\t\telse\n\t\t\tfor (j1 = 0; j1 < m; j1++)\n\t\t\t\tfor (j2 = j1 + 1; j2 < m; j2++)\n\t\t\t\t\tadj[i][j1][i][j2] = 1;\n\tscanf(\"%s\", t);\n\tfor (j = 0; j < m; j++)\n\t\tif (t[j] == '^')\n\t\t\tfor (i1 = 0; i1 < n; i1++)\n\t\t\t\tfor (i2 = i1 - 1; i2 >= 0; i2--)\n\t\t\t\t\tadj[i1][j][i2][j] = 1;\n\t\telse\n\t\t\tfor (i1 = 0; i1 < n; i1++)\n\t\t\t\tfor (i2 = i1 + 1; i2 < n; i2++)\n\t\t\t\t\tadj[i1][j][i2][j] = 1;\n\tfor (i1 = 0; i1 < n; i1++)\n\t\tfor (j1 = 0; j1 < m; j1++)\n\t\t\tfor (i2 = 0; i2 < n; i2++)\n\t\t\t\tfor (j2 = 0; j2 < m; j2++) {\n\t\t\t\t\tmemset(used, 0, sizeof used);\n\t\t\t\t\tif (!dfs(i1, j1, i2, j2, n, m)) {\n\t\t\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd94218da21524fb5df301bbec558dea", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "/*strongly connected city*/\n#include\nint main()\n{\nint m,n,i,ul,ur,dl,dr;\nscanf(\"%d %d\",&m,&n);\ngetchar();\nul=getchar();\nfor(i=2;i\n#include \n\nint main()\n{ int i,b[6],s=0,j,p=0,k;\n for(i=0;i<6;i++)\n {\n scanf(\"%d\",&b[i]);\n s=s+b[i];\n\n }\n if(s%2==1)\n {\n printf(\"NO\");\n p++;\n }\n else\n {\n s=s/2;\n\n for(i=0;i<4;i++)\n {\n for(j=i+1;j<6;j++)\n {\n for(k=j+1;k<6;k++)\n {\n if(b[i]+b[j]+b[k]==s)\n {\n p=p+2;\n\n }\n break;\n }\n break; }\n break; }\n }\n\n\n if(p==0||p==1)\n {\n printf(\"NO\");\n }\n if(p==2)\n {\n printf(\"YES\");\n }\ni\n\n \n \n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3517ad2ea7d5f5093d8a55a6df6c45f", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a[6];\n int sum;\n scanf(\"%d %d %d %d %d %d\",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);\n sum=a[0]+a[1]+a[2]+a[3]+a[4]+a[5];\n if(sum%2==0)\n {\n for(int i=0;i<6;i++)\n for(int j=1;<6;j++)\n for(int k=2;k<6;k++)\n {\n if(a[i]+a[j]+a[k]==(sum/2)) \n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n else printf(\"NO\");\n printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7b9b7afa2b187db5c4b9f2508511ae7b", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,i,j,k,c=0;\n float s=0,sum=0;\n\n float arr[6];\n for(i=0;i<6;i++){\n scanf(\"%f\",&arr[i]);\n s=s+arr[i];}\n for(i=0;i<4;i++){\n for(j=i+1;j<5;j++){\n for(k=j+1;k<6;k++){\n sum=arr[i]+arr[j]+arr[k];\n\n if(sum==s/2)\n {c++;\n\n\n }}\n\n }\n }\n if(c==0)\n printf(\"NO\");\n else printf(\"YES\");\n\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d2634d5149aa320552cb28e4f818507", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a[6];\n int sum;\n scanf(\"%d %d %d %d %d %d\",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);\n sum=a[0]+a[1]+a[2]+a[3]+a[4]+a[5];\n if(sum%2==0)\n {\n for(int i=0;i<6;i++)\n for(int j=1;<6;j++) \n for(int k=2;k<6;k++)\n {\n if(a[i]+a[j]+a[k]==(sum/2)) \n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n else \n {\n printf(\"NO\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "79675759017514df2cce2029d90073a0", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "main.c", "lang_cluster": "C", "compilation_error": true, "code_uid": "c05c8a5a31f598f99955cdb9158ecb65", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n\n\nint main()\n{\n int *t;\n int i, j;\n int aux;\n int n;\n int right;\n\n\n scanf(\"%d\", &n);\nt = malloc(n*sizeof(int));\n\nif(n<2)\n{\n printf(\"-1\");\n}\n\nif(n>=2)\n{\n t[0]=8;\n t[1]=9;\n for(i=2; i\nint main() {\n int n;\n scanf(\"%d\",&n);\n if(n<3) printf(\"-1\\n\");\n else {\n int i;\n for(i=n;i>0;i--) {\n printf(\" %d\",i);\n \uff5d\n printf(\"\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "74ef68b4fe949a3d0a214a4100e814cf", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int n,i;\n scanf(\"%d\",&n);\n if(1==n)\n printf(\"-1\");\n else{\n for(i=n;i>=1;i++)\n printf(\"%d \",i);\n }\n return 0\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f5f746d81897b86099f62ccb1d31e56c", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1 || n==2) {\n \tprintf(\"-1\");\n\t}\n\telse {\n\t\tprintf(\"100\");\n\t\tfor(i=1;i\nmain()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n if(n==1||n==2)\n {\n printf(\"-1\");\n return 0;\n\n }\n\n printf(\"2 3 1 \");\n for(i=4;i<=n;i++)\n {\n printf(\"%d \",i);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8ad6c7b5c33b40477eb6826831772711", "src_uid": "fe8a0332119bd182a0a5b7758716317e", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint convert(int a,int b,char c[])\n{\n\n char d[101]=\"\";\n copy(d,c,a,b);\n return atol(d);\n\n}\nvoid copy(char g[],char h[],int A,int B)\n{\n int i,j;\n for(i=A,j=0;i<=B;i++,j++)\n {\n g[j]=h[i];\n }\n\n\n}\nint main()\n{\n\tchar s[8]=\"\";\n\tint i,n,max=0,x=0,y=0,z=0,a=0,b=0;\nscanf(\"%s\",s);\n\tfor(i=0;s[i]!='\\0';i++);\n\t\tn=i;\n\t\tif(s[0]=='0')\n\t\tprintf(\"-1\");\n\t\telse{\n\t\tfor(i=0;ib)\n break;\n\n\t\t x=convert(0,i,s);\n\t\t y=convert(a,b,s);\n\t\t z=convert(b+1,n-1,s);\n\t\t if((x+y+z)>max)\n\t\t max=x+y+z;\n\n\n\n\t\t}\n\n\t\tfor(i=0;imax)\n\t\t max=x+y+z;\n\n\n\t\t}\n\n\t\tfor(i=0;imax)\n\t\t max=x+y+z;\n\n\n\t\t}\n\t\tprintf(\"%d\",max);}\n\n\n\n\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b186338acd2f3d999a070a17cc8735a", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nint convert(int a,int b,char c[])\n{\n\n char d[101]=\"\";\n copy(d,c,a,b);\n return atol(d);\n\n}\nvoid copy(char g[],char h[],int A,int B)\n{\n int i,j;\n for(i=A,j=0;i<=B;i++,j++)\n {\n g[j]=h[i];\n }\n\n\n}\nint main()\n{\n\tchar s[100]=\"\";\n\tint i,n,max=0,x=0,y=0,z=0,a=0,b=0;\nscanf(\"%s\",s);\n\tfor(i=0;s[i]!='\\0';i++);\n\t\tn=i;\n\t\tif(s[0]=='0')\n\t\tprintf(\"-1\");\n\t\telse{\n\t\tfor(i=0;ib)\n break;\n\n\t\t x=convert(0,i,s);\n\t\t y=convert(a,b,s);\n\t\t z=convert(b+1,n-1,s);\n\t\t if((x+y+z)>max)\n\t\t max=x+y+z;\n\n\n\n\t\t}\n\n\t\tfor(i=0;imax)\n\t\t max=x+y+z;\n\n\n\t\t}\n\n\t\tfor(i=0;imax)\n\t\t max=x+y+z;\n\n\n\t\t}\n\t\tprintf(\"%d\",max);}\n\n\n\n\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ca3b720002b3609246cb8c310b4d2454", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nchar s[99];\nint i,j,l,ans=-1,temp;\n\nint dv(p,q){\n if(11e6)return-1;\n ret+=z;\n s[p]=t;\n t=s[q];\n s[q]=0;\n z=atoi(s+p);\n if(z>1e6)return-1;\n ret+=z;\n s[q]=t;\n z=atoi(s+q);\n if(z>1e6)return-1;\n ret+=z;\n //if(ret>1000000)return 0;\n //printf(\"%d %d %d\\n\",p,q,ret);\n return ret;\n}\n\n\nmain(){\n scanf(\"%s\",s);\n l=strlen(s);\n if(l<3&&21\n#include\n#include\n#include\n#include\n#include\nchar arr[25000];\nint main(){\n\tint a,b,c,d,e;\n\tgets(arr);\n\tint i; int len=strlen(arr); int s,s1,s2; s=s1=s2=0; int max=-1;\n\tfor(i=0;i1000000){\n\t\t\t\ts=0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint t = a;\n\t\t\tif(arr[t] == '0' && a+1 !=b)\n\t\t\t\tcontinue;\n\t\n\t\t\twhile(t1000000){\n\t\t\t\ts=s1=0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(arr[b]=='0' && b!=len-1)\n\t\t\t\tcontinue;\n\t\t\tint t1=b;\n\t\t\twhile(t11000000){\n\t\t\t\ts=s1=s2=0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif((s+s1+s2)>max){\n\t\t\tmax=s+s1+s2;\n\t\t\t}\n\t\t\t}\n\t}}\n\tprintf(\"%d\",max);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "37f5c13d63217342588be7496ae5d4a7", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nchar s[99];\nint i,j,l,ans=-1,temp;\n\nint dv(p,q){\n if(11e6)return-1; ret+=z;\n t=s[q]; s[q]=0; z=atoi(s+p); s[q]=t;\n if(z>1e6)return-1;\n ret+=z; z=atoi(s+q);\n if(z>1e6)return-1;\n ret+=z;\n //if(ret>1000000)return 0;\n //printf(\"%d %d %d\\n\",p,q,ret);\n return ret;\n}\n\n\nmain(){\n scanf(\"%s\",s);\n l=strlen(s);\n if(l<3||217)continue;\n temp=dv(i,j);\n ans\n#include \n\nvoid mergeSort(int* a, int low, int mid, int high) {\n int p1=low, p2=mid+1, i=0, j;\n int temp[high-low+1];\n while(p1<=mid && p2<=high) {\n temp[i++] = ((a[p1] < a[p2])? a[p1++] : a[p2++]);\n }\n while(p1<=mid) {\n temp[i++] = a[p1++];\n }\n while(p2<=high) {\n temp[i++] = a[p2++];\n }\n for(j=low; j<=high; j++) {\n a[j] = temp[j - low];\n }\n}\n\nvoid merge(int* a, int low, int high) {\n if(low == high) return;\n int mid = (low+high)/2;\n merge(a, low, mid);\n merge(a, mi+1, high);\n mergeSort(a, low, mid, high);\n}\n\nvoid repeatedNumber(int* a, int* b, int m, int n) {\n int p1;\n int p2;\n for(p1=0, p2=0; p1 b[p2]) {\n p2++;\n }\n }\n }\n}\n\nint main()\n{\n int m,n;\n scanf(\"%d %d\", &n, &m);\n int a[n];\n for(int i=0; i\nusing namespace std;\n\nint main()\n{\n int n,m,cn=0,k, i;\n int code[20], check[20]={0};\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++) scanf(\"%d\",&code[i]);\n for(i=1;i<=m;i++) {\n scanf(\"%d\",&k);\n check[k]=1;\n }\n for(i=1;i<=n;i++){\n if(check[code[i]]) printf(\"%d \",code[i]);\n }\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3cc77db632c797bde1fed229236baf16", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int arr[10],arr1[10],i,j,n1,n2,arr2[],k=0;\n scanf(\"%d\",&n1);\n scanf(\"%d\",&n2);\n for(i=0;i\n\nint arith_test(int,int,int,int);\nint geo_test(int,int,int,int);\nint main(){\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(arith_test(a,b,c,d)) printf(\"%d\",2*d-c);\n else if(geo_test(a,b,c,d)) printf(\"%d\",d*d/c);\n else printf(\"42\");\n return 0;\n}\n\nint arith_test(int a,int b,int c,int d){\n if(2*b==a+c && 2*c=b+d) return 1;\n else return 0;\n}\n\nint geo_test(int a,int b,int c,int d){\n if(b*b=a*c && c*c=b*d) return 1;\n else return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1a346a0c3cc42d194538b9fd6be0478a", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n\tint a, b, c, d;\n\tint prirastaj, koeficijent;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\n\tprirastaj=b-a;\n\tkoeficijet=b/a;\n\n\tif(c==b+prirastaj && d==c+prirastaj)\n\t\tprintf(\"%d\", d+prirastaj);\n\telse if(c==koeficijent*b && d==koeficijent*c)\n\t\tprintf(\"%d\", koeficijent*d);\n\telse printf(\"42\");\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "491493caaf847aae8ffc14cddae51c57", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint arith_test(int,int,int,int);\nint geo_test(int,int,int,int);\nint main(){\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(arith_test(a,b,c,d)) printf(\"%d\",2*d-c);\n else if(geo_test(a,b,c,d)) printf(\"%d\",d*d/c);\n else printf(\"42\");\n return 0;\n}\n\nint arith_test(int a,int b,int c,int d){\n if(2*b==a+c && 2*c=b+d) return 1;\n else return 0;\n}\n\nint geo_test(int a,int b,int c,int d){\n if(b*b==a*c && c*c==b*d) return 1;\n else return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2cfe276f4e16084a2bdcedf3dfda2f5d", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tint a, b, c, d;\n\tint prirastaj;\n\tfloat koeficijent;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\n\tprirastaj=b-a;\n\tkoeficijent=(float)b/a;\n\n\tif(c==b+prirastaj && d==c+prirastaj)\n\t\tprintf(\"%d\", d+prirastaj);\n\telse if(c==koeficijent*b && d==koeficijent*c)\n\t{\n\t\tif(koeficijent*d==(int)(koeficijent*d))\n\t\t\tprintf(\"%d\", (int)(koeficijent*d));\n\t\telse printf(\"42\");\n\t}\n\telse printf(\"42\");\n\n\treturn 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "34d0e26d0c558233e9aebf6ce0b86f24", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n\tint a, b, c, d;\n\tint prirastaj, koeficijent;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\n\tprirastaj=b-a;\n\tkoeficijent=b/a;\n\n\tif(c==b+prirastaj && d==c+prirastaj)\n\t\tprintf(\"%d\", d+prirastaj);\n\telse if(c==koeficijent*b && d==koeficijent*c)\n\t\tprintf(\"%d\", koeficijent*d);\n\telse printf(\"42\");\n\n\treturn 1;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "247bddf6f3b09dd140a7620a564aa070", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint daynumber(A[10])\n{\n if(A[0]=='s' && A[1]=='u')\n return 0;\n else\n if(A[0]=='m')\n return 1;\n else\n if(A[0]=='t' && A[1]=='u')\n return 2;\n else\n if(A[0]=='w')\n return 3;\n else\n if(A[0]=='t' && A[1]=='h')\n return 4;\n else\n if(A[0]=='f')\n return 5;\n else\n if(A[0]=='s' && A[1]=='a')\n return 6; \n}\n\nint main()\n{\n char d1[10],d2[10];\n int numd1,numd2;\n printf(\"give 2 days\\n\");\n scanf(\"%s %s\",&d1,&d2);\n \n if (daynumber(d2)==(daynumber(d1)+28)%7||daynumber(d2)==(daynumber(d1)+30)%7||daynumber(d2)==(daynumber(d1)+31)%7)\n printf(\"yes\");\n else\n printf(\"no\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2ebcc93c6606b0b7d6af63a5669c317f", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nmain()\n{\n char a[20];\n char b[20];\n gets(a);\n gets(b);\n if(a[0]==m)\n {\n if((b[0]==m)||(b[0]==w)||((b[0]==t)&&(b[1]==h)))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if ((a[0]==t) && (a[1]==u))\n {\n if((b[0]==t)|| (b[0]==f))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if (a[0]==w)\n {\n if ((b[0]==w)||(b[0]==f)||((b[0]==s)&& (b[1]==a)))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if ((a[0]==t)&& (a[1]==h))\n {\n if (((b[0]==t)&& (b[1]==h))|| (b[0]==s))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if (a[0]==f)\n {\n if((b[0]==f)|| (b[0]==m)|| ((b[0]==s)&& (b[1]==u)))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if ((a[0]==s)&& (a[1]==a))\n {\n if(((b[0]==s) && (b[1]==a))|| (b[0]==m)|| ((b[0]==t) && (b[1]==u)))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n {\n if ((b[0]==w) || ((b[0]==s) && b[1]==u) || ((b[0]==t) && (b[1]==u)))\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e65cec9d8a810bff32e41c65457e0a49", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n char day1[10],day2[10];\n // printf(\"Give two days:\");\n scanf(\"%s %s\",day1,day2);\n if (strstr(day1,\"monday\")!=NULL)\n {\n char day3[]=\"thursday\";\n char day4[]=\"monday\";\n char day5[]=\"wednesday\";\n }\n else if (strstr(day1,\"tuesday\")!=NULL)\n {\n char day3[]=\"friday\";\n char day4[]=\"tuesday\";\n char day5[]=\"thursday\";\n }\n else if (strstr(day1,\"wednesday\")!=NULL)\n {\n char day3[]=\"saturday\";\n char day4[]=\"wednesday\";\n char day5[]=\"friday\";\n }\n else if (strstr(day1,\"thursday\")!=NULL)\n {\n char day3[]=\"sunday\";\n char day4[]=\"thursday\";\n char day5[]=\"saturday\";\n }\n else if (strstr(day1,\"friday\")!=NULL)\n {\n char day3[]=\"monday\";\n char day4[]=\"friday\";\n char day5[]=\"sunday\";\n }\n else if (strstr(day1,\"saturday\")!=NULL)\n {\n char day3[]=\"tuesday\";\n char day4[]=\"saturday\";\n char day5[]=\"monday\";\n }\n else\n {\n char day3[]=\"wednesday\";\n char day4[]=\"sunday\";\n char day5[]=\"tuesday\";\n }\n if (strstr(day2,day3)!=NULL || strstr(day2,day4)!=NULL || strstr(day2,day5)!=NULL)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ea5909faee2b732228f2508e2f35422f", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n/*\n * \n */\nint main() {\n \n int i, k=1, d1, d2, D[32];\n char D1[10], D2[10];\n \n //printf(\"Give two days of a week.\\n\");\n //scanf(\" %c\", D1);\n //scanf(\" %c\", D2);\n gets(D1);\n gets(D2);\n \n //printf(\"ascii %d\\n\", day1);\n \n if(strstr(D1,\"monday\")){\n //printf(\"day1=\\n\");\n d1=1;\n }else if(strstr(D1,\"tuesday\")){\n //printf(\"day1=2\\n\");\n d1=2;\n }else if(strstr(D1,\"wednesday\")){\n d1=3;\n }else if(strstr(D1,\"thursday\")){\n d1=4;\n }else if(strstr(D1,\"friday\")){\n d1=5;\n }else if(strstr(D1,\"saturday\")){\n d1=6;\n }else{\n d1=7;\n }\n \n if(strstr(D2,\"monday\")){\n d2=1;\n }else if(strstr(D2,\"tuesday\")){\n d2=2;\n }else if(strstr(D2,\"wednesday\")){\n d2=3;\n }else if(strstr(D2,\"thursday\")){\n d2=4;\n }else if(strstr(D2,\"friday\")){\n d2=5;\n }else if(strstr(D2,\"saturday\")){\n d2=6;\n }else{\n d2=7;\n }\n \n //printf(\"day1=%d\\n\",day1);\n //printf(\"day2=%d\\n\",day2);\n \n k=day1;\n for(i=1; i<=32; i++){\n D[i]=k;\n if(D[i]>7){\n k=1;\n D[i]=k;\n }\n k++;\n }\n /*\n for(i=1; i<=32; i++){\n printf(\"%d\\n\", D[i]);\n }\n */\n if(D[32]==d2){\n printf(\"YES\\n\");\n }else if(D[29]==d2){\n printf(\"YES\\n\");\n }else if(D[31]==d2){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n \n return;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d28f539fe0adbf5c4c9d4b5ba4826f5e", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n char day1[10],day2[10];\n // printf(\"Give two days:\");\n scanf(\"%s %s\",day1,day2);\n if (strstr(day1,\"monday\")!=NULL)\n {\n char day3[9]=\"thursday\";\n char day4[7]=\"monday\";\n char day5[10]=\"wednesday\";\n }\n else if (strstr(day1,\"tuesday\")!=NULL)\n {\n char day3[7]=\"friday\";\n char day4[8]=\"tuesday\";\n char day5[9]=\"thursday\";\n }\n else if (strstr(day1,\"wednesday\")!=NULL)\n {\n char day3[9]=\"saturday\";\n char day4[10]=\"wednesday\";\n char day5[7]=\"friday\";\n }\n else if (strstr(day1,\"thursday\")!=NULL)\n {\n char day3[7]=\"sunday\";\n char day4[9]=\"thursday\";\n char day5[9]=\"saturday\";\n }\n else if (strstr(day1,\"friday\")!=NULL)\n {\n char day3[7]=\"monday\";\n char day4[7]=\"friday\";\n char day5[7]=\"sunday\";\n }\n else if (strstr(day1,\"saturday\")!=NULL)\n {\n char day3[8]=\"tuesday\";\n char day4[9]=\"saturday\";\n char day5[7]=\"monday\";\n }\n else\n {\n char day3[10]=\"wednesday\";\n char day4[7]=\"sunday\";\n char day5[8]=\"tuesday\";\n }\n if (strstr(day2,day3)!=NULL || strstr(day2,day4)!=NULL || strstr(day2,day5)!=NULL)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c7e315db24f7badc58914a656b4a7ff5", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a,b,c,k=0,k1,x;\n scanf(\"%d %d %d\",&a,&b,&c);\n k1=a;\n if(a<1||a>100||b<-1000000||b>1000000||c<0||c>1000000)\n printf(\"-1\");\n else\n {\n a=a/2;\n if(b>=-k1&&b<=k1&&k1!=b&&k1!=-b)\n {\n if(c==0||c%k1==0||(k1%2==0&&b==k1/2&&k1!=2)||(k1%2==0&&b==-k1/2&&k1!=2))\n printf(\"-1\");\n else\n {\n while(kk1/2||b<-k1/2||2==k2)\n printf(\"-1\");\n else\n printf(\"1\");\n }\n else\n printf(\"%d\",x+(x/2-1));\n }\n else\n {\n if((x==1&&b>k1/2)||(x==1&&b<-k1/2)||(x==1&&b==k1/2&&k1==2))\n printf(\"-1\");\n else\n printf(\"%d\",x+(x/2-1)+1);\n }\n }\n else\n {\n if(b>-k1/2&&b\n#include\nint main()\n{\n\tfloat a,x,y;\n\tscanf(\"%f%f%f\",&a,&x,&y);\n\tif(y <= 0 )\n\t{\n\t\tprintf(\"-1\\n\");\n\t\texit(1);\n\t}\n\tif((int)y %(int)a == 0 )\n\t{\n\t\tprintf(\"-1\\n\");\n\t\texit(1);\n\t}\n\tif(y < a)\n\t{\n\t\tprintf(\"1\\n\");\n\t\texit(1);\n\n\t}\n//\tprintf(\"etfsgtsr\\n\");\n\n\tint num,one;\n\n\tnum = y /a;\n\tif (num % 2 != 0)\n\t\tone = 1 ;\n\telse\n\t\tone = 0;\n\n//\tprintf(\"num = %d\\n\",num);\n//\tprintf(\"one = %d\\n\",one);\n\tif(one == 1)\n\t{\n\t\tif(x <= -a/2 || x >= a/2 )\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t\texit(1);\n\t\t}\n\t}\n\tif(one == 0)\n\t{\n\t\tif(x <= -a || x >= a || x == 0 )\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t\texit(1);\n\t\t}\n\t}\n\n\n\tint count = 1;\n\n\tcount = count + ((2 * (num/2)) + num - num/2);\n\tif(one == 1)\n\t\tprintf(\"%d\\n\",count);\n\telse\n\t{\n\t\tif(x < 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",count-1);\n\t\t}\n\t\telse if(x > 0)\n\t\t\tprintf(\"%d\\n\",count);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t}\n\n\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "00a318914e229b6534dacbc96f673bf1", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\nint a,x,y,t;\nscanf(\"%d%d%d\",&a,&x,&y);\nif(y%a==0)\nprintf(\"%d\",-1);\nelse if(y<(2*a))\n{\nif(x<(fabs)((double)a/2))\nprintf(\"%d\",y/a+1);\nelse\nprintf(\"%d\",-1);\n}\nelse if(y>(2*a))\n{\n t=y/a+1;\n if(t%2==0)\n {\n if(x<(fabs)((double)a/2))\n {\n int g=((t-1)/2)*3+2;\n printf(\"%d\",g);\n\n }\n else\n printf(\"%d\",-1);\n }\n else\n {\n if(x>0 && x-a)\n printf(\"%d\",(t/2)*3+1);\n else\n printf(\"%d\",-1);\n }\n return(0);\n}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "04449fcb85cc0c5ebdd4077d9c532616", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint a,x;\n\tint y;\n\tscanf(\"%d%d%d\",&a,&x,&y);\n\tif(y <= 0 )\n\t{\n\t\tprintf(\"-1\\n\");\n\t\texit(1);\n\t}\n\tif(y %a == 0 )\n\t{\n\t\tprintf(\"-1\\n\");\n\t\texit(1);\n\t}\n\tif(y < a)\n\t{\n\t\tprintf(\"1\\n\");\n\t\texit(1);\n\n\t}\n//\tprintf(\"etfsgtsr\\n\");\n\n\tint num,one;\n\n\tnum = y /a;\n\tif (num % 2 != 0)\n\t\tone = 1 ;\n\telse\n\t\tone = 0;\n\n//\tprintf(\"num = %d\\n\",num);\n//\tprintf(\"one = %d\\n\",one);\n\tif(one == 1)\n\t{\n\t\tif(x <= -a/2 || x >= a/2 )\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t\texit(1);\n\t\t}\n\t}\n\tif(one == 0)\n\t{\n\t\tif(x <= -a || x >= a || x == 0 )\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t\texit(1);\n\t\t}\n\t}\n\n\n\tint count = 1;\n\n\tcount = count + ((2 * (num/2)) + num - num/2);\n\tif(one == 1)\n\t\tprintf(\"%d\\n\",count);\n\telse\n\t{\n\t\tif(x < 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",count-1);\n\t\t}\n\t\telse if(x > 0)\n\t\t\tprintf(\"%d\\n\",count);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5b9e4e8a3dcb642f3bc2821e71f9ae7f", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int x,y,a; \n scanf(\"%d %d %d\",&x,&y,&a);\n float a2=(float)a/2; \n if(y%a==0)\n {\n printf(\"-1\");\n return 0;\n }\n int ya=y/a+1;\n float xa=x/a2;\n int num=ya+(ya-1)/2;\n if(ya==1||ya%2==0)\n { \n if(xa!=0)\n printf(\"-1\");\n else\n printf(\"%d\",num);\n return 0;\n }\n else\n {\n if(xa>=2||xa<=-2||xa==0)\n {\n printf(\"-1\");\n return 0;\n }\n else \n { \n if(xa>0)\n num++;\n printf(\"%d\",num);\n }\n return 0;\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "88d60f78caf4f4b14c56adf687cef7e6", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0} {"lang": "GNU C", "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 elseprintf(\"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", "lang_cluster": "C", "compilation_error": true, "code_uid": "03324536ae0e7a151827a1860ec362d7", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nint main(int argc, char const *argv[]) {\n scanf(\"%d %d %d\\n\",&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", "lang_cluster": "C", "compilation_error": true, "code_uid": "88934d4bce1b9200f3cad3ee2738a2be", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0} {"lang": "GNU C", "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\n#include \nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d \"&a,&b,&c);\n int k;\n if(a\n\nint main()\n{\n int i, i1, i2, i3, n, x1, x2, x3, k1, k2, k3, flag;\n\n scanf(\"%d %d %d\", &k1, &k2, &k3);\n n = k1 + k2 + k3;\n\n for (i1 = 1; i1 < n; i1++){\n for (i2 = 1; i2 < n; i2++){\n for (i3 = 1; i3 < n; i3++){\n x1 = i1;\n x2 = i2;\n x3 = i3;\n i = 1;\n flag = 1;\n while ((i < n) && (flag == 1)){\n if ((i != x1) && (i != x2) && (i != x3))\n {\n flag = 0;\n }\n else {\n if (i == x1) x1 = x1 + k1;\n if (i == x2) x2 = x2 + k2;\n if (i == x3) x3 = x3 + k3;\n }\n i++;\n }\n if (flag == 1){\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n\n printf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5a0bd3d7330279f783ca593251bb6291", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \nlong long min(long long x , long long y)\n{ if(x>=y)\n return y;\n else\n return x ;\n}\nint main()\n{\n long long int d , k , a, b, t ;\n scanf(\"%lld %lld %lld %lld %lld\",&d, &k ,&a , &b, &t);\n long long int distance_covered;\n long long int walk ;\n long long int car_reach ;\n if(k>=d)\n {printf(\"%lld\\n\",d*a );}\n else if( k*a + t < k*b) \n {printf(\"%lld\\n\",(d/k)*a*k + (d/k-1)*t + min(d%k*a + t, d%k*b));}\n else \n {printf(\"%lld\\n\",a*k+(d-k)*b );}\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "be380c00f3ad58d6f2f5686e5a8ea84e", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \"stdbool.h\"\n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"ctype.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#define PI 3.14159265358979323846264338327950288\n#define ll long long\n#define MOD 1000000007\n#define N 300001\n#define MAX1 101\n\nint max(int a,int b) {return a>b?a:b;}\nint min(int a,int b) {return ab?a:b;}\n\n\nll d,k,a,b,t,ans;\n\nint main() {\n scanf(\"%lld %lld %lld %lld %lld\", &d, &k, &a, &b, &t);\n ll firstStep = minl(d,k);\n d -= firstStep;\n ans = a * firstStep;\n if (d >= k) {\n ll z = minl(t + a*k, b*k);\n ans += (d/k) * z;\n d %= k;\n }\n printf(\"%lld\\n\", ans + minl(t + a*d, b*d));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3a88ea2dcde82d674783582e5251ad08", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{ unsigned long long int d,dleft,time=0,a,b,k,t;\n scanf(\"%I64u%I64u%I64u%I64u%I64u\",&d,&k,&a,&b,&t);dleft=d;\n if(d<=k)\n time=d*a;\n\tif(d>k){\n\t\t\ttime=a*k;dleft=d-k;\n\t\t if(t+a*k\nint main()\n{\n\n unsigned long long int a,b,c,d,e,f,i,j,n,tc,th,tb,s;\n scanf(\"%llu%llu%llu%llu%llu\",&a,&b,&c,&d,&e);\n if(b>a)\n {tc=a*c;\n a=0;}\n else if(a>=b)\n {a=a-b;\n tc=b*c;}\n if(a!=0)\n {\n th=a%b;\n tb=a-th;\n s=a/b;\n\n\n if(e+b*c>=b*d)\n {\n tc=tc+a*d;\n \n }\n else\n {\n i=tc+s*e+tb*c+e+(a-tb)*c;\n tc=tc+s*e+tb*c+(a-tb)*d;\n if(i\n#include \n\nint main()\n{\n long long d,k,a,b,t,m1,result;\n scanf(\"%lli%lli%lli%lli%lli\",&d,&k,&a,&b,&t);\nif( d <=k){\n result = d*a;}\n else{\n if(k*a+t < b*k){\n m1=d/k;\n if ( (d - m1*k)*a+t< (d-m1*k)*b ) {\n result = d*a+m1*t;}\n else\n result = m1*a*k + (m1-1)*t + (d-m1*k)*b;\n }\n else result = a*k+(d-k)*b;}\n\n printf(\"%lli\", result);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "14406961408f8d6e7a15cbda8db32d39", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include\nint main() {\n int n, p[1007], sum[2] = {0}, cur[2] = {1, 2};\n scanf(\"%d\",&n);\n for (int i = 1; i <= n / 2; i++) scanf(\"%d\",&p[i]);\n qsort(p + 1, p + 1 + n / 2);\n for (int i = 1; i <= n / 2; i++, cur[0] += 2, cur[1] += 2) {\n sum[0] += abs(cur[0] - p[i]);\n sum[1] += abs(cur[1] - p[i]);\n }\n printf(\"%d\\n\",min(sum[0], sum[1]));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1e896ee95e7167ab87587518b4dcb8fe", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include\nint main() {\n int n, p[1007], sum[2] = {0}, cur[2] = {1, 2};\n scanf(\"%d\",&n);\n for (int i = 1; i <= n / 2; i++) scanf(\"%d\",&p[i])\n qsort(p + 1, p + 1 + n / 2);\n for (int i = 1; i <= n / 2; i++, cur[0] += 2, cur[1] += 2) {\n sum[0] += abs(cur[0] - p[i]);\n sum[1] += abs(cur[1] - p[i]);\n }\n printf(\"%d\\n\",min(sum[0], sum[1]));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d75a48bd862150f1495b11e8d980883", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint black(int *,int);\nint white(int *,int);\nint main()\n{\n int n,arr[100],i;\n scanf(\"%d\",&n);\n \n int pos;\n for(i=0;iwhite)?printf(\"%d\",black):printf(\"%d\",white);\n \n return 0;\n}\nint black(int *arr,int n)\n{\n int i=n-1,j=n-2,steps=0;\n while(i>=0 &&j>=0)\n {\n if(arr[i]==1 && i/%2==1)\n {\n if(arr[j]==0)\n {\n arr[j]=1;\n arr[i]=0;\n \n steps+=abs(j-i);\n i--;\n j-=2;\n }\n else\n {\n while(arr[j]!=0)\n j-=2;\n \n arr[j]=1;\n arr[i]=0;\n \n steps+=abs(j-i);\n i--;\n j-=2;\n \n }\n }\n else if(arr[i]==1 && i%2==0)\n i--; \n }\n}\nint white(int *arr,int n)\n{\n int i=n-1,j=n-1,steps=0;\n while(i>=0 && j>=1)\n {\n if(arr[i]==1 && i/%2==1)\n {\n if(arr[j]==0)\n {\n arr[j]=1;\n arr[i]=0;\n \n steps+=abs(j-i);\n i--;\n j-=2;\n }\n else\n {\n while(arr[j]!=0)\n j-=2;\n \n arr[j]=1;\n arr[i]=0;\n \n steps+=abs(j-i);\n i--;\n j-=2;\n \n }\n }\n else if(arr[i]==1 && i%2==0)\n i--; \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "80cbe9488e313175cc0c07194802987f", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,arr[100],i;\n scanf(\"%d\",&n);\n \n int pos;\n for(i=0;iwhite)?printf(\"%d\",black):printf(\"%d\",white);\n \n return 0;\n}\nint black(int *arr,int n)\n{\n int i=n-1,j=n-2,steps=0;\n while(i>=0)\n {\n if(arr[i]==1 && i/%2==1)\n {\n if(arr[j]==0)\n {\n arr[j]=1;\n arr[i]=0;\n \n steps+=abs(j-i);\n i--;\n j-=2;\n }\n else\n {\n while(arr[j]!=0)\n j-=2;\n \n arr[j]=1;\n arr[i]=0;\n \n steps+=abs(j-i);\n i--;\n j-=2;\n \n }\n }\n else if(arr[i]==1 && i%2==0)\n i--; \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "238ec069cf3fd30a9e1c104b842c5b30", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include\n#include\nusing namespace std;\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar a[109];\n\tfor(int i=1;i<=n/2;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tsort(a+1,a+1+n/2);\n\tint sum1=0,sum2=0;\n\tfor(int i=1;i<=n/2;i++){\n\t\tsum1+=abs(a[i]-(i*2-1));\n\t\tsum2+=abs(a[i]-(i*2));\n\t}\n\tprintf(\"%d\",sum1\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 k1 ,k2 ,N1 , N2 ;\n\tif (N1>N2)\n\t{printf (\"le joeur 1 gagne \");\n\t } \n\t else { printf (\"le joeur 2 gagne \")\n\t }\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2af1df838f44663f37b11c87bc1678b3", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int i,j,k,l;\n scanf(\"%d %d %d %d\", &i,&j,&k,&l);\n if(i<=j){\n \tprintf(\"second\");\n\t\n\t } else{\n else\n\t printf(\"first\");\n\n \n\t\n \t\n \t\n \t\n \t\n \t\n }\n \n \n return 0;\n \n \n \n \n \n \n \n \n \n \n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d310d4b6f301f78d1f72e3f3b0238292", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "GNU C11", "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\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "f7453062b8628b33a7d30646886c5abb", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a2f6fae94993e763181467755e546299", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int b1,b2,m1,m2;\n for(int i=0; i<5; i++)\n {\n cin>>b1>>b2>>m1>>m2;\n if(m1<=b1&&m2<=b2)\n {\n if(m1==m2&&b2>b1)cout<<\"second\";\n else if(m1==m2&&b1>b2)cout<<\"first\";\n else if(m1==m2&&b1==b2)continue;\n else if(m1>m2&&b1>=b2)cout<<\"first\";\n else if(m1>m2&&b2-m2>=b1-m1)cout<<\"second\";\n else if(m2>m1&&b2>=b1)cout<<\"second\";\n else if(m2>m1&&b1-m1>=b2-m2)cout<<\"first\";\n else continue;\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d8457eec9f0f382f83ada8a7aa85a0b2", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define LL long long\n#define me(x) memset(x,0,sizeof(x))\nlong n,m,k;\nLL max(LL x,LL y)\n{\n\treturn x>y?x:y;\n}\nlong d[100005],tot=0;\nint main()\n{\n\tlong i,t;\n\tLL ans=0;\n\tscanf(\"%ld %ld %ld\",&n,&m,&k);\n\tk+=2;\n\tif (k>m+n){printf(\"-1\"); return 0;}\n\tt=(long)sqrt(m+0.1);\n\tfor (i=1;i<=t;i++) {d[++tot]=i; d[++tot]=m/i;}\n\tt=(long)sqrt(n+0.1);\n\tfor (i=1;i<=t;i++) {d[++tot]=k-i; d[++tot]=k-n/i;}\n\tfor (i=1;i<=tot;i++) if (d[i]>0&&d[i]\n#include \nint main()\n{\n\tint x,n,m,k=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&k);\n\tif(k>n+m-2)\n\t{\n\t\tprintf(\"-1\\n\");\n\t return 0;\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\",n*m/(k+1));\n\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "39dfec8120911d60a40141618d6b37af", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nlong long int n,m,k,i,j,k,t;\nlong long int ans(long long int a,long long int b)\n{\n long long int x = n*m;\n long long int y = (a+1)*(b+1);\n return x/y;\n}\nint main()\n{\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n if(n>m)\n {\n t=n;\n n=m;\n m=t;\n }\n else\n {\n\n }\n if(k>n+m-2)\n printf(\"-1\\n\");\n else if(k=n && k\nint main()\n{\n long int n,m,k,temp;\n scanf(\"%ld\",&n);\n scanf(\"%ld\",&m);\n scanf(\"%ld\",&k);\n\n if(mm+n-2)\n printf(\"-1\");\n else if(k<=m+n-2)\n {\n if(k=m)\n printf(\"%ld\",n/(k-m+2));\n }\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5e8aa7364fe0cc7bdc0d82cf2ee047d0", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \"stdio.h\"\nint main()\n{\n\t_int64 s,x,n,m,k,c;\n\tscanf (\"%I64d %I64d %I64d\",&n,&m,&c);k=c+1;//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0475 \u04bb\ufffd\u01f5\ufffd\ufffd\u2f38\ufffd\ufffd\ufffd\ufffd\u04aa\u05e2\ufffd\ufffd \u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd K=c+1 \ufffd\ufffd\ufffd\ufffd\ufffd\u0737\ufffd\ufffd\ufffd\ufffd\u04e6\ufffd\ufffd\ufffd\u01ff\ufffdk%m\ufffd\u01f7\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\tx=m*n;// \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0475\ufffd\u01fe\ufffd\ufffd\ufffd\u0133\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03aa\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \u04b2\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\u022b\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03aa\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\tif (c>n+m-2)\n\t\tprintf (\"-1\");\n\telse if (m%k==0||n%k==0)\n\t\tprintf (\"%I64d\",s=x/k);\n\telse if (cn/k*m?m/k*n:n/k*m));\n\telse if (k>m&&k>n)\n\t\tprintf (\"%I64d\",s=(m/(k+1-n)>n/(k+1-m)?m/(k+1-n):n/(k+1-m)));\n\telse if (km/k*n?m/(k+1-n):m/k*n));\n\telse\n\t\tprintf (\"%I64d\",s=(n/(k+1-m)>n/k*m?n/(k+1-m):n/k*m));\n\tprintf (\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d204a7fac7b041103ba4ec1baf633b7", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a[10000],n,i,x,b[10000],p=0,q=0;\n scanf(\"%d\",&n);\n for(i=0;ib[i+1])\n b[i+1]=b[i];\n \n }\n\n printf(\"%d\\n\",b[i+1);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5ff304f574c169218868e2c90c4051f4", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\n for(int i=0;imax)\n {\n max=arr[i];\n }\n }\n for(int i=0;imax1)\n{\n max1=h[i];\n}\n}\n\nprintf(\"%d\",max1);\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e953031199901db8f2985376f4e1e009", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint m (int a,int b){\n\tif (a>b)\n\t return a;\n\telse\n\t return b;\n}\n\t\nint main (){\n\tint i,n,max,min,m,maxi=0,mini=0,a[101];\n\t\n\tscanf (\"%d\",&n);\n\tscanf (\"%d\",&max);\n\ta [0]=min=max;\n\tfor (i=1;i max){\n max=a[i];\n\t\t maxi=i;\n\t\t}\n\t else if (a [i]\n#include \nint main(){\n int n;\n scanf(\"%d\", &n);\n int a[n],i;\n for(i=0;i\nvoid main()\n{\n\tint n, i, vmin, vmax,min,max, a[101];\n\tscanf_s(\"%d\", &n);\n\tmin = n + 1; max = -1;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf_s(\"%d\", &a[i]);\n\t\tif (a[i] > max)\n\t\t{\n\t\t\tmax = a[i];\n\t\t\tvmax = i;\n\t\t}\n\t\tif (a[i] < min)\n\t\t{\n\t\t\tmin = a[i];\n\t\t\tvmin = i;\n\t\t}\n\t}\n\tif (vmin < n - vmin) vmin = n - vmin;\n\tif (vmax < n - vmax) vmax = n - vmax;\n\tif (vmin > vmax)printf(\"%d\", vmin-1);\n\telse printf(\"%d\", vmax-1);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d0e434dd53b965b1660a5f02f5e6933", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint x = 0, a = 0, ans = 0;\n\t\tchar b = 'E', t = 'E';\n\t\tx = in.nextInt();\n\t\tif (x % 4 == 1) {\n\t\t\tSystem.out.println(\"0 A\");\n\t\t} else {\n\t\t\tfor (a = 0; a <= 2; a++) {\n\t\t\t\tif ((x + a) % 4 == 1) {\n\t\t\t\t\tt = 'A';\n\t\t\t\t} else if ((x + a) % 4 == 3) {\n\t\t\t\t\tt = 'B';\n\t\t\t\t} else if ((x + a) % 3 == 2) {\n\t\t\t\t\tt = 'C';\n\t\t\t\t} else if ((x + a) % 4 == 0) {\n\t\t\t\t\tt = 'D';\n\t\t\t\t}\n\t\t\t\tif (t - b < 0) {\n\t\t\t\t\tb = t;\n\t\t\t\t\tans = a;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans + \" \" + b);\n\t\t}\n\t\tin.close();\n\t}\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "23c52d53f51d6d588735f0b4708bcf89", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n \n int main()\n \n { \n int x;\n printf(\"enter the current HP\\n\");\n scanf(\"%d\",&x);\n \n if (x%4==1)\n flag=1;\n \n else if(x%4==3)\n flag=2;\n \n else if(x%4==2)\n flag=3;\n \n else\n flag=4;\n \n if (flag==1)\n {\n printf(\"0 A\");\n }\n \n else if (flag==2)\n {\n printf(\"2 A\"); \n }\n \n \n else if (flag==3)\n {\n printf(\"1 B\");\n }\n \n \n else if (flag==4)\n {\n printf(\"1 A\");\n }\n return 0;\n \n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e92c3ef613d1e41d390415cbe9f03aa", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nvoid main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a%4==1)\n {\n printf(\"%d %c\",0,'A');\n }\n else if(a%4==3)\n {\n for(i=0;i<=2;i++)\n {\n if((a+i)%4==1)\n printf(\"%d %c\",i,'A');\n }\n }\n else if(a%4==2)\n {\n for(i=0;i<2;i++)\n {\n if((a+i)%4==1)\n printf(\"%d %c\",i,'A');\n else if((a+i)%4==3)\n printf(\"%d %c\",i,'B');\n }\n }\n else if(a%4==0)\n {\n for(i=0;i<2;i++)\n {\n if((a+i)%4==1)\n printf(\"%d %c\",i,'A');\n else if((a+i)%4==3)\n printf(\"%d %c\",i,'B');\n else if((a+i)%4==2)\n printf(\"%d %c\",i,'C');\n } \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1e1cbb9e35ceb9a124e454d09f63a086", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n;\n scanf(\"%d\", &n);\n char cat[0];\n int en;\n if(n%4==1){\n en = 0;\n }\n else if(n%4==3){\n en = 0;\n }\n else if(n%4==2){\n en = 1;\n }\n else if(n%4==0){\n en = 1;\n }\n n = n+ en;\n if(n%4==1){\n cat[0]='A';\n }\n else if(n%4==3){\n cat[0] = 'B';\n }\n else if(n%4==2){\n cat[0] = 'C';\n }\n else if(n%4==0){\n cat[0] = 'D';\n }\n printf(\"%d %c\", en, cat[0]);\n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "292c14f3ca1f960bd853539064a515b0", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nmain()\n{\n int n,b,c;\n scanf(\"%d\",&n);\n b=n%4;8\n if(b==1)\n {\n printf(\"0 A\");\n }\n else\n {\n if(b==2)\n {\n printf(\"1 B\");\n }\n else\n if(b==3)\n {\n printf(\"2 A\");\n }\n else\n printf(\"2 B\");\n }\n\n\n\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ed2906a31b827d7ec0e5e9148a17bf7f", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n\tint n,k,path;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n==1){\n\t print(0);\n\t}\n\telse{\n\tif((n-k)<=(k-1)){\n\t\tpath=(n-k)+(n-1);\n\t}\n\telse{\n\t\tpath=(n-1)+(k-1);\n\t}\n\tint total=2*path+n+2;\n\tif(k!=1 && k!=n){\n\t\ttotal -= 1;\n\t}\n\tprintf(\"%d\",total);\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b7552487b8bd0b3b9181602d85ab5523", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n,k,total,median;\n\tscanf(\"%d %d\",&n,&k);\n\ttotal = (n - 1) * 2 + 3;\n\t(n % 2 == 0) ? median = n / 2 : median = n/2+1;\n\tif(k == 1 || k == n)\n\t{\n\t\tprintf(\"%d\\n\",total + n - 1);\t\n\t} \n\telse{\n\t\tif(n % 2 == 0)\n\t\t{\n\t\t\tif(k == median || k == median + 1)\n\t\t\t{\n\t\t\t\tk = (median - 1) * 2 + n/2;\n\t\t\t\tprintf(\"%d\\n\",total+ k);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint temp = median + (median+1);\n\t\t\t\tif(k < median)\n\t\t\t\t{\n\t\t\t\t\ttotal += (k-1) * 2 + (n - k);\n\t\t\t\t\tprintf(\"%d\\n\",total);\n\t\t\t\t}\n\t\t\t\telse if(k > median)\n\t\t\t\t{\n\t\t\t\t\tk = temp % k;\n\t\t\t\t\ttotal += (k-1) * 2 + (n - k);\n\t\t\t\t\tprintf(\"%d\\n\",total);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(n % 2 != 0)\n\t\t{\n\t\t\tif(k == median)\n\t\t\t{\n\t\t\t\tk = n-1;\n\t\t\t\tprintf(\"%d\\n\",total + k + n/2);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(k < median)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\",total + (k-1) * 2 + (n - k));\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tk = k % (median * 2);\n\t\t\t\t\tprintf(\"%d\\n\",total + (k-1) * 2 + (n-k));\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6062e5722464060ebf6e4312be6cb77d", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\nint n,pos,ans;\n\nscanf(\"%d\",&n);\n\nscanf(\"%d\",&pos);\n\nif(pos>n/2)\nans=n+n+1+2*(n-k)+(k-1);\n\nelse\nans=n+n+1+2*(k-1)+(n-k);\n\nprintf(\"%d\",ans);\nreturn 0;\n}\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "26a4377e8d0a01205af2e2a418b3c5f1", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n if(k==1)\n printf(\"%d\\n\",3*(n-k+1));\n else if(k==2&&n==2)\n else if(k==2&&n==3)\n printf(\"%d\",4*(n-k)+6);\n printf(\"%d\",6);\n else if(k>n/2)\n printf(\"%d\",4*(n-k)+5);\n else\n {\n printf(\"%d\",3*n+k-1);\n \n }\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9f90dfc77d4445fc1e40c38696aca1ce", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n if(k==1)\n printf(\"%d\\n\",3*(n-k+1));\n else if(k==2)\n printf(\"%d\",3*(n-k+1)+4);\n else if(k>n/2)\n printf(\"%d\",4*n-k;\n else\n {\n printf(\"%d\",3*n+k-1);\n \n }\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e2a3752969e47635798ea9a7462cd75e", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nint r,x,rev,i;\nlong long int j=1;\nscanf(\"%d\",&x);\nr=(x/1000)%10;\nrev=(x/10000)*10000+((x%1000)/100)*1000+(x%10)*100+((x%100)/10)*10+r;\nfor(i=1;i<=5;i++)\nj=(j*rev)%100000;\nprintf(\"%5lld\",j);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8f2188f188a61d0f705a3421491d4fd5", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nchar a[6];\nscanf(\"%s\",a);\nb0=(a[0]-48)*10000;\nb1=(a[2]-48)*1000;\nb2=(a[4]-48)*100;\nb3=(a[3]-48)*10;\nb4=(a[1]-48);\nc=b0+b1+b2+b3+b4;\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "388ccd5c76dc24c5e76847d8df152982", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main ()\n{\n char s[6];\n scanf(\"%s\",s);\n long long int s=1;\n long long int i;\n long long int n=((s[0]-48)*10000)+((s[2]-48)*1000)+((s[4]-48)*100)+((s[3]-48)*10)+(s[1]-48);\n for(i=0;i<5;i++)\n {\n s=s*n;\n s=s%100000;\n \n }\nprintf(\"%05lld\",ans);\nreturn 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5b1c6970db7ce378e1f3c49f4a31cc5c", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main ()\n{\n char s[6];\n scanf(\"%s\",s);\n long long int s=1;\n long long int i;\n long long int n=((s[0]-48)*10000)+((s[2]-48)*1000)+((s[4]-48)*100)+((s[3]-48)*10)+(s[1]-48);\n for(i=0;i<5;i++)\n {\n s=s*n;\n s=s%100000;\n \n }\nprintf(\"%05lld\",s);\nreturn 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "918a01565f7ef271547f350b9aeee14b", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main ()\n{\n char s[6];\n scanf(\"%s\",s);\n long long int s=1;\n long long int i;\n long long int n=((s[0]-48)*10000)+((s[2]-48)*1000)+((s[4]-48)*100)+((s[3]-48)*10)+(s[1]-48);\n for(i=0;i<5;i++)\n {\n s=s*n;\n s=s%100000;\n \n }\nprintf(\"%lld\",ans);\nreturn 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "50ce6cb1056cb9785a73e1db7d2df097", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\n int main() {\n char num[100];\n long long int limit, p = 0, q = 1, ans;\n int i, len, j, r;\n scanf(\"%s\", num);\n scanf(\"%lld\", &limit);\n len = strlen(num);\n for(i = len-1 ; i >= 0; i--, q *= 10) {\n if(num[i] == '9') \n continue;\n p = q*(num[i] - 47);\n if(p > limit)\n break;\n limit -= p; \n j = i;\n num[i] = '9';\n while(j-- >= 0) {\n if(num[j] != '0') {\n num[j]--; \n break;\n } \n num[j] = '9';\n \n } \n }\n sscanf(num, \"%lld\", &ans);\n printf(\"%lld\\n\", ans);\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "50d985732ec7d932dcdb87c801bab728", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int val(char t[25]);\n char ans[25],t1[25],t2[25]={'0'};\n long long a,b,ta;\n int i,j,k,lt,now,str;\n now=0;\n scanf(\"%I64d %I64d\",&a,&b);\n b=a-b; lt=0; ta=a;\n while (ta!=0)\n {\n t1[lt++]=ta % 10;\n ta=ta /10;\n }\n t1[lt+1]='\\0';\n while (1)\n {\n strcpy(t2,t1);\n for (i=0;i<=now;i++)\n t2[i]='9';\n while (val(t2)>=a)\n if (t2[now+1]>'0') t2[now+1]--;\n else break;\n if ((val(t2)b)) strcpy(ans,t2);\n else break;\n now++;\n }\n if (now==0) printf(\"%I64d\",a);\n else printf(\"%I64d\",val(ans));\n}\nlong long val(char t[25])\n{\n int i,lt,tt,ans;\n tt=1;\n ans=0;\n for (i=0;i<=strlen(t);i++)\n {\n ans=ans+(t[i]-'0')*tt;\n tt=tt*10;\n }\n return ans;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7dec60af9924f6de2ed8563aed976e60", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n long long p, d, i, m = 0;\n scanf(\"%I64d%I64d\", &p, &d);\n if (p < 10)printf(\"%I64d\\n\", p);\n else {\n for (i = 10 ; i <= p ; i *= 10){\n if (p % i + 1 <= d)\n m = p % i + 1;\n else break;\n }\n printf(\"%I64d\\n\", p - m);\n }\n scanf(\" \");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1c8f3096118f397aa7bd990824cf2baf", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\nint num_digits(long long x);\n\nint main(void)\n{\n long long p, d;\n scanf(\"%I64d %I64d\", &p, &d);\n\n int s = 1, q = 0;\n long long p2 = p;\n\n while (d > 0)\n {\n q = ((p2 % 10) + 1) * s;\n s *= 10;\n \n if (num_digits(q) == num_digits(p) || d < q || q >= p)\n break;\n \n if (q != s)\n {\n p = p-q;\n d = d-q;\n }\n p2 = p/s;\n }\n\n printf(\"%I64d\\n\", p);\n return 0;\n}\n\nint num_digits(long long x)\n{\n if (x % 10 == x)\n return 1;\n return 1 + num_digits(x / 10);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9b6fb3cc0e452571613235105fd62d56", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n //char ans[25],t1[25],t2[25]={'0'};\n long long val(char t[25]);\n long long a,b,ta,t1,ans;\n long long bit[18],nine[18];\n int i,j,k,lt,now,str;\n now=0;\n scanf(\"%I64d %I64d\",&a,&b);\n b=a-b; lt=0;\n bit[0]=1; nine[0]=9;\n for (i=1;i<=17;i++)\n {bit[i]=bit[i-1]*10; nine[i]=nine[i-1]*10+9;}\n while (1)\n {\n t1=a;\n t1=t1-(t1 % bit[now+1])+nine[now];\n while (t1>=a)\n t1=t1-bit[now+1];\n if ((t1b)) ans=t1;\n else break;\n now++;\n }\n if (now==0) printf(\"%I64d\",a);\n else printf(\"%I64d\",ans);\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "61318614d88b5b74fa65bd92e46528d4", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define maxN 1000001\n\nbool isP[maxN];\nint ps[maxN];\n\nbool isPrime( int n ) {\n\tint i;\n\n\tfor( i = 2; (long long) i * i <= n; i++ )\n\t\tif( n % i == 0 ) return false;\n\t\n\treturn true;\n}\n\nint main( void ) {\n\tint i, j, c;\n\n\tisP[2] = isP[3] = isP[5] = 1;\n\n\tfor( i = 7; i < maxN; i += 2 )\n\t\tif( isPrime(i) ) isP[i] = 1;\n\t\n\tps[0] = 0;\n\tfor( i = 1; i < maxN; i++ )\n\t\tps[i] = ps[i-1] + isP[i];\n\t\n\tint a, b, k;\n\tscanf(\"%i %i %i\", &a, &b, &k);\n\t\n\tint lo = 0, hi = b, ans = -1, mid;\n\twhile( lo <= hi ) {\n\t\tmid = (lo + hi) / 2;\n\n\t\tif( b - mid + 1 < a ) break;\n\n\t\tint cnt = ps[a+mid-1] - ps[a-1];\n\t\t\n\t\tbool ok = 1;\n\t\tif( cnt < k ) ok = 0;\n\n\t\tfor( i = a+1; i <= b-mid+1; i++ )\n\t\t\tif( ps[i+mid-1] - ps[i-1] < k ) ok = 0;\n\n\t\tif( ok ) {\n\t\t\tans = mid;\n\t\t\thi = mid - 1;\n\t\t} else lo = mid + 1;\n\n\t}\n\n\tprintf(\"%i\\n\", ans);\n\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8b9fb9ecc5b43a8605eb4f721924ec1", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAXN 1000001\n\nchar Flag[MAXN];\nint Prime[79000];\nint Cnt;\n\nvoid Make()\n{\n int i,j;\n for(Cnt=0,i=2; i=Left)\n {\n Mid=(Left+Right)/2;\n if(Prime[Mid]==key)\n {\n return Mid;\n }\n else if(Prime[Mid]Max)\n {\n Max=temp;\n }\n }\n temp=Binary(B);\n if(B==Prime[temp])\n {\n --K;\n }\n temp=Prime[temp-K];\n temp=B-temp+1;\n if(temp>Max)\n {\n Max=temp;\n }\n if(Max>B-A+1)\n {\n puts(\"-1\");\n }\n else\n {\n printf(\"%d\\n\",Max);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "da7f571dc2fdecdfe72aeb90d8986b3b", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint t,x,y,k,q,l;\n\tint sv[2000000];\n\tint i,j=0;\n\tfor(i=2;i<1000000;i++)\n\tfor(j=2;j*i<2000000;j++)\n\t\tsv[i*j]=1;\n\tscanf(\"%d\",&t);\n\tfor(i=0;i<1000;i++)\n\t//\tprintf(\"%d\",sv[i]);\n\twhile(t-->0)\n\t{\tint c=0;\n\t\tscanf(\"%d %d %d\",&x,&y,&k);j=y+2;\n\t\tint mid,low=0,high=(y-x+1);\n\t\tmid=(low+high)/2;\n\t\twhile(low<=high)\n\t\t{\tl=mid;\n\t\t//\tprintf(\"%d\",sv[i]);\n\t\t\tfor(q=(y-l+1);q>=x;q--)\n\t\t{\tc=0;\n\t\t\tfor(i=q;i<(q+l);i++)\n\t\t\t\tif(sv[i]==0)\n\t\t\t\t\tc++;\n\t\t\tif(c\n\n#define MAXN 1000001\n\nchar Flag[MAXN];\nint Prime[79000];\nint Cnt;\n\nvoid Make()\n{\n int i,j;\n for(Cnt=0,i=2; i=Left)\n {\n Mid=(Left+Right)/2;\n if(Prime[Mid]==key)\n {\n return Mid;\n }\n else if(Prime[Mid]Max)\n {\n Max=temp;\n }\n }\n temp=Binary(B);\n if(B==Prime[temp])\n {\n --K;\n }\n temp=Prime[temp-K];\n temp=B-temp+1;\n if(temp>Max)\n {\n Max=temp;\n }\n if(Max>B-A+1)\n {\n puts(\"-1\");\n }\n else\n {\n printf(\"%d\\n\",Max);\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a699ce8ed661610343e616b9d7a7a0da", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nint p[100000001];\nvoid isPrime(int n)\n{\n\tint i,j,prime;\n\n\tp[0] = 0;\n\tp[1] = 0;\n\n\tfor(i=2;i*i<=n;i++)\n\t{\n\t\tif(p[i] == 1)\n\t\t{\n\t\t\tfor(j=i*2;j<=n;j+=i)\n\t\t\t{\n\t\t\tp[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint check_prime(int a,int b,int l,int k)\n {\n\nint c = 0;\n isPrime(b);\n\n for(int i=a;i<=a+l-1;i++)\n {\n \tif(p[i] == 1)\n \t{\n \tc++;\n \t}\n\n }\t\nif(c\r\n#include \r\nusing namespace std;\r\n\r\nint main(){\r\n unsigned short t;\r\n cin >> t;\r\n while(t--){\r\n unsigned short n;\r\n cin >> n;\r\n cout << (int)pow(2,n)-1 << endl;\r\n }\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9a6e58a849b3c6f0a4b1528392a15b62", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\n#include\r\n#include\r\nusing namespace std;\r\nint main()\r\n{\r\n\tint n;\r\n\tcin>>n;\r\n\tint *a=(int*)malloc(sizeof(int)*n);\r\n\tfor(int i=0;i>a[i];\r\n\tfor(int i=0;i\r\n\r\nint main()\r\n{\r\n\tint n;\r\n\tscanf(\"%d\",&n);\r\n\twhile(n--)\r\n\t{\r\n\t\tint num;\r\n\t\tscnaf(\"%d\",&num);\r\n\t\tnum = 1 << num;\r\n\t\tnum--;\r\n\t\tprintf(\"%d\\n\",num);\r\n\t\t\r\n\t}\r\n\r\n\t\r\n\t\r\n \r\n \r\n}\r\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "85e0c2b4b052fbaa8a4483a7aaad788f", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\nint main()\r\n{\r\n\tint t;\r\n\tscanf_s(\"%d\", &t);\r\n\twhile (t--) {\r\n\t\tint n;\r\n\t\tlong int sum = 2;\r\n\t\tscanf_s(\"%d\", &n);\r\n\t\tfor (int i = 2;i <= n;i++) {\r\n\t\t\tsum *= 2;\r\n\t\t}\r\n\t\tprintf(\"%d\", sum - 1);\r\n\t}\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cd368e7c7e2d1e79159254f5016e8b85", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\nusing namespace std;\r\n\r\nint ans(unsigned int n){\r\n return (int)pow(2,n)-1;\r\n}\r\n\r\nint main(){\r\n unsigned short t;\r\n cin >> t;\r\n while(t--){\r\n unsigned short n;\r\n cin >> n;\r\n cout << ans(n) << endl;\r\n }\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e9e5bb38e46879725e49ee9c51a9355a", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n char *original=NULL, *received=NULL;\n size_t org_size;\n int length;\n getline(&original, &org_size, stdin);\n getline(&received, &org_size, stdin);\n length = strlen(received);\n int final=0, sure=0, doubts=0;\n int i,j,k;\n\n for(i=0; i doubts){\n printf(\"0.000000000000\\n\");\n return 0;\n }\n if (plus == 0) plus = doubts/2;\n int num = 1;\n int deno = 1;\n for(i=0; i\n#include\n#include\n#include\n int compare( const void* a, const void* b)\n {\n long long int int_a = * ( (int*) a );\n long long int int_b = * ( (int*) b );\n\n if ( int_a == int_b ) return 0;\n else if ( int_a < int_b ) return -1;\n else return 1;\n }\nlong int fact(int x)\n {\n long int f=1;\n int i;\n for(i=1;i<=x;i++)\n f=f*i;\n return(f);\n }\nint main()\n{\n char s1[10],s2[10];\n double ans;\n int i,j,sig1=0,sig2=0,un,a[1025];\n scanf(\"%s\",s1);\n getchar();//printf(\"p\");\n gets(s2);\n\n for(i=0;i\n#include\n#include\n#include\n int compare( const void* a, const void* b)\n {\n long long int int_a = * ( (int*) a );\n long long int int_b = * ( (int*) b );\n\n if ( int_a == int_b ) return 0;\n else if ( int_a < int_b ) return -1;\n else return 1;\n }\nlong int fact(int x)\n {\n long int f=1;\n int i;\n for(i=1;i<=x;i++)\n f=f*i;\n return(f);\n }\nint main()\n{\n char s1[10],s2[10];\n double ans;\n int i,j,sig1=0,sig2=0,un,a[1025];\n scanf(\"%s\",s1);\n getchar();//printf(\"p\");\n gets(s2);\n\n for(i=0;i\n#include\n#include\n\nusing namespace std;\n\nint CombinationsRecur(int iN, int iR) {\n if (iR < 0 || iR > iN) {\n return 0;\n }\n if (iR < 1) {\n return 1;\n }\n if (iN == iR) {\n return 1;\n }\n return CombinationsRecur(iN - 1, iR) + CombinationsRecur(iN - 1, iR - 1);\n}\n\nint main(){\n\n\tchar s1[10];\n\tchar s2[10];\n\tscanf(\"%s\",s1);\n\tscanf(\"%s\",s2);\n\tint n=strlen(s1);\n\n int arr[2];\n arr[0]=arr[1]=0;\n\n for(int i=0;i\n#include\nint b(int i,int unknown);\nint main()\n{\n int size=0,f=0,i=0,r,count=0,unknown=0,known=0;\n int y,demosum;\n double c,s;\n char s1[11],s2[11];\n\n gets(s1);\n gets(s2);\n\n\n\n while(s1[i]!='\\0')\n {\n if(s1[i]=='+')\n f++;\n else\n f--;\n\n size++;\n i++;\n }\n\n for(i=0;i=0;j--)\n {\n if(str[j]=='1')\n sum++;\n else\n sum--;\n }\n return (sum);\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4aa3d6edc635c6f706685358dd9d84a3", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main () {\n int a[11][1024],i,j,p=0;\n a[1][0]=1;\n a[1][1]=-1;\n for(i=2;i<=10;i++) {\n for(j=0;j<(int)pow(2,i-1);j++)\n a[i][p++]=a[i-1][j]+1;\n for(j=0;j<(int)pow(2,i-1);j++)\n a[i][p++]=a[i-1][j]-1;\n p=0;\n }\n int d=0,f=0,k=0,ctr=0;\n double ans,ctr1,p1;\n char c[11],b[11];\n scanf(\"%s%s\",c,b);\n for(i=0;i\n#include \n\nint main(void)\n{\n int i, n, s, pos_c, pos_s, vel_c, win;\n char states[201], direction[10];\n \n memset(states, 0, sizeof(states));\n memset(direction, 0, sizeof(direction));\n \n scanf(\"%d%d%d%*s%s%s\", &n, &pos_s, &pos_c, direction, states);\n \n if (!strcmp(direction, \"head\")) vel_c = -1;\n else vel_c = 1;\n\n s = strlen(states);\n\n if (pos_s < pos_c) pos_s = 1;\n else pos_s = n;\n\n win = 0;\n\n for (i = 0; i < s; i++)\n {\n if (pos_c == pos_s) { win = 1; break; }\n if (pos_c == 1 && vel_c == -1) vel_c = 1;\n if (pos_c == n && vel_c == 1) vel_c = -1;\n \n if (states[i] == '0')\n {\n pos_c += vel_c;\n }\n else\n {\n pos_c += vel_c;\n if (pos_c > 1) {\n if (vel_c == 1) pos_s = 1;\n else pos_s = n;\n }\n if (pos_c < n) {\n if (vel_c == -1) pos_s = n;\n else pos_s = 1;\n }\n }\n }\n\n if (win)\n printf(\"Controller %d\\n\", i);\n else\n printf(\"Stowaway\\n\");\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f698ed0959378ea2bbed2a1fc70beca6", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main (void) {\n\tint n, st, co, ht, ok, i, tail;\n\tchar s[201];\n\tscanf (\"%d%d%d\\n\", &n, &st, &co);\n\tscanf (\"to %s\", s);\n\ttail = (s[0]=='t');\n\tscanf (\"%s\", s);\n\tfor (ok = i = 0; s[i] != '1' && !ok; i++) {\n\t\tif (st < co && st > 1)\t/*st esta pro lado do 1 <- -> ou <- <-*/\n\t\t\tst--;\n\t\telse if (st > co && st < n)\t/*st esta pro lado do n -> -> ou <- ->*/\n\t\t\tst++;\n\t\tif (tail) { /* vai pro n */\n\t\t\tif (++co == n)\ttail = 0;\n\t\t} else { /* vai pro 1 */\n\t\t\tif (--co == 1)\ttail = 1;\n\t\t}\n\t\tif (co == st)\tok = 1;\n\t}\n\tif (!ok) { /* s[i] == 1 */\n\t\twhile (s[i] != '\\0' && !ok) {\n\t\t\tif (tail) {\n\t\t\t\tst = 1;\n\t\t\t\tif(++co == n)\ttail = 0;\n\t\t\t} else {\n\t\t\t\tst = n;\n\t\t\t\tif (--co == 1)\ttail = 1;\n\t\t\t}\n\t\t\tfor (++i; s[i] != '1' && s[i] != '\\0' && !ok; i++) {\n\t\t\t\tif (tail) {\n\t\t\t\t\tif(++co == n)\ttail = 0;\n\t\t\t\t} else {\n\t\t\t\t\tif (--co == 1)\ttail = 1;\n\t\t\t\t}\n\t\t\t\tif (co == st)\tok = 1;\n\t\t\t}\n\t\t}\n\t}\n\tif (!ok)\tprintf (\"Stowaway\\n\");\n\telse\tprintf (\"Controller %d\\n\", i);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "68dc83fd1202943b6bfee7fc7da8c4a2", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, m, k, l, p, i;\n char c[5], s[201];\n\n scanf(\"%d %d %d\", &n, &k, &m);\n scanf(\"%*s %s\", c);\n scanf(\"%s\", s);\n\n if (c[0] == 'h') {\n\t p = 0;\n } else {\n\t p = 1;\n }\n\n l = strlen(s);\n\n for (i = 0; i < l; i++) {\n\t if (s[i] == '0') {\n\t if (k < m) {\n\t\t k--;\n\n\t\t if (k == 0) k = 1;\n\t } else {\n\t\t k++;\n\n\t\t if (k == n + 1) k = n;\n\t }\n\n\t if (p == 0) {\n\t\t m--;\n\n\t\t if (m == 1) p = 1;\n\t } else {\n\t\t m++;\n\n\t\t if (m == n) p = 0;\n\t }\n\n\t if (m == k) {\n\t\t printf(\"Controller %d\\n\", i + 1);\n\n\t\t break;\n\t }\n\t } else {\n\t if (p == 0) {\n\t\t m--;\n\n\t\t if (m == 1) p = 1;\n\t } else {\n\t\t m++;\n\n\t\t if (m == n) p = 0;\n\t }\n\n\t if ((m > 1 && p == 1) || m == n) {\n\t\t k = 1;\n\t } else {\n\t\t k = n;\n\t }\n\t }\n }\n\n if (i == l) puts(\"Stowaway\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5a5c74d1b5dc473b6e801515dbc01166", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i= n) dir *= -1;\n\n if(now < enemy) now = 0;\n else now = n-1;\n\n for(i=0;;i++) if(in[i]<' ') break; len=i;\n rep(turn,len){\n if(in[turn]=='1') now=-1;\n if(in[turn]=='0' && now==-1) now = far(enemy,dir,n);\n \n enemy += dir;\n if(enemy+dir < 0 || enemy+dir >= n) dir *= -1;\n\n if(enemy==now) break;\n }\n\n if(turn==len)puts(\"Stowaway\"); else printf(\"Controller %d\\n\",turn+1);\n }\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "34a864f68670772d00e31729a5d4452a", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint main() {\n\tint n,m,k;\n\tint i;\n\tchar a[3],b[5];\n\tchar c[201];\n\tchar *p;\n\t// 1-> -1<-\n\tint d;\n\tscanf(\"%d %d %d\", &n, &m, &k);\n\tscanf(\"%s %s\",a,b);\n\tscanf(\"%s\", c);\n\n\tif(n==2){\n\t\tprintf(\"Controller 1\\n\");\n\t\treturn 0;\n\t}\n\n\tif(b[0] == 'h')\n\t\td = -1;\n\telse\n\t\td = 1;\n\n\tfor(p=c,i=1; *p!='\\0'; p++,i++) {\n\t\t// move stowaway\n\t\tint f = 0\n\t\tif(d == 1) {\n\t\t\tif(*p=='1'){\n\t\t\t\tif(k!=1)\n\t\t\t\t\tm = k-1;\n\t\t\t\telse\n\t\t\t\t\tm = k+2;\n\t\t\t} else if(m-k==1 && m!=n){\n\t\t\t\tm += 1;\n\t\t\t}\n\t\t\tf = 1;\n\t\t}else{\n\t\t\tif(*p=='1'){\n\t\t\t\tif(k!=n)\n\t\t\t\t\tm = k+1;\n\t\t\t\telse\n\t\t\t\t\tm = k-2;\n\t\t\t} else if(k-m==1 && m!=1){\n\t\t\t\tm -= 1;\n\t\t\t}\n\t\t}\n\n\t\t// move controller\n\t\tk += d;\n\t\tif(k == 1)\n\t\t\td = 1;\n\t\tif(k == n)\n\t\t\td = -1;\n\n\t\tif(k == m && f == 0){\n\t\t\tprintf(\"Controller %d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprintf(\"Stowaway\\n\");\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "25f4ed2e929c7862b46a081c40e5af84", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#define mod 1000000007\nint main()\n{\n long long n,abc,d,nabc,nd;\n abc=0; //originally not at a/b/c\n d=1; //originally at d\n scanf(\"%I64d\",&n);\n while(n--) //after n steps get completed\n {\n nabc=(abc*2LL + d)%mod; //to come at a/b/c..we have 3 options\n nd=(abc*3LL4)%mod; //to come at d..we have 3 options\n abc=nabc;\n d=nd;\n }\n printf(\"%I64d\\n\",d);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b3d92b0c3c6976311760e0a2273e3f6d", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n \nint main()\n{\n /* Enter your code here. Read input from STDIN. Print output to STDOUT */\n int N = 0;\n scanf(\"%d\", &N);\n if(N<2)\n return 0;\n long long currentD=0, oldD=0, currentA=0, oldA=1, modulo=1000000007;\n for(int i=2;i<=N;i++)\n \tcurrentD=(3*oldA)%modulo, currentA=((2*oldA)%modulo+oldD%modulo)%modulo. oldA=currentA, oldD=currentD;\n printf(\"%ll\\n\", oldD);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dfc99be8e31de771e8eadc966bb1c8c8", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n /* Enter your code here. Read input from STDIN. Print output to STDOUT */\n int N = 0;\n scanf(%d, &N);\n if(N<2)\n return 0;\n int ways[N]={0};\n ways[1]=3;\n for(int i=1;i\n#include \n#include \nint main()\n{\n long long int n,val=1000000007;\n scanf(\"%lld\",&n);\n long long int steps[10000005]={0};\n steps[1]=0;\n for(int i=2;i<=n;i++)\n {\n steps[i]=(pow(3,i-1)%val)-steps[i-1];\n }\n printf(\"%lld\",steps[n]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "543f36ecbab2f4332c60e5f9d10e10c7", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#include \n\n\nlong long int f(int x)\n{\n long long int res = 0;\n if(x%2 == 0)\n {\n x /= 2;\n long long int multplier = 1;\n for(int i = 0; i < x; i++)\n {\n res = (res+multplier) % 1000000007;\n multplier = (multplier*9) % 1000000007;\n }\n res = (2*res+1) % 1000000007;\n }\n else\n {\n int _x /= 2;\n long long int mult = 1;\n while(_x-- > 0) mult = (mult*9)%1000000007;\n res = mult - f(x-1);\n while(res < 0) res += 1000000007;\n }\n return res%1000000007;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n printf(\"%lld\", f(n)%1000000007);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c46ebb48ddaa0d5a724bc76d64b67900", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n int a1[1000],b1[1000],i,at[1000],n,a,b,m;\n scanf(\"%d %d %d\",&n,&a,&b){\n memset(at,0,1000);\n for(i=0;i\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();\ninline ll inp()\n{\n ll n=0,s=1;\n char p=getchar();\n if(p=='-')\n s=-1;\n while((p<'0'||p>'9')&&p!=EOF&&p!='-')\n p=getchar();\n if(p=='-')\n s=-1,p=getchar();\n while(p>='0'&&p<='9')\n {\n n = (n<< 3) + (n<< 1) + (p - '0');\n p=getchar();\n };\n return n*s;\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 j,n,i,k,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n int arr[a];int all[b];int w[n+1];\n for(i=0;i<=a-1;i++)\n scanf(\"%d\",&arr[i]);\n for(i=0;i<=b-1;i++)\n scanf(\"%d\",&all[i]);\n for(i=0;i<=n;i++)\n w[i]=0;\n for(i=1;i<=n;i++)\n {\n for(j=0;j\n#include\nusing namespace std;\nint mian()\n{\n int i,j,n,a1,b1,a[105],b[105],count=0;\n scanf(\"%d%d%d\",&n,&a1,&b1);\n for(i=0;i\nint main()\n{\n\tint n, a, b, m, c[102] = { 0 }, i, j;\n\tscanf(\"%d%d%d\", &n, &a, &b);\n\twhile (a--)\n\t\tscanf(\"%d\", &m), c[m] = *;\n\tfor (i = 1; i <= n; i++)\n\t\tif (c[i] != 0)\n\t\t\tprintf(\"1 \");\n\t\telse\n\t\t\tprintf(\"2 \");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fa2928b8ba9666ff91c11cb8989463a9", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint n,a,b,i;\n\tint ans[n],x[100],y[100];\n\tscanf(\"%d %d %d\",&n,&a,&b);\n\tfor(i=1;i<=a;i++)\n\t\tscanf(\"%d\",&x[i]);\n\tfor(i=1;i<=b;i++)\n\t\tscanf(\"%d\",&y[i]);\n\tfor(i=1;i<=b;i++)\n\t\tans[y[i]]=2;\n\tfor(i=1;i<=a;i++)\n\t\tans[x[i]]=1;\n\tfor(i=1;i<=n;i++)\n\t\tprintf(\"%d \",ans[i]);\n\treturn 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8c26f3f143e0b24b3fc6ea40aae173bc", "src_uid": "a35a27754c9c095c6f1b2d4adccbfe93", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n long long unsigned int x,y,n,a,b;\n scanf(\"%d\",&n);\n scanf(\"%I64d %I64ud\",&x,&y);\n a=(x-1)*(x-1)+(y-1)*(y-1);\n b=(n-x)*(n-x)+(n-x)*(n-x);\n if(a>b){\n printf(\"Black\");\n }\n else{\n printf(\"White\");\n }\n}\n \n \n \n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4c13578b27bd29ebab44206d8cbfab60", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n long long long int 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(\"black\");\n }\n else\n {\n printf(\"white\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b0e4a081195bec70d264ca2cd024d3bf", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n int main()\n{\n unsigned double w,b;\n long long int n,x,y,w1,w2,b1,b2;\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}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "47989e2ab3f90793335e002fbc1e83c2", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(void){\n long long n, x, y, temp1x, temp1y, temp2c, temp2y, max1, max2;\n scanf(\"%lli %lli %lli\", &n ,&x, &y);\n temp1x=x;\n temp1y=y;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b4c184c824d08301e0d2f3f08dee33ea", "src_uid": "b8ece086b35a36ca873e2edecc674557", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n\tlong long int a,b,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\nint main()\n{\n char cur[12],res[12];\n scanf(\"%s\",cur);\n strcpy(res,cur);\n res[0]++;\n int len=strlen(cur);\n for(int i=1;i\n#include\n\nbool luck(long long int y)\n{\n\tint y1,i,j,k=0,n=0;\n\ty1=y;\n\twhile(y1!=0)\n\t{\n\t\ty1=y1/10;\n\t\tn++;\n\t}\n\ty1=y;\n\tfor(i=0;i\n#include\n#include\nbool luck(long long int y)\n{\n\tint i,j,k=0,n=0;\n\tint y1=y;\n\twhile(y1!=0)\n\t{\n\t\ty1=y1/10;\n\t\tn++;\n\t}\n\ty1=y;\n\tfor(i=0;i\n#include \n#include \n#include \nint main()\n{\n long long n;\n while(~scanf(\"%lld\",&n))\n {\n if(n<100)\n {\n n=n%5;\n printf(\"%lld\\n\",5-n);\n }\n else if(n<1000)\n {\n n=n%100;\n printf(\"%lld\\n\",100-n);\n }\n else if(n<10000)\n {\n n=n%1000;\n printf(\"%lld\\n\",1000-n);\n }\n else if(n<100000)\n {\n n=n%10000;\n printf(\"%lld\\n\",10000-n);\n }\n else if(n<1000000)\n {\n n=n%100000;\n printf(\"%lld\\n\",100000-n);\n }\n else if(n<10000000)\n {\n n=n%1000000;\n printf(\"%lld\\n\",1000000-n);\n }\n else if(n<100000000)\n {\n n=n%10000000;\n printf(\"%lld\\n\",10000000-n);\n }\n else if(n<1000000000)\n {\n n=n%100000000;\n printf(\"%lld\\n\",100000000-n);\n }\n else if(n<10000000000)\n {\n n=n%1000000000;\n printf(\"%lld\\n\",1000000000-n);\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc82b2787bb58704ca68a16582a74d69", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2a4a2dc2b469dbba44b7aef4ec279139", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main(void){\n\tint s,v1,v2,t1,t2;\n\tscanf(\"%d%d%d%d%d\",&s,&v1,&v2,&t1,&t2);\n\tint p1,p2;\n\tif\n\tp1=s*v1-t1;\n\tp2=s*v2-t2;\n\tif(p1==p2)\n\t\tprintf(\"Friendship\");\n\tif(p1>p2)\n\t\tprintf(\"First\");\n\tif(p2>p1)\n\t\tprintf(\"Second\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0774247b364ee0c8ca63bc622fdc0453", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "nclude \n\n struct game{\n int s,v,t;\n };\nint main()\n{\n struct game player[2];\n scanf(\"%d %d %d %d %d\",&player[0].s,&player[0].v,&player[1].v,&player[0].t,&player[1].t);\n\n if((player[0].s*player[0].v+2*player[0].t)>(player[0].s*player[1].v+2*player[1].t))\n printf(\"Second\\n\");\n else if((player[0].s*player[0].v+2*player[0].t)<(player[0].s*player[1].v+2*player[1].t))\n printf(\"First\\n\");\n else printf(\"Friendship\\n\");\n\n\n\n\n\n\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c2c185f718de3435b1996b29d0e9698e", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "nclude \n\n struct game{\n int s,v,t;\n };\nint main()\n{\n struct game player[2];\n scanf(\"%d %d %d %d %d\",&player[0].s,&player[0].v,&player[1].v,&player[0].t,&player[1].t);\n\n if((player[0].s*player[0].v+2*player[0].t)>(player[0].s*player[1].v+2*player[1].t))\n printf(\"Second\\n\");\n else if((player[0].s*player[0].v+2*player[0].t)<(player[0].s*player[1].v+2*player[1].t))\n printf(\"First\\n\");\n else printf(\"Friendship\\n\");\n\n\n\n\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5279c5f071f0668e339db1d41d064e2b", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nmain()\n{\n int s,i,s,v1,v2,t1,t2;\n scanf(\"%d %d %d %d %d\",&s,&v1,&v2,&t1,&t2);\n if(s*v1+2*t1s*v2+2*t2) printf(\"Second\");\n if(s*v1+2*t1==s*v2+2*t2)printf(\"Second\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a2b28c9d802ca31f95599fbdb1786b2b", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define ll long long\n#define sf scanf\n#define pf printf\n#define db double\n#define end return 0\nint func(int,int);\nint a[100005];\nint main()\n{\n \n char c[1001],ch[1001],i,k=1;\n gets(c);\n ch[0]='/';\n for(i=0;c[i];i++)\n {\n if((ch[k-1]!='/'||ch[k-1]=='/')&& c[i]!='/')\n ch[k++]=c[i];\n else if(ch[k-1]!='/' && c[i]=='/')\n ch[k++]='/';\n }\n if(ch[k-1]=='/';)\n k=k-1;\n ch[k]='\\0';\n pf(\"%s\",ch);\nend;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1a9ce65c2368d5bb7f9cf13d37bd3a2e", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int i,j=0,k,count=0,y=0,x=0,m=0;\n char s[100];\n scanf(\"%s\",s);\n y=strlen(s);\n char p[y];\n for(m=y-1;m>0;m--)\n {\n if(s[m]!='/')\n {\n x=m;\n break;\n }\n }\n for(i=0;i<=m;i++)\n {\n if(s[i]=='/' && count==0)\n {\n p[j]='/';\n j++;\n count++;\n }\n if(s[i]!='/')\n {\n p[j]=s[i];\n j++;\n count=0;\n }\n }\n for(k=0;k\n#include\n\nint main()\n{\n int i,j=0,k,count=0,y=0,x=0,m=0;\n char s[100];\n scanf(\"%s\",s);\n y=strlen(s);\n char p[y];\n for(m=y-1;m>0;m--)\n {\n if(s[m]!='/')\n {\n x=m;\n break;\n }\n }\n for(i=0;i<=m;i++)\n {\n if(s[i]=='/' && count==0)\n {\n p[j]='/';\n j++;\n count++;\n }\n if(s[i]!='/')\n {\n p[j]=s[i];\n j++;\n count=0;\n }\n }\n for(k=0;k\n#include\nint main()\n{\n char s1[1000],s2[1000];\n gets(s1);\n int i,k=0;\n for(i=0;i\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bae4e1890c524a1a35f40c1ba1a8d0d1", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint min=1000000000;\n\nvoid gao(int x,int y){\n if((x+y)%2) return ;\n if(xx) min=x;\n}\n\nint main(void){\n int n,m,i,j,a,b;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n if((i-1)%a==0 && (j-1)%b==0) gao((i-1)/a,(j-1)/b);\n if((i-1)%a==0 && (m-j)%b==0) gao((i-1)/a,(m-j)/b);\n if((n-i)%a==0 && (j-1)%b==0) gao((n-i)/a,(j-1)/b);\n if((n-i)%a==0 && (m-j)%b==0) gao((n-i)/a,(m-j)/b);\n if(min<1000000000) printf(\"%d\",min);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f1e925a4ea0088bf626953db40f6adab", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0} {"lang": "GNU C", "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\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\texit;\n\t\t}\n\t\telse {\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t\texit;\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "d2ad3663203f0a3d16bca3f4e4f7bf36", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0} {"lang": "GNU C", "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,ans1=INF,ans2=INF,ans3=INF,ans4=INF,i,j,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 i=min(ans1,ans2);\n j=min(ans3,ans4);\n ret=min(i,j);\n printf(\"%d\\n\",ret);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5682c769d9140601c5b450c7175e9c5c", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\n long long int j,t,i,f,x,n,m,d,g,k=0,s=1,sum=0,count=1,l=0;\n char a[51];\n char b[51];\n scanf(\"%s\",a);\nl=strlen(a);\nif(l==3){\n printf(\"%c%c%c\",a[1],a[2],a[0]);\n}\nelse { for(i=0,j=0;i=0;i--){\n printf(\"%c\",b[i]);}\n}\n\n\nreturn 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9838f1a024402097ff6d13d5e1731f0e", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "erfdcoeocs", "lang_cluster": "C", "compilation_error": true, "code_uid": "1ca62a095303b087244563fa79998286", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "\n#include \n#include\nint main()\n{\n char t[50],s[50];\n int i,j,temp=0;\n scanf(\"%s\",t);\n int l=strlen(t);\n i=(l+1)/2 -1,j=(l+1)/2;\n if(l==1)\n {\n printf(\"%s\",t);\n }\n while(i>=0&&j=0)\n {\n\t\twhile(i>=0)\n\t\ts[temp++]=t[i--];\n\t}\n\tif(j\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<=n)\n {\n printf(\"%c\",a[l+1]);\n p--;\n l++;\n }\n }\n \n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "71852ab60e09f9844921472b7b5ca068", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int l,x,y,a,i,j=0;\n char t[100];\n scanf(\"%s\",t);\n char s[100];\n l=strlen(t);\n x=l/2;\n y=x-1;\n a=y+1;\n for(i=0;i\nusing namespace std;\n\nint arr[7][7], i, j;\n\nchar a[7][7];\n\nstring s;\n\nmap>mp;\n\nint main()\n{\n\tios_base::sync_with_stdio(false);\n\n\tfor (i = 0; i < 6; i++){\n\t\tcin >> s;\n\t\tint k = 0;\n\t\tfor (j = 0; j < s.size(); j++)\n\t\t{\n\t\t\tif (s[j] == '.' || s[j] == '*')a[i][k++] = s[j];\n\t\t}\n\t}\n\tint num = 0, val = 3;\n\tfor (i = 0; i < 6; i++)\n\t{\n\t\tif (num == 2)\n\t\t\tval--, num = 0;\n\t\tnum++;\n\t\tarr[i][0] = arr[i][1] = val;\n\t}\n\tnum = 0;\n\tval = 4;\n\tfor (i = 0; i < 6; i++)\n\t{\n\t\tif (num == 2)\n\t\t\tval--, num = 0;\n\t\tnum++;\n\t\tarr[i][2] = arr[i][3] = val;\n\t}\n\tnum = 0;\n\tval = 3;\n\tfor (i = 0; i < 6; i++)\n\t{\n\t\tif (num == 2)num = 0, val--;\n\t\tnum++;\n\t\tarr[i][4] = arr[i][5] = val;\n\t}\n\n\tfor (i = 0; i < 6; i++)\n\t{\n\t\tfor (j = 0; j < 6; j++)\n\t\t{\n\t\t\tif (a[i][j] == '.')\n\t\t\t{\n\t\t\t\tmp[arr[i][j]] = { i, j };\n\t\t\t}\n\t\t}\n\t}\n\n\tauto it = mp.end();\n\n\tit--;\n\n\ta[it->second.first][it->second.second] = 'P';\n\n\tfor (i = 0; i < 6; i++)\n\t{\n\t\tcout << a[i][0] << a[i][1] << '-';\n\t\tcout << a[i][2] << a[i][3] << '-';\n\t\tcout << a[i][4] << a[i][5] << '\\n';\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "752f7f29fd93bdec1fa547463f57242f", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\n#define ll long long\nint main()\n{\n int n,i,j,k,l=0;\n int a[6][8]={{3,3,-1,4,4,-1,3,3},{3,3,-1,4,4,-1,3,3},\n\t{2,2,-1,3,3,-1,2,2},{2,2,-1,3,3,-1,2,2},{1,1,-1,2,2,-1,1,1}\n\t,{1,1,-1,2,2,-1,1,1}};\n string s[6];\n for(i=0;i<6;i++)\n cin>>s[i];\n for(j=0;j<6;j++){\n for(i=0;i<8;i++)\n {\n \tif(s[j][i]=='-')\n \tcontinue;\n \tif(s[j][i]=='.')\n \t{\n \t\tif(l<=a[j][i])\n \t\t{\n \t\t\tn=j,k=i;\n \t\t\tl=a[j][i];\n \t\t}\n \t}\n }}\n k--;\n s[n][k]='P';\n for(i=0;i<6;i++)\n cout< max) {\n\t\t\t\t\tmax = a[i][j];\n\t\t\t\t\tii = i, jj = j;\n\t\t\t\t}\n\t\t}\n\t}\n\tc[ii][jj] = 'P';\n\tfor(int i = 0; i < 5; i++)\n\t\tprintf(\"%c%c-%c%c-%c%c\\n\", c[i][0], c[i][1], c[i][2], c[i][3], c[i][4], c[i][5]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "71356892015da961c891afee6d2147c8", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(void) {\n\tchar s[6][9];\n\tfor (int i =0 ;i <6;i++){\n\t\tscanf(\"%s\",s[i]);\n\t\ts[i][8]='\\0';\n\t}\n\tint x[]={0,0,1,1, 0,0,0,0,1,1,1,1,2,2,3,3 2,2,2,2,3,3,3,3,4,4,5,5, 4,4,4,4,5,5,5,5};\n\tint y[]={3,4,3,4, 0,1,6,7,0,1,6,7,3,4,3,4 0,1,6,7,0,1,6,7,3,4,3,4, 0,1,6,7,0,1,6,7};\n\tfor (int i=0;i<36;++i){\n\t\tif (s[x[i]][y[i]]!='*'){\n\t\t\ts[x[i]][y[i]]='P';\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (int i =0 ;i <6;i++){\n\t\tprintf(\"%s\\n\",s[i]);\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2aac7e2a680c53bca42eec226b95b024", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nusing namespace std;\n\nint p[7][8] = {\n { 3, 3, 0, 4, 4, 0, 3, 3 },\n { 3, 3, 0, 4, 4, 0, 3, 3 },\n { 2, 2, 0, 3, 3, 0, 2, 2 },\n { 2, 2, 0, 3, 3, 0, 2, 2 },\n { 1, 1, 0, 2, 2, 0, 1, 1 },\n { 1, 1, 0, 2, 2, 0, 1, 1 }\n};\n\nchar st[7][10];\n\nint main()\n{\n for (int i = 0; i < 6; i++) {\n scanf(\"%s\", st[i]);\n }\n\n int y = -1, x = -1, mx = 0;\n\n for (int i = 0; i < 6; i++) {\n for (int j = 0; j < 6; j++) {\n if (st[i][j] == '.' && p[i][j] > mx) {\n mx = p[i][j];\n y = i;\n x = j;\n }\n }\n }\n\n st[y][x] = 'P';\n\n for (int i = 0; i < 6; i++) {\n puts(st[i]);\n }\n\n return 0;\n}\n\n\n/*\n\n00000001100\n\n1 2 3 100 100 100 100 100 100 100\nabcdefgh\n\nabcdefg\ncdefghi\n\n4 1\n50 50 10 20\n130\n*/", "lang_cluster": "C", "compilation_error": true, "code_uid": "1f62d1bf27cb7fe02e7b43a14fffcc12", "src_uid": "35503a2aeb18c8c1b3eda9de2c6ce33e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n long int n.s,count=0;\n scanf(\"%ld %ld\",&n,&s);\n if(n>=s)\n count=1;\n else{\n count+=s/n;\n if(s%n!=0)\n count++;\n }\n printf(\"%ld\\n\",count);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a1846ae6965ac68cab01d3d24461abab", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,s;\n int k=0;\n int a=0;\n scanf(\"%d%d\",&n,&s);\n for(i=0;i<=s;i--){\n if(k\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d23c7051e32775296cc92a1b80011855", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n long float n, s, a, c;\n\tlong int b ; \n\tscanf(\"%lf %lf\", &n, &s);\n\ta=s/n;\n\tc=a;\n\tb=a;\n\tif(c!=b)\n\t{\n\t\tprintf(\"%ld\\n\", b+1);\n\t}\n\telse \n\t{\n\t\tprintf(\"1\");\n\t}\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "887df6043e65b55f2518613dd0c834f2", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int a , b ;\n scanf(\"%d%d\",&a.&b);\n printf(\"%d\",b-1/a-1);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2bda264d9f0210ffc195daa71ff96073", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\nint main()\n{\n\n int n,min,c=0,d=0,l,i=0,sub,count=0;\n scanf(\"%d\",&n);\n char s[200];\n scanf(\"%s\",s);\n l = strlen(s);\n for(i=0;i\n\nint main(void)\n{\n\t\tint n;\n\t\tscanf(\"%d \", &n);\n\n\t\tchar arr[n+1];\n\t\tarr[n] = '\\0';\n\n\t\tint sit = 0, stand = 0;\n\t\tfor (int i =0; i < n; i++){\n\t\t\t\tscanf(\"%c \", &arr[i]);\n\t\t\t\tif (arr[i] == 'x')\n\t\t\t\t\t\tsit++;\n\t\t\t\telse\n\t\t\t\t\t\tstand++;\n\t\t}\n\n\t\tif (sit == stand)\n\t\t\t\tprintf(\"0\\n\");\n\t\telse\n\t\t\t\tprintf(\"1\\n\");\n\n\t\tint i = 0;\n\t\twhile (sit > stand && i < n){\n\t\t\t\tif (arr[i] == 'x'){\n\t\t\t\t\t\tarr[i] = 'X';\n\t\t\t\t\t\tsit--; stand++;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t}\n\t\t\n\t\ti = 0;\n\t\twhile (stand > sit && i < n){\n\t\t\t\tif (arr[i] == 'X'){\n\t\t\t\t\t\tarr[i] = 'x';\n\t\t\t\t\t\tstand--; sit++;\n\t\t\t\t}\n\t\t}\n\n\t\tprintf(\"%s\\n\", arr);\n\t\treturn 0;\n}\n\n\t\t\t\t\n\n\t\t\t\t\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f043e0f81aed04ed4f2e8f01472f5a18", "src_uid": "fa6311c72d90d8363d97854b903f849d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nmain()\n{\n int n,s1=0,s,s2=0,i,l=0;\n char ch[1000];\n while(1)\n {\n s1=s2=0;\n l=0;\n scanf(\"%d\",&n);\n for(i=0;i<=n;i++)\n {\n scanf(\"%c\",&ch[i]);\n if(ch[i]=='x')\n s1++;\n if(ch[i]=='X')\n s2++;\n }\n l=abs((s1-s2))/2;\n printf(\"%d\",l);\n for(i=0;i<=n;i++)\n {\n if(s1s2&&l+1)\n {\n if(ch[i]=='x')\n ch[i]=ch[i]-32;\n l--;\n }\n }\n for(i=0;i<=n;i++)\n printf(\"%c\",ch[i]);\n }\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a505fa66a2f93a9242b0225e91391a32", "src_uid": "fa6311c72d90d8363d97854b903f849d", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{ //424A\n int n, i, j;\n char arr[200];\n char c;\n int m = 0;\n int target, remain;\n int current = 0;\n scanf(\"%d\\n\", &n);\n target = n / 2;\n\n for (i = 0; i < n; i++) {\n c = getchar();\n if (c == 'x')\n arr[i] = 0;\n else {\n arr[i] = 1;\n current++;\n }\n }\n remain = target - current;\n m = remain;\n if (remain < 0) remain * = -1;\n if (remain > 0) {\n for (i = 0; i < n && remain > 0; i++) {\n if (arr[i] == 0) {\n arr[i] = 1;\n remain--;\n }\n }\n } else if (remain < 0){\n for (i = 0; i < n && remain < 0; i++) {\n if (arr[i] == 1) {\n arr[i] = 0;\n remain++;\n }\n }\n }\n\n printf(\"%d\\n\", m);\n for (i = 0; i < n; i++) {\n if (arr[i] == 0)\n putchar('x');\n else\n putchar('X');\n }\n\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e291c095e55ad56acfc60c15cb5de7e2", "src_uid": "fa6311c72d90d8363d97854b903f849d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\ninat main()\n{\n int n,index,standing=0,sitting=0,diff,flag;\n char *array;\n scanf(\"%d\",&n);\n array=(char*)malloc(n*sizeof(char));\n scanf(\"%s\",array);\n for (index=0;indexsitting)\n {diff=standing-sitting;\n flag=0;}\n else\n {diff=sitting-standing;\n flag=1;}\n printf(\"%d\\n\",diff);\n if(flag=0)\n {\n for (index=0;index\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tfor(int i=0;i\nusing namespace std;\n \n \nint main() {\n //ios_base::sync_with_stdio(false);\n //cin.tie(nullptr), cout.tie(nullptr);\n \n int n, v;\n cin >> n >> v;\n if (n-1 <= v) {\n cout << n-1 << endl;\n return 0;\n }\n int result = v - 1;\n for(int i = 1; i <= n - v; ++i) {\n result += i;\n }\n cout << result << endl;\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d832f0c07a58df9055413890a9bde26d", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n,v;\n scanf(\"%d %d\",&n,&v);\n \n int sum=0;\n for(int i=2;i<=n-v;i++)\n {\n sum=sum+i;\n }\n int p=v+sum;\n print(\"%d\",p);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "515b3490d1b979e5d1b5f616500a965f", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a>=b)\n int sum=b;\n else\n sum=a;\n for(int i=2;i<=a-b;i++)\n {\n sum+=i;\n }\n printf(\"%d\",sum);\n return 0;\n \n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a49afb1875204f554644f472fb56a020", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint i,count,n,v,sum;\n\tscanf(\"%d %d\",&n,&v);\n\tcount=v;\n\ti=2;\n\tif(v>=n-1)\n\t{\n\t\tcount=n-1;\n\t}\n\tsum=0;\n\telse\n\t{\t\n\t\twhile(n-1!=v)\n\t\t{\n\t\t\tsum=sum+i;\n\t\t\tn--;\n\t\t\ti++;\n\t\t}\n\t\tcount=sum;\n\t}\t\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ef0e9f42ef732d6e5bd6011b8c0fb7c0", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n, i, sum=0;\n char a[1000];\n scanf(\"%d\", &n);\n\n scanf(\"%s\", a);\n\n for(i=0; i\n#include\nvoid main()\n{\n char *str;\n int len,i,num;\n num=0;\n scanf(\"%d\",&len);\n str=malloc(sizeof(char)*len);\n scanf(\"%s\",str);\n for(i=0;i\n\nint main()\n{\n int n;\n scanf(\"%d\\n\" , &n);\n char A[n];\n for(int i=0;i\n\nusing namespace std;\n\nint main()\n{\n\tint n;\n\tcin>>n;\n\tchar p[n];\n\tint c=0,i=0;\n\tcin>>p;\n\tfor(int j=0;j\nint main()\n{\n\tint n;\n\tscanf(\"%d\\n\", &n);\n\tint a[102];\n\ta[0] = 0;\n\tchar c;\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c == '+')\n\t\t\ta[i + 1] = a[i] + 1;\n\t\telse\n\t\t\ta[i + 1] = a[i] - 1;\n\t}\n\tint min = 0;\n\tfor (i = 0; i <= n; i++)\n\t\tif (min > a[i])\n\t\t\tmin = a[i];\n\tif (0 > a[n] - min)\n\t\tprintf(\"0\\n\");\n\telse\n\t\tprintf(\"%d\\n\", a[n] - min);\n\treturn 0;\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "429f82c7f16ad75badb5db404b95f15d", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tstring s;\n\tcin>>s;\n\tlong long int l,i,j,k,c=0,d=0,flag=1;\n\tl=s.length();\n\tfor(i=0;i=0;i--)\n\t{\n\t\tif(s[i]=='0')\n\t\td++;\n\t\telse\n\t\tbreak;\n\t}\n\tif(c>d)\n\tflag=0;\n\telse\n\t{\n\t\tk=d-c;\n\t\tfor(i=0,j=l-k-1;i<=j;i++,j--)\n\t\t{\n\t\t\tif(s[i]!=s[j])\n\t\t\t{\n\t\t\t\tflag=0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==1)\n\tprintf(\"yes\\n\");\n\telse\n\tprintf(\"no\\n\");\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f2ff4a4e1bc60acb8429f33a514f166f", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nvoid main()\n{\n long a,c,rev=0;\n int d\n scanf(\"%ld\",&a);\n d=a%10;\n while(d==0)\n {\n a/=10;\n d=a%10;\n }\n c=a;\n while(c!=0)\n {\n d=c%10;\n rev=rev*10+d;\n }\n if(rev==a)\n printf(\"YES\");\n else\n printf(\"NO\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9df1bd58a9f292621847d011b97d208e", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n\tint x, a, reverse = 0, b = 0;\n\tscanf(\"%d\", &x);\n\twhile (n)\n\t{\n\t\tif (x % 10 == 0)\n\t\t\tx = x / 10;\n\t\telse\n\t\t\tbreak;\n\t}\n\tx = b;\n\twhile (x)\n\t{\n\t\ta = x % 10;\n\t\treverse = reverse * 10 + a;\n\t\tx = x / 10;\n\t}\n\tif (reverse == b)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "abcedb75e7e3934d754cda070c6fc51e", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d04b7ecb6f5a61260ea9728ff65fac4a", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint main()\n{\nchar input[1000000];\nscanf(\"%s\",&input);\nint length=strlen(input),letter=length-1,numofzeroes=0,caseid;\n\nif((length+1)%2==0)\ncaseid=0;\nelse\ncaseid=1;\n\nwhile(input[letter]=='0'){\nletter--;\nnumofzeroes++;\n}\n\nint done=0,front=0,back=letter;\nwhile(done==0){\n\n//printf(\"%c %c\\n\",input[front],input[back]);\nif(len==1)\ndone=1;\nelse if(input[front]!=input[back]){\ndone=1;\n}\nelse{\nif(front==(((length-numofzeroes-caseid)/2)-1)){\ndone=2;\n}\nfront++;\nback--;\n}\n}\n\nif(done==2)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5897c58dc0b9ccea4478e49bfc5079ff", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nlong long int max(long long int a,long long int b){\n if(a>b)\n return a;\n else \n return b;\n}\nint main(){\n\n long long int n,m;\n scanf(\"%lld%lld\",&n,&m);\n printf(\"%lld %lld\",max(n-2*m,0),max(n-m-1,0);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb77b304b1715dbf0e37fca6b0773426", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include\n#include\n#include\n\n\nint main()\n{\n\tint n,m;//\u9876\u70b9\uff0c\u8fb9\n\tscanf(\"%d%d\", &n, &m);\n\t//\u6700\u5c11/\u591a\u51e0\u4e2a\u5b64\u7acb\u9876\u70b9 \n\t//\u6700\u5c11\u7684\u8bdd\u5c3d\u53ef\u80fd\u4e00\u4e2a\u8fb9\u5c31\u8fde\u4e24\u4e2a\u70b9\n\t//\u6700\u591a\u7684\u8bdd\u5c3d\u53ef\u80fd\u63a5\u8fd1\u6ee1\u56fe\n\t//\u89e3\u4e0d\u7b49\u5f0f p(p-1)/2 < m \u6c42maxp\n\tint maxp = ceil((1 + sqrt(1 + 8 * m)) / 2);// +1;\n\tif (m == 0)\n\t{\n\t\tmaxp = 0;\n\t}\n\tprintf(\"%d %d\", max(n - 2 * m, 0) , n- maxp);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4e9ede9c8643d1155b4c8ab78feabbb4", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tlong long n,m,k,a,min,max;\n\tscanf(\"%lld %lld\",&n,&m);\n\tfor(a=0;a<=m;a++)\n\t{\n\t\tk=a*(a-1);\n\t\tif(k>=(2*m))\n\t\t\tbreak;\n\t}\n\tmax=n-a;\n\tmin=n-2*m;\n\tif(min<0)\n\t\tmin=0;\n\tprintf(\"%lld %lld\\n\",min,max);\n}\n/*\nint factorial(int n)\n {\n int ans=n;\n for(int i=n-1;i>0;i++)\n {\n ans*=i;\n }\n return ans;\n }\nint main()\n {\n int vertex,edges,min=0,max=0;\n scanf(\"%d\",&vertex);\n scanf(\"%d\",&edges);\n\n max=(vertex/2-edges)*2;\n min=factorial(vertex)/(factorial(vertex-2)*2)\n if(vertex%2==0)\n {\n\n printf(\"%d \",max);\n }\n else\n {\n printf(\"%d\",max+1);\n }\n\n }\n/*\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5413e5701f571330e18de51e87513690", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n\nint main()\n{\n long long temp,m,n,min,max;\n double x;\n while(scanf(\"%lld %lld\",&n,&m)!=EOF)\n {\n if(n==1)\n {\n min=max=1;\n printf(\"%lld %lld\\n\",min,max);\n continue;\n } \n if(2*m>n)\n min=0;\n else\n min=n-2*m;\n if(n*(n-1)/2==m)\n max=0;\n else\n {\n x=m;\n x=sqrt(x*2+0.25)+0.5;\n temp=(long long)x;\n temp=temp+1;\n while(temp*(temp-1)/2>=m)\n temp--;\n temp++; \n max=n-temp; \n }\n printf(\"%lld %lld\\n\",min,max);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "aa39a806c66047494b24467c07f1e650", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#define int long long int\nint main(){\n\tint i,n,m,min,max;\n\tscanf(\"%lld%lld\",&n,&m);\n\tint l=n-2*m;\n\tif(l>=0)\n\t\tmin=l;\n\telse \n\t\tmin=0;\n\tfor(i=0;i=m)\n\t\t\tbreak;\n\tmax=n-i;\n\tprintf(\"%lld %lld\",min,max);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "473a4d45bdd6d2af949c5a92b4e95597", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\n int main(){\r\n int t,n;\r\n scanf(\"%d\",&t);\r\n while(t>=1){\r\n scanf(\"%d\",&n);\r\n \r\n } printf(\"%d\\n\",int sqrt(n)+int cbrt(n)-int(sqrt( cbrt(n))));\r\n t--;\r\n }\r\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "291f1122e96274aed0f23b6f83bcd4e9", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n\tint n;\r\n\tcin >> n;\r\n\twhile (cin >> n)\r\n\t\tcout<< (int) sqrt(n) + (int) cbrt(n) - (int) sqrt(cbrt(n)) << endl;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "014f28634f34ad9b43af7febbc843074", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\n int main(){\r\n int t,i;\r\n scanf(\"%d\",&t);\r\n while(t>=1){\r\n int n;\r\n int count=0;\r\n scanf(\"%d\",&n);\r\n for(i=1;i*i<=n;i++){\r\n if(i*i<=n){\r\n count++;\r\n }if(i*i*i<=n){\r\n count++;\r\n }\r\n }\r\n t--; }printf(\"%d\",count);\r\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "4d7ce45d3581b703a340478808aa6180", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\n int main(){\r\n int t,i,count;\r\n scanf(\"%d\",&t);\r\n while(t>=1){\r\n scanf(\"%d\",&n);\r\n int a=sqrt(n);\r\n int b=cbrt(n);\r\n int c=sqrt(b);\r\n printf(\"%d\\n\", a+b-c);\r\n t--;\r\n } \r\n \r\n }\r\n \r\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5933d76c63bad52529fb7193284e3965", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\nvoid solve() {\r\n int n;\r\n scanf(\"%d\",&n);\r\n printf(\"%d\\n\",sqrt(n)+cbrt(n));\r\n}\r\nint main() {\r\n int t;\r\n scanf(\"%d\",&t;\r\n for (int i=0;i\nusing namespace std;\nint main()\n{\n int n;int ar[110];\n int i=0;\n for(i=0;i<109;i++)\n ar[i]=0;\n scanf(\"%d\",&n);\n int ans=0;\n for(i=1;i<=n;i++)\n scanf(\"%d\",&ar[i]);\n for(i=1;i<=n;i++)\n {\n if(ar[i]==1)\n ans++;\n if(ar[i]==0&&ar[i-1]==1&&ar[i+1]==1)\n ans++;\n }\n printf(\"%d\\n\",ans);\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6dfa46e040ce8625bb331ba417a447e8", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nenum State\n{\n HOME,\n SCHOOL,\n LEAVE\n};\n\nint\nautomation(int n)\n{\n int state = HOME;\n int count = 0;\n int pair;\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &pair);\n switch (state) {\n case HOME:\n if (pair == 1) {\n state = SCHOOL;\n count++;\n }\n break;\n case SCHOOL:\n if (pair == 1) {\n count++;\n }\n else {\n state = LEAVE;\n }\n break;\n case LEAVE:\n if (pair == 1) {\n count += 2;\n state = SCHOOL;\n }\n else {\n state = HOME;\n }\n break;\n }\n }\n return count;\n}\n\nint\nmain()\n{\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\\n\", automation(n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d846f40a09dff6fc6eab571df1e0a374", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int n,a[101],i,c=0,k=0;\n scanf(\"%lld\",&n);\n for(i=1;i<=n;i++)\n {scanf(\"%lld\",&a[i]);}\n if(n==1&&a[1]==0)\n {c=0;}\n else\n {\n for(i=1;i<=n;i++)\n {if(a[i]==1)\n {c++;}\n else\n {while(a[i]==0)\n {k++;\n i++;\n }\n if(k<2&&(i-1)!=1))\n {c++;}\n i--;\n }\n }}\n \n \n printf(\"%lld\",c);\n}\n \n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "24a5181132ce5337560ff51bae0b920f", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#define MAX 105\n\nmain()\n{\nint a[MAX],n,res =0;\nscanf (\"%d\",&n);\nfor(i=0;i\nint a[150];\nint main()\n{\n\tint n,sum,flag,flag1;\n\twhile(~scanf(\"%d\",&n))\n\t{\n\t\tsum=0,flag=1,flag1=1;\n\t\tfor(int i=0;i\n#include \n\nint max(int a, int b)\n{\n return (a>b) ? a : b;\n}\n\nint min(int a, int b)\n{\n return (a>b) ? b : a;\n}\n\nint main()\n{\n int HPY,ATKY,DEFY;\n int HPM,ATKM,DEFM;\n int addDEF = 0;\n int count = 0;\n int mini = 1000001;\n int h,a,d;\n\n scanf(\"%d %d %d\", &HPY, &ATKY, &DEFY);\n scanf(\"%d %d %d\", &HPM, &ATKM, &DEFM);\n scanf(\"%d %d %d\", &h, &a, &d);\n\n int i;\n int HPYS = HPY,ATKYS = ATKY,DEFYS = DEFY;\n int HPMS = HPM,ATKMS = ATKM,DEFMS = DEFM;\n /* Increase attaque every time */\n for (i=0;i<100;++i)\n {\n count = a*i;\n if (ATKY+i-DEFM <= 0)\n continue;\n\n if (ATKY+i > 100)\n break;\n\n /* Count How much time every one before die */\n int numberH = (int)ceil((double)HPY/(double)max(0,ATKM-DEFY));\n int numberM = (int)ceil((double)HPM/(double)max(0,ATKY+i-DEFM));\n if (numberH > numberM)\n break;\n else if (numberM > 1)\n {\n /* If we increase Defence */\n while (max(0,ATKM-DEFY)*(numberM-1) > HPY)\n ++DEFY;\n count += (DEFY-DEFYS)*d;\n DEFY = DEFYS;\n mini = min(mini, count);\n /* If we increase Health */\n count = a*i;\n HPY += max(0,ATKM-DEFY)*(numberM-1) - HPY;\n count += HPY*h;\n mini = min(mini, count);\n }\n else if (numberM == 1)\n {\n while (max(0,ATKM-DEFY)*numberM > HPY)\n ++DEFY;\n count += (DEFY-DEFYS)*d;\n DEFY = DEFYS;\n mini = min(mini, count);\n /* If we increase Health */\n count = a*i;\n HPY += max(0,ATKM-DEFY)*numberM - HPY;\n count += HPY*h;\n mini = min(mini, count);\n }\n\n HPY = HPYS,ATKY = ATKYS,DEFY = DEFYS;\n HPM = HPMS,ATKM = ATKMS,DEFM = DEFMS;\n }\n\n printf(\"%d\\n\", mini);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7f123a11ff0374e23ed3a783b1b05f2e", "src_uid": "bf8a133154745e64a547de6f31ddc884", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint max(int a, int b)\n{\n return (a>b) ? a : b;\n}\n\nint min(int a, int b)\n{\n return (a>b) ? b : a;\n}\n\nint main()\n{\n int HPY,ATKY,DEFY;\n int HPM,ATKM,DEFM;\n int addDEF = 0;\n int count = 0;\n int mini = 1000001;\n int h,a,d;\n\n scanf(\"%d %d %d\", &HPY, &ATKY, &DEFY);\n scanf(\"%d %d %d\", &HPM, &ATKM, &DEFM);\n scanf(\"%d %d %d\", &h, &a, &d);\n\n int i;\n int HPYS = HPY,ATKYS = ATKY,DEFYS = DEFY;\n int HPMS = HPM,ATKMS = ATKM,DEFMS = DEFM;\n /* Increase attaque every time */\n for (i=0;i<100;++i)\n {\n count += a*i;\n\n while (HPM > 0)\n {\n if (HPY < (ATKM-DEFY))\n {\n while (max(0,ATKM-(DEFY+addDEF)) >= HPY)\n ++addDEF;\n\n if ((max(0, ATKM-DEFY)-(HPY)+1)*h < addDEF*d)\n {\n count += (max(0, ATKM-DEFY)-(HPY)+1)*h;\n HPY += max(0, ATKM-DEFY)-(HPY)+1;\n addDEF = 0;\n }\n else\n {\n count += addDEF*d;\n DEFY += addDEF;\n addDEF = 0;\n }\n }\n\n HPM -= max(0, ATKY+i-DEFM);\n HPY -= max(0, ATKM-DEFY);\n }\n\n if (HPY > 0)\n mini = min(mini, count);\n\n HPY = HPYS,ATKY = ATKYS,DEFY = DEFYS;\n HPM = HPMS,ATKM = ATKMS,DEFM = DEFMS;\n\n count = 0;\n }\n\n printf(\"%d\\n\", mini);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f63934725082536cf0244172161f8657", "src_uid": "bf8a133154745e64a547de6f31ddc884", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint lTime(int h, int a, int d) {\n int i=-1;\n if(d>=a) return 999999999;\n while(h>0){\n h=h-(a-d);\n i++;\n }\n return i;\n}\nint main() {\n int yh,ya,yd;\n int mh,ma,md;\n int h,a,d;\n int lh,la,ld=1000;\n int i,j,k,cost,min=999999999,yaa=0;\n scanf(\"%d %d %d\",&yh,&ya,&yd);\n scanf(\"%d %d %d\",&mh,&ma,&md);\n scanf(\"%d %d %d\",&h,&a,&d);\n\n for(i=0;i<1000;i++)\n if(lTime(yh+i,ma,yd)>lTime(mh,ya,md)) \n break;\n lh=i;\n for(i=0;i<1000;i++)\n if(lTime(yh,ma,yd)>lTime(mh,ya+i,md)) \n break;\n la=i;\n for(i=0;i<1000;i++)\n if(lTime(yh,ma,yd+i)>lTime(mh,ya,md)) \n break;\n ld=i;\n\n// lh=(h>10)?10000/h:1000;\n// la=(a>10)?10000/a:1000;\n// ld=(d>10)?10000/d:1000;\n if(ya<=md) yaa=md-ya+1;\n// printf(\"%d %d %d\\n\",lh,la,ld);\n for(i=0;i<=lh;i++){\n for(j=yaa;j<=la;j++) {\n for(k=0;k<= ld;k++) {\n if(lTime(yh+i,ma,yd+k)>lTime(mh,ya+j,md)) {\n cost=i*h+j*a+k*d;\n if(cost\n\nint lTime(int h, int a, int d) {\n int i=-1;\n if(d>=a) return 999999999;\n while(h>0){\n h=h-(a-d);\n i++;\n }\n return i;\n}\nint main() {\n int yh,ya,yd;\n int mh,ma,md;\n int h,a,d;\n int lh,la,ld;\n int i,j,k,cost,min=999999999,yaa=0;\n scanf(\"%d %d %d\",&yh,&ya,&yd);\n scanf(\"%d %d %d\",&mh,&ma,&md);\n scanf(\"%d %d %d\",&h,&a,&d);\n \n lh=(lh>10)?8000/h:800;\n la=(la>10)?8000/a:800;\n ld=(ld>10)?8000/d:800;\n if(ya<=md) yaa=md-ya+1;\n// printf(\"%d %d %d\\n\",lh,la,ld);\n for(i=0;ilTime(mh,ya+j,md)) {\n cost=i*h+j*a+k*d;\n if(cost\n\n#define Max 200\nshort Life[Max+1][Max+1][Max+1];\n\nint chkLT(int a,int b,int c) {\n if(a<=Max&&b<=Max&&c<=Max) return Life[a][b][c];\n else if(c>=b) return 99999;\n else return (a-1)/(b-c);\n}\n\nint main() {\n int yh,ya,yd;\n int mh,ma,md;\n int h,a,d;\n int i,j,k,cost,min=99999,yaa=0;\n int lh=1000,la=1000,ld=1000;\n scanf(\"%d %d %d\",&yh,&ya,&yd);\n scanf(\"%d %d %d\",&mh,&ma,&md);\n scanf(\"%d %d %d\",&h,&a,&d);\n\n for(i=1;i<=Max;i++)\n for(j=1;j<=Max;j++)\n for(k=1;k<=Max;k++)\n if(k>=j) Life[i][j][k]=99999;\n else Life[i][j][k]=(i-1)/(j-k);\n//printf(\"%d %d\\n\",Life[10][5][2],Life[10][6][1]);\n lh=(h>5)?lh/h:1000;\n la=(a>5)?la/a:1000;\n ld=(d>5)?ld/d:1000;\n\n for(i=0;i<=lh;i++){\n for(j=yaa;j<=la;j++) {\n for(k=0;k<=ld;k++) {\n if(chkLT(yh+i,ma,yd+k)>chkLT(mh,ya+j,md)) {\n cost=i*h+j*a+k*d;\n if(cost\n#include\n#include\n#include\n#include\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n else\n return b;\n}\nlong long int ar[2000005],flag[2000005];\nint main()\n{\n long long int a,b,val,val1,val2,i,j,ans,mod=1000000007,k;\n scanf(\"%lld %lld\",&a,&b);\n val1=min(a,b);\n val=sqrt(2*(a+b));\n if((val*(val+1))/2>(a+b))\n val--;\n val2=(val*(val+1))/2-max(a,b);\n if(val1>val2)\n {\n val2=val1+val2-(val1=val2);\n }\n //printf(\"%lld \",val);\n if(val1<0)\n val1=0;\n //printf(\"%lld %lld \",val,val2);\n //long long int ar[val2+1],flag[val2+1];\n for(i=0;i<=val2;i++)\n ar[i]=0;\n if(val2>min(a,b))\n val2=min(a,b);\n if(val*(val+1)<2*max(a,b))\n i=0;\n else\n i=1;\n for(i=0;i<=val;i++)\n {\n for(k=1;k<=val2;k++)\n flag[k]=0;\n for(j=1;j<=val2;j++)\n {\n if(j-i>0&&ar[j-i]>0&flag[j-i]==0)\n {\n ar[j]=ar[j]+ar[j-i];\n flag[j]=1;\n if(ar[j]>mod)\n ar[j]=ar[j]%mod;\n }\n }\n if(i<=val2)\n ar[i]++;\n if(ar[i]>mod)\n ar[i]=ar[i]%mod;\n //for(k=1;k<=val2;k++)\n //printf(\"%lld \",ar[k]);\n //printf(\"\\n\");\n }\n ans=0;\n for(i=val1;i<=val2;i++)\n {\n ans=ans+ar[i];\n if(ans>mod)\n ans=ans%mod;\n }\n printf(\"%lld\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "16a3fe9ba5b97ed65aef4f5bf21ecfd5", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n else\n return b;\n}\nlong long int ar[2000005],flag[2000005];\nint main()\n{\n long long int a,b,val,val1,val2,i,j,ans,mod=1000000007,k;\n scanf(\"%lld %lld\",&a,&b);\n val1=min(a,b);\n val=sqrt(2*(a+b));\n val2=(val*(val+1))/2-max(a,b);\n if(val1>val2)\n {\n val2=val1+val2-(val1=val2);\n }\n //printf(\"%lld %lld \",val,val2);\n //long long int ar[val2+1],flag[val2+1];\n for(i=0;i<=val2;i++)\n ar[i]=0;\n for(i=1;i<=val;i++)\n {\n for(k=1;k<=val2;k++)\n flag[k]=0;\n for(j=1;j<=val2;j++)\n {\n if(j-i>0&&ar[j-i]>0&flag[j-i]==0)\n {\n ar[j]=ar[j]+ar[j-i];\n flag[j]=1;\n if(ar[j]>mod)\n ar[j]=ar[j]%mod;\n }\n }\n if(i<=val2)\n ar[i]++;\n if(ar[i]>mod)\n ar[i]=ar[i]%mod;\n //for(k=1;k<=val2;k++)\n //printf(\"%lld \",ar[k]);\n //printf(\"\\n\");\n }\n ans=0;\n for(i=val1;i<=val2;i++)\n {\n ans=ans+ar[i];\n if(ans>mod)\n ans=ans%mod;\n }\n printf(\"%lld\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1bc07a47b45f91c9762aded2163ac8c6", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAX 200010\n#define MOD 1000000007\n\nusing namespace std;\n\nint n, m, h, sum[1010], dp[MAX][2];\n\nvoid Pregenerate(){\n int i, j, l, res, x = 0;\n for (i = h; i >= 0; i--){\n sum[i] = x;\n x += i;\n }\n\n for (l = 0; l <= h; l++){\n for (i = n; i >= 0; i--){\n j = sum[l] - i;\n if (i > sum[l]) continue;\n if (j > m) continue;\n\n\n if (!l) res = 1;\n else{\n res = 0;\n if ((i + l) <= n) res = res + dp[i + l][(l - 1) & 1];\n if ((j + l) <= m) res = res + dp[i][(l - 1) & 1];\n }\n\n if (res >= MOD) res -= MOD;\n dp[i][l & 1] = res;\n }\n }\n}\n\nint main(){\n int i, j;\n\n while (scanf(\"%d %d\", &n, &m) != EOF){\n for (h = 0; h <= 1000; h++){\n int x = (h * (h + 1)) >> 1;\n if (x > (n + m)){\n h--;\n break;\n }\n }\n\n Pregenerate();\n int res = dp[0][h & 1];\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3c0bd6f10638a3b639db3f24bd27858a", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \nlong long int mmax(long long int a,long long int b){\n if(a>b) return a;\n else return b;\n}\nlong long int fun(long long int i){\n return (i*(i+1))/2;\n}\nlong long int target;\nlong long int binSearch(long long int i,long long int j){\n long long int mid;\n while (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}\nlong long int min(long long int a,long long int b)\n{\n if(ab)\n return a;\n else\n return b;\n}\nint main()\n{\n long long int a,b,val,val1,val2,i,j,ans,mod=1000000007,k;\n scanf(\"%lld %lld\",&a,&b);\n val1=min(a,b);\n val=sqrt(2*(a+b));\n val2=(val*(val+1))/2-max(a,b);\n if(val1>val2)\n {\n val2=val1+val2-(val1=val2);\n }\n //printf(\"%lld %lld \",val,val2);\n long long int ar[val2+1],flag[val2+1];\n for(i=0;i<=val2;i++)\n ar[i]=0;\n for(i=1;i<=val;i++)\n {\n for(k=1;k<=val2;k++)\n flag[k]=0;\n for(j=1;j<=val2;j++)\n {\n if(j-i>0&&ar[j-i]>0&flag[j-i]==0)\n {\n ar[j]=ar[j]+ar[j-i];\n flag[j]=1;\n if(ar[j]>mod)\n ar[j]=ar[j]%mod;\n }\n }\n if(i<=val2)\n ar[i]++;\n if(ar[i]>mod)\n ar[i]=ar[i]%mod;\n //for(k=1;k<=val2;k++)\n //printf(\"%lld \",ar[k]);\n //printf(\"\\n\");\n }\n ans=0;\n for(i=val1;i<=val2;i++)\n {\n ans=ans+ar[i];\n if(ans>mod)\n ans=ans%mod;\n }\n printf(\"%lld\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3c2cc9025f150cdb9e29264c09dd2a3a", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n char s[200];\n int k=0,len=0,index=0,i=0,flag=2,count1;count2;\n scanf(\"%s\",s);\n len=strlen(s);\n scanf(\"%d\",&k);\n if((len+k)%2!=0&&len!=0) { index++;}\n while(index=len) {flag=0;break;}\n index+=2;\n }\n count1=len+k-index-flag;\n index=0;flag=2,k=0;\n if((len+k)%2!=0&&len!=0) { index++;}\n while(index=len) {flag=0;break;}\n index+=2;\n }\n count2=len+k-index-flag;\n if(count1\n#include\n\nint tandem(int , int );\nchar s[401];\nint k,count;\nint main(void)\n{\n int i,j,len,max=0;\n scanf(\"%s %d\",s,&k);\n len=strlen(s);\n for(i=len,j=0;j\n#include\n#include\nint main()\n{\n int i,j,k,l,m,temp,res=0,max=0;\n char s[300],in[10];\n scanf(\"%s\",s);\n scanf(\"%s\",in);\n k=atoi(in);\n l=strlen(s);\n if(k>=l)\n printf(\"%d\\n\",((k+l)/2));\n else\n {\n for(i=0;i=1;j--)\n {\n temp=0;\n for(m=i;m=l)\n break;\n if(s[i]!=s[m+j])\n {temp=-1;break;}\n }\n if(temp==0 && j>max)\n max=j;\n }\n }\n if(max>k)\n printf(\"%d\\n\",2*max);\n else\n printf(\"%d\\n\",2*k);\n }\n return 0;\n}#include \n\nint main(void) {\n\t// your code goes here\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6a52039f731bb7bb278638ce4a6c895d", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n char s[200];\n int k=0,len=0,index=0,i=0,flag=0;\n scanf(\"%s\",s);\n len=strlen(s);\n scanf(\"%d\",&k);\n if((len+k)%2!=0) { index++;}\n while(1)\n {\n int mid=index+ (len+k-index)/2;\n for(i=0;mid+i\n#include \n#include \n\nint ktra(char s[], int start, int end, int u, int n)\n{\n int i;\n for (i = start; i < start + u; i++)\n {\n if (s[i] != s[i + u] && i + u <= n - 1)\n break;\n }\n if (i >= start + u)\n return 1;\n else return 0;\n}\n\nint kqua(char s[], int k)\n{\n int n, u, start, end;\n n = strlen(s);\n u = (n + k) / 2;\n if (n > k)\n {\n for (; u >= k; u--)\n {\n start = 0; end = 2*u - 1;\n while (end <= n + k - 1)\n {\n if (ktra(s, start, end, u, n))\n break;\n else\n {\n start++; end++;\n }\n }\n if (end <= n + k - 1)\n return 2 * u;\n }\n }\n else return 2 * u;\n}\n\n\nint main()\n{\n char s[100];\n int k;\n scanf(\"%s\", &s);\n scanf(\"%d\", &k);\n printf(\"%d\", kqua(s, k));\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "78ec5de8cd1654da5d22de4e7c1d56e9", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n,a,b,i;\n\n scanf(\"%d %d %d\", &n, &a, &b);\n \n for (i=1; i<=a && i<=b && (a/i + b/i >= n); x++);\n \n printf(\"%d\", x - 1);\n \n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e48882f490aed70b8f2924dc191c503", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "GNU C11", "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 / m;\n\t\t y = b / (n - m);\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c614b923b5e9f32fe18195860a73b99", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c565389b5cdf9400c38ecc3f0a1a6785", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n,a,b,i;\n\n scanf(\"%d %d %d\", &n, &a, &b);\n \n for (i=1; i<=a && i<=b && (a/i + b/i >= n); i++);\n \n printf(\"%d\", x - 1);\n \n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "df5421d767a0432acdbc092041863599", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "GNU C11", "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}*/\nint a[1550]\nint main(){\n\tint n ,i ,j;\n\ts(n);\n\tFor(i ,n)\ts(a[i]);\n\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "051b8fb638cc1c7451597457be70dd86", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "include\n#include\nint min(int a,int b)\n{\n\tif(a>b)\n\treturn b;\n\telse\n\treturn a;\n}\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n+1];\n\t\n\tint i,x,y;\n\tx=n;\n\tfor(i=0;i<=n;i++)\n\ta[i]=INT_MAX;\n\ta[0]=0;\n\tint t;\n\t//int q=11;\n\tfor( i=1;i<=9;i++)\n\ta[i]=1;\n\tfor(i=10;i<=n;i++)\n\t{\n\t\tx=i;\n\t\twhile(x/10!=0)\n\t\t{\n\t\t//\tprintf(\"iii\");\n\t\t\ty=x%10;\n\t\t//\tprintf(\"%d\\n\",y);\n\t\t\tif(y!=0)\n\t\t\ta[i]=min(a[i-y]+1,a[i]);\n\t\t\tx=x/10;\n\t\t//\tprintf(\"%d\\n\",x);\n\t\t}\n\t\ty=x%10;\n\t\tif(y!=0)\n\t\t\ta[i]=min(a[i-y]+1,a[i]);\n\t\t\n\t}\n\tprintf(\"%d\",a[n]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cbebb52272c331ea737ec541e2ad4b56", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "k", "lang_cluster": "C", "compilation_error": true, "code_uid": "2c3af4f0b1ec48c43dc373061a37a14c", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "kk", "lang_cluster": "C", "compilation_error": true, "code_uid": "00fc52fe611fefce49c5d075fa828107", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n int main() \n { \n int n, m, large=0, rem;\n int counter=0; \n scanf(\"%d\", &n); \n for(; n!=0; counter++) \n { large = 0; m = n;\n while(m) \n { rem = m%10;\n if(rem > large) large = rem;\n m = m/10; }\n n = n-large; }\nprintf(\"%d\\n\", counter);\ngetch();\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5b1839fd18a0278e67e8fd6d2c0cdd4c", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n int main() \n { \n int n, m, large=0, rem;\n int counter=0; \n scanf(\"%d\", &n); \n for(; n!=0; counter++) \n { large = 0; m = n;\n while(m) \n { rem = m%10;\n if(rem > large) large = rem;\n m = m/10; }\n n = n-large; }\nprintf(\"%d\\n\", counter);\ngetch();\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cba6500283077b215925b5f3b4a59b98", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\n#include\nlong long int min(long long int a,long long int b)\n{\n if(a\n#include \n#include \n\nint main(){\n long long int n, a, b, c;\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: long long int x = a + b;\n if (x > (a + a + a)) x = a + a + a;\n else if (x > c) x = c\n printf(\"%I64d\\n\", x); break;\n case 2: long long int x = c + c + a + a + a;\n if (x > (a + a)) x = a + a;\n else if (x > b) x = b;\n printf(\"%I64d\\n\", x); break;\n case 3: long long int x = c + b;\n if (x > a) x = a;\n printf(\"%I64d\\n\", x); break; \n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c7679bfe2a3ed2b6c65f7fe394045b09", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0} {"lang": "GNU C11", "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)\nint main()\n{\n int n,a,b,c;\n int ans;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n switch((n%4))\n {\n case 0 : ans=0; break;\n case 3 : ans=a < b+c ? a: b+c ;\n ans= ans < 3*c ? ans = 3*c;\n break;\n case 2 : ans= 2*a > b ? b : 2*a ;\n ans = ans < 2*c ? ans : 2*c ;\n break;\n default: ans= 2*a > b ? b+a : 3*a ;\n ans= ans > c ? c : ans ;\n };\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0fc3254ce43137c39deefa729816e1c5", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "167e34aaade2ea5ee885d47db9690df1", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n \nusing namespace std;\n \n#define mp make_pair\n#define pb push_back\n#define nd second\n#define st first\n#define endl '\\n'\n#define endll cout< pii;\ntypedef pair < lli,lli > plli;\nconst int MAX = 1e5+7;\nint main()\n{\n\tlong long int a[50]={ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472, 258944, 517888, 1035776, 2071552, 4143104, 8286208, 16572416, 33144832, 66289664, 132579328, 265158656, 530317312, 1060634624, 2121269248, 4242538496, 8485076992, 16970153984, 33940307968};\n\tint n;\n\tcin>>n;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7e3913c0312c4577843e5d3520c7519f", "src_uid": "76f6ebfaeea789952c931d65c6a5fdff", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "int main()\n{\n\n int n;\n long long a[36] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472, 258944, 517888, 1035776, 2071552, 4143104, 8286208, 16572416, 33144832, 66289664, 132579328, 265158656, 530317312, 1060634624, 2121269248, 4242538496, 8485076992, 16970153984, 33940307968 };\n scanf(\"%d\",&n);\n printf(\"%I64d\",a[n]);\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "83c1e0286e4678252b83526484ee360e", "src_uid": "76f6ebfaeea789952c931d65c6a5fdff", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n long long a;\n scanf(\"%I64d\",&a);\n p=pow(2,a);\n printf(\"%I64d\\n\",p);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "36abf660a218a61a932ec223e6962c3c", "src_uid": "76f6ebfaeea789952c931d65c6a5fdff", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e7f7e2b9aeb64d7bada12ed894d33585", "src_uid": "76f6ebfaeea789952c931d65c6a5fdff", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n cin>>a;\n print(\"%d\",pow(2,a));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8633163487e77b8f0f500fe7cbeae49c", "src_uid": "76f6ebfaeea789952c931d65c6a5fdff", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#define M 1000000007\n__int64 fastpow(int a,__int64 n){\n __int64 ans;\n if(n==0) return 1;\n if(n==1) return a%M;\n ans=fastpow(a,n/2)%M;\n ans=(ans*ans)%M;\n if(n%2==1)\n ans=((ans%M)*(a%M))%M;\n return ans%M;\n}\nint main(){\n __int64 ans;\n __int64 n;\n while(scanf(\"%I64d\",&n)!=EOF){\n if(n==0)\n printf(\"1\\n\");\n else{\n ans=(fastpow(2,n-1)%M+(2*(fastpow(4,n-1)%M))%M)%M;\n printf(\"%I64d\\n\",ans);\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "71bcd24364e7ee8d4578d133bfa52d8d", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\n__int64 pows(__int64 x, __int64 n)\n{\n if(n == 1)\n return x;\n __int64 ans=pows(x,n/2) % 1000000007;\n if(n & 1)\n return (ans * ans * x) % 1000000007;\n else\n return (ans * ans) % 1000000007;\n}\n\nint main()\n{\n __int64 n;\n while(~scanf(\"%I64d\", &n))\n {\n if(n == 0)\n {\n printf(\"1\\n\");\n continue;\n }\n __int64 u = pows(2, n)% 1000000007;\n u = (u * (u + 1) / 2) % 1000000007;\n printf(\"%I64d\\n\", u);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e33e638de1ac075466a904fb6153be91", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#define MAX 1000000007\nlong long i,n,y=1,temp,temp2,a=0;\nlong long int pow(long long int a){\n\tif(!a) return 1;\n\n\ttemp = pow(a/2);\n\ttemp = (temp*temp) % MAX;\n\tif(a%2 == 1) temp*=2 % MAX;\n\treturn temp;\n}\nint main(){\n\tscanf(\"%lld\",&n);\n\tn = pow(n);\n\tprintf(\"%lld\",(n*(n+1)/2)%MAX);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "abdff968e26cae9d0799cb4f885ebbfa", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nconst long long mod = 1000000007;\n\nlong long\npower(long long a, long long b)\n{\n if(b == 0){\n return 1;\n }\n if(b % 2 == 0){\n long long l = power(a, b / 2);\n l = (l * l) % mod;\n return l;\n } else {\n long long l = (power(a, b - 1) * a) % mod;\n return l;\n }\n}\n\nint\nmain(void)\n{\n long long n;\n if(n == 0){\n printf(\"1\");\n return 0;\n }\n scanf(\"%I64d\", &n);\n long long ans = power(2, n - 1);\n long long ans2 = (ans * 2 + 1) % mod;\n ans = (ans * ans2) % mod;\n printf(\"%I64d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3550b82658d8e9e1a15f8863c3bf6924", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\n__int64 pows(__int64 x, __int64 n)\n{\n\tif(n == 1)\n\t\treturn x;\n\t__int64 ans=pows(x,n/2) % 1000000007;\n\tif(n & 1)\n\t\treturn (ans * ans * x) % 1000000007;\n\telse\n\t\treturn (ans * ans) % 1000000007;\n}\n\nint main()\n{\n\t__int64 n;\n\twhile(~scanf(\"%I64d\", &n))\n\t{\n\t\t__int64 u = pows(2, n)% 1000000007;\n\t\tu = (u * (u + 1) / 2) % 1000000007;\n\t\tprintf(\"%I64d\\n\", u);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "eb1a00f8aa14213a52156cad6eea0ebd", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(void)\n{\n char map[4][4], x, temp[5];\n int c = 0;\n \n for(int i = 0; i < 4; i++)\n {\n scanf(\"%s\", map[i]);\n }\n \n for(int i = 0; i < 4; i++)\n {\n for(int j = 0; j < 4; j++)\n {\n if (map[i][j] == '.')\n {\n map[i][j] = 'x';\n }\n }\n }\n \n \n for(int i = 0; i < 4; i++)\n {\n for(int j = 0; j < 4; j++)\n {\n temp[j] = map[i][j];\n }\n temp[4] = 0;\n if (strcmp(temp, \"xxxx\") == 0)\n {\n c++;\n }\n }\n for(int i = 0; i < 4; i++)\n {\n for(int j = 0; j < 4; j++)\n {\n temp[j] = map[j][i];\n }\n temp[4] = 0;\n if (strcmp(temp, \"XXXX\") == 0)\n {\n c++;\n }\n }\n \n for(int i = 0; i < 4; i++)\n {\n temp[i] = map[i][i];\n }\n if (strcmp(temp, \"XXXX\") == 0)\n {\n c++;\n }\n for(int i = 0; i < 4; i++)\n {\n temp[i] = map[i][3 - i];\n }\n if (strcmp(temp, \"xxxx\") == 0)\n {\n c++;\n }\n \n \n \n if (c == 0)\n {\n puts(\"NO\");\n }\n else\n {\n puts(\"YES\");\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "67f516f319b47e9bcde823fa191b23a8", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint num[4][4] = { 0 };\n\nint ok(int a, int b)\n{\n\tint i, cnt = 0;\n\n\tfor (i = a - 2; i <= a + 2; i++)\n\t{\n\t\tif (i < 0)\n\t\t\tcontinue;\n\t\telse if (i > 3)\n\t\t\tbreak;\n\t\telse if (num[i][b] == 1)\n\t\t\tcnt++;\n\t\telse if (num[i][b] != 1 && cnt > 0 && cnt != 3)\n\t\t{\n\t\t\tcnt = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (cnt == 3)\n\t\treturn 1;\n\telse\n\t\tcnt = 0;\n\n\tfor (i = b - 2; i <= b + 2; i++)\n\t{\n\t\tif (i < 0)\n\t\t\tcontinue;\n\t\telse if (i > 3)\n\t\t\tbreak;\n\t\telse if (num[a][i] == 1)\n\t\t\tcnt++;\n\t\telse if (num[a][i] != 1 && cnt > 0 && cnt != 3)\n\t\t{\n\t\t\tcnt = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (cnt == 3)\n\t\treturn 1;\n\telse\n\t\tcnt = 0;\n\n\tfor (i = -2; i <= 2; i++)\n\t{\n\t\tif (a + i < 0 || b + i < 0)\n\t\t\tcontinue;\n\t\telse if (a + i > 3 || b + i > 3)\n\t\t\tbreak;\n\t\telse if (num[a + i][b + i] == 1)\n\t\t\tcnt++;\n\t\telse if (num[a + i][b + i] != 1 && cnt > 0 && cnt != 3)\n\t\t{\n\t\t\tcnt = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (cnt == 3)\n\t\treturn 1;\n\telse\n\t\tcnt = 0;\n\n\treturn 0;\n}\n\nint dfs(int a, int b)\n{\n\tif (a == 4)\n\t\treturn 0;\n\telse if (b == 4)\n\t\treturn dfs(a + 1, 0);\n\telse if (num[a][b] == 2 || num[a][b] == 1)\n\t\treturn dfs(a, b + 1);\n\telse\n\t{\n\t\tnum[a][b] = 1;\n\t\tif (ok(a, b))\n\t\t\treturn 1;\n\t\tnum[a][b] = 0;\n\t\treturn dfs(a, b + 1);\n\t}\n}\n\nint main(void)\n{\n\tint i, j;\n\tchar temp;\n\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\", &temp);\n\t\t\tif (temp == 'x')\n\t\t\t\tnum[i][j] = 1;\n\t\t\telse if (temp == 'o')\n\t\t\t\tnum[i][j] = 2;\n\t\t}\n\t\tgetchar();\n\t}\n\tif (dfs(0, 0))\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e32f8010c11c3ce9e1bc87d66758b8c4", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#define MAX 6\n\nint threeRow(char arr[MAX][MAX]);\n\nint main(void) {\n\t\n\tchar aux,ticTac[MAX][MAX];\n\tint i,j;\n\t\n\tfor (i=0;icountO){\n temp='o';\n }\n else if (countX\n#include\n#include\n#include\n#define ll long long int\n#define M 1000000007\n#define rep(i,a,b,c) for(i=a;i=b;i=i-c)\n#define test long long int t;scanf(\"%lld\",&t);while(t--)\n#define pi(a) printf(\"%lld\\n\",a)\n#define psi(a) printf(\"%lld \",a)\n#define pc(a) printf(\"%c\\n\",c)\n#define ps(a) printf(\"%s\\n\",s)\n#define si(a) scanf(\"%lld\",&a)\n#define sf(a) scanf(\"%f\",&a)\n#define sc(a) scanf(\"%c\",&c)\n#define ss(a) scanf(\"%s\",a)\n#define min(a,b) (a=0){s=1;}\n else if(s1[i][j+1]=='x'&&s1[i][j+2]=='x'&&j+2<4){s=1;}\n else if(s1[i][j-1]=='x'&&s1[i][j-2]=='x'&&j-2>=0){s=1;}\n else if(s1[i+1][j+1]=='x'&&s1[i+2][j+2]=='x'&&j+2<4&&i+2<4){s=1;}\n else if(s1[i-1][j-1]=='x'&&s1[i-2][j-2]=='x'&&j-2>=0&&i-2>=0){s=1;}\n else if(s1[i+1][j-1]=='x'&&s1[i+2][j-2]=='x'&&j-2>=0&&i+2<4)s=1;\n else if(s1[i-1][j+1]=='x'&&s1[i-2][j+2]=='x'&&j+2<4&&i-2>=0)\n }\n else if(s1[i][j]=='x')\n {\n if(((s1[i+1][j]=='.'&&s1[i+2][j]=='x')||(s1[i+1][j]=='x'&&s1[i+2][j]=='.'))&&i+2<4){s=1;}\n else if(((s1[i-1][j]=='.'&&s1[i-2][j]=='x')||(s1[i-1][j]=='x'&&s1[i-2][j]=='.'))&&i-2>=0){s=1;}\n else if(((s1[i][j+1]=='.'&&s1[i][j+2]=='x')||(s1[i][j+1]=='x'&&s1[i][j+2]=='.'))&&j+2<4){s=1;}\n else if(((s1[i][j-1]=='.'&&s1[i][j-2]=='x')||(s1[i][j-1]=='x'&&s1[i][j-2]=='.'))&&j-2>=0){s=1;}\n\n else if((s1[i+1][j+1]=='.'&&s1[i+2][j+2]=='x')||(s1[i+1][j+1]=='x'&&s1[i+2][j+2]=='.')){if(j+2<4&&i+2<4){s=1;}}\n else if((s1[i-1][j-1]=='.'&&s1[i-2][j-2]=='x')||(s1[i-1][j-1]=='x'&&s1[i-2][j-2]=='.')){if(j-2>=0&&i-2>=0){s=1;}}\n\n else if((s1[i-1][j+1]=='.'&&s1[i-2][j+2]=='x')||(s1[i-1][j+1]=='x'&&s1[i-2][j+2]=='.')){if(i-2>=0&&j+2<4)s=1;}\n else if((s1[i+1][j-1]=='.'&&s1[i+2][j-2]=='x')||(s1[i+1][j-1]=='x'&&s1[i+2][j-2]=='.')){if(j-2>=0&&i+2<4)s=1;}\n }\n }\n}\nif(s==1)printf(\"YES\\n\");\nelse printf(\"NO\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "af8fecff13b1fd74f4aa1f01ce6e9d70", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{double a, b, c, d, x, y, a1, a2, p, q;\n scanf(\"%lf %lf %lf %lf\", &a, &b, &c, &d);\nx =(a - (a/250)*c);\ny =(b - (b/250)*d);\na1 =(3*a)/10;\nb2 =(3*b)/10;\np=max(x,a1);\nq=max(y,b1); \nif(pq)\n {\n printf(\"Misha\");\n }\n else if (p==q)\n {\n printf(\"Tie\");\n\n }\n return 0;\n}\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7a419135e11365d360b3178a98eac94c", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{int a, b, c, d, x, y, m, n, o, p;\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\nm =(a - (a/250)*c);\nn =(b - (b/250)*d);\no =(3*a)/10;\np =(3*b)/10;\n\n if(m>o)\n {\n x=m;\n }\n else if(mp){\n {\n y=n;\n }\n else if(ny){\n printf(\"Misha\");\n }\n else if(y>x){\n printf(\"Vasya\");\n }\n else if (x==y){\n printf(\"Tie\");\n }\n \n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e13c1fac8c5a5e6d277ce636a4afbe88", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n main()\n{double a, b, c, d, x, y, m, n, o, p;\n scanf(\"%lf %lf %lf %lf\", &a, &b, &c, &d);\nm =(a - (a/250)*c);\nn =(b - (b/250)*d);\no =(3*a)/10;\np =(3*b)/10;\n\n if(m>o)\n {\n x=m;\n }\n else if(mp){\n {\n y=n;\n }\n else if(ny){\n printf(\"Misha\");\n }\n else if(y>x){\n printf(\"Vasya\");\n }\n else if (x==y){\n printf(\"Tie\");\n }\n return 0;\n }\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "04ba3878b0e5dc3fdbc9e0090968d0d8", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nint main()\n{\n\tint a, b, c, d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tint xxx, yy;\n\txxx = 75 * a > 250 * a - a*c ? 75 * a : 250 * a - a*c;\n\tyy = 75 * b> 250 * b - b*d? 75 * b: 250 * b - b*d;\n\tif (xxx > yy)printf(\"Misha\\n\");\n\telse if (xxx == yy)printf(\"Tie\\n\");\n\telse printf(\"Vasya\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1eddcdadac41bd57454e5097c0f4214", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid main()\n{\nint a,b,c,d,e,f;\nprintf(\"\\nEnter points and timings of Misha and Vasya resp.:\");\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\ne=a-(a/250)*c;\nf=b-(b/250)*d;\nif(e>f)\n{\nprintf(\"\\nMisha\");\n}\nelseif(e\nint main()\n{\n int c,v,v1,a,l,i=0,s=0;\n scanf(\"%d %d %d %d %d\",&c,&v,&v1,&a,&l);\n while(1)\n {\n\n\n\n s=s+(v+(a*i));\n if(i!=0)\n {\n s=s-l;\n }\n if(s>=v1)\n {\n s=v1;\n }\n i++;\n if(s==c)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f974d3e53c3a7d82358b2342baaeb7d1", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint c,vo,term,v1,a,l,ans=1,sum;\n\tscanf(\"%d%d%d%d%d\",&c,&vo,&v1,&a,&l);\n\tsum=vo;\n\tterm=vo+a-l;\n\twhile(sum\nint main()\n{\n int c,v0,v1,a,l,m=0,i=0;\n scanf(\"%d%d%d%d%d\",&c,&v0,&v1,&a,&l);\n while(c>0)\n {\n if(m\nint main (void){\n int pages,init,max,acc,reread;\n scanf(\"%d %d %d %d %d\",&pages,&init,&max,&acc,&reread)\n int days=0,read=0,speed;\n for(days=1;1==1;days++){\n speed=init+(days-1)*acc;\n if(speed=pages)\n break;\n read=read-reread;\n }\n printf(\"%d\",days);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "61f0b8826e26a632f2033ad7729d008c", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nvoid main(){\n int c, v0, v1, a, l;\n scanf(\"%d%d%d%d%d\", &c, &v0, &v1, &a, &l);\n int pages = v0;\n int days = 1;\n c = c - pages;\n while (c>0){\n days += 1;\n pages = pages + a;\n if (pages>v1){\n pages = v1;\n }\n c = c + l - (pages);\n }\n printf(\"%d\", days);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "052f595a453198c9651b29276602f65d", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n long int x1,y1,x2,y2,x,y,k1,k2,flag=0;\n scanf(\"%ld%ld%ld%ld\",&x1,&y1,&x2,&y2);\n scanf(\"%ld%ld\",&x,&y);\n if((abs(x2-x1)%x==0)&&(abs(y2-y1)%y==0))\n {\n k1=abs(x2-x1)/x;\n k2=abs(y2-y1)/y;\n if(k1==k2)flag=1;\n else if((k1%2==0)&&(k2%2==0))flag=1;\n else if((k1%2!=0)&&(k2%2!=0))flag=1;\n\n }\n if(flag==1)printf(\"Yes\\n\");\n else if(flag==0)printf(\"No\\n\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e9669457c5d27b1e1dd1a4301db24cb", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint abs(int a)\n{\n return a < 0 ? -1 : a;\n}\nint main()\n{\n int x1,y1,x2,y2,x,y;\n scanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\n int x0 = abs(x1-x2);\n int y0 = abs(y1-y2);\n scanf(\"%d %d\",&x,&y);\n if(x0%x != 0 || y0%y != 0)\n printf(\"NO\\n\");\n else\n {\n if((x0/x)%2 == (y0/y)%2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "77730db6d85684eb163803d8e327b222", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int x1,x2,y1,y2,x,y,a,b;\n scanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\n scanf(\"%d %d\",&x,&y);\n\n a=abs(x2-x1);\n b=abs(y2-y1);\n\n if(a%x!=0||b%y!=0)\n {\n printf(\"NO\\n\");\n }\n\n else if((a/x)%2==(b/y)%2)\n {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b5df01fb96d05e99adf33021a48d6223", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "`````````````2222222222222222222222222222222222222222222222222222\n \t\t \t \t\t \t \t\t\t \t \t\t\t \t\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "717a172120d6b55e5d4e906721c31e27", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main()\n{\n int x1,y1,x2,y2,x,y;\n scanf(\"%d %d %d %d\",x1,y1,x2,y2);\n int n,m;\n n=abs(x1-x2);\n m=abs(y1-y2);\n if((n==0&&m%y==0)||(m==0&&n%x==0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab9d0eb7f4a24d242f696e91fd4fea4e", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint i;\n\tint l[4],s[4],r[4],p[4];\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%d\",&l[i]);\n\t\tscanf(\"%d\",&s[i]);\n\t\tscanf(\"%d\",&r[i]);\n\t\tscanf(\"%d\",&p[i]);\n\t}\n\n\tfor(i=0;i<4;i++)\n\t{\n\t\tif(p[i]==1)\n\t\t{\n\t\t\tif(l[i]==1||s[i]==1||r[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\t}\n\t}\n\t\n\tprintf(\"NO\\n\");\n\treturn 0;\n\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "53462402db9babf23c5ecfbc0d172996", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong a,b,c,d,r1,r2,r3,r4,f1,f2,f3,f4;\n\tr1=0,r2=0,r3=0,r4=0;\n\tscanf(\"%ld %ld %ld %ld\",&a,&b,&c,&f1);\n\tr4+=a;\n\tr3+=b;\n\tr2+=c;\n\tscanf(\"%ld %ld %ld %ld\",&a,&b,&c,&f2);\n\tr1+=a;\n\tr4+=b;\n\tr3+=c;\n\tscanf(\"%ld %ld %ld %ld\",&a,&b,&c,&f3);\n\tr2+=a;\n\tr1+=b;\n\tr4+=c;\n\tscanf(\"%ld %ld %ld %ld\",&a,&b,&c,&f4);\n\tr3+=a;\n\tr2+=b;\n\tr1+=c;\n\tif((f1==1 && r1>0) || (f2==1 && r2>0) || (f3==1 && r3>0) || (f4==1 && r4>0))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "04e4e353b96647cc4624f1bdb05686e9", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int i,j,ara[4][4];\n for(i=0; i<4; i++)\n {\n for(j=0; j<4; j++)\n scanf(\"%d\",&ara[i][j]);\n }\n /* for(i=0; i<4; i++)\n {\n for(j=0; j<4; j++)\n printf(\"%d\",ara[i][j]);\n }*/\n\n if(ara[0][3]==1 && (ara[0][0]==1 || ara[3][0]==1 || ara[2][1]==1 || ara[1][2]==1))\n printf(\"YES\");\n else if(ara[3][3]==1 && (ara[0][0]==1 || ara[3][0]==1 || ara[2][2]==1 || ara[1][1]==1))\n printf(\"YES\");\n else if(ara[1][3]==1 && (ara[0][2]==1 || ara[2][2]==1 || ara[3][1]==1 || ara[1][0]==1))\n printf(\"YES\");\n else if(ara[2][3]==1 && (ara[2][0]==1 || ara[3][2]==1 || ara[0][1]==1 || ara[1][2]==1))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0c3211244385f92a1ee6a689c182aa2c", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{int a[4][4],i,k,j;\n\tfor(i=0;i<4;i++)\n\tfor(j=0;j<4;j++)\n\tscanf(\"%d\",&a[i][j]);\n\tfor(i=0;i<4;i++)\n\tif(a[i][3]==1)\n {\tk=i;break;}\n \n if(a[(k+1)%4][0]==1||a[(k+2)%4][1]==1||a[(k+3)%4][2]==1||a[k][0]==1||a[k][1]==1||a[k][2]==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6248b31c1510246bdfb9325b0998c9a", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\nconst int size =4;\n\nvoid analyze(int input[][size]){\n if((input[0][3] == input[1][0] ||input[0][3] == input[2][1] || input[0][3] == input[3][2] )&& input[0][3]==1 && input[0][0] != 1 && input[0][1] != 1 && input[0][2] != 1){\n printf(\"YES\");\n return;\n }\n else if((input[1][3] == input[2][0] || input[1][3] == input[3][1] || input[1][3] == input[0][2] )&& input[1][3] == 1 && input[1][0] != 1 && input[1][1] != 1 && input[1][2] != 1){\n printf(\"YES\");\n return;\n }\n else if((input[2][3] == input[3][0] || input[2][3] == input[0][1] || input[2][3] == input[1][2] )&& input[2][3] == 1 && input[2][0] != 1 && input[2][1] != 1 && input[2][2] != 1){\n printf(\"YES\");\n return;\n }\n else if((input[3][3] == input[0][0] || input[3][3] == input[1][1] || input[3][3] == input[2][2] )&& input[3][3] == 1 && input[3][0] != 1 input[3][1] != 1 input[3][2] != 1){\n printf(\"YES\");\n return;\n }\n else{\n printf(\"NO\");\n }\n}\n\nint main(void) {\n int * p;\n int N, i , j;\n int x = 0;\n int input[size][size];\n \n p = &input[0][0];\n \n \n for( i=0 ; i < (size*4) ; i++){\n scanf(\"%d\", (p+i));\n }\n analyze(input);\n printf(\"\\n\");\n \n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9f8b9e7a82c1b67082639d0084ac8413", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define LONG 10\n#define DIG 8\n#include \"cifrado.h\"\n\nint main(){\n\n /* declaraciones de variables */\n char cifrado[LONG*DIG+1];\n char codigoCifrado[LONG][LONG+1];\n \n int i,j,k,h=0;\n \n char cadena[LONG + 1], contrasenia[LONG+1], resultado[LONG+1];\n\n //lectura de datos\n scanf(\"%s\", &cifrado);\n for(i=0; i\n#include \n#include \n#include \nchar *extraer(char *string, int pos, int lh) ;\nint main()\n{\n char *s, digito[10],*puntero;\n gets(s);\n int x;\n for (size_t i = 0; i < sizeof(digito) / sizeof(digito[0]); ++i)\n {\n scanf(\"%c\", &digito[i]);\n }\n for (size_t i = 0; i < 8; ++i)\n {\n puntero = extraer(s,i * 10, 10);\n for (size_t j = 0; j < 10; ++j)\n {\n if (x == digito[j])\n {\n printf(\"%d\",&j);\n break;\n }\n }\n }\n system(\"pause\");\n return 0;\n}\nchar *extraer(char *string, int pos, int lh) \n{\n char *puntero;\n int c;\n \n puntero =(char*) malloc(sizeof (lh+1));\n \n if (puntero == NULL)\n {\n printf(\"Memoria no disponible\");\n exit(-1);\n }\n \n for (c = 0 ; c < pos -1 ; c++) \n string++; \n \n for (c = 0 ; c < lh ; c++)\n {\n *(puntero+c) = *string; \n string++; \n }\n \n *(puntero+c) = '\\0';\n \n return puntero;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d32dd7cc14d64552785c24611634b9a6", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main() \n{\nchar s1[10][11],s2[81],d[2],*ptr;\n int i=2,c=10;\n scanf(\"%s\",s2);\n for( i=0;i<10;i++){\n scanf(\"%s\",s1[i]);\n }\nfor(int j=0;j a2.n )\n return 1;\n\n return 0;\n }\n\n public String toString()\n {\n return \"\" + this.n;\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1ea6d4734d265d95226c2326a501b652", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nstruct Team {\n char name[25];\n int point;\n int score;\n int miss;\n}team[4], tmp_team[4];\n\nvoid swap(int *lhs, int *rhs) {\n int tmp = *lhs;\n *lhs = *rhs;\n *rhs = tmp;\n}\n\nvoid cpy_team() {\n int i;\n for (i = 0; i < 4; ++i) {\n tmp_team[i].point = team[i].point;\n tmp_team[i].score = team[i].score;\n tmp_team[i].miss = team[i].miss;\n strcpy(tmp_team[i].name, team[i].name);\n }\n}\n\nchar hash_s[4][25];\nint hash_idx = 0;\nint hash(const char* str) {\n int i;\n for (i = 0; i < hash_idx; ++i) {\n if (!strcmp(str, hash_s[i])) {\n return i;\n }\n }\n strcpy(hash_s[hash_idx++], str);\n return hash_idx - 1;\n}\n\nint comp(const void *lhs, const void *rhs) {\n struct Team *sa = (struct Team *)lhs;\n struct Team *sb = (struct Team *)rhs;\n if (sa->point != sb->point) {\n return sa->point < sb->point;\n }\n if (sa->score - sa->miss != sb->score - sb->miss) {\n return sa->score - sa->miss < sb->score - sb->miss;\n }\n if (sa->score != sb->score) {\n return sa->score < sb->score;\n }\n return strcmp(sa->name, sb->name) > 0;\n}\n\nint main() {\n //freopen(\"in.txt\", \"r\", stdin);\n int i, j, ia, ib, na, nb, b_id, opp_id, x, y, min = 10000, cnt[4];\n char sa[25], sb[25];\n\n memset(cnt, 0, sizeof(cnt));\n for (i = 0; i < 5; ++i) {\n scanf(\"%s %s %d:%d\", sa, sb, &na, &nb);\n ia = hash(sa);\n ib = hash(sb);\n strcpy(team[ia].name, sa);\n strcpy(team[ib].name, sb);\n ++cnt[ia];\n ++cnt[ib];\n /*printf(\"%d %d %d %d\\n\", na, nb, ia, ib);*/\n if (nb > na) {\n swap(&na, &nb);\n swap(&ia, &ib);\n }\n /*printf(\"%d %d\\n\", na, nb);*/\n if (na > nb) {\n team[ia].point += 3;\n } else if (na == nb) {\n team[ia].point += 1;\n team[ib].point += 1;\n }\n team[ia].score += na;\n team[ia].miss += nb;\n team[ib].score += nb;\n team[ib].miss += na;\n }\n /*for (i = 0; i < 4; ++i) {*/\n /*printf(\"%d %d %d\\n\", team[i].point, team[i].score, team[i].miss);*/\n /*}*/\n /*return 0;*/\n for (i = 0; i < 4; ++i) {\n if (!strcmp(team[i].name, \"BERLAND\")) {\n b_id = i;\n } else if (cnt[i] != 3) {\n opp_id = i;\n }\n }\n\n cpy_team();\n qsort(tmp_team, 4, sizeof(struct Team), comp);\n /*for (i = 0; i < 4; ++i) {*/\n /*printf(\"%s\\n\", tmp_team[i].name);*/\n /*}*/\n /*printf(\"opp_id = %d, b_id = %d\\n\", opp_id, b_id);*/\n /*for (i = 0; i < hash_idx; ++i) {*/\n /*printf(\"%s\\n\", hash_s[i]);*/\n /*}*/\n for (i = 1; i < 100; ++i) {\n for (j = i - 1; j >= 0; --j) {\n cpy_team();\n tmp_team[b_id].point += 3;\n tmp_team[b_id].score += i;\n tmp_team[opp_id].miss += i;\n\n tmp_team[b_id].miss += j;\n tmp_team[opp_id].score += j;\n qsort(tmp_team, 4, sizeof(struct Team), comp);\n if (!strcmp(tmp_team[0].name, \"BERLAND\") || !strcmp(tmp_team[1].name, \"BERLAND\")) {\n if (i - j < min) {\n min = i - j;\n x = i;\n y = j;\n }\n }\n }\n if (min != 10000) {\n printf(\"%d:%d\\n\", x, y);\n } else {\n puts(\"IMPOSSIBLE\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc92191fa16868f6880b5e73b2a83bec", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nstruct Team {\n char name[25];\n int point;\n int score;\n int miss;\n}team[4], tmp_team[4];\n\nvoid swap(int *lhs, int *rhs) {\n int tmp = *lhs;\n *lhs = *rhs;\n *rhs = tmp;\n}\n\nvoid cpy_team() {\n int i;\n for (i = 0; i < 4; ++i) {\n tmp_team[i] = team[i];\n }\n}\n\nchar hash_s[4][25];\nint hash_idx = 0;\nint hash(const char* str) {\n int i;\n for (i = 0; i < hash_idx; ++i) {\n if (!strcmp(str, hash_s[i])) {\n return i;\n }\n }\n strcpy(hash_s[hash_idx++], str);\n return hash_idx - 1;\n}\n\nint comp(const void *lhs, const void *rhs) {\n struct Team *sa = (struct Team *)lhs;\n struct Team *sb = (struct Team *)rhs;\n if (sa->point != sb->point) {\n return sa->point < sb->point;\n }\n if (sa->score - sa->miss != sb->score - sb->miss) {\n return sa->score - sa->miss < sb->score - sb->miss;\n }\n if (sa->score != sb->score) {\n return sa->score < sb->score;\n }\n return strcmp(sa->name, sb->name) > 0;\n}\n\nint main() {\n //freopen(\"in.txt\", \"r\", stdin);\n int i, j, ia, ib, na, nb, b_id, opp_id, cnt[4];\n char sa[25], sb[25];\n\n memset(cnt, 0, sizeof(cnt));\n for (i = 0; i < 5; ++i) {\n scanf(\"%s %s %d:%d\", sa, sb, &na, &nb);\n ia = hash(sa);\n ib = hash(sb);\n strcpy(team[ia].name, sa);\n strcpy(team[ib].name, sb);\n ++cnt[ia];\n ++cnt[ib];\n /*printf(\"%d %d %d %d\\n\", na, nb, ia, ib);*/\n if (nb > na) {\n swap(&na, &nb);\n swap(&ia, &ib);\n }\n /*printf(\"%d %d\\n\", na, nb);*/\n if (na > nb) {\n team[ia].point += 3;\n } else if (na == nb) {\n team[ia].point += 1;\n team[ib].point += 1;\n }\n team[ia].score += na;\n team[ia].miss += nb;\n team[ib].score += nb;\n team[ib].miss += na;\n }\n /*for (i = 0; i < 4; ++i) {*/\n /*printf(\"%d %d %d\\n\", team[i].point, team[i].score, team[i].miss);*/\n /*}*/\n /*return 0;*/\n for (i = 0; i < 4; ++i) {\n if (!strcmp(team[i].name, \"BERLAND\")) {\n b_id = i;\n } else if (cnt[i] != 3) {\n opp_id = i;\n }\n }\n\n cpy_team();\n qsort(tmp_team, 4, sizeof(struct Team), comp);\n /*for (i = 0; i < 4; ++i) {*/\n /*printf(\"%s\\n\", tmp_team[i].name);*/\n /*}*/\n /*printf(\"opp_id = %d, b_id = %d\\n\", opp_id, b_id);*/\n /*for (i = 0; i < hash_idx; ++i) {*/\n /*printf(\"%s\\n\", hash_s[i]);*/\n /*}*/\n for (i = 1; i < 100; ++i) {\n cpy_team();\n tmp_team[b_id].point += 3;\n tmp_team[b_id].score += i;\n tmp_team[opp_id].miss += i;\n /*for (j = 0; j < 4; ++j) {*/\n /*printf(\"%d %d %d\\n\", tmp_team[j].point, tmp_team[j].score, tmp_team[j].miss);*/\n /*}*/\n /*putchar('\\n');*/\n qsort(tmp_team, 4, sizeof(struct Team), comp);\n if (!strcmp(tmp_team[0].name, \"BERLAND\") || !strcmp(tmp_team[1].name, \"BERLAND\")) {\n printf(\"%d:0\\n\", i);\n return 0;\n }\n }\n puts(\"IMPOSSIBLE\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ecbcbd2f7a766ca0faedcef88799b644", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n#include \n\nchar ss[4][32];\n\nint get(char *s) {\n\tstatic int n;\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tif (strcmp(ss[i], s) == 0)\n\t\t\treturn i;\n\tstrcpy(ss[n], s);\n\treturn n++;\n}\n\nint g1[4], g0[4], pp[4], dd[4];\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\tint gi, gj;\n\n\tif (pp[i] != pp[j])\n\t\treturn pp[j] - pp[i];\n\tgi = g1[i] - g0[i];\n\tgj = g1[j] - g0[j];\n\tif (gi != gj)\n\t\treturn gj - gi;\n\tif (g1[i] != g1[j])\n\t\treturn g1[j] - g1[i];\n\treturn strcmp(ss[i], ss[j]);\n}\n\nint main() {\n\tstatic char s[32], t[32], z[8];\n\tstatic int ii[4];\n\tint h, i, j, x, y, r;\n\n\tfor (h = 0; h < 5; h++) {\n\t\tscanf(\"%s%s%s\", s, t, z);\n\t\ti = get(s), j = get(t);\n\t\tx = z[0] - '0';\n\t\ty = z[2] - '0';\n\t\tg1[i] += x, g0[j] += x;\n\t\tg0[i] += y, g1[j] += y;\n\t\tif (x > y)\n\t\t\tpp[i] += 3;\n\t\telse if (x < y)\n\t\t\tpp[j] += 3;\n\t\telse {\n\t\t\tpp[i]++;\n\t\t\tpp[j]++;\n\t\t}\n\t\tdd[i]++;\n\t\tdd[j]++;\n\t}\n\tfor (i = 0; i < 4; i++)\n\t\tii[i] = i;\n\ti = 0;\n\twhile (strcmp(ss[i], \"BERLAND\"))\n\t\ti++;\n\tj = 0;\n\twhile (j == i || dd[j] != 2)\n\t\tj++;\n\tfor (x = 1, y = 0; x < 30; x++) {\n\t\tg1[i] += x, g0[j] += x;\n\t\tg0[i] += y, g1[j] += y;\n\t\tif (x > y)\n\t\t\tpp[i] += 3;\n\t\telse if (x < y)\n\t\t\tpp[j] += 3;\n\t\telse {\n\t\t\tpp[i]++;\n\t\t\tpp[j]++;\n\t\t}\n\t\tqsort(ii, 4, sizeof *ii, compare);\n\t\tr = 0;\n\t\twhile (ii[r] != i)\n\t\t\tr++;\n\t\tif (r < 2) {\n\t\t\tprintf(\"%d:0\\n\", x);\n\t\t\treturn 0;\n\t\t}\n\t\tg1[i] -= x, g0[j] -= x;\n\t\tg0[i] -= y, g1[j] -= y;\n\t\tif (x > y)\n\t\t\tpp[i] -= 3;\n\t\telse if (x < y)\n\t\t\tpp[j] -= 3;\n\t\telse {\n\t\t\tpp[i]--;\n\t\t\tpp[j]--;\n\t\t}\n\t}\n\tprintf(\"IMPOSSIBLE\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a7ec8eb6d88aebbdac3892cd0dc00977", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nstruct Team {\n char name[15];\n int point;\n int score;\n int miss;\n}team[4], tmp_team[4];\n\nvoid swap(int *lhs, int *rhs) {\n int tmp = *lhs;\n *lhs = *rhs;\n *rhs = tmp;\n}\n\nvoid cpy_team() {\n int i;\n for (i = 0; i < 4; ++i) {\n tmp_team[i] = team[i];\n }\n}\n\nchar hash_s[4][25];\nint hash_idx = 0;\nint hash(const char* str) {\n int i;\n for (i = 0; i < hash_idx; ++i) {\n if (!strcmp(str, hash_s[i])) {\n return i;\n }\n }\n strcpy(hash_s[hash_idx++], str);\n return hash_idx - 1;\n}\n\nint comp(const void *lhs, const void *rhs) {\n struct Team *sa = (struct Team *)lhs;\n struct Team *sb = (struct Team *)rhs;\n if (sa->point != sb->point) {\n return sa->point < sb->point;\n }\n if (sa->score - sa->miss != sb->score - sb->miss) {\n return sa->score - sa->miss < sb->score - sb->miss;\n }\n if (sa->score != sb->score) {\n return sa->score < sb->score;\n }\n return strcmp(sa->name, sb->name) > 0;\n}\n\nint main() {\n //freopen(\"in.txt\", \"r\", stdin);\n int i, j, ia, ib, na, nb, b_id, opp_id, cnt[4];\n char sa[25], sb[25];\n\n memset(cnt, 0, sizeof(cnt));\n for (i = 0; i < 5; ++i) {\n scanf(\"%s %s %d:%d\", sa, sb, &na, &nb);\n ia = hash(sa);\n ib = hash(sb);\n strcpy(team[ia].name, sa);\n strcpy(team[ib].name, sb);\n ++cnt[ia];\n ++cnt[ib];\n /*printf(\"%d %d %d %d\\n\", na, nb, ia, ib);*/\n if (nb > na) {\n swap(&na, &nb);\n swap(&ia, &ib);\n }\n /*printf(\"%d %d\\n\", na, nb);*/\n if (na > nb) {\n team[ia].point += 3;\n } else if (na == nb) {\n team[ia].point += 1;\n team[ib].point += 1;\n }\n team[ia].score += na;\n team[ia].miss += nb;\n team[ib].score += nb;\n team[ib].miss += na;\n }\n /*for (i = 0; i < 4; ++i) {*/\n /*printf(\"%d %d %d\\n\", team[i].point, team[i].score, team[i].miss);*/\n /*}*/\n /*return 0;*/\n\n cpy_team();\n qsort(tmp_team, 4, sizeof(struct Team), comp);\n /*for (i = 0; i < 4; ++i) {*/\n /*printf(\"%c\\n\", tmp_team[i].name);*/\n /*}*/\n for (i = 0; i < 4; ++i) {\n if (!strcmp(tmp_team[i].name, \"BERLAND\")) {\n b_id = i;\n } else if (cnt[i] != 3) {\n opp_id = i;\n }\n }\n /*printf(\"opp_id = %d, b_id = %d\\n\", opp_id, b_id);*/\n /*for (i = 0; i < hash_idx; ++i) {*/\n /*printf(\"%s\\n\", hash_s[i]);*/\n /*}*/\n for (i = 1; i < 100; ++i) {\n cpy_team();\n tmp_team[b_id].point += 3;\n tmp_team[b_id].score += i;\n tmp_team[opp_id].miss += i;\n /*for (j = 0; j < 4; ++j) {*/\n /*printf(\"%d %d %d\\n\", tmp_team[j].point, tmp_team[j].score, tmp_team[j].miss);*/\n /*}*/\n /*putchar('\\n');*/\n qsort(tmp_team, 4, sizeof(struct Team), comp);\n if (!strcmp(tmp_team[0].name, \"BERLAND\") || !strcmp(tmp_team[1].name, \"BERLAND\")) {\n printf(\"%d:0\\n\", i);\n return 0;\n }\n }\n puts(\"IMPOSSIBLE\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "24ad406229db41baa52342ded1aa1c7c", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n#include \n\nchar ss[4][32];\n\nint get(char *s) {\n\tstatic int n;\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tif (strcmp(ss[i], s) == 0)\n\t\t\treturn i;\n\tstrcpy(ss[n], s);\n\treturn n++;\n}\n\nint g1[4], g0[4], pp[4], dd[4];\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\tint gi, gj;\n\n\tif (pp[i] != pp[j])\n\t\treturn pp[j] - pp[i];\n\tgi = g1[i] - g0[i];\n\tgj = g1[j] - g0[j];\n\tif (gi != gj)\n\t\treturn gj - gi;\n\tif (g1[i] != g1[j])\n\t\treturn g1[j] - g1[i];\n\treturn strcmp(ss[i], ss[j]);\n}\n\nint main() {\n\tstatic char s[32], t[32], z[8];\n\tstatic int ii[4];\n\tint h, i, j, x, y, r;\n\n\tfor (h = 0; h < 5; h++) {\n\t\tscanf(\"%s%s%s\", s, t, z);\n\t\ti = get(s), j = get(t);\n\t\tx = z[0] - '0';\n\t\ty = z[2] - '0';\n\t\tg1[i] += x, g0[j] += x;\n\t\tg0[i] += y, g1[j] += y;\n\t\tif (x > y)\n\t\t\tpp[i] += 3;\n\t\telse if (x < y)\n\t\t\tpp[j] += 3;\n\t\telse {\n\t\t\tpp[i]++;\n\t\t\tpp[j]++;\n\t\t}\n\t\tdd[i]++;\n\t\tdd[j]++;\n\t}\n\tfor (i = 0; i < 4; i++)\n\t\tii[i] = i;\n\ti = 0;\n\twhile (strcmp(ss[i], \"BERLAND\"))\n\t\ti++;\n\tj = 0;\n\twhile (j == i || dd[j] != 2)\n\t\tj++;\n\tfor (x = 0, y = 0; x < 30; x++) {\n\t\tg1[i] += x, g0[j] += x;\n\t\tg0[i] += y, g1[j] += y;\n\t\tif (x > y)\n\t\t\tpp[i] += 3;\n\t\telse if (x < y)\n\t\t\tpp[j] += 3;\n\t\telse {\n\t\t\tpp[i]++;\n\t\t\tpp[j]++;\n\t\t}\n\t\tqsort(ii, 4, sizeof *ii, compare);\n\t\tr = 0;\n\t\twhile (ii[r] != i)\n\t\t\tr++;\n\t\tif (r < 2) {\n\t\t\tprintf(\"%d:0\\n\", x);\n\t\t\treturn 0;\n\t\t}\n\t\tg1[i] -= x, g0[j] -= x;\n\t\tg0[i] -= y, g1[j] -= y;\n\t\tif (x > y)\n\t\t\tpp[i] -= 3;\n\t\telse if (x < y)\n\t\t\tpp[j] -= 3;\n\t\telse {\n\t\t\tpp[i]--;\n\t\t\tpp[j]--;\n\t\t}\n\t}\n\tprintf(\"IMPOSSIBLE\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e96305d0fb5be1fdedeef8e1cbd34718", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n char str[101];\n scanf(\"%s\", str);\n\n if(strlen(str) >= 5)\n count++;\n\n for(i=0; i= 'A' && str[i] <= 'Z'){\n count++;\n break;\n }\n }\n\n for(i=0; i= 'a' && str[i] <= 'z'){\n count++;\n break;\n }\n }\n\n for(i=0; i= '1' && str[i] <= '9'){\n count++;\n break;\n }\n }\n\n if(count == 4)\n printf(\"Correct\");\n else\n printf(\"Too weak\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "cdf80884bf676c6a5fc66eb204056988", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include\n\nint main(){\n\tchar s[101];\n\tint i,flag,l,f,g,h,k;\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tf=0;\n\tg=0;\n\th=0;\n\tk=0;\n\tflag=0;\n\tif(l<5){\n\t\tprintf(\"Too weak\\n\");\n\t}\n\telse{\n\t\tfor(i=0;i=65 && s[i]<=90){\n\t\t\t\tf=1;\n\t\t\t}\n\t\t\tif(s[i]>=97 && s[i]<=122){\n\t\t\t\tg=1;\n\t\t\t}\n\t\t\tif(s[i]=='!' || s[i]=='?' || s[i]=='.' || s[i]==',' || s[i]=='_'){\n\t\t\t\th=1;\n\t\t\t}\n\t\t\tif(s[i]>=48 && s[i]<=57){\n\t\t\t\tk=1\n\t\t\t}\n\t\t\tif(f==1 && g==1 && h==1 && k==1){\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\tprintf(\"Correct\\n\");\n\t\t}\n\t\telse printf(\"Too weak\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4e5e5ff8f7ab1bdbcb5173126f1fff5f", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\nlong len,k1=0,k2=0,k3=0,k4=0,i;\nchar s[101];\nscanf(\"%s\",&s);\nlen=strlen(s);\n\nif(len>=5)k1=1;\n\nfor(i=0;i=s[i])\nk2++;\n\nfor(i=0;i=s[i])\nk3++;\n\nfor(i=0;i=s[i]);\nk4++;\n\nif(k1&&k2&&k3&&k4)\nprintf(\"Correct\");\n\nelse\n\nprintf(\"Too weak\");\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dc5c990d04b0381819340ecd1e91946f", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n char arr[1000];\n scanf(\"%s\",arr);\n int i,j,f1=0,f2=1,f3=0;\n for(i=0;arr[i]!='\\0';i++)\n {\n if(arr[i]=='0'|| arr[i]=='1'|| arr[i]=='2'|| arr[i]=='3'|| arr[i]=='4'|| arr[i]=='5'||arr[i]=='6'||arr[i]=='7'||arr[i]=='8'||arr[i]=='9' )\n {\n f1=1;\n }\n if(arr[i]>=65 && arr[i]<=90)\n {\n f2=1;\n }\n if(arr[i]>=97 && arr[i]<=122)\n {\n f3=1;\n }\n }\n if(f1==1 && f2==1 && f3==1)\n {\n printf(\"Correct\");\n }\n else\n {\n printf(\"Too weak\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "706fa25d35337d54899f347666769d9c", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int Up=0,Low=0,Num=0,i,a=0;\n char str[1000];\n gets(str);\n a=strlen(str);\n for(i=0;i47&&str[i]<58)\n Num++;\n if(str[i]>64&&str[i]<91)\n Up++;\n if(str[i]>96&&str[i]<123)\n Low++;\n }\n if(Num>0 && Up>0 && Low>0 && a>=5)\n printf(\"Correct\\n\");\n else\n printf(\"Too weak\\n\");a\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "75a8f268162e2f50c78673088ba0bbda", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int x[10],y[10],cnt=0,i,j,a,b;\n for(i=1;i<=8;i++){\n scanf(\"%d%d\",&x[i],&y[i]);\n }\n for(i=1;i<=8;i++){\n for(j=1;j<=8;j++){\n if(x[i]>=x[j]){\n a=x[i];\n b=y[i];\n x[i]=x[j];\n y[i]=y[j];\n x[j]=a;\n y[j]=b;\n }\n }\n }\n for(i=1;i<=8;i++){\n for(j=i+1;j<=8;j++){\n if(x[i]==x[j]&&y[i]==y[j]){\n printf(\"ugly\\n\");\n return 0;\n }\n }\n }\n for(i=1;i<=4;i++){\n if(x[1]==x[i]){cnt++;}\n }\n if(cnt!=3){printf(\"ugly\\n\");return 0;}\n cnt=0;\n for(i=4;i<=6;i++){\n if(x[4]==x[i]){cnt++;}\n }\n if(cnt!=2){printf(\"ugly\\n\");return 0;}\n cnt=0;\n for(i=6;i<=8;i++){\n if(x[6]==x[i]){cnt++;}\n }\n if(cnt!=3){printf(\"ugly\\n\");return 0;}\n for(i=1;i<=3;i++){\n for(j=i+1;j<=3;j++){\n if(y[i]>y[j]){\n a=y[i];\n y[i]=y[j];\n y[j]=a;\n }\n }\n }\n for(i=4;i<=5;i++){\n for(j=i+1;j<=5;j++){\n if(y[i]>y[j]){\n a=y[i];\n y[i]=y[j];\n y[j]=a;\n }\n }\n }\n for(i=6;i<=8;i++){\n for(j=i+1;j<=8;j++){\n if(y[i]>y[j]){\n a=y[i];\n y[i]=y[j];\n y[j]=a;\n }\n }\n }\n if(y[1]!=y[4]||y[1]!=y[6]){\n printf(\"ugly\\n\");\n return 0;\n }\n if(y[2]!=y[7]){\n printf(\"ugly\\n\");\n return 0;\n }\n if(y[3]!=y[5]||y[3]!=y[8]){\n printf(\"ugly\\n\");\n return 0;\n }\n printf(\"respectable\\n\");\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "16b25d81fac1c7883051d5dcfaf94f88", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \nint compare(const void *a,const void *b)\n{\n return (*(int *)a-*(int *)b);\n}\nint main()\n{\n int x[8],y[8],i,j,arr[8][8];\n for(i=0;i<8;i++)\n {\n scanf(\"%d %d\",&x[i],&y[i]);\n scanf(\"%d %d\",&arr[i][0],&arr[i][1]);\n }\n qsort(x,8,sizeof(int),compare);\n qsort(y,8,sizeof(int),compare);\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n if(arr[i][i]==arr[j][j])\n {\n return \"ugly\";\n }\n }\n if(x[1]==x[0]&&x[2]==x[1]&&x[4]==x[3]&&x[7]==x[6]&&x[5]==x[7]&&x[3]>x[0]&&x[6]>x[3]&&y[3]>y[2]&&y[5]>y[4]&&y[4]==y[3]&&y[0]==y[1]&&y[1]==y[2]&&y[6]==y[7]&&y[5]==y[6]&&y[3]!=y[1])\n printf(\"respectable\");\n else\n printf(\"ugly\");\n //printf(\"Hello world!\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "84dba7aea9fba5e2dc7a1f23f78f444b", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef struct _P {\n unsigned x;\n unsigned y;\n} Point;\n\nint comparePoint(const void *_a, const void *_b) {\n Point *a = (Point*)_a;\n Point *b = (Point*)_b;\n return a->x - b->x ? a->x - b->x : a->y - b->y;\n}\n\nbool parallelLine(Point pAA, Point pAB, Point pAC,\n Point pBA, Point pBB, Point pBC) {\n if(pAA.x == pAB.x && pAA.x == pAC.x)\n if(pBA.x == pBB.x && pBA.x == pBC.x)\n if(pAA.y == pBA.y && pAB.y == pBB.y && pAC.y == pBC.y)\n if(pAA.y != pAB.y && pAA.y != pAC.y)\n return true;\n if(pAA.y == pAB.y && pAA.y == pAC.y)\n if(pBA.y == pBB.y && pBA.y == pBC.y)\n if(pAA.x == pBA.x && pAB.x == pBB.x && pAC.x == pBC.x)\n if(pAA.x != pAB.x && pAA.x != pAC.x)\n return true;\n return false;\n}\n\nconst char* answers[2] = {\"respectable\\n\", \"ugly\\n\"};\n\nint main() {\n short i;\n \n Point ps[8];\n for(i = 0; i < 8; i++)\n scanf(\"%u%u\", &ps[i].x, &ps[i].y);\n \n qsort(ps, 8u, sizeof(Point), comparePoint);\n \n if(parallelLine(ps[0], ps[1], ps[2], ps[5], ps[6], ps[7]) &&\n parallelLine(ps[0], ps[3], ps[5], ps[2], ps[4], ps[7]))\n printf(answers[0]);\n else\n printf(answers[1]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0b8eff551ece66fb53ba09e9fd5ec3ff", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a[3]={-1,-1,-1};\n int b[3]={-1,-1,-1};\n int ca=0,cb=0,ia,ib,i;\n for(i=0;i<8;i++)\n {\n scanf(\"%d %d\",&ia,&ib);\n if(ia!=a[0] && ia!=a[1] && ia!=a[2])\n {\n a[ca]=ia;\n ca++;\n }\n if(ib!=b[0] && ib!=b[1] && ib!=b[2])\n {\n b[cb]=ib;\n cb++;\n }\n if(ia==a[1] && ib==b[1])\n {\n printf(\"ugly\");\n return 0;\n }\n }\n if(ca==3 && cb==3)\n {\n printf(\"respectable\");\n return 0;\n }\n else\n printf(\"ugly\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1697cb56442e3eccfb7599e3ef1b1732", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\nint compare(const void *a,const void *b)\n{\n return (*(int *)a-*(int *)b);\n}\nint main()\n{\n int x[8],y[8],i,j;\n for(i=0;i<8;i++)\n {\n scanf(\"%d %d\",&x[i],&y[i]);\n }\n for(i=0;i<8;i++)\n {\n for(j=i+1;j<8;j++)\n { \n\t\t\tif(x[i]==x[j]&&y[i]==y[j])\n {\n printf(\"ugly\");\n return 0;\n }\n else\n {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n }\n qsort(x,8,sizeof(int),compare);\n qsort(y,8,sizeof(int),compare);\n\n if(x[1]==x[0]&&x[2]==x[1]&&x[4]==x[3]&&x[7]==x[6]&&x[5]==x[7]&&x[3]>x[0]&&x[6]>x[3]&&y[3]>y[2]&&y[5]>y[4]&&y[4]==y[3]&&y[0]==y[1]&&y[1]==y[2]&&y[6]==y[7]&&y[5]==y[6]&&y[3]!=y[1])\n {\n\t\tprintf(\"respectable\\n\");\n\t}\n\telse\n\t{\n printf(\"ugly\\n\");\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b4f4c6be1f3f10df1672c51560fed8b2", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#define min(a,b) (a\n\nint a[50001];\nint main(){\n\tint n, i, j, ind_min=0;\n\tscanf (\"%d\", &n);\n\tfor (i=0;i\n\nint a[50001];\nint main(){\n\tint n, i, j, ind_min=0;\n\tscanf (\"%d\", &n);\n\tfor (i=0;i\n#define min(a,b) (a\n\nint a[50001];\nint main(){\n\tint n, i, j, ind_min=0;\n\tscanf (\"%d\", &n);\n\tfor (i=0;i\n#include\nint main(void)\n{\n\n int n,zcount=0,onecount=0,i;\n scanf(\"%d\",&n);\n char str[100];\n scanf(\"%s\",str);\n for(i=0;i\n#include \n\nchar x[89];\n\nint main()\n{\n int i,n,c=0;\n scanf(\"%d %s\",&n,x);\n for (i=0; i<=n; i++)\n {\n if (str[i] == '1') c++;\n else\n {\n printf(\"%d\",c);\n c = 0;\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "289bb2c2bf9877774fe654cb100ecd7b", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int strLen;\n scanf(\"%d\",&strLen);\n char str [1000];\n scanf(\"%s\",str);\n //aprintf(\"%s\\n\",str);\n int i, cnt=0;\n for (i=0; i\n#include\n\nchar a[1000000005];\n\nint main()\n{\n long long int n, x, k, i, j, r, ans=0;\n scanf(\"%I64d\\n\", &n);\n gets(a);\n //puts(a);\n for(i=0; i\n\tint main()\n\t{\n\t\tint a, i = 0;\n\t\tscanf(\"%d\", &a);\n\t\tchar s[a];\n\t\tscanf(\"%s\", s);\n\t\tif (s[0] == '1')\n\t\t\tprintf(\"1\");\n\t\tfor (i = 0; i\nusing namespace std;\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char s[110];\n scanf(\"%s\",&s);\n int ans1=0,ans0=0;\n for(int i=0;i\n\nvoid main()\n{\n int n,i,m=0;\n char s[105];\n scanf(\"%d\",&n);\n scanf(\" %s\",s);\n if(n==1&&s[0]==0)\n printf(\"0\");\n else\n {\n for(i=0;i\n\nvoid main()\n{\n int n,i,m=0;\n char s[105];\n scanf(\"%d\",&n);\n scanf(\" %s\",s);\n if(n==1&&s[0]=0)\n printf(\"0\");\n else\n {\n for(i=0;i\n#include\n#include\nusing namespace std;\nint main()\n{\n\tint t,n,m,i,num,j,sum;\n\tchar a[150];\n\tmemset(a, 0 ,sizeof(a));\n\tscanf(\"%d\", &t);\n\tscanf(\"%s\", a);\n\tint k = strlen(a);\n\tsum = 0;\n\tfor(i=0; i\n\nmain(){\n int i, n, m, hg= 0, sum= 0;\n scanf(\"%i %i\", &n, &m);\n int a[n];\n for(i=0; ihg) hg = a[i];\n sum += a[i];\n }\n printf(\"%i %i\\n\", ((sum+m)%n) ? ((sum+m)/n)+1 : (sum+m)/n, hg+m);", "lang_cluster": "C", "compilation_error": true, "code_uid": "2a04f8c3faa5c32d4b18a352d31c5a2e", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nint main(){\n int benches,initial,late;\n int people[101]={0};\n \n scanf(\"%d\", &benches);\n scanf(\"%d\", &initial);\n scanf(\"%d\", &late);\n \n int late_cpy=late;\n \n int people_cpy[101]={0};\n \n for(int i=0;i<=benches;++i)\n {\n scanf(\"%d\", &people[i]);\n people_cpy[i]=people[i];\n }\n \n int max=0;\n for(int i=0;i<=benches;++i)\n {\n if(people[i]>=max){\n max=people[i];\n }\n }\n for(int i=0;i<=benches;++i)\n {\n if(late_cpy<=0){\n break;\n }\n while(benches[i]!=max){\n if(late_cpy<=0){\n break;\n }\n ++benches[i];\n --late_cpy;\n }\n }\n int min=10000;\n for(int i=0;i<=benches;++i)\n {\n if(benches[i]<=min){\n min=benches[i];\n }\n }\n \n for(int i=0;i<=benches;++i)\n {\n if(benches[i]==max){\n max = benches[i]+late;\n break;\n }\n }\n printf(\"%d %d\", min,max );\n \n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "64efd6671edf2ff91b51ad0a080b1b78", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\n\n\nclass CycledDynamicArray {\npublic:\n CycledDynamicArray(unsigned int initCapacity);\n ~CycledDynamicArray();\n\n void PushBack(int element);\n void PopBack();\n int Back() const;\n bool IsEmpty() const;\n\nprivate:\n unsigned int capacity;\n unsigned int siz;\n int start;\n int* data;\n\n\n unsigned int CalcModPos(unsigned int pos);\n void Rotate(unsigned int newCapasity);\n void Extend();\n void Shrink();\n};\nCycledDynamicArray::~CycledDynamicArray(){\n\n}\n\n\n\nint main(){\n CycledDynamicArray arr(8);\n arr.PushBack(5);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "836f5460c603e7ef1d43ffd90b4c5376", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n#include\n#include\nusing namespace std;\n\nint main()\n{\n int N,k,M,i,max=0;\n\tcin>>N>>M;\n\tint a[N];\n\tfor(i=0;i>a[i];\n\t if(a[i]>max)\n\t max=a[i];\n\t}\n\tsort(a,a+N);\n\tfor(i=0;i\n#include \n\nint searchMin(int capacity, int m, int n, int maxElement) {\n\tint kMin = 0;\n\tif (capacity >= m) kMin = maxElement;\n\telse if ((m - capacity) % n == 0) {\n\t\tkMin = maxElement + (m - capacity) / n;\n\t}\n\telse if ((m - capacity) % n != 0) {\n\t\tkMin = maxElement + 1 + (m - capacity) / n;\n\t}\n\treturn kMin;\n}\n\nint main() {\n\tint n, m, maxElement, capacity, kMin, kMax;\n\tscanf(\"%d\\n %d\\n\", &n);\n\tint* a = (int*)malloc(n * sizeof(int));\n\tmaxElement = 0;\n\tfor (int i = 0; i < n; ++i) {\n\t\tscanf(\"%d\\n\", &a[i]);\n\t\tif (a[i] > maxElement) maxElement = a[i];\n\t}\n\tkMax = maxElement + m;\n\tfor (int i = 0; i < n; ++i) {\n\t\tcapacity += (maxElement - a[i]);\n\t}\n\tkMin = searchMin(capacity, m, n, maxElement);\n\tprintf(\"%d %d\", kMIn, kMax);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1dbdb4730f066efea5573a7b68cd3cce", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include \n\nint gcd (int a, int b) {\n\treturn b ? gcd (b, a % b) : a;\n}\n\nint main() {\n\tlong long a, b, x, y, l = 0, r = (long long)2e9, d;\n\tscanf(\"%I64d%I64d%I64d%I64d\", &a, &b, &x, &y);\n\td = gcd(x, y);\n\tx /= d; y /= d;\n\tprintf(\"%I64d %I64d\", x * min(a / x, b / y), y * min(a / x, b / y));\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6e21345e27a7ad40ba92d7989ed4d8b2", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nlong long int lcm(long long int x,long long int y)\n{\n long long int n1,n2;\n n1=x;n2=y;\n while(n1!=n2)\n {\n if(n1>n2)\n n1=n1-n2;\n else\n n2=n2-n1;\n }\n return(x*y/n1);\n}\nint main()\n{long long int i,j,t,r,k,a1,x,y,a,b;\nscanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&x,&y);\nif(b>=(y*a)/x)\n{if((a*y)%x==0)\nprintf(\"%I64d %I64d\",a,y*a/x);\nelse\n{t=lcm(x,y);\nk=t/y;\na=(a/k)*k;\n printf(\"%I64d %I64d\",a,y*a/x);\n}\n}\nelse\n{\n if((b*x)%y==0)\n {a=x*b/y;\n printf(\"%I64d %I64d\",a,b);}\n else\n {t=lcm(x,y);\nk=t/x;\nb=(b/k)*k;\n printf(\"%I64d %I64d\",(b*x)/y,b);\n\n }\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4982a6bb494790f23d401657fabbdd2b", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint binsearch(int a, int x) {\n\tint low, high, mid;\n\n\tlow = 1;\n\thigh = a / x;\n\n\twhile (low <= high) {\n\t\tmid = (low + high) / 2;\n\t\tif (mid * x < a)\n\t\t\tlow = mid + 1;\n\t\telse if (mid * x > a)\n\t\t\thigh = mid - 1;\n\t\telse\n\t\t\treturn mid;\n\t}\n\treturn -1;\n}\n\nint main() {\n\tint a, b, x, y, g;\n\tlong long i, j, k, n, m;\n\n\tscanf(\"%d%d%d%d\", &a, &b, &x, &y);\n\tg = gcd(x, y);\n\tx /= g, y /= g;\n\ti = binsearch(a, x);\n\tj = binsearch(b, y);\n\tk = a / x < b / y ? a / x : b / y;\n\tn = i * x, m = i * y;\n\tif (n * m < j * x * j * y) {\n\t\tn = j * x;\n\t\tm = j * y;\n\t}\n\tif (n * m < k * x * k * y) {\n\t\tn = k * x;\n\t\tm = k * y;\n\t}\n\tif (n < 0)\n\t\tn = -n;\n\tif (m < 0)\n\t\tm = -m;\n\tif (a < x || b < y)\n\t\tprintf(\"0 0\\n\");\n\telse\n\t\tprintf(\"%lld %lld\\n\", n, m);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "84b67c5e98f4aada9adb685481dc0fc2", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n__int64 gcd(__int64 a,__int64 b)\n{\n if(b==0)\n return(a);\n else return(gcd(b,a%b));\n}\nint main()\n{\n __int64 a,b,x,y,i,j,p,d,low,high,mid,c=0,ma=0,ra,rb;\n scanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&x,&y);\n d=gcd(x,y);\n x=x/d;\n y=y/d;\n for(i=0;id)\n low=mid+1;\n else if(p==d)\n {\n c++;\n if((a-i)*(b-mid)>ma)\n {\n ma=(a-i)*(b-mid);\n ra=a-i;\n rb=b-mid;\n }\n break;\n }\n }\n if(c>0)\n break;\n }\n if(c==0)\n printf(\"0 0\");\n else printf(\"%I64d %I64d\",ra,rb);\n return(0);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "042fce801d455bd7a6b49eba5ac78c1c", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nvoid find_size(int a, int b, int x, int y, int *p, int *q)\n{\n\tdouble r1 = (double) a / b, r2 = (double) x / y;\n\tif (r1 == r2) {\n\t\t*p = a;\n\t\t*q = b;\n\t}\n\telse if (r1 > r2) {\n\t\tdouble f = (double) x*b / y;\n\t\tif (ceilf(f) == f) {\n\t\t\t*p = f;\n\t\t\t*q = b;\n\t\t}\n\t\telse {\n\t\t\tfind_size(f, b, x, y, p, q);\n\t\t}\n\t}\n\telse {\n\t\tdouble f = (double) a*y / x;\n\t\tif (ceilf(f) == f) {\n\t\t\t*p = a;\n\t\t\t*q = f;\n\t\t}\n\t\telse {\n\t\t\tfind_size(a, f, x, y, p, q);\n\t\t}\n\t}\n}\n\nint main()\n{\n\n\tint a, b, x, y, p, q;\n\n\tscanf(\"%i %i %i %i\", &a, &b, &x, &y);\n\tfind_size(a, b, x, y, &p, &q);\n\tprintf(\"%i %i\\n\", p, q);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0b82dd0e689fa14352f1c464e7707eba", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\n#define N 10\nint S1[N] = {0}, S2[N] = {0};\nint t1 = 0, t2 = 0;\nint k1, k2;\n\nint main(int argc, char *argv[])\n{\n int n;\n int i, f;\n unsigned int H1, H2, h1, h2;\n\n scanf(\"%d\", &n);\n\n scanf(\"%d\", &k1);\n t1 = 0; H1 = 0;\n for (i = 0; i < k1; i++) {\n scanf(\"%d\", &S1[t1+i]);\n H1 = H1 * n + S1[t1+i];\n }\n\n scanf(\"%d\", &k2);\n t2 = 0; H2 = 0;\n for (i = 0; i < k2; i++) {\n scanf(\"%d\", &S2[t2+i]);\n H2 = H2 * n + S2[t2+i];\n }\n\n f = 0;\n while (k1 && k2) {\n if (S1[t1 % N] > S2[t2 % N]) {\n S1[(t1+k1) % N] = S2[(t2) % N]; t2++; k1++; k2--;\n S1[(t1+k1) % N] = S1[(t1) % N]; t1++; k1++; k1--;\n } else {\n S2[(t2+k2) % N] = S1[(t1) % N]; t1++; k2++; k1--;\n S2[(t2+k2) % N] = S2[(t2) % N]; t2++; k2++; k2--;\n }\n f++;\n\n h1 = h2 = 0;\n for (i = 0; i < k1; i++) h1 = h1 * n + S1[(t1+i) % N];\n for (i = 0; i < k2; i++) h2 = h2 * n + S2[(t2+i) % N];\n\n if (h1 == H1 && h2 == H2)\n break;\n }\n\n if (k1 && !k2) {\n printf(\"%d 1\\n\", f);\n } else if (!k1 && k2) {\n printf(\"%d 2\\n\", f);\n } else {\n puts(\"-1\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a398510cff59dc54c54850a5df833d6f", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n //while(1){\n int i,j,n,k1,k2,ps1=0,ps2=0,s1=0,s2=0,shit=1,temp,flag,cnt=0,m,bal;\n int c1[12];\n int c2[12];\n int man[12];\n for(i=1;i<=11;i++)\n {\n c1[i]=c2[i]=-1;\n man[i]=-2;\n }\n scanf(\"%d\",&n);\n scanf(\"%d\",&k1);\n for(i=1;i<=k1;i++)\n {\n scanf(\"%d\",&c1[i]);\n man[i]=c1[i];\n }\n scanf(\"%d\",&k2);\n for(i=1;i<=k2;i++)\n scanf(\"%d\",&c2[i]);\n m=k1;\n /*for(i=1;i<=k1;i++)\n {\n shit=1;\n for(j=1;j<=k1-i;j++)\n shit=shit*10;\n ps1=ps1+shit*c1[i];\n }\n\n for(i=1;i<=k2;i++)\n {\n shit=1;\n for(j=1;j<=k2-i;j++)\n shit=shit*10;\n ps2=ps2+shit*c2[i];\n }*/\n\n //printf(\"%d %d\\n\\n\",ps1,ps2);\n //ps1=c1[1];\n //ps2=c1[k1];\n\n while(1)\n {\n s1=s2=0;\n if(c1[1]>c2[1])\n {\n temp=c1[1];\n for(i=1;ik1)\n bal=m;\n else\n bal=k1;\n\n for(i=1;i<=bal;i++)\n {\n if(c1[i]!=man[i])\n {\n flag=9;\n break;\n }\n else\n flag=0;\n }\n\n\n\n /* for(i=1;i<=k1;i++)\n {\n shit=1;\n for(j=1;j<=k1-i;j++)\n shit=shit*10;\n s1=s1+shit*c1[i];\n }\n for(i=1;i<=k2;i++)\n {\n shit=1;\n for(j=1;j<=k2-i;j++)\n shit=shit*10;\n s2=s2+shit*c2[i];\n } */\n //printf(\"%d %d\\n\",s1,s2);\n\n /*if((c1[1]==ps1 && c1[k1]==ps2) || (c2[1]==ps1 && c2[k2]==ps2))\n {\n flag=0;\n break;\n }\n if(s1==ps2 && s2==ps1)\n {\n flag=0;\n break;\n } */\n\n if(flag==0)\n break;\n\n }\n if(flag!=0)\n printf(\"%d %d\",cnt, flag);\n else\n printf(\"-1\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "731dab52ebb5ee01ab4436f16d74745b", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#define gi(x) scanf(\"%d\",&x)\nint main()\n{\n\tint n;\n\tgi(n);\n\tint k1,k2,i,x;\n\tgi(k1);\n\tint a[1000001];\n\tint b[1000001];\n\tint y=k1;\n\tint g=0;\n\tint countone=k1;\n\tfor(g=0;g 0 && counttwo > 0)\n\t{\n\t\tif(a[r] > b[r])\n\t\t{\n\t\t\ta[k1++]=b[r];\n\t\t\ta[k1++]=a[r];\n\t\t\tcounttwo-=1;\n\t\t\tcountone+=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tb[k2++]=a[r];\n\t\t\tb[k2++]=b[r];\n\t\t\tcountone-=1;\n\t\t\tcounttwo+=1;\n\t\t}\n\t\tcount++;\n\t\tr++;\n\t}\n\tif(count==oo)\n\t\tprintf(\"-1\\n\");\n\telse if(countone==0)\n\t\tprintf(\"%d 2\\n\",count);\n\telse\n\t\tprintf(\"%d 1\\n\",count );\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e5264208b0110448b7235075cda1525e", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint g_count ;\nstruct stack {\n int header;\n int tail;\n int size;\n int *array;\n};\nvoid printer(int size , int grid[size]) {\n for (int i = 0 ; i < size ; i++) {\n printf(\"%d \", grid[i]);\n }\n printf(\"\\n\");\n}\nvoid queue_add( struct stack *s, int element, int size) {\n s->tail++;\n s->array[(s->tail)%size] = element;\n}\nint queue_pop(struct stack *s, int size) {\n s->header++;\n return s->array[(s->header)%size];\n}\nint queue_size(struct stack *s , int size) {\n return (s->tail - s->header) ;\n}\nint main() {\n int n;\n\n scanf(\"%d\", &n);\n struct stack s1;\n struct stack s2;\n scanf(\"%d\", &s1.size);\n s1.array = malloc(s1.size * sizeof(int));\n s1.header = -1 , s1.tail = -1;\n for (int i = 0; i < s1.size ; i++) {\n int temp;\n scanf(\"%d\", &temp);\n queue_add(&s1, temp, n);\n }\n\n scanf(\"%d\", &s2.size);\n s2.header = -1 , s2.tail = -1;\n\n s2.array = malloc(s2.size * sizeof(int));\n for (int i = 0; i < s2.size ; i++) {\n int temp;\n scanf(\"%d\", &temp);\n queue_add(&s2, temp, n);\n }\n int win = 0, stale = 0;\n\n int s2_back = s2.array[0];\n int s1_back = s1.array[0];\n g_count = 0;\n\n while ( win == 0 && stale == 0) {\n int save_size = queue_size(&s1, n);\n\n int a = queue_pop(&s1, n);\n int b = queue_pop(&s2, n);\n\n g_count++;\n if ( a > b) {\n queue_add(&s1, b, n);\n queue_add(&s1, a, n);\n\n //printer(n, s1.array);\n // printer(n, s2.array);\n } else {\n queue_add(&s2, a, n);\n queue_add(&s2, b, n);\n // printer(n, s1.array);\n // printer(n, s2.array);\n\n }\n if ( s1.header == s1.tail) {\n win = 2;\n }\n if ( s2.header == s2.tail) {\n win = 1;\n }\n if ( a == s1_back && b == s2_back && save_size == s1.size && g_count> 900) {\n stale = 1;\n }\n }\n if ( stale == 1) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%d %d\\n\",g_count,win);\n }\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ee1c3b154878331655562dc0730cb9e", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#define MAXN 10\nchar d[MAXN], g[1 << MAXN];\nint v1[MAXN], v2[MAXN], st1 = 0, dr1, st2 = 0, dr2;\n\ninline void add(int *x, int n){\n (*x)++;\n if(*x == n)\n *x = 0;\n}\n\ninline int vad(int n){\n int i, rez = 0;\n for(i = 0; i < n; i++)\n rez += d[i] * (1 << i);\n return rez;\n}\n\nint main(){\n int n, k1, k2, i;\n scanf(\"%d\", &n);\n scanf(\"%d\", &k1);\n for(i = 0; i < k1; i++){\n scanf(\"%d\", &v1[i]);\n v1[i]--;\n d[v1[i]] = 0;\n }\n dr1 = k1;\n scanf(\"%d\", &k2);\n for(i = 0; i < k2; i++){\n scanf(\"%d\", &v2[i]);\n v2[i]--;\n d[v2[i]] = 1;\n }\n dr2 = k2;\n for(i = 0; !g[vad(n)] && !(st1 == dr1 || st2 == dr2); i++){\n g[vad(n)] = 1;\n if(v1[st1] > v2[st2]){\n d[v2[st2]] = 0;\n v1[dr1] = v2[st2];\n add(&dr1, n);\n v1[dr1] = v1[st1];\n add(&dr1, n);\n add(&st1, n);\n add(&st2, n);\n }\n else{\n d[v1[st1]] = 1;\n v2[dr2] = v1[st1];\n add(&dr2, n);\n v2[dr2] = v2[st2];\n add(&dr2, n);\n add(&st1, n);\n add(&st2, n);\n }\n }\n if(g[vad(n)])\n printf(\"-1\");\n else{\n printf(\"%d \", i);\n if(dr1 != st1)\n printf(\"1\");\n else\n printf(\"2\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e9c686939046119a1d31138f763be391", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nint main()\n{\n long long int n,sum=1,i,c=0;\n\n scanf(\"%I64d\",&n);\n\n if(n==0) printf(1);\n else{\n for(i=6;;i+=6){\n sum+=i;\n c++;\n if(c==n) break;\n }\n printf(\"%I64d\",sum);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa4a42248aa8f4021443b7ef386c49dc", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main () {\n unsigned long long a;\n int b, i;\n scanf(\"%lld\", a);\n printf(\"%lld\", 1 + 6 * a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "46c22b7e75475b4a8752f9e0fe69a47b", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{ int n,t;\n \n scanf(\"%d\",n);\n \n t=(6^n-1)/(6-1);\n printf(\"%d\",t);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "21bb1f9357c1ed8945a9bb180aba389c", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int n;\n long t ;\n scanf(\"%d\",&n);\n t=6^(n-1)/5;\n printf(\"%ld\",t);\n return(0);", "lang_cluster": "C", "compilation_error": true, "code_uid": "f347d8ac949c713cc3326e0f1a8baa44", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main () {\n unsigned long long a;\n int b, i;\n scanf(\"%lld\", &a);\n if (a < 2) {\n if (a == 0) \n printf(\"1\");\n if (a == 1)\n printf(\"7\");\n }\n else\n printf(\"%lld\", a*(a+1)/2*6 + 1;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b03033816170aeef946bd3ccf110a0b7", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#define oo 1000000000\n#define pi 3.14159265359\n#define zero(a) (abb(a)<=1e-7)\n#define lowbit(a) ((a)&(-(a)))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nlong count(long n,long m)\n{\n if (n<1||m<1)\n return 0;\n if (n==1)\n return (m+1)/2;\n if (m==1)\n return (n+1)/2;\n return 2*(n/2+m/2)-!(n&1)-!(m&1);\n}\n\nint main()\n{\n long n,m,k;\n scanf(\"%ld%ld%ld\",&n,&m,&k);\n printf(\"%ld\\n\",count(n-(k-1)*2,m-(k-1)*2));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "07521c82a0868ff8aa083399d8d1911c", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define oo 2000000000\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abs(a) ((a)<0?-(a):(a))\n#define eps 1e-8\n\nlong a[5005][5005]={0};\n\nint main()\n{\n long n,m,x;\n long i,j;\n long k;\n long ans=0;\n \n scanf(\"%ld%ld%ld\",&n,&m,&x);\n \n for(i=1,j=1;i<=n-i+1&&j<=m-j+1;i++,j++)\n {\n for(k=j;k<=m-j+1;k++)\n a[i][k]=a[n-i+1][k]=i;\n for(k=i;k<=n-i+1;k++)\n a[k][j]=a[k][m-j+1]=i;\n }\n for(i=1;i<=n;i++)\n for(j=1;j<=m;j++)\n if(((i+j)&1)==0&&a[i][j]==x)\n ans++;\n printf(\"%ld\\n\",ans);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eaaba06d5dc7cd88e34ce65dc88ed4a1", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int m,n,i,j,k=0,x;\n scanf(\"%d %d %d\",&m,&n,&x);\n int arr[10000];\n if(m>=n)\n {int l=m;\n for(i=0;i<((l/2)+1);i++)\n {\n if(m>0 && n>0 &&(m*n)%2==0)\n {\n arr[k]=(m*n)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n else if(m>0 && n>0 && (m*n)%2==1)\n {\n arr[k]=((m*n)+1)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n }\n if(x==1)\n {\n printf(\"%d\",arr[0]-arr[1]);\n }\n else\n {\n printf(\"%d\",arr[x-1]-arr[x]);\n }\n\n }\n else\n {\nint l=n;\n for(i=0;i<(n/2);i++)\n {\n if(m>0 && n>0 &&(m*n)%2==0)\n {\n arr[k]=(m*n)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n else if(m>0 && n>0 && (m*n)%2==1)\n {\n arr[k]=((m*n)+1)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n }\n if(x==1)\n {\n printf(\"%d\",arr[0]-arr[1]);\n }\n else\n {\n printf(\"%d\",arr[x-1]-arr[x-2]);\n }\n\n }\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9cd266aa1b7c5b9ab0e548a0d035e18e", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n long long m,n,i,j,k=0,x;\n scanf(\"%I64d %I64d %I64d\",&m,&n,&x);\n long long arr[10000];\n if((m==1 || n==1 ) && x!=1)\n {\n printf(\"0\");\n return 0;\n }\n else if((m==1 && x==1 && n!=1))\n {\n printf(\"%I64d\",n/2);\n return 0;\n }\n else if(n==1 && x==1 && m!=1)\n {\n printf(\"%I64d\",m/2);\n return 0;\n }\n if(m>=n)\n {\n long long l=m;\n for(i=0;i<((l/2)+1);i++)\n {\n if(m>0 && n>0 &&(m*n)%2==0)\n {\n arr[k]=(m*n)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n else if(m>0 && n>0 && (m*n)%2==1)\n {\n arr[k]=((m*n)+1)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n }\n if(x==1)\n {\n printf(\"%I64d\",arr[0]-arr[1]);\n }\n else\n {\n printf(\"%I64d\",arr[x-1]-arr[x]);\n }\n\n }\n else\n {\nlong long l=n;\n for(i=0;i<(n/2);i++)\n {\n if(m>0 && n>0 &&(m*n)%2==0)\n {\n arr[k]=(m*n)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n else if(m>0 && n>0 && (m*n)%2==1)\n {\n arr[k]=((m*n)+1)/2;\n m=m-2;\n n=n-2;\n k++;\n }\n }\n if(x==1)\n {\n printf(\"%I64d\",arr[0]-arr[1]);\n }\n else\n {\n printf(\"%I64d\",arr[x-1]-arr[x-2]);\n }\n\n }\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "91244171922ac1a0280c9b859e892334", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,m,times,newn,newm,ans;\n\tscanf(\"%d%d%d\",&n,&m,×);\n\ttimes--;\n\tnewn=n-2*times;\n\tnewm=m-2*times;\n\tif(newn==0 || newm==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(newn-2>0 && newm-2>0)\n\tans=(\t(newn*newm)\t-\t((newn-2)*(newm-2))\t)/2;\n\telse\n\tans=(newn*newm)/2+(newn*newm)%2;\n\tprintf(\"%d\\n\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a931a0be8270420531e3f1624863fcfa", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n char input[99];\n scanf(\"%s\",input);\n printf(\"%d\",check(input));\n return 0;\n}\n\n\n\n\nint check (char input[])\n{\n int noofquestionmarl=0;\n int noofdistinctletters=0;\n char letters[28];\n int n=1;\n int i=0;\n int m=0;\n int ans=0;\n int flag=0;\n int counter;\n while(input[n]!='\\0')\n {\n if(input[n]=='?')\n noofquestionmarl++;\n else\n {\n if(isdigit(input[n])!=1)\n {\n m=0;\n while(letters[m]!='\\0')\n {\n if(input[n]==letters[m])\n {\n flag++;\n break;\n\n }\n m++;\n }\n if(flag==0)\n {\n noofdistinctletters++;\n letters[i]=input[n];\n i++;\n letters[i]='\\0';\n }\n\n }\n\n }\n n++;\n }\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n //////////////////////////////////////////////////////\n if(input[0]=='?')\n ans=9;\n else\n if(isdigit(input[0])!=1)\n {\n ans=9;\n }\n m=0;\n while(letters[m]!='\\0')\n {\n if(input[0]==letters[m])\n\n {\n noofdistinctletters--;\n break;\n }\n m++;\n\n\n }\n\n ////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////\n //////////////////////////////////////////////////////////////\n if(ans!=0)\n {\n if(input[1]=='?')\n n=10;\n else\n n=9;\n while(i>0)\n {\n ans=ans*n;\n n--;\n i--;\n }\n ans=ans*power(10,noofquestionmarl);\n return ans;\n }\n\n else\n\n {\n\n ans=1;\n\n n=10;\n for(counter=0;counter\n#include\nint main()\n{\n\tchar a[100100],c;\n\tint i,sum;\n\tint num[26],flag1,flag2,num1,sum1,k,h,total;\n\twhile(scanf(\"%s\",a)!=EOF)\n\t{\n\t\tsum=0;\n\t\tmemset(num,0,sizeof(num));\n\t\tfor(i=0;a[i];i++)\n\t\t\tif(a[i] != '0')\n\t\t\t\tbreak;\n\t\tif(a[i] ==0)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tflag1=0;\n\t\tflag2=0;\n\t\tnum1=0;\n\t\tif(a[i] == '?')\n\t\t\tflag1=1;\n\t\telse if(a[i]>='A' && a[i] <='J')\n\t\t{\n\t\t\tflag2=1;\n\t\t\tc=a[i];\n\t\t}\n\t\tfor(;a[i];i++)\n\t\t{\n\t\t\tif(a[i]>='A' && a[i]<='J')\n\t\t\t{\n\t\t\t\tif(num[a[i] -'A'] == 0)\n\t\t\t\t\tnum1++;\n\t\t\t\tnum[a[i] -'A']++;\n\t\t\t}\n\t\t\telse if(a[i] == '?')\n\t\t\t\tsum++;\n\t\t}\n\t\tif(flag1 == 1)\n\t\t\ttotal = sum *9;\n\t\telse\n\t\t\ttotal = sum*10;\n\t\tif(flag2 == 1)\n\t\t{\n\t\t\th=2;\n\t\t\tsum1=9;\n\t\t\tk=9;\n\t\t\tfor(;h<=num1;h++)\n\t\t\t{\n\t\t\t\tsum1*=k;\n\t\t\t\tk--;\n\t\t\t}\n\t\t\ttotal *= sum1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsum1=1;\n\t\t\tk=10;\n\t\t\tfor(h=1;h<=num1;h++)\n\t\t\t{\n\t\t\t\tsum1*=k;\n\t\t\t\tk--;\n\t\t\t}\n\t\t\ttotal *= sum1;\n\t\t}\n\t\tif(total ==0)\n\t\t\tprintf();\n\t\tprintf(\"%d\\n\",total);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "643c5ea373741d70626edc1e6539b1c0", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define MAX 100000\n\nint main()\n{\n\tchar hint[MAX], c ;\n\tint let_flag[10], i, pos, n ;\n\t\n\tscanf(\" %s\",hint) ;\n\n\tn = 1 ;\n\tpos = 10 ;\n\n\tfor(i=0;i<10;++i)\n\t\tlet_flag[i] = 0 ;\n\n\tfor(i=0;i='A')&&(c<='J'))\n\t\t{\n\t\t\tif(let_flag[c-65]==0)\n\t\t\t{\n\t\t\t\tlet_flag[c-65] = 1 ;\n\t\t\t\tif(i==0)\n\t\t\t\t\tn *= 9 ;\n\t\t\t\telse\n\t\t\t\t\tn *= pos ;\n\t\t\t\tpos-- ;\n\t\t\t}\n\t\t}\n\t\telse if(c=='?')\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\tn *= 9 ;\n\t\t\telse\n\t\t\t\tn *= 10 ;\n\t\t}\n\t}\n\n\tprintf(\"%d \\n\",n) ;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "01a7003c20e0d06976f78bb21d6975cf", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define MAX 100000\n\nint main()\n{\n\tchar hint[MAX], c ;\n\tint let_flag[10] = {0}, i, pos, n ;\n\t\n\tscanf(\" %s\",hint) ;\n\n\tn = 1 ;\n\tpos = 10 ;\n\n\tfor(i=0;i='A')&&(c<='J'))\n\t\t{\n\t\t\tif(let_flag[c-65]==0)\n\t\t\t{\n\t\t\t\tlet_flag[c-65] = 1 ;\n\t\t\t\tif(i==0)\n\t\t\t\t\tn *= 9 ;\n\t\t\t\telse\n\t\t\t\t\tn *= pos ;\n\t\t\t\tpos-- ;\n\t\t\t}\n\t\t}\n\t\telse if(c=='?')\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\tn *= 9 ;\n\t\t\telse\n\t\t\t\tn *= 10 ;\n\t\t}\n\t}\n\n\tprintf(\"%d \\n\",n) ;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3f6ce86bfb555ac742d973db607a9965", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n\tchar hint[100], c ;\n\tint let_flag[10], i, pos, n ;\n\t\n\tscanf(\" %s\",hint) ;\n\n\tn = 1 ;\n\tpos = 10 ;\n\n\tfor(i=0;i<10;++i)\n\t\tlet_flag[i] = 0 ;\n\n\tfor(i=0;i='A')&&(c<='J'))\n\t\t{\n\t\t\tif(let_flag[c-65]==0)\n\t\t\t{\n\t\t\t\tlet_flag[c-65] = 1 ;\n\t\t\t\tif(i==0)\n\t\t\t\t\tn *= 9 ;\n\t\t\t\telse\n\t\t\t\t\tn *= pos ;\n\t\t\t\tpos-- ;\n\t\t\t}\n\t\t}\n\t\telse if(c=='?')\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\tn *= 9 ;\n\t\t\telse\n\t\t\t\tn *= 10 ;\n\t\t}\n\t}\n\n\tprintf(\"%d \\n\",n) ;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8c1cc45b3a327f91774faa8d7ee7d341", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\t{\n\tint midLen, len1, len2;\n\tint i, letterArr[26]={0}, pos, lenToKey;\n\tchar str[30], key, grid1[14]={0}, grid2[14]={0}, *cp1, *cp2;\n\tscanf(\"%s\", str);\n\tfor(i=0; i<27; i++)\t{\n\t\tif(letterArr[str[i]-'A'])\tbreak;\n\t\telse letterArr[str[i]-'A']++;\n\t}\n\tkey = str[i];\n\tcp1 = strchr(str, key);\n\tcp2 = strchr(cp1+1, key);\n\tmidLen = (int)(cp2-cp1-1);\n\tif(midLen == 0)\t{\n\t\tprintf(\"Impossible\");\treturn 0;\n\t}\n\tlen1 = midLen/2;\n\tlen2 = midLen-len1;\n\tfor(pos=13-len1-1, i=0; i<=len1; i++)\t{\n\t\tgrid1[pos++] = *(cp1+i);\n\t}\n\tpos = 13-len1-1;\n\tfor(pos=12, i=len2; i>0; i--)\t{\n\t\tgrid2[pos--] = *(cp2-i);\n\t}\n\tlenToKey = cp1-str+1;\n\tif(lenToKey+len1>=13)\t{\n//\t\tputs(\"EnteredAt1st\");\n\t\tpos = 13-len1-1;\n\t\twhile(pos>=0)\tgrid1[--pos] = *(--cp1);\n\t\ti=0;\n//\t\tputs(\"Ok\");\n\t\twhile(cp1>str)\tgrid2[i++] = *(--cp1);\n\t\tcp2++;\tpos = 13-len2;\n\t\twhile(*cp2)\tgrid2[--pos] = *(cp2++);\n\t\tprintf(\"%s\\n%s\", grid1, grid2);\n\t\treturn 0;\n\t}\n\telse\t{\n\t\tpos = 13-len2;\n\t\twhile(pos>=0)\tgrid2[--pos] = *(cp2++);\n\t\ti=0;\n\t\twhile(*cp2)\tgrid1[i++] = *(cp2++);\tpos=0;\n\t\twhile(i<13)\tgrid1[i++] = str[i];\n\t\tprintf(\"%s\\n%s\",grid1, grid2);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b265cef9612fb8bc0acfc45f2a4b246d", "src_uid": "56c5ea443dec7a732802b16aed5b934d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define eps 1e-9\n#define ll long long int \n#define N 500500\nchar first1[N];\nchar in[N];\nchar first2[N];\nchar second1[N];\nchar second2[N];\nint main(){\n gets(in);\n int remem=-1;int start;\n for(int i=0;i26)\n i=0;\n first2[k++]=in[i++];\n }\n k=0;\n for(int w=0;w26)\n i=0;\n second2[k++]=in[i++];\n }\n i++;k=0;\n for(int w=0;w<(13-(remem/2));w++){\n if(i>26)\n i=0;\n first1[k++]=in[i++];\n } \n k=0;\n for(int w=0;w<13-(ub);w++){\n if(i>26)\n i=0;\n second1[k++]=in[i++];\n }\n for(int i=0;i\nchar s[30];\nint a[30];\nint main()\n{\n scanf(\"%s\",s);\n int target=s[0]-'A'+1;\n int last=target;\n a[0]=target;\n for(int i=1;s[i]!='\\0';i++)\n {\n int temp=s[i]-'A'+1;\n a[i]=temp;\n if(temp==last)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n last=temp;\n }\n for(int i=0;i<=26;i++)\n {\n for(int j=i+1;j<=26;j++)\n if(a[i]==a[j])\n target=a[i];\n }\n int flag=0;\n int start,end;\n start=end=0;\n for(int i=0;i<27;i++)\n {\n if(a[i]==target&&flag==0)\n start=i,flag=1;\n else if(a[i]==target&&flag!=0)\n end=i;\n }\n int mid=(end-start-1)/2+start;\n //printf(\"%d %d %d\\n\",mid,start,end);\n if(mid>=13){\n if((end-start-1)%2!=0) mid++;\n for(int i=mid-12;i<=mid;i++)\n printf(\"%c\",a[i]+'A'-1);\n printf(\"\\n\");\n for(int i=mid-13;i>=0;i--)\n printf(\"%c\",a[i]+'A'-1);\n for(int i=26;i>mid;i--)\n {\n if(i==end) continue;\n printf(\"%c\",a[i]+'A'-1);\n }\n printf(\"\\n\");\n } else\n {\n if((end-start-1)%2==0) mid++;\n for(int i=mid+1;i<=mid+13;i++)\n {\n //if(i==end) continue;\n printf(\"%c\",a[i]+'A'-1);\n }\n printf(\"\\n\");\n for(int i=mid;i>=0;i--)\n {\n if(i==start) continue;\n printf(\"%c\",a[i]+'A'-1);\n }\n for(int i=26;i>mid+13;i--)\n {\n printf(\"%c\",a[i]+'A'-1);\n }\n printf(\"\\n\");\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "23f6fa43fd1ea3c6fb7bef01b8859587", "src_uid": "56c5ea443dec7a732802b16aed5b934d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\t{\n\tint midLen, len1, len2;\n\tint i, letterArr[26]={0}, pos, lenToKey;\n\tchar str[30], key, grid1[14]={0}, grid2[14]={0}, *cp1, *cp2;\n\tscanf(\"%s\", str);\n\tfor(i=0; i<27; i++)\t{\n\t\tif(letterArr[str[i]-'A'])\tbreak;\n\t\telse letterArr[str[i]-'A']++;\n\t}\n\tkey = str[i];\n\tcp1 = strchr(str, key);\n\tcp2 = strchr(cp1+1, key);\n\tmidLen = (int)(cp2-cp1-1);\n\tif(midLen == 0)\t{\n\t\tprintf(\"Impossible\");\treturn 0;\n\t}\n\tlen1 = midLen/2;\n\tlen2 = midLen-len1;\n\tfor(pos=13-len1-1, i=0; i<=len1; i++)\t{\n\t\tgrid1[pos++] = *(cp1+i);\n\t}\n\tpos = 13-len1-1;\n\tfor(pos=12, i=len2; i>0; i--)\t{\n\t\tgrid2[pos--] = *(cp2-i);\n\t}\n\tlenToKey = cp1-str+1;\n\tif(lenToKey+len1>=13)\t{\n//\t\tputs(\"EnteredAt1st\");\n\t\tpos = 13-len1-1;\n\t\twhile(pos>=0)\tgrid1[--pos] = *(--cp1);\n\t\ti=0;\n//\t\tputs(\"Ok\");\n\t\twhile(cp1>str)\tgrid2[i++] = *(--cp1);\n\t\tcp2++;\tpos = 13-len2;\n\t\twhile(*cp2)\tgrid2[--pos] = *(cp2++);\tgrid1[13] = 0; grid2[13] = 0;\n\t\tprintf(\"%s\\n%s\", grid1, grid2);\n\t\treturn 0;\n\t}\n\telse\t{\n//\t\tputs(\"EntererdAt2nd\");\n\t\tpos = 13-len2;\n\t\twhile(pos>=0)\tgrid2[--pos] = *(cp2++);\n\t\ti=0;\n\t\twhile(*cp2)\tgrid1[i++] = *(cp2++);\tpos=0;\n\t\twhile(i<13)\tgrid1[i++] = str[i];\tgrid1[13] = 0; grid2[13] = 0;\n\t\tprintf(\"%s\\n%s\",grid1, grid2);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "65d9003b38144a36d82f98689ed041e8", "src_uid": "56c5ea443dec7a732802b16aed5b934d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define eps 1e-9\n#define ll long long int \n#define N 500500\nchar in[N];\nchar first[N];\nchar second[N];\nint main(){\n gets(in);\n if(in[19]!=in[6]){\n printf(\"Impossible\");\n return 0;\n }\n second[0]=in[strlen(in)-1];\n int k=1;\n int len=strlen(in);\n for(int i=0;i<6;i++){\n second[k++]=in[i];\n }\n int s=12;\n int go=13;\n for(int i=0;i<6;i++){\n second[s--]=in[go++];\n }\n s=0;\n go=25;\n for(int i=0;i<6;i++){\n first[s++]=in[go--];\n }\n go=6;\n for(int i=0;i<=6;i++){\n first[s++]=in[go++];\n }\n \n for(int i=0;i\n\nvoid merge(int arr[], int l, int m, int r)\n{\n\tint arr1[m-l+1], arr2[r-m], i, j, k;\n\n\tfor(i = 0; i < m-l+1; i++)\n\t\tarr1[i] = arr[l+i];\n\n\tfor(j = 0; j < r-m; j++)\n\t\tarr2[j] = arr[j+m+1];\n\n\ti = 0;\n\tj = 0;\n\tk = l;\n\n\twhile((i< m-l+1) && (j < r-m))\n\t{\n\t\tif(arr1[i] <= arr2[j])\n\t\t\tarr[k++] = arr1[i++];\n\t\telse\n\t\t\tarr[k++] = arr2[j++];\n\t}\n\n\twhile(i < m-l+1)\n\t\tarr[k++] = arr1[i++];\n\twhile(j < r - m)\n\t\tarr[k++] = arr2[j++];\n\n}\n\nvoid mergesort(int arr[], int l, int r)\n{\n\tif(l < r){\n\t\tint m = l + (r - l)/2;\n\t\tmergesort(arr, l , m);\n\t\tmergesort(arr, m+1, r);\n\t\tmerge(arr, l, m, r);\n\t}\n}\n\nint main ()\n{\n\n\tint p, x, y, i, j, k, l, ans, flag, count, arr[475];\n\n\tscanf(\"%d %d %d\", &p, &x, &y);\n\tl = 0;\n\tfor(k = 0; k < 475; k++)\n\t{\n\t\ti = k;\n\t\tfor(j = 0; j < 25; j++)\n\t\t{\n\t\t\ti = (i*96 + 42)%475;\n\t\t\tif(p == 26 + i)\n\t\t\t{\n\t\t\t\tarr[l++] = k;\n\t\t\t\tprintf(\"%d\\n\", k);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"Aur k nahi\\n\");\n\tcount = 0;\n\tflag = 0;\n\t\n\tif(x < y)\n\t{\n\t\tif((y-x)%50 != 0)\n\t\t{\n\t\t\ty = y + 50 - (y-x)%50;\n\t\t}\n\t\t\n\t\twhile(1)\n\t\t{\n\t\t\tfor(i = 0; i < l; i++)\n\t\t\t{\n\t\t\t\tif((y/50)%475 == arr[i])\n\t\t\t\t\tflag++;\n\t\t\t}\n\t\t\t\n\t\t\tif(flag != 0)\n\t\t\t\tbreak;\n\t\t\t\n\t\t\ty += 50;\n\t\t\tcount++;\n\t\t}\n\t\t\n\t\tans = (y-x)/100;\n\t\tif((y-x)%100 != 0)\n\t\t\tans += 1;\n\t}\n\t\n\telse\n\t{\n\t\ty = x;\n\t\twhile(1)\n\t\t{\n\t\t\tfor(i = 0; i < l; i++)\n\t\t\t{\n\t\t\t\tif((y/50)%475 == arr[i])\n\t\t\t\t\tflag++;\n\t\t\t}\n\t\t\t\n\t\t\tif(flag != 0)\n\t\t\t\tbreak;\n\t\t\t\n\t\t\ty += 50;\n\t\t\tcount++;\n\t\t}\n\t\t\n\t\tans = (y-x)/100;\n\t\tif((y-x)%100 != 0)\n\t\t\tans += 1;\n\t}\n\t\n\tprintf(\"%d\\n\", ans);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "70a972e44ba6ead26f5fbb139b6c6162", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#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, j, k, count=0, ans=0, p, x,y;\n\tlong long temp=0;\n\tscanf(\"%lld %lld %lld\", &p, &x, &y);\n\t//\tscanf(\"%s\", str);\n\ti=(x/50)%475;\n\tlong long flag=0;\n\tfor(j=1;j<=25;j++)\n\t{\n\t\ti=(i*96+42)%475;\n//\t\tprintf(\"%lld\\n\",26+i);\n\t\tif(i+26==p)\n\t\t\tflag=1;\n\t}\n\tif(flag)\n\t\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tfor(i=x+50;i<=25000;i=i+50)\n\t\t{\n\t\t\tk=(i/50)%475;\n\t\t\tfor(j=1;j<=25;j++)\n\t\t\t{\n\t\t\t\tk=(k*96+42)%475;\n\t\t\t\tif(k+26==p)\n\t\t\t\t{\n\t\t\t\t\tans=(i-x+50)/100;\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)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(flag)\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\telse\n\t\t\tprintf(\"0\\n\");\n\n\n\t\treturn 0;\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "baba92071a3f9730b0d786f7e8fd5940", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int p, x, y;\n int i, j = 1, n = 0, temp = 1;\n scanf(\"%d%d%d\", &p, &x, &y);\n i = (x / 50) % 475;\n while(1)\n {\n i = (i * 96 + 42) % 475;\n if(i + 26 == p)\n {\n printf(\"0\\n\");\n temp = 0;\n break;\n }\n j++;\n if(j >= 25)\n {\n j = 1;\n n++;\n i = ((x - n * 50) / 50) % 475;\n }\n }\n if(temp)\n {\n j = 1;\n int a = 1;\n i = ((x + a * 100 - 50) / 50) % 475;\n while(1)\n {\n i = (i * 96 + 42) % 475;\n if(i + 26 == p)\n {\n break;\n }\n j++;\n if(j >= 25)\n {\n j = 1;\n a++;\n i = ((x + a * 100 - 50) / 50) % 475;\n }\n }\n j = 1;\n int m = 1;\n i = ((x + m * 100) / 50) % 475;\n while(1)\n {\n i = (i * 96 + 42) % 475;\n if(i + 26 == p)\n {\n break;\n }\n j++;\n if(j >= 25)\n {\n j = 1;\n m++;\n i = ((x + m * 100) / 50) % 475;\n }\n }\n printf(\"%d\\n\", a > m ? m : a);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ce69ff6376ab0fb311e6dd6a13d13b74", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint func(int x,int p)\n{\n\tint i=(x/50)%475,j=25;\n\tfor(j=0;j<25;j++)\n\t{\n\t\ti=(i*96+42)%475;\n\t\tif(26+i==p)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t}\n\treturn 0;\n}\n\nint main( )\n{\n\tint p,x,y,i=0,j,c=25,a[500];\n\tscanf(\"%d %d %d\",&p,&x,&y);\n\tfor(i=x;i>=y;i-=50)\n\t{\n\t\tif(func(i,p))\n\t\t{\n\t\t\treturn !printf(\"0\\n\");\n\t\t}\n\t}\n\tfor(i=50;;i+=50)\n\t{\n\t\tif(func(x+i,p))\n\t\t{\n\t\t\treturn !printf(\"%d\\n\",(i+50/100));\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "852d03693d055e2ff54a089811f699f9", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint good(int i, int p) {\n\tint k;\n\n\tfor (k = 0; k < 25; k++) {\n\t\ti = (i * 96 + 42) % 475;\n\t\tif (i + 26 == p)\n\t\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nint main() {\n\tint p, y, x, i, a, b, min, res;\n\n\tscanf(\"%d%d%d\", &p, &x, &y);\n\ta = y / 50;\n\tb = x / 50;\n\tmin = 1000;\n\tfor (i = a; i <= b + 475; i++) {\n\t\tres = i < b ? 0 : (i - b + 1) / 2;\n\t\tif (good(i % 475, p) && min > res)\n\t\t\tmin = res;\n\t}\n\tprintf(\"%d\\n\", min);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb56f270d432c6d16733743a26ee8798", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0} {"lang": "GNU C", "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 continue;\n }\n if(c=wb){\n printf(\"%d\\n\",c/wb*hb);\n continue;\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 ", "lang_cluster": "C", "compilation_error": true, "code_uid": "1c01096bea773cb3bf851fd16d766ce4", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0} {"lang": "GNU C", "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))\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b78541aadeb4a885466505cd84b16c95", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "600fe131f44819425b046c2cbc0c7738", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0} {"lang": "GNU C", "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 ", "lang_cluster": "C", "compilation_error": false, "code_uid": "13de05fcac69a9c600788fe316e28fe0", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "16626c48bdd502109e274c1fcaf2daec", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tint a[10], i, n, max=0;\n\tscanf(\"%d\", &n);\n\tfor(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;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*(a-pos_x[i])>=0) {printf(\"Yes\"); return 0;}\n }else{\n if(a-pos_x[i]==0 && (b-pos_y[i])%dy==0 && dy*(b-pos_y[i])>=0) {printf(\"Yes\"); return 0;}\n }\n }\n printf(\"No\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "acd61fbeb2afcee592dbc550d224faca", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0} {"lang": "GNU C", "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};\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(\"URDL\", s[i]) - s;\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f2913eaa76a65b453b570a0949a41259", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0} {"lang": "GNU C", "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{\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 }\n }\n printf(\"No\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "119c8009e5bbb697bd8726b04ebdd445", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0} {"lang": "GNU C", "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&&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", "lang_cluster": "C", "compilation_error": false, "code_uid": "d4705fe61b748ba5618f0361d6070048", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tint a,b,i,path[2][105],len,delta_x,delta_y,k;\n\tchar str[105];\n\tscanf(\"%d%d\",&a,&b);\n\tscanf(\"%s\",str);\n\tlen = strlen(str);\n\ti=0;\n\tk=0;\n\tpath[0][k]=0;\n\tpath[1][k]=0;\n\tk++;\n\twhile(ilen)\n\t\tprintf(\"No\\n\");\nreturn 0;\n}\t", "lang_cluster": "C", "compilation_error": true, "code_uid": "42bfbb8914e148dab8683b8c7d7eefd1", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,need=0;\n scanf(\"%d\",&n);\n \n int a[n];\n char temp;\n \n for(int i=0;i\nint main()\n{\n int n,i,temp,k=0,j;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;is[j])\n {\n temp=s[j];\n s[j]=s[i];\n s[i]=temp;\n }\n }\n for(i=0;i\n#include\nmain()\n{\n int a,d,count=0;\n scanf(\"%d\",&a);\n int s[a],c[a];\n for(int i=0;ic[k])\n d=c[j-1];\n }\n for(int k=0;k\nint main()\n{\n int i,k,a[100],n,s=0;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n for(i=2;i<=n;i++)\n {\n k=a[i];\n j=i-1;\n while(a[j]>k)\n a[j+1]=a[j];\n a[i]=k;\n }\n for(i=1;i<=n;i+=2)\n s=s+a[i+1]-a[i];\n printf(\"%d\",s);\n return 0;\nj", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f6665da800e0bcac044c8ffda6d1940", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,temp,k=0,j;\n scanf(\"%d\",&n);\n int s[n];\n for(i=0;is[j])\n {\n temp=s[j];\n s[j]=s[i];\n s[i]=temp;\n }\n }\n for(i=0;i\n\nint main() {\n\tint w1,h1,w2,h2;\n\tscanf(\"%d%d%d%d\",&w1,&h1,&w2,&h2);\n\tn=2*w1+2*(h1+h2+2);\n\tprintf(\"%d\\n\",n);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a5ebcfcd6f2d0031bb8623b0e3358fb9", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n#include \nusing namespace std;\n\n\nint main(){\n\tint w1,h1,w2,h2;\n\tscanf(\"%d%d%d%d\",&w1,&h1,&w2,&h2);\n\tint num=w1+2+h1+h1+2+(w1-w2)+h2+h2+w2;\n\tprintf(\"%d\",num);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7b5ebcb400c2c184dbd8a820d15a83de", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int w[2],h[2];\n scanf(\"%d %d %d %d\", &w[0], &h[0], &w[1], &h[1]);\n int ar[2];\n for(int i = 0; i < 2; i++)\n ar[i] = (w[i]+2) * (h[i]+2) - (w[i] * h[i]);\n ans = ar[0] + ar[1] - ( (w[1] + 2) * 2 );\n printf(\"%d\",ans);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e471f5f8aabc95e8be79fcb18bc47e9e", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n long long w1,w2,h1,h2;\n cin>>w1>>h1>>w2>>h2;\n long long ans = 2*w1 + 2*h1 + 2*h2 + 4;\n cout<\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6c9664a70d8b12fc39a54c186e4f630f", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\"%d\", &n)\n if(n>-127 && n<128)\n {\n printf(\"byte\");\n }\n else if(n>-32767 && n<32768)\n {\n printf(\"short\");\n }\n else if(n>=-2147483648 && n<=2147483647)\n {\n printf(\"int\");\n }\n else if(n>=-9223372036854775808 && n<=9223372036854775807)\n {\n printf(\"long\");\n }\n else\n {\n printf(\"biginteger\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "153cd5a952e72860bb3771c02e247801", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n int len;\n char a[101];\n scanf(\"%s\",a);\n len=strlen(a);\n if(len<3||(len==3&&strcmp(a,\"127\")<=0))printf(\"byte\\n\");\n else if(len<5||(len==5&&strcmp(a,\"32767\")<=0))printf(\"short\\n\");\n else if(len<10||(len==10&&strcmp(a,\"2147483647\")<=0))printf(\"int\\n\");\n else if(len<19||(len==19&&strcmp(a,\"9223372036854775807\")<=0))printf(\"long\\n\");\n else printf(\"BigInteger\\n\");\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5921c5c8b1d4a722b2a12274de99ce29", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "df5336946de085b3a1bde14402945c1d", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n//#include\nint main()\n{\n int l;\n char a[101];\n gets(a);\n l=strlen(a);\n if(l==1 || l==2) printf(\"byte\");\n else if(l==3 && a[0]<='1' && a[1]<='2' && a[2]<='7') printf(\"byte\");\n else if(l==3) printf(\"short\");\n else if(l==4) printf(\"short\");\n else if(l==5 && a[0]<='3' && a[1]<='2' && a[2]<='7' && \n a[3]<='6' && a[4]<='7') printf(\"short\");\n else if(l==5) printf(\"int\");\n else if(l>5 && l<10) printf(\"int\");\n else if(l==10 && a[0]<='2' && a[1]<='1' && a[2]<='4' && \n a[3]<='7' && a[4]<='4' && a[5]<='8' && a[6]<='3' && a[7]<='6' \n && a[8]<='4' && a[9]<='7')\n printf(\"int\");\n else if(l==10)\n printf(\"long\");\n else if(l>10 && l<19) printf(\"long\");\n else if(l==19 && a[0]<='9' && a[1]<='2' && a[2]<='2' && a[3]<='3'\n && a[4]<='3' && a[5]<='7' && a[6]<='2' && a[7]<='0' &&\n a[8]<='3' && a[9]<='6' && a[10]<='8' && a[11]<='5' && a[12]<='4'\n && a[13]<='7' && a[14]<='7' && a[15]<='5' && a[16]<='8'\n && a[17]<='0' && a[18]<='7') printf(\"long\");\n else if(l==19) printf(\"BigInteger\");\n else if(l>19) printf(\"BigInteger\");\n getch();\n // return(0);\n}\n // 2158324958633591462\n // 2147483647\n // 9 2 2 3 3 7 2 0 3 6 8 5 4 7 7 5 8 0 7\n // 2147483647\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c5f89e140cbd43875b11628d69e808e2", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain(){\n long long t,x,i;\n scanf(\"%d\",&x);\n t=0;\n for(i=0;i<=127;i++)\n {\n if(x==i)\n {\n printf(\"byte\");\n t=1;;\n }\n }\n if(t==0)\n {\n for(i=128;i<=32767;i++)\n {\n if(x==i)\n {\n printf(\"short\");\n t=1;\n }\n }\n }\n if(t==0)\n {\n for(i=32768;i<=2147483647;i++)\n {\n if(x==i)\n {\n printf(\"int\");\n t=1;\n }\n }\n }\n if(t==0)\n {\n for(i=21474836;i<=9223372036854775807;i++)\n {\n if(x==i)\n {\n printf(\"long\");\n t=1;\n }\n }\n if(t==0)\n {\n printf(\"BigInteger\");\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aaf22d9811311690db6d51d6af37c611", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void){\n\tint length;\n\tscanf(\"%d\\n\", &length);\n\n\tchar b[length];\n\tfor (int i = 0; i < length; i++) {\n\t\tscanf(\"%c\", &b[i]);\n\t}\n\n\tint result = 0;\n\tfor (int i = 0; i < length; i++) {\n\t\tif (b[i] == '0') {\n\t\t\tresult++;\n\t\t\tbreak;\n\t\t}\n\t\telse if (b[i] == '1') {\n\t\t\tresult++;\n\t\t}\n\t}\t\n\n\tprintf(\"%d\\n\", result);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "72d87887c7ca9ef14adb67fad51d0358", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nchar x[1001]= {'\\0'};\nint main()\n{\n int n,x,i,a=0;\n scanf(\"%d %s\",&n,x);\n \n for(i=0;i\n#include \nint main () {\n\tint input;\n\tfloat result=0;\n\n\tscanf(\"%d\",&input);fflush(stdin);\n\tchar binary[100];\n\n\tscanf(\"%s\",binary);fflush(stdin);\n\n\tfor (int i=0;i\n\nint main(int argc, char const *argv[])\n{\n\tint length;\n\tscanf(\"%d\\n\", &length);\n\n\tchar b[length];\n\tfor (int i = 0; i < length; i++) {\n\t\tscanf(\"%s\", &b[i]);\n\t}\n\n\tint result = 0;\n\tfor (int i = 0; i < length; i++) {\n\t\tif (b[i] == '0') {\n\t\t\tresult++;\n\t\t\tbreak;\n\t\t}\n\t\telse if (b[i] == '1') {\n\t\t\tresult++;\n\t\t}\n\t}\t\n\n\tprintf(\"%d\\n\", result);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8714912a94bd63eda87d315eea2d368d", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int i,n;\n char a;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%c\",&a);\n if(a!='1')\n break;\n }\n if(i==n+1)\n printf(\"%d\",n);\n else\n printf\"%d\",i);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f37a500ed0dbaf2db851ca372f77c57e", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n char cad[10];\n scanf(\"%s\",cad);\n printf(\"7\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3663220ede908deacaa9f76d36513ab8", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint top,i;\nchar a[10];\nint main(){\n\tscanf(\"%s\",a+1);\n\tfor(i=2;i<7;i++);\n\ttop+=(a[i]-'0')*(a[i]=='1' ? 10 : 1);\n\tprintf(\"%d\",top+1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "83d0006772a3ed314ae16018b5ae9d6a", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int i,r;\n char s[10];\n scanf(\"%s\",s);\n for(i=r=1;i<7;i++){\n if(s[i]==1){\n r+=10;\n }else{\n r+=s[i]-'0';\n }\n }\n printf(\"%d\",r);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "498cb56f5ae8495de3283e41cf2f26d2", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\tint n,i,t,t1;\n\tchar a[14444];\nint main(){\n\tscanf(\"%s\",a);\n\tt=a[1]-'0'+a[2]-'0';\n\tt1=a[2]-'0'+a[3]-'0';\n\tif(t1>t)\n\t\tprintf(\"%c%c\",a[1],a[2]);\n\telse\n\t\tprintf(\"%c%c\",a[2],a[3]);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a693ff87c40ee27014fb269671d9b4c", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint top,i;\nchar a[10];\nint main(){\n\tscanf(\"%s\",a+1);\n\tfor(i=2;i<=7;i++);\n\ttop+=(a[i]-'0')*(a[i]=='1' ? 10 : 1);\n\tprintf(\"%d\",top+1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4785dbc8054d7746ba2b7ea7a1c4acf7", "src_uid": "47287f8bc61fec72d729638d5e0e67f5", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint stat[26], sumT;\n\nint checkSubStrings(){\n int i, status = 0;\n for (i = 0; i < 26; i++){\n status += stat[i];\n }\n return status + sumT;\n}\n\nint main()\n{\n char s[50005];\n scanf(\"%s\", &s);\n int len = strlen(s), i, j, k;\n sumT = 0;\n if (len < 26) printf(\"-1\\n\");\n else{\n for (i = 0; i < 26; i++){\n if (s[i] != '?'){\n stat[s[i] - 65] = 1;\n }else sumT++;\n }\n// printf(\"SubStrings = %d\\n\", checkSubStrings());\n i = 0;\n while ((checkSubStrings() != 26) && (i <= (len - 26))){\n if (s[i] != '?') stat[s[i] - 65] = 0;\n else sumT--;\n if (s[i + 26] != '?') stat[s[i + 26] - 65] = 1;\n else sumT++;\n i++;\n }\n// printf(\"I = %d\\n\", i);\n if (checkSubStrings() != 26) printf(\"-1\\n\");\n else {\n for (j = i; j < i + 26; j++){\n if (s[j] == '?'){\n k = 0;\n while (k < 26){\n if (!stat[k]) {\n s[j] = k + 65;\n stat[k] = 1;\n break;\n }\n k++;\n }\n }\n }\n for (j = 0; j < len; j++)\n if (s[j] == '?') s[j] = 'A';\n printf(\"%s\\n\", s);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "febfa22882e90bb2678b7262ea6789eb", "src_uid": "a249431a4b0b1ade652997fe0b82edf3", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n long int n,que=0,count=0,i=0,j=0,p,res=0,k,l;\n char str[50010];\n scanf(\"%s\",&str);\n long int arr[27]={0};\n for(i=0,j=0;j\n#include \n#include \nvoid test(char* str)\n{\n\tfor(int i=0;i<26;i++)\n\t{\n\t\tif(str[i]=='\\0')\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\texit(0);\n\t\t}\n\t\tfor(int j=0;j\n#include\nint main()\n{\n long int n,que=0,count=0,i=0,j=0,p,res=0,k,l;\n char str[50010];\n scanf(\"%s\",&str);\n long int arr[27]={0};\n for(i=0,j=0;j\n#include\nint main()\n{\n long int n,que=0,count=0,i=0,j=0,p,res=0,k,l;\n char str[50010];\n scanf(\"%s\",&str);\n long int arr[27]={0};\n for(i=0,j=0;j\n\nint tab[110];\nint abs(int a){\n\tint b;\n\t(a>0) ? b=a : b=-a;\n\treturn b;\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\nint a[100];\nint main(){\n int n,k,i,max=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\n\nusing namespace std;\n\nint main (void)\n{\n int n, k;\n\n cin>>n>>k;\n\n int a[n];\n\n for(int i = 0; i < n; i++)\n cin>>a[i];\n\n int max = 0;\n\n\n for(int b = 0; b < k; b++){\n int infor = 0;\n int social = 0;\n for(int i = 0; i < n; i++){\n if((i-b)%k!=0){\n if(a[i] == -1)\n social++;\n else\n infor++;\n }\n }\n if(max\n\n \n \n Debug\n Win32\n \n \n Release\n Win32\n \n \n Debug\n x64\n \n \n Release\n x64\n \n \n \n 15.0\n {7C2D7A28-1431-4F1D-BD6D-B1DA49A551D4}\n Win32Proj\n ARomanandBrowser\n 10.0.17134.0\n \n \n \n Application\n true\n v141\n Unicode\n \n \n Application\n false\n v141\n true\n Unicode\n \n \n Application\n true\n v141\n Unicode\n \n \n Application\n false\n v141\n true\n Unicode\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n true\n \n \n true\n \n \n false\n \n \n false\n \n \n \n Level3\n Disabled\n true\n WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)\n true\n \n \n true\n Console\n \n \n \n \n Level3\n Disabled\n true\n _DEBUG;_CONSOLE;%(PreprocessorDefinitions)\n true\n \n \n true\n Console\n \n \n \n \n Level3\n MaxSpeed\n true\n true\n true\n WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)\n true\n \n \n true\n true\n true\n Console\n \n \n \n \n Level3\n MaxSpeed\n true\n true\n true\n NDEBUG;_CONSOLE;%(PreprocessorDefinitions)\n true\n \n \n true\n true\n true\n Console\n \n \n \n \n \n \n \n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6a126837bf085ac56d4793bf9e42998b", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "057381a65497e48b01b3ec5d2c95ae95", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "f16d7e3565287d1d726c9e7fd2780b76", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "91d5d048398317d88b9a59060ffcd160", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "96f2d9d0e78bd2940d9b86b79e4989c3", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e3c43881a9575ea991e9d9072413bbf7", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#define MAX 7\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7894639ebe3764a3371fc528ef661c99", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define uLL unsigned long long\n#define LL long long\nuLL exgcd64(uLL a,uLL b,uLL *x,uLL *y)\n{\n\tstatic uLL gcd;\n\tif (a==0)\n\t{\n\t\t*x=0;*y=1;\n\t\treturn b;\n\t}\n\telse\n\t{\n\t\tgcd=exgcd64(b%a,a,y,x);\n\t\t*x-=(b/a)*(*y)+b;\n\t\t*y+=a;\n\t\treturn gcd;\n\t}\n}\nint main()\n{\n\t//freopen(\"in.in\",\"r\",stdin);\n\tLL i,j,k,n,m,a,b,c,d,x,y,vx,vy;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&x,&y,&vx,&vy);\n\tif ((vx==0)||(vy==0))\n\t{\n\t\tif (vx==0)\n\t\t{\n\t\t\tif ((x==0)||(x==n))\n\t\t\t{\n\t\t\t\tif (vy<0) {printf(\"%lld 0\\n\",x);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",x,m);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t\tif (vy==0)\n\t\t{\n\t\t\tif ((y==0)||(y==m))\n\t\t\t{\n\t\t\t\tif (vx<0) {printf(\"0 %lld\\n\",y);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",n,y);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (vx<0)\n\t\t{\n\t\t\tx=n-x;\n\t\t}\n\t\tif (vy<0)\n\t\t{\n\t\t\ty=m-y;\n\t\t}\n\t\tc=exgcd64(m,n,&a,&b);\n\t\td=x-y;\n\t\tif (d<0) {d=(d%m+m)%m;}\n\t\tif (d%c!=0) {printf(\"-1\\n\");}\n\t\telse\n\t\t{\n\t\t\tc=(d/c)*b;\n\t\t\tif (c==0) {c+=m;}\n\t\t\td=(c*n-(x-y))/m;\n\t\t\t//printf(\"%lld %lld %lld %lld\\n\",d,c,a,b);\n\t\t\tc=c&1;d=d&1;\n\t\t\tif (vx<0) {c=c^1;}\n\t\t\tif (vy<0) {d=d^1;}\n\t\t\tc=c*n;d=d*m;\n\t\t\tprintf(\"%lld %lld\\n\",c,d);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9bb13cb6098e9e64c96ce0aed6aab185", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define uLL unsigned long long\n#define LL long long\nuLL exgcd64(uLL a,uLL b,uLL *x,uLL *y)\n{\n\tstatic uLL gcd;\n\tif (a==0)\n\t{\n\t\t*x=0;*y=1;\n\t\treturn b;\n\t}\n\telse\n\t{\n\t\tgcd=exgcd64(b%a,a,y,x);\n\t\t*x-=(b/a)*(*y)+b;\n\t\t*y+=a;\n\t\treturn gcd;\n\t}\n}\nint main()\n{\n\tfreopen(\"in.in\",\"r\",stdin);\n\tLL i,j,k,n,m,a,b,c,d,x,y,vx,vy;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&x,&y,&vx,&vy);\n\tif ((vx==0)||(vy==0))\n\t{\n\t\tif (vx==0)\n\t\t{\n\t\t\tif ((x==0)||(x==n))\n\t\t\t{\n\t\t\t\tif (vy<0) {printf(\"%lld 0\\n\",x);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",x,m);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t\tif (vy==0)\n\t\t{\n\t\t\tif ((y==0)||(y==m))\n\t\t\t{\n\t\t\t\tif (vx<0) {printf(\"0 %lld\\n\",y);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",n,y);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (vx<0)\n\t\t{\n\t\t\tx=n-x;\n\t\t}\n\t\tif (vy<0)\n\t\t{\n\t\t\ty=m-y;\n\t\t}\n\t\t//printf(\"%lld %lld %lld %lld\\n\",n,m,x,y);\n\t\tc=exgcd64(m,n,&a,&b);\n\t\td=x-y;\n\t\tif (d<0) {d=(d%m+m)%m;}\n\t\tif (d%c!=0) {printf(\"-1\\n\");}\n\t\telse\n\t\t{\n\t\t\td=(d/c)*(b/c)%(m/c);\n\t\t\tif (d==0) {d+=m/c;}\n\t\t\tc=d;\n\t\t\td=(c*n-(x-y))/m;\n\t\t\t//printf(\"%lld %lld %lld %lld\\n\",c,d,n,m);\n\t\t\tc=c&1;d=d&1;\n\t\t\tif (vx<0) {c=c^1;}\n\t\t\tif (vy<0) {d=d^1;}\n\t\t\tc=c*n;d=d*m;\n\t\t\tprintf(\"%lld %lld\\n\",c,d);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7bfa5abfb5dbf6bf167506f949978cb8", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define uLL unsigned long long\n#define LL long long\nuLL exgcd64(uLL a,uLL b,uLL *x,uLL *y)\n{\n\tstatic uLL gcd;\n\tif (a==0)\n\t{\n\t\t*x=0;*y=1;\n\t\treturn b;\n\t}\n\telse\n\t{\n\t\tgcd=exgcd64(b%a,a,y,x);\n\t\t*x-=(b/a)*(*y)+b;\n\t\t*y+=a;\n\t\treturn gcd;\n\t}\n}\nint main()\n{\n\tfreopen(\"in.in\",\"r\",stdin);\n\tLL i,j,k,n,m,a,b,c,d,x,y,vx,vy;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&x,&y,&vx,&vy);\n\tif ((vx==0)||(vy==0))\n\t{\n\t\tif (vx==0)\n\t\t{\n\t\t\tif ((x==0)||(x==n))\n\t\t\t{\n\t\t\t\tif (vy<0) {printf(\"%lld 0\\n\",x);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",x,m);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t\tif (vy==0)\n\t\t{\n\t\t\tif ((y==0)||(y==m))\n\t\t\t{\n\t\t\t\tif (vx<0) {printf(\"0 %lld\\n\",y);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",n,y);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (vx<0)\n\t\t{\n\t\t\tx=n-x;\n\t\t}\n\t\tif (vy<0)\n\t\t{\n\t\t\ty=m-y;\n\t\t}\n\t\t//printf(\"%lld %lld %lld %lld\\n\",n,m,x,y);\n\t\tc=exgcd64(m,n,&a,&b);\n\t\td=x-y;\n\t\tif (d<0) {d=(d%m+m)%m;}\n\t\tif (d%c!=0) {printf(\"-1\\n\");}\n\t\telse\n\t\t{\n\t\t\tc=(d/c)*(b/c)%m/c;\n\t\t\tif (c==0) {c+=m;}\n\t\t\td=(c*n-(x-y))/m;\n\t\t\t//printf(\"%lld %lld %lld %lld\\n\",c,d,n,m);\n\t\t\tc=c&1;d=d&1;\n\t\t\tif (vx<0) {c=c^1;}\n\t\t\tif (vy<0) {d=d^1;}\n\t\t\tc=c*n;d=d*m;\n\t\t\tprintf(\"%lld %lld\\n\",c,d);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "eebaef266b9ffaad401a6eb097ed77c2", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define uLL unsigned long long\n#define LL long long\nuLL exgcd64(uLL a,uLL b,uLL *x,uLL *y)\n{\n\tstatic uLL gcd;\n\tif (a==0)\n\t{\n\t\t*x=0;*y=1;\n\t\treturn b;\n\t}\n\telse\n\t{\n\t\tgcd=exgcd64(b%a,a,y,x);\n\t\t*x-=(b/a)*(*y)+b;\n\t\t*y+=a;\n\t\treturn gcd;\n\t}\n}\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tLL i,j,k,n,m,a,b,c,d,x,y,vx,vy,e;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&x,&y,&vx,&vy);\n\tif ((vx==0)||(vy==0))\n\t{\n\t\tif (vx==0)\n\t\t{\n\t\t\tif ((x==0)||(x==n))\n\t\t\t{\n\t\t\t\tif (vy<0) {printf(\"%lld 0\\n\",x);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",x,m);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t\tif (vy==0)\n\t\t{\n\t\t\tif ((y==0)||(y==m))\n\t\t\t{\n\t\t\t\tif (vx<0) {printf(\"0 %lld\\n\",y);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",n,y);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (vx<0)\n\t\t{\n\t\t\tx=n-x;\n\t\t}\n\t\tif (vy<0)\n\t\t{\n\t\t\ty=m-y;\n\t\t}\n\t\t//printf(\"%lld %lld %lld %lld\\n\",n,m,x,y);\n\t\tc=exgcd64(m,n,&a,&b);\n\t\te=c;\n\t\td=x-y;\n\t\tif (d<0) {d=(d%m+m)%m;}\n\t\tif (d%c!=0) {printf(\"-1\\n\");}\n\t\telse\n\t\t{\n\t\t\t//printf(\"%lld %lld %lld\\n\",b%c,d,((d/c)*(b/1)%(m/c)*n)%m);\n\t\t\td=(d/c)*(b)%(m/c);\n\t\t\tif (d==0) {d+=m/c;}\n\t\t\tc=d;\n\t\t\td=(c*n-(x-y))/m;\n/*\t\t\tif (d<0)\n\t\t\t{\n\t\t\t\ta=(-d)/c+1;\n\t\t\t\tc+=a*(m/e);\n\t\t\t\td+=a*(n/e);\n\t\t\t}*/\n\t\t\t//printf(\"%lld %lld %lld %lld\\n\",c,d*m,(c*n-(x-y))%m,x-y);\n\t\t\tc=c&1;d=d&1;\n\t\t\tif (vx<0) {c=c^1;}\n\t\t\tif (vy<0) {d=d^1;}\n\t\t\tc=c*n;d=d*m;\n\t\t\tprintf(\"%lld %lld\\n\",c,d);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f0ee009f8842ce2503c10ee5ce425f59", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define uLL unsigned long long\n#define LL long long\nuLL exgcd64(uLL a,uLL b,uLL *x,uLL *y)\n{\n\tstatic uLL gcd;\n\tif (a==0)\n\t{\n\t\t*x=0;*y=1;\n\t\treturn b;\n\t}\n\telse\n\t{\n\t\tgcd=exgcd64(b%a,a,y,x);\n\t\t*x-=(b/a)*(*y)+b;\n\t\t*y+=a;\n\t\treturn gcd;\n\t}\n}\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tLL i,j,k,n,m,a,b,c,d,x,y,vx,vy,e;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&x,&y,&vx,&vy);\n\tif ((vx==0)||(vy==0))\n\t{\n\t\tif (vx==0)\n\t\t{\n\t\t\tif ((x==0)||(x==n))\n\t\t\t{\n\t\t\t\tif (vy<0) {printf(\"%lld 0\\n\",x);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",x,m);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t\tif (vy==0)\n\t\t{\n\t\t\tif ((y==0)||(y==m))\n\t\t\t{\n\t\t\t\tif (vx<0) {printf(\"0 %lld\\n\",y);}\n\t\t\t\telse {printf(\"%lld %lld\\n\",n,y);}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (vx<0)\n\t\t{\n\t\t\tx=n-x;\n\t\t}\n\t\tif (vy<0)\n\t\t{\n\t\t\ty=m-y;\n\t\t}\n\t\t//printf(\"%lld %lld %lld %lld\\n\",n,m,x,y);\n\t\tc=exgcd64(m,n,&a,&b);\n\t\te=c;\n\t\td=x-y;\n\t\tif (d<0) {d=(d%m+m)%m;}\n\t\tif (d%c!=0) {printf(\"-1\\n\");}\n\t\telse\n\t\t{\n\t\t\t//printf(\"%lld %lld %lld\\n\",b%c,d,((d/c)*(b/1)%(m/c)*n)%m);\n\t\t\td=(d/c)*(b)%(m/c);\n\t\t\tif (d==0) {d+=m/c;}\n\t\t\tc=d;\n\t\t\td=(c*n-(x-y))/m;\n\t\t\tif (d<0)\n\t\t\t{\n\t\t\t\ta=(-d)/c+1;\n\t\t\t\tc+=a*(m/e);\n\t\t\t\td+=a*(n/e);\n\t\t\t}\n\t\t\t//printf(\"%lld %lld %lld %lld\\n\",c,d*m,(c*n-(x-y))%m,x-y);\n\t\t\tc=c&1;d=d&1;\n\t\t\tif (vx<0) {c=c^1;}\n\t\t\tif (vy<0) {d=d^1;}\n\t\t\tc=c*n;d=d*m;\n\t\t\tprintf(\"%lld %lld\\n\",c,d);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cc47d189fbd546d445246a8533753238", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int a,b,c,t;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n\n if(a>b)\n {t=a;\n a=b;\n b=t;}\n\n if(b>c)\n { t=b;\n b=c;\n c=t;}\n if(a>b)\n { t=a;\n a=b;\n b=t;\n }\n\n\n\n\n if(a==0&&b==0)\n printf(\"0\");\n else\n { if((b-a)%2==0)\n printf(\"%I64d\",b);\n else\n printf(\"%I64d\",c);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ef2ce3db0e1aac4067ac9e66e42d3bc", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int a[3],i,j,k;\n for(i=0;i<3;i++)\n scanf(\"%I64d\",&a[i]);\n for(i=0;i<2;i++)\n for(j=i+1;j<3;j++)\n {\n if(a[i]>a[j])\n {\n k=a[i];a[i]=a[j];a[j]=k;\n }}\n if((a[1]-a[0])%2)\n printf(\"%I64d\",a[2]);\n else printf(\"%I64d\",a[1]);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "021e5ecad3efd037e398a8dfd3ad5b4d", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int a[3],k;\n int i,j;\n for(i=0;i<3;i++)\n scanf(\"%I64d\",&a[i]);\n for(i=0;i<2;i++)\n for(j=i+1;j<3;j++)\n {\n if(a[i]>a[j])\n {\n k=a[i];a[i]=a[j];a[j]=k;\n }}\n if((a[1]-a[0])%2)\n printf(\"%I64d\",a[2]);\n else printf(\"%I64d\",a[1]);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "871c17e82fbaa6576300e2b5582aa8b7", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long int a[3],i,j,k;\n for(i=0;i<3;i++)\n scanf(\"%l64d\",&a[i]);\n for(i=0;i<2;i++)\n for(j=i+1;j<3;j++)\n {\n if(a[i]>a[j])\n {\n k=a[i];a[i]=a[j];a[j]=k;\n }}\n if((a[1]-a[0])%2)\n printf(\"%l64d\",a[2]);\n else printf(\"%l64d\",a[1]);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cc099bc1e155f9d2454a663a3f028fc2", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{int a[3]={0},b,c,i,j,k=0,t;\nscanf(\"%d %d %d\",&a[0],&a[1],&a[2]);\nfor(i=0;i<3;i++)\nfor(j=0;j<3-i-1;j++)\nif(a[j]=0;i--)\n{ if(a[i]-a[i+1]==0)\n {\n k+=a[i];\n goto flag;\n }\n}\na[1]--;a[0]--;\na[2]++;k++;\nif(a[1]\n#include \n#include \n#include \nusing namespace std;\n\n\nlong long int bSearch(long long n,long long int e) {\n\tlong long int m = n ;\n\tint a = 0;\n\twhile(m){\n\t\ta++;\n\t\tm /= 2;\n\t} \n long long mid, left = 1, right = (long long) (pow(2.0,a)-1); \n long long num = 0;\n while(left <= right) { \n mid = (left + right) >> 1; \n if(mid >= e)\n \tright = mid - 1;\n else {\n \tnum += n / 2 + n % 2;\n \tleft = mid + 1;\n }\n n /= 2; \n }\n return num; \n} \n\n\nint main(){\n\tlong long n , l , r ;\n\twhile(scanf(\"%lld%lld%lld\",&n,&l,&r)!=EOF){\n\t\tlong long sum;\n\t\tsum = bSearch(n,r+1)-bSearch(n,l) ;\n\t\tprintf(\"%lld\\n\",sum);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3ac9e61efe93034bfb0d8c67a4eeee2b", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#define MAXN 100010\nlong long a[MAXN],b[MAXN];\nint sign,flag; \nint main(){\n\tvoid crash(long long a[],long long b[]);\n\tlong long n;\n\tint r,l;\n\tint i,count\uff1b\n\tfor(i=0;i0){\n\t\tfor(i=r-1;i<=l-1;i++){\n\t\t\tif(a[i]==1){\n\t\t\t\tcount++; \n\t\t\t}\n\t\t}\n }\n\telse{\n\t\tfor(i=r-1;i<=l-1;i++){\n\t\t\tif(b[i]==1){\n\t\t\t\tcount++; \n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n} \n\nvoid crash(long long a[],long long b[]){\n\tsign=1,flag=0;\n\tint i,quo,mod,count;\n\tfor(i=0,count=0;a[i]!=-1;i++){\n\t\tif(a[i]!=1&&a[i]!=0){\n\t\t\tquo=a[i]/2;\n\t\t\tmod=a[i]%2;\n\t\t\tb[count]=quo;\n\t\t\tb[count+1]=mod;\n\t\t\tb[count+2]=quo;\n\t\t\tcount=count+3;\n\t\t\tflag=1;\n\t\t}\n\t\telse{\n\t\t\tb[count]=a[i];\n\t\t\tcount++;\n\t\t}\n\t}\n\tsign=sign*(-1);\n\tif(flag==1){\n\t\tcrash(b,a);\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "59d481dfd0f8f6ec96659e59028e930e", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\ntypedef long long ll;\n\nll solve(ll n, ll l, ll r, ll x, ll y) {\n if (r < x || l > y || n == 0) return 0;\n if (n == 1) return 1;\n ll mid = (x + y) / 2;\n return solve(n / 2, l, r, x, mid - 1) + solve(n % 2, l, r, mid, mid) + solve(n / 2, l, r, mid + 1, y);\n}\n\nint main() {\n ll n, l, r;\n ll ans;\n scanf(\"%lld %lld %lld\", &n, &l, &r);\n ll max = 1; while (max <= n) { max *= 2; }\n ans = solve(n, l, r, 1, max);\n printf(\"%lld\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "015474abeb1114a412002a5601295173", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\n\nlong long int bSearch(long long n,long long int e) {\n\tlong long int m = n ;\n\tint a = 0;\n\twhile(m){\n\t\ta++;\n\t\tm /= 2;\n\t} \n long long mid, left = 1, right = (int) (pow(2.0,a)-1); \n long long num = 0;\n while(left <= right) { \n mid = (left + right) >> 1; \n if(mid >= e)\n \tright = mid - 1;\n else {\n \tnum += n / 2 + n % 2;\n \tleft = mid + 1;\n }\n n /= 2; \n }\n return num; \n} \n\n\nint main(){\n\tlong long n , l , r ;\n\twhile(scanf(\"%lld%lld%lld\",&n,&l,&r)!=EOF){\n\t\tlong long sum;\n\t\tlong long a;\n\t\tsum = bSearch(n,r+1)-bSearch(n,l) ;\n\t\tprintf(\"%lld\\n\",sum);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8d0d77d54abec2c5439a319be3de4b8a", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\ntypedef __int64 ll;\n\n//L,R\u662f\u67e5\u8be2\u533a\u95f4\uff0cl,r\u662f\u8ba1\u7b97\u51fa\u7684\u5206\u89e3\u4ee5\u540e\u7684\u957f\u5ea6\nll query(ll L ,ll R,ll l,ll r, ll n) \n{\n if(l == r)\n return n;\n \n //\u5206\u6cbb\n ll mid = (l+r)>>1;\n ll ans = 0;\n \n //\u5728\u5de6\u4fa7\u8fdb\u884c\u9012\u5f52\n if(L <= mid - 1)\n ans += query(L,R,l,mid - 1,n>>1);\n //\u5728\u53f3\u4fa7\u8fdb\u884c\u9012\u5f52\u67e5\u627e\n if(R >= mid + 1)\n ans += query(L,R,mid + 1,r,n>>1);\n //\u8fd9\u4e2a\u65f6\u5019\u5bf9mid\u8fdb\u884c\u5904\u7406\uff0c\u5224\u65ad\u6761\u4ef6\u662fmid\u5728\u67e5\u8be2\u8303\u56f4\u533a\u95f4\u5185\n if(mid <= R && mid >= L)\n ans += n%2;\n \n return ans;\n}\n\n//\u8be5\u51fd\u6570\u662f\u7528\u6765\u6c42\u5206\u89e3n\u4ee5\u540e\u7684\u4f4d\u6570\n//\u4e5f\u53ef\u4ee5\u770b\u51fa\u4e00\u4e2a\u89c4\u5f8b\uff0c\u67d0\u4e2a\u6570\u7684\u5c55\u5f00\u4ee5\u540e\u7684\u4f4d\u6570\u662f\u521a\u597d\u5927\u4e8e\u4e8c\u6b21\u5e42\u7684\u503c\u51cf\u53bb1\uff0c\u6bd4\u59823\u7684\u5c55\u5f00\u4e3a4-1\uff0c4\u7684\u5c55\u5f00\u4e3a8-1\nll f(ll n) \n{\n if(n == 1 || n == 0)\n return 1;\n return 2 * f(n >> 1) + 1;\n}\n\nint main()\n{\n ll n;\n ll l, r;\n \n cin >> n >> l >> r;\n \n cout << query(l,r,1,f(n),n) << endl; \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "903c7d81ea35855b75f1cbaca32f2189", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{ int aux,m,n,c,k,d,min,j=0,s,i;\nint t[1000000000];\nscanf(\"%d\",&n);\nfor(i=1;i\nint main()\n{ int n,k=0,d,j,s,i;\nint *t;\nscanf(\"%d\",&n);\nint t[n];\nfor(i=1;i\n#include \n#include \n#define DIJKSTRA\n#ifndef _TJYTLXWXHYZQFW_HEAP_H\n#define _TJYTLXWXHYZQFW_HEAP_H\n#include \n#include \nstruct heap {\n int cap, last;\n void **cell; \n\tint (*cmp)(const void *, const void *);\n\t#ifdef DIJKSTRA\n\tvoid (*set)(void *, const int);\n\tvoid (*swap)(void *, void *);\n\t#endif\n};\nstruct heap *heap_new(int cap, int (*cmp)(const void *, const void*)\n\t#ifdef DIJKSTRA\n\t,void (*set)(void *, const int), void (*swap)(void *, void *)\n\t#endif\n)\n{\n struct heap *h;\n assert(h = malloc(sizeof(struct heap)));\n h->cap = ++cap;\n\th->last = 0;\n assert(h->cell = malloc(sizeof(void*) * cap));\n\th->cmp = cmp;\n\t#ifdef DIJKSTRA\n\th->set = set;\n\th->swap = swap;\n\t#endif\n return h;\n}\nvoid heap_destroy(struct heap *h)\n{\n if (h)\n free(h->cell);\n free(h);\n}\nvoid heap_pdown(int x, struct heap *h)\n{\n int c, d;\n void *tmp;\n while ((c = 2 * x) <= h->last) {\n d = c + 1;\n if (d <= h->last && h->cmp(h->cell[d], h->cell[c]) < 0)\n c = d;\n if (h->cmp(h->cell[x], h->cell[c]) < 0)\n break;\n tmp = h->cell[c];\n h->cell[c] = h->cell[x];\n h->cell[x] = tmp;\n\t\t#ifdef DIJKSTRA\n\t\th->swap(h->cell[c], h->cell[x]);\n\t\t#endif\n x = c;\n }\n}\nvoid heap_pup(int x, struct heap *h)\n{\n int p;\n void *tmp;\n while ((p = x / 2) >= 1) {\n if (h->cmp(h->cell[p], h->cell[x]) < 0)\n break;\n tmp = h->cell[x];\n h->cell[x] = h->cell[p];\n h->cell[p] = tmp;\n\t\t#ifdef DIJKSTRA\n\t\th->swap(h->cell[x], h->cell[p]);\n\t\t#endif\n x = p;\n }\n}\nint heap_insert(void *e, struct heap *h)\n{\n if (h->last >= h->cap)\n return -1;\n h->cell[++h->last] = e;\n\t#ifdef DIJKSTRA\n\th->set(h->cell[h->last], h->last);\n\t#endif\n heap_pup(h->last, h);\n return 0;\n}\nvoid *heap_del(struct heap *h)\n{\n void *ret;\n if (h->last <= 0)\n return NULL;\n ret = h->cell[1];\n h->cell[1] = h->cell[h->last--];\n\t#ifdef DIJKSTRA\n\th->set(h->cell[1], 1);\n\t#endif\n heap_pdown(1, h);\n return ret;\n}\n#endif\n\n#define LEN 20000001\nstruct node {\n\tlong long cost;\n\tchar color;\n\tlong long id;\n\tint hidx;\n};\nint compare(const void *x, const void *y)\n{\n\treturn ((struct node *)x)->cost - ((struct node *)y)->cost;\n}\nvoid sethidx(void *node, const int idx)\n{\n\t((struct node *)node)->hidx = idx;\n}\nvoid swaphidx(void *x, void *y)\n{\n\tint tmp;\n\ttmp = ((struct node *)x)->hidx;\n\t((struct node *)x)->hidx = ((struct node *)y)->hidx;\n\t((struct node *)y)->hidx = tmp;\n}\nlong long len;\n#define OOS(x) ((x) < 0 || (x) > len)\nlong long x, y;\nstruct node nodes[LEN];\nvoid handle(int id, long long cost, struct heap *h)\n{\n\tstruct node *next;\n\tif (OOS(id))\n\t\treturn;\n\tnext = &nodes[id];\n\tif (next->color == 2)\n\t\treturn;\n\tif (cost >= next->cost)\n\t\treturn;\n\tnext->cost = cost;\n\tif (next->color == 0) {\n\t\theap_insert(next, h);\n\t\tnext->color = 1;\n\t} else {\n\t\theap_pup(next->hidx, h);\n\t}\n}\nlong long dijkstra(void)\n{\n\tstruct heap *h;\n\tstruct node *node;\n\th = heap_new(LEN, compare, sethidx, swaphidx);\n\theap_insert(&nodes[0], h);\n\tnodes[0].color = 1;\n\tnodes[0].cost = 0;\n\twhile ((node = heap_del(h)) != NULL) {\n\t\tnode->color = 2;\n\t\tif (node->id == len)\n\t\t\treturn node->cost;\n\t\thandle(node->id + 1, node->cost + x, h);\n\t\thandle(node->id - 1, node->cost + x, h);\n\t\thandle(node->id * 2, node->cost + y, h);\n\t}\n\treturn -1;\n}\nint main(void)\n{\n\tlong long i, imax;\n\tscanf(\"%lld%lld%lld\", &len, &x, &y);\n\tfor (imax = len * 2, i = 0; i <= imax; ++i) {\n\t\tnodes[i].id = i;\n\t\tnodes[i].cost = LLONG_MAX;\n\t\tnodes[i].color = 0;\n\t}\n\tprintf(\"%lld\\n\", dijkstra());\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8d4bbbb435126d30a95785c6c7b83af5", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \nint dp[1<<24];\nvoid solve(const int n, const int x, const int y) {\n dp[1] = x;\n for(int i = 1; i <= n; i++)\n if(i & 1) dp[i] = dp[i - 1] + x;\n else dp[i] = dp[i >> 1] + y < dp[i - 1] + x ? dp[i >> 1 + y] : dp[i - 1] + x;\n return dp[n];\n}\n\nint main(void) {\n int n, x, y;\n scanf(\"%d%d%d\", &n, &x, &y);\n printf(\"%d\", solve(n, x, y));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8b4156553af5a6a37a507bf14ba63278", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \nint dp[1<<24];\n\nvoid solve(int n, int x, int y) {\n dp[1] = x;\n for(int i = 1; i <= n; i++)\n if(i & 1) dp[i] = dp[i - 1] + x;\n else dp[i] = min(dp[i >> 1] + y, dp[i - 1] + x);\n return dp[n];\n}\n\nint main(void) {\n int n, x, y;\n scanf(\"%d%d%d\", &n, &x, &y);\n printf(\"%d\", solve(n, x, y));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fec941626bd3a27a4d5cfec8bb69bf89", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n\n//////////////////////////////////////////\n// \u02fc\u00b7\ufffd\ufffd // \n// \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd // \n// by : //\n// \u02e7\ufffd\ufffd\ufffd\ufffd // \n////////////////////////////////////////// \n \ndouble final(double n,double a,double b) {\n\tdouble t; //\ufffd\ufffd\u02b1\ufffd\ufffd \n\tdouble t0; //\ufffd\ufffdkg+1\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\ufffd\ufffd\u0135\ufffd\u02b1\ufffd\ufffd \ufffd\ufffd\u00b7\u04bb \n\tdouble t1; //\ufffd\ufffdkg-1\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\ufffd\ufffd\u0135\ufffd\u02b1\ufffd\ufffd \ufffd\ufffd\u00b7\ufffd\ufffd \n\tint tk = 0; //\ufffd\ufffdkg+1\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\u00b3\ufffd\ufffd\ufffd 2 \ufffd\u0134\ufffd\ufffd\ufffd \n\tint tk2 = 0; //\ufffd\ufffdkg+1\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\u00bc\u04fc\ufffd 1 \ufffd\u0134\ufffd\ufffd\ufffd \n\tint dk = 0; //\ufffd\ufffdkg-1\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\u00b3\ufffd\ufffd\ufffd 2 \ufffd\u0134\ufffd\ufffd\ufffd\n\tint dk2 = 0; //\ufffd\ufffdkg-1\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\u00bc\u04fc\ufffd 1 \ufffd\u0134\ufffd\ufffd\ufffd\n\tlong kg = n; //\ufffd\ufffd\u05b9 n \u05b5\ufffd\ufffd\ufffd\u0131\ufffd \n\tlong hg2 = 0; // kg \ufffd\ufffd\ufffd\ufffd\ufffd\u01b7\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd hg \u05b5\ufffd\u0138\u0131\ufffd \n\tlong hg =0; // kg \ufffd\ufffd\ufffd\ufffd\ufffd\u01b7\ufffd\ufffd\ufffd\ufffd\u05b9 kg \u05b5\ufffd\u0138\u0131\ufffd \n\tint tag = 0; // \ufffd\ufffd\u01f0 kg \ufffd\u01f2\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0131\ufffd\u02b6 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffdkg == 1\ufffd\ufffd \u017c\ufffd\ufffd\ufffd\ufffdkg == 0\ufffd\ufffd \n\tint tag2 = 0; // \ufffd\ufffd\u01f0 hg \ufffd\u01f2\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0131\ufffd\u02b6 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffdhg == 1\ufffd\ufffd \u017c\ufffd\ufffd\ufffd\ufffdhg == 0\ufffd\ufffd\n\tint k1 = 0; // \ufffd\ufffd\ufffd\u06bc\ufffd\u00bc\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\ufffd\ufffd 2 \ufffd\u0134\ufffd\ufffd\ufffd\n\tint k2 = 0; // \ufffd\ufffd\ufffd\u06bc\ufffd\u00bc\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\ufffd\u04fc\ufffd 1 \ufffd\u0134\ufffd\ufffd\ufffd\n\tfor(; kg >= 2; k1++) {\n\t\tif(kg%2 != 0) {\n\t\t\ttag = 1;\n\t\t\tif(tag == 1 && (kg-kg/2-1)*a < b) //\u0427\ufffd\u02b6\u0531\u023e\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd \n\t\t\t\tbreak; \n\t\t\thg2 = kg;\n\t\t\thg = (kg+1)/2; //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\u04bb\ufffd\ufffd\ufffd\u00f5\ufffd\u04bb\ufffd\ufffd\u02b1\ufffd\ufffd \n\t\t\tfor(;hg>=2;tk++){ \n\t\t\t\tif(hg%2 != 0) \n\t\t\t\t\ttag2 = 1;\n\t\t\t\tif(tag2 == 1 && (hg-hg/2-1)*a < b) //\u0427\ufffd\u02b6\u0531\u023e\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd\u046d\ufffd\ufffd \n\t\t\t\t\tbreak;\n\t\t\t\tif(tag2 == 0 && (hg-hg/2)*a < b) //\u0427\ufffd\u02b6\u0531\u023e\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd\u046d\ufffd\ufffd \n\t\t\t\t\tbreak;\n\t\t\t\tif(hg%2 != 0)\n\t\t\t\t\ttk2++;\n\t\t\t\thg = hg/2;\n\t\t\t\ttag2 = 0;\n\t\t\t}\n\t\t\tt0 = b*tk + a*hg + a*tk2; //\ufffd\ufffd\u04bb\ufffd\ufffd\u02b1\ufffd\ufffd \n\t\t\ttag2 = 0;\n\t\t\thg = (hg2-1)/2; //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\ufffd\ufffd\ufffd\ufffd\ufffd\u00f5\ufffd\ufffd\u06b6\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd \n\t\t\tfor(;hg>=2;dk++){\n\t\t\t\tif(hg%2 != 0) \n\t\t\t\t\ttag2 = 1;\n\t\t\t\tif(tag2 == 1 && (hg-hg/2-1)*a < b) //\u0427\ufffd\u02b6\u0531\u023e\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd\u046d\ufffd\ufffd \n\t\t\t\t\tbreak;\n\t\t\t\tif(tag2 == 0 && (hg-hg/2)*a < b) //\u0427\ufffd\u02b6\u0531\u023e\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd\u046d\ufffd\ufffd \n\t\t\t\t\tbreak;\n\t\t\t\tif(hg%2 != 0)\n\t\t\t\t\tdk2++;\n\t\t\t\thg = hg/2;\n\t\t\t\ttag2 = 0; // tk dk tag \u03f5\ufffd\u0432\ufffd\ufffd\ufffd\u00ff\ufffd\ufffd\u046d\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n\t\t\t}\n\t\t\tt1 = b*dk + a*hg + a*dk2; //\ufffd\u06b6\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd \n\t\t\tif(t0 <= t1) \n\t\t\t\tkg+=1; //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\u04bb \n\t\t\telse\n\t\t\t\tkg-=1; //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00b7\ufffd\ufffd \n\t\t\t}\n\t\t\ttk = tk2 = dk = dk2 = hg2 = 0; // tk dk tag \u03f5\ufffd\u0432\ufffd\ufffd\ufffd\u00ff\ufffd\ufffd\u046d\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \n\t\t}\n\t\tif(tag == 1) {\n\t\t\tk2++;\n\t\t}\n\t\tif((kg-kg/2)*a <= b) //\u0427\ufffd\u02b6\u0531\u023e\ufffd\ufffd\ufffd\u04aa\ufffd\ufffd\u04aa\ufffd\ufffd\ufffd\ufffd\u046d\ufffd\ufffd \n\t\t\tbreak;\n\t\tkg = kg/2;\n\t\ttag = 0;\n\t}\n\tt = b*k1 + k2*a + kg*a; //\ufffd\u00f5\ufffd\ufffd\ufffd\ufffd\ufffd\u0237\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd \n\treturn t;\n}\n\nint main() {\n\tlong n,a,b; //\u02b9\ufffd\ufffd long double \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03aa\ufffd\u02f7\ufffd\u05b9\ufffd\ufffd\ufffd \n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tprintf(\"%.0f\\n\",final(n,a,b));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "12c5d56648df22428ecdb37092f25cfa", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "/*\n * 710E\n */\n\n#include \n#include \n#include \n\n#define DIJKSTRA\n#ifndef _TJYTLXWXHYZQFW_HEAP_H\n#define _TJYTLXWXHYZQFW_HEAP_H\n\n#include \n#include \n\n/** \u4f18\u5148\u961f\u5217\u7ed3\u6784 */\nstruct heap {\n\t/**\n\t * cap - \u4f18\u5148\u961f\u5217\u7684\u5bb9\u91cf\n\t * last - \u4f18\u5148\u961f\u5217\u4e2d\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u7684\u4e0b\u6807\n\t */\n int cap, last;\n\n\t/* \u6307\u9488\u6570\u7ec4,\u6307\u5411\u4f18\u5148\u961f\u5217\u4e2d\u7684\u5143\u7d20 */\n void **cell; \n\n\t/* \u6bd4\u8f83\u51fd\u6570,\u7528\u4e8e\u6bd4\u8f83\u961f\u5217\u5143\u7d20\u7684\u5927\u5c0f */\n\tint (*cmp)(const void *, const void *);\n\n\t#ifdef DIJKSTRA\n\t/* \u8bbe\u7f6e\u4e00\u4e2a\u5143\u7d20\u5728cell\u4e2d\u7684\u4e0b\u6807 */\n\tvoid (*set)(void *, const int);\n\t/* \u4ea4\u6362\u4e24\u4e2a\u5143\u7d20\u5728cell\u4e2d\u7684\u4e0b\u6807 */\n\tvoid (*swap)(void *, void *);\n\t#endif\n};\n\n/**\n * \u521b\u5efa\u4f18\u5148\u961f\u5217\n *\n * @param cap - \u4f18\u5148\u961f\u5217\u7684\u5bb9\u91cf,\u4e5f\u662fcell\u6570\u7ec4\u53ef\u7528\u4e0b\u6807\u7684\u6700\u5927\u503c\n * @param cmp - \u4f18\u5148\u961f\u5217\u4e2d\u5143\u7d20\u7684\u6bd4\u8f83\u65b9\u6cd5\n * @return - \u6307\u5411\u4f18\u5148\u961f\u5217\u7ed3\u6784\u7684\u6307\u9488\n */\nstruct heap *heap_new(int cap, int (*cmp)(const void *, const void*)\n\t#ifdef DIJKSTRA\n\t,void (*set)(void *, const int), void (*swap)(void *, void *)\n\t#endif\n)\n{\n struct heap *h;\n\n assert(h = malloc(sizeof(struct heap)));\n\t/* \u7531\u4e8ecell[0]\u4e0d\u5b58\u653e\u5143\u7d20,\u6545\u5b9e\u9645\u5206\u914d\u7684\u5143\u7d20\u662f(cap + 1)\u4e2a */\n h->cap = ++cap;\n\t/* linux\u4f1a\u66ff\u4f60\u63a9\u9970\u4f60\u72af\u4e0b\u7684**\u5fd8\u6389\u521d\u59cb\u5316**\u7684\u9519\u8bef, OJ\u4e0d\u4f1a */\n\th->last = 0;\n assert(h->cell = malloc(sizeof(void*) * cap));\n\t/* comparison function */\n\th->cmp = cmp;\n\n\t#ifdef DIJKSTRA\n\th->set = set;\n\th->swap = swap;\n\t#endif\n\n return h;\n}\n\n/**\n * \u91ca\u653e\u4f18\u5148\u961f\u5217\n *\n * @param h - \u8981\u88ab\u6467\u6bc1\u7684\u961f\u5217\n *\n * \u8fd9\u4e2a\u8fc7\u7a0b\u4e0d\u4f1a\u6467\u6bc1\u961f\u5217\u5143\u7d20,\u56e0\u4e3a\u961f\u5217\u672c\u8eab\u5bf9\n * \u5b58\u50a8\u4e8e\u5176\u4e2d\u7684\u5143\u7d20\u4e00\u65e0\u6240\u77e5\n */\nvoid heap_destroy(struct heap *h)\n{\n if (h)\n free(h->cell);\n free(h);\n}\n\n/**\n * \u4e0b\u6ee4\n *\n * @param x - \u8981\u88ab\u4e0b\u6ee4\u7684\u5143\u7d20\u7684\u4e0b\u6807\n * @param h - \u6307\u5411\u4f18\u5148\u961f\u5217\u7684\u6307\u9488\n *\n *
  • \u5982\u679cx\u7684\u4e24\u68f5\u5b50\u6811\u662f\u4f18\u5148\u961f\u5217,\u90a3\u4e48\u4e0b\u6ee4\u7ed3\u675f\u540e,\u4ee5x\u4e3a\u6839\u7684\u6811\u662f\u4f18\u5148\u961f\u5217
  • \n *
  • \u5728\u6700\u5927\u5806\u4e2d\u7a81\u7136\u589e\u5927\u7684\u5143\u7d20\u6216\u8005\u5728\u6700\u5c0f\u5806\u4e2d\u7a81\u7136\u53d8\u5c0f\u7684\u5143\u7d20\u9700\u8981\u88ab\u4e0b\u6ee4
  • \n */\nvoid heap_pdown(int x, struct heap *h)\n{\n int c, d;\n void *tmp;\n\n while ((c = 2 * x) <= h->last) {\n d = c + 1;\n if (d <= h->last && h->cmp(h->cell[d], h->cell[c]) < 0)\n c = d;\n if (h->cmp(h->cell[x], h->cell[c]) < 0)\n break;\n\n tmp = h->cell[c];\n h->cell[c] = h->cell[x];\n h->cell[x] = tmp;\n\t\t#ifdef DIJKSTRA\n\t\th->swap(h->cell[c], h->cell[x]);\n\t\t#endif\n\n x = c;\n }\n}\n\n/**\n * \u4e0a\u6ee4\n *\n * @param x - \u8981\u88ab\u4e0a\u6ee4\u7684\u5143\u7d20\u7684\u4e0b\u6807\n * @param h - \u6307\u5411\u4f18\u5148\u961f\u5217\u7684\u6307\u9488\n */\nvoid heap_pup(int x, struct heap *h)\n{\n int p;\n void *tmp;\n\n while ((p = x / 2) >= 1) {\n if (h->cmp(h->cell[p], h->cell[x]) < 0)\n break;\n\n tmp = h->cell[x];\n h->cell[x] = h->cell[p];\n h->cell[p] = tmp;\n\t\t#ifdef DIJKSTRA\n\t\th->swap(h->cell[x], h->cell[p]);\n\t\t#endif\n\n x = p;\n }\n}\n\n/**\n * \u63d2\u5165\n *\n * @param e - \u6307\u5411\u88ab\u63d2\u5165\u5143\u7d20\u7684\u6307\u9488\n * @param h - \u6307\u5411\u4f18\u5148\u961f\u5217\u7684\u6307\u9488\n * @return \u63d2\u5165\u7ed3\u679c: 0 - \u6210\u529f, -1 - \u5931\u8d25\n */\nint heap_insert(void *e, struct heap *h)\n{\n if (h->last >= h->cap)\n return -1;\n\n h->cell[++h->last] = e;\n\t#ifdef DIJKSTRA\n\th->set(h->cell[h->last], h->last);\n\t#endif\n heap_pup(h->last, h);\n\n return 0;\n}\n\n/**\n * \u5220\u9664\u6700\u5927/\u6700\u5c0f\u5143\n *\n * @param h - \u6307\u5411\u4f18\u5148\u961f\u5217\u7684\u6307\u9488\n * @return - \u6307\u5411\u88ab\u5220\u9664\u7684\u5143\u7d20\u7684\u6307\u9488; NULL - \u961f\u5217\u4e3a\u7a7a\n */\nvoid *heap_del(struct heap *h)\n{\n void *ret;\n\n if (h->last <= 0)\n return NULL;\n\n ret = h->cell[1];\n h->cell[1] = h->cell[h->last--];\n\t#ifdef DIJKSTRA\n\th->set(h->cell[1], 1);\n\t#endif\n heap_pdown(1, h);\n return ret;\n}\n\n#endif\n\n\n#define LEN 10000001\n\nstruct node {\n\tlong long cost;\n\tchar color;\n\tint id;\n\tint hidx;\n};\n\nint compare(const void *x, const void *y)\n{\n\t/* \u7528\u4e86long long\u7b80\u76f4\u5230\u5904\u662f\u9677\u9631 */\n\treturn ((struct node *)x)->cost - ((struct node *)y)->cost < 0 ? -1 : 1;\n}\n\nvoid sethidx(void *node, const int idx)\n{\n\t((struct node *)node)->hidx = idx;\n}\n\nvoid swaphidx(void *x, void *y)\n{\n\tint tmp;\n\n\ttmp = ((struct node *)x)->hidx;\n\t((struct node *)x)->hidx = ((struct node *)y)->hidx;\n\t((struct node *)y)->hidx = tmp;\n}\n\nlong long len;\n#define OOS(x) ((x) < 0 || (x) > len)\nlong long x, y;\nstruct node nodes[LEN];\n\nvoid handle(int id, long long cost, struct heap *h)\n{\n\tstruct node *next;\n\n\tif (id > len) {\n\t\tnext = &nodes[len];\n\t\tcost += x * (id - len); \n\t} else if (id >= 0) {\n\t\tnext = &nodes[id];\n\t} else {\n\t\treturn;\n\t}\n\n\n\tif (next->color == 2)\n\t\treturn;\n\n\tif (cost >= next->cost)\n\t\treturn;\n\n\n\tnext->cost = cost;\n\tif (next->color == 0) {\n\t\theap_insert(next, h);\n\t\tnext->color = 1;\n\t} else {\n\t\theap_pup(next->hidx, h);\n\t}\n}\n\nlong long dijkstra(void)\n{\n\tstruct heap *h;\n\tstruct node *node;\n\n\th = heap_new(len, compare, sethidx, swaphidx);\n\theap_insert(&nodes[0], h);\n\tnodes[0].color = 1;\n\tnodes[0].cost = 0;\n\n\twhile ((node = heap_del(h)) != NULL) {\n\t\tnode->color = 2;\n\t\tif (node->id == len)\n\t\t\treturn node->cost;\n\n\t\thandle(node->id + 1, node->cost + x, h);\n\t\thandle(node->id - 1, node->cost + x, h);\n\t\thandle(node->id * 2, node->cost + y, h);\n\t}\n\n\t/* impossible */\n\treturn -1;\n}\n\nint main(void)\n{\n\tlong long i, imax;\n\n\tscanf(\"%lld%lld%lld\", &len, &x, &y);\n\n\tfor (imax = len * 2, i = 0; i <= imax; ++i) {\n\t\tnodes[i].id = i;\n\t\tnodes[i].cost = LLONG_MAX;\n\t\tnodes[i].color = 0;\n\t}\n\n\tprintf(\"%lld\\n\", dijkstra());\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "237b03dcfa3c9991865903a82f96afb0", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;iin[k][0]&&in[k][0]>in[3][0]))) break;\n if(in[i][0]==in[3][0] && ((in[i][1]in[k][1]&&in[k][1]>in[3][1]))) break;\n }\n if(k==3) break;\n }\n }\n if(i<2) break;\n ok=1; break;\n }\n in[3][0] -= di; in[3][1] -= dj;\n }\n if(ok) puts(\"OTHER\"); else puts(\"CHECKMATE\");\n\n break;\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a1136abf536f44a93219ce32ee683a95", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;iin[k][1]&&in[k][1]>in[3][0]))) break;\n if(in[i][1]==in[3][1] && ((in[i][1]in[k][0]&&in[k][0]>in[3][1]))) break;\n }\n if(k==3) break;\n }\n }\n if(i<2) break;\n ok=1; break;\n }\n in[3][0] -= di; in[3][1] -= dj;\n }\n if(ok) puts(\"OTHER\"); else puts(\"CHECKMATE\");\n\n break;\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a06eb224a88cfc8a5b5b8036bfae3cc", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;iin[k][0]&&in[k][0]>in[3][0]))) break;\n if(in[i][1]==in[3][1] && ((in[i][1]in[k][1]&&in[k][1]>in[3][1]))) break;\n }\n if(k==3) break;\n }\n }\n if(i<2) break;\n ok=1; break;\n }\n in[3][0] -= di; in[3][1] -= dj;\n }\n if(ok) puts(\"OTHER\"); else puts(\"CHECKMATE\");\n\n break;\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8c380c4878b6bbfbf65634fe1a6dd8e9", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;iin[k][0]&&in[k][0]>in[3][0]))) break;\n if(in[i][0]==in[3][0] && in[i][0]==in[k][0] && ((in[i][1]in[k][1]&&in[k][1]>in[3][1]))) break;\n }\n if(k==3) break;\n }\n }\n if(i<2) break;\n ok=1; break;\n }\n in[3][0] -= di; in[3][1] -= dj;\n }\n if(ok) puts(\"OTHER\"); else puts(\"CHECKMATE\");\n\n break;\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7e76a462006c0f08a2b7c24a63ee6548", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint max(int a, int b)\n{\n if (a > b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nint min(int a, int b)\n{\n if (a < b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nint main()\n{\n char s[4][3];\n int p, q, i, j, k;\n int a[8][8] = {0};\n int b[2][2];\n\n for (i = 0; i < 4; i++) scanf(\"%s\", s[i]);\n\n p = s[2][0] - 'a';\n q = s[2][1] - '1';\n\n for (i = p - 1; i <= p + 1; i++) {\n\t for (j = q - 1; j <= q + 1; j++) {\n\t if (i >= 0 && i < 8 && j >= 0 && j < 8) a[i][j] = 1;\n\t }\n }\n\n for (i = 0; i < 2; i++) {\n\t b[i][0] = s[i][0] - 'a';\n\t b[i][1] = s[i][1] - '1';\n\n\t for (j = b[i][0]; j >= 0; j--) {\n\t a[j][b[i][1]]++;\n\n\t if (j == p && b[i][1] == q) break;\n\t }\n\n\t for (j = b[i][0] + 1; j < 8; j++) {\n\t a[j][b[i][1]]++;\n\n\t if (j == p && b[i][1] == q) break;\n\t }\n\n\t for (j = b[i][1] - 1; j >= 0; j--) {\n\t a[b[i][0]][j]++;\n\n\t if (b[i][0] == p && j == q) break;\n\t }\n\n\t for (j = b[i][1] + 1; j < 8; j++) {\n\t a[b[i][0]][j]++;\n\n\t if (b[i][0] == p && j == q) break;\n\t }\n }\n\n p = s[3][0] - 'a';\n q = s[3][1] - '1';\n\n if (a[p][q] == 0) {\n\t puts(\"OTHER\");\n\n\t return 0;\n }\n\n for (i = p - 1; i <= p + 1; i++) {\n\t for (j = q - 1; j <= q + 1; j++) {\n\t if (i >= 0 && i < 8 && j >= 0 && j < 8) {\n\t\t if (a[i][j] == 0) {\n\t\t\t puts(\"OTHER\");\n\n\t\t\t return 0;\n\t\t }\n\n\t\t for (k = 0; k < 2; k++) {\n\t\t\t if (i == b[k][0] && j == b[k][1]) {\n\t\t\t if (a[i][j] == 1) {\n\t\t\t\t puts(\"OTHER\");\n\n\t\t\t\t return 0;\n\t\t\t }\n\t\t\t }\n\t\t }\n\t }\n\t }\n }\n\n puts(\"CHECKMATE\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "078a10d0713dbe452a3e0643622d34ad", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint dp[100][51][201][2];\n\nint main()\n{\n int n, c = 0, len, i, j, k;\n char s[101];\n\n scanf(\"%s\", s);\n scanf(\"%d\", &n);\n\n len = strlen(s);\n\n for (i = 0; i < len; i++) {\n\t if (s[i] == 'T') c++;\n }\n\n if (c <= n) {\n\t n -= c;\n\n\t len -= n % 2;\n\n\t printf(\"%d\\n\", len);\n } else {\n\t if (s[0] == 'T') {\n\t dp[0][0][100][1] = 1;\n\t dp[0][1][101][0] = 1;\n\t } else {\n\t dp[0][0][101][0] = 1;\n\t dp[0][1][100][1] = 1;\n\t }\n\n\t for (i = 0; i < len - 1; i++) {\n\t for (j = 0; j <= n; j++) {\n\t\t for (k = 0; k <= 200; k++) {\n\t\t\t if (dp[i][j][k][0] == 1) {\n\t\t\t if (s[i] == 'T') {\n\t\t\t\t dp[i + 1][j][k][1] = 1;\n\n\t\t\t\t if (j < n) dp[i + 1][j + 1][k + 1][0] = 1;\n\t\t\t } else {\n\t\t\t\t dp[i + 1][j][k + 1][0] = 1;\n\n\t\t\t\t if (j < n) dp[i + 1][j + 1][k][1] = 1;\n\t\t\t }\n\t\t\t }\n\n\t\t\t if (dp[i][j][k][1] == 1) {\n\t\t\t if (s[i] == 'T') {\n\t\t\t\t dp[i + 1][j][k][0] = 1;\n\n\t\t\t\t if (j < n) dp[i + 1][j + 1][k - 1][1] = 1;\n\t\t\t } else {\n\t\t\t\t dp[i + 1][j][k - 1][1] = 1;\n\n\t\t\t\t if (j < n) dp[i + 1][j + 1][k][0] = 1;\n\t\t\t }\n\t\t\t }\n\t\t }\n\t }\n\t }\n\n\t c = 0;\n\n\t for (i = 0; i <= 100; i++) {\n\t if (dp[len - 1][n][100 + i][0] == 1) c = i;\n\n\t if (dp[len - 1][n][100 - i][0] == 1) c = i;\n\n\t if (dp[len - 1][n][100 + i][1] == 1) c = i;\n\n\t if (dp[len - 1][n][100 - i][1] == 1) c = i;\n\t }\n\n\t printf(\"%d\\n\", c);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f122a6cd5c4b1339ab507a1be34f69c7", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint max(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, c = 0, len, i, j, k;\n char s[101];\n\n scanf(\"%s\", s);\n scanf(\"%d\", &n);\n\n len = strlen(s);\n\n for (i = 0; i < len; i++) {\n\t if (s[i] == 'T') c++;\n }\n\n if (c <= n) {\n\t n -= c;\n\n\t len -= n % 2;\n\n\t printf(\"%d\\n\", len);\n } else {\n\t int dp[100][51] = {0};\n\n\t if (s[0] == 'T') {\n\t dp[0][1] = 1;\n\t } else {\n\t dp[0][0] = 1;\n\t }\n\n\t for (i = 1; i < len; i++) {\n\t for (j = 0; j <= i; j++) {\n\t\t if (s[i] == 'T') {\n\t\t\t for (k = 0; k < i; k++) {\n\t\t\t dp[i][j] = max(dp[i][j], dp[k][j]);\n\t\t\t }\n\n\t\t\t if (j > 0) {\n\t\t\t c = j - 1;\n\n\t\t\t for (k = i - 1; k >= 0; k--) {\n\t\t\t\t if (s[k] == 'T') c--;\n\n\t\t\t\t if (c < 0) break;\n\t\t\t }\n\n\t\t\t if (k < 0) {\n\t\t\t\t if (c == 0) dp[i][j] = i + 1;\n\t\t\t } else {\n\t\t\t\t dp[i][j] = max(dp[i][j], i - k);\n\t\t\t }\n\t\t\t }\n\t\t } else {\n\t\t\t for (k = 0; k < i; k++) {\n\t\t\t dp[i][j] = max(dp[i][j], dp[k][j]);\n\t\t\t }\n\n\t\t\t c = j;\n\n\t\t\t for (k = i - 1; k >= 0; k--) {\n\t\t\t if (s[k] == 'T') c--;\n\n\t\t\t if (c < 0) break;\n\t\t\t }\n\n\t\t\t if (k < 0) {\n\t\t\t if (c == 0) dp[i][j] = i + 1;\n\t\t\t } else {\n\t\t\t dp[i][j] = max(dp[i][j], i - k);\n\t\t\t }\n\t\t }\n\t }\n\t }\n\n\t printf(\"%d\\n\", dp[len - 1][n]);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f767123fc05bcfd6b3b055626de73cd1", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nconst int inf = 1 << 30;\n\nint f[110][55][2];\nchar s[110];\n\n#define max(a, b) (a > b ? a : b)\n\nint main( void ) {\n\tint n, m, i, j, c, k;\n\tscanf(\"%s %i\", s, &m);\n\n\tn = strlen(s);\n\n\tfor( i = 0; i < n; i++ )\n\t\ts[i] = (s[i] == 'F') ? 0 : 1;\n\t\n\t/*for( i = 0; i < n; i++) \n\t\tprintf(\"%i\", s[i]);\n\tputs(\"\");*/\n\t\n\tfor( i = 0; i < 110; i++ )\n\t\tfor( j = 0; j < 55; j++ )\n\t\t\tf[i][j][0] = f[i][j][1] = -inf;\n\n\tf[n][0][0] = f[n][0][1] = 0;\n\tfor( i = n-1; i >= 0; i-- )\n\t\tfor( j = m; j >= 0; j-- )\n\t\t\tfor( k = 0; k < 2; k++ ) {\n\t\t\t\tf[i][j][k] = -inf;\n\t\t\t\t\n\t\t\t\tint sign = (k == 0) ? 1 : -1;\n\t\t\t\tfor( c = 0; c <= j; c++ ) {\n\t\t\t\t\tint new_c = (c % 2) ? s[i] ^ 1 : s[i], cost;\n\n\t\t\t\t\tif( new_c == 0 ) cost = sign;\n\t\t\t\t\telse\t\t\t cost = 0;\n\t\t\t\t\t\n\t\t\t\t\tint new_k = (new_c == 1) ? k ^ 1 : k;\n\t\t\t\t\tf[i][j][k] = max(f[i][j][k], f[i+1][j-c][new_k] + cost);\n\t\t\t\t}\n\t\t\t}\n\t\n\tprintf(\"%i\\n\", f[0][m][0]);\n\t\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f25ec36afd77ed0123cde31be858e73e", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define abs(a) ((a < 0) ? (-(a)) : (a))\n#define abs_max(a, b) ((abs(a) > abs(b)) ? (a) : (b))\n\nint d[101][51][2];\nchar s[101];\nint n, k;\n\nint\nmain(void)\n{\n while(isalpha(s[n++] = getchar()))\n ;\n --n;\n int i, j, p;\n scanf(\"%d\", &k);\n for(i = 0; i <= n; ++i){\n for(j = 0; j <= k; ++j){\n d[i][j][0] = 0;\n d[i][j][1] = 0;\n }\n }\n for(i = 1; i <= n; ++i){\n for(j = 0; j <= k; ++j){\n for(p = 0; p <= j; ++p){\n if((s[i - 1] == 'F' && p % 2 == 0) || (s[i - 1] == 'T' && p % 2 == 1)){\n d[i][j][0] = abs_max(d[i - 1][j - p][0] + 1, d[i][j][0]);\n d[i][j][1] = abs_max(d[i - 1][j - p][1] - 1, d[i][j][1]);\n } else {\n d[i][j][1] = abs_max(d[i - 1][j - p][0], d[i][j][1]);\n d[i][j][0] = abs_max(d[i - 1][j - p][1], d[i][j][0]);\n }\n }\n }\n }\n printf(\"%d\", abs(abs_max(d[n][k][0], d[n][k][1])));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7079a528f7e41335b9797b97cf0e3f42", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nenum {\n L, R, N = 101\n};\n\nconst int INF = 100100;\n\nint max(int a, int b) { \n if(a == INF)\n return b;\n return a > b ? a : b; \n}\nint min(int a, int b) { return a < b ? a : b; }\n\nchar cmd[N];\nint n, len;\nint d[N][N][55][2][2];\n\nint sim(int left, int right) {\n int i, pos = 0, dx = 1;\n for(i = left; i <= right; i++) {\n if(cmd[i] == 'T')\n dx = -dx;\n else\n pos += dx;\n }\n return pos;\n}\n\nint rec(int left, int right, int nCmd, int dir, int isLow) {\n if(nCmd < 0)\n return INF;\n if(d[left][right][nCmd][dir][isLow] != -INF)\n return d[left][right][nCmd][dir][isLow];\n int *ret = &d[left][right][nCmd][dir][isLow];\n *ret = INF;\n if(left > right) {\n *ret = INF;\n }\n if(nCmd == 0) {\n *ret = sim(left, right);\n }\n if(left == right) {\n if((cmd[left] == 'T' && nCmd % 2 == 0) ||\n (cmd[left] == 'F' && nCmd % 2))\n *ret = 0;\n else\n *ret = 1;\n }\n if(*ret != INF)\n return *ret;\n int i, turns, nd, ni, nd2, ni2;\n for(i = left; i <= right; i++) {\n for(turns = 0; i != right && turns <= nCmd; turns++) {\n for(nd = L; nd <= R; nd++)\n for(ni = 0; ni < 2; ni++)\n for(nd2 = L; nd2 <= R; nd2++)\n for(ni2 = 0; ni2 < 2; ni2++) {\n int val = rec(left, i, turns, nd, ni) + \n rec(i + 1, right, nCmd - turns, nd2, ni2);\n if(rec(left, i, turns, nd, ni) == INF ||\n rec(i + 1, right, nCmd - turns, nd2, ni2) == INF)\n continue;\n if((isLow == 0 && dir == R) ||\n isLow == 1 && dir == L)\n *ret = max(*ret, val);\n else\n *ret = min(*ret, val);\n }\n }\n for(turns = 0; turns <= nCmd; turns++)\n for(nd = L; nd <= R; nd++)\n for(ni = 0; ni < 2; ni++)\n for(nd2 = L; nd2 <= R; nd2++)\n for(ni2 = 0; ni2 < 2; ni2++) {\n int ch;\n for(ch = 0; ch < 2; ch++) {\n int val = rec(left, i - 1, turns - ch, nd, ni);\n if(val == INF)\n continue;\n if(cmd[i] == 'F') {\n val -= \n rec(i + 1, right, nCmd - turns - (1 - ch), nd2, ni2);\n if(rec(i + 1, right, nCmd - turns - (1 - ch), nd2, ni2) == INF)\n continue;\n }\n else {\n if(rec(i + 1, right, nCmd - turns - (1 - ch), nd2, ni2) == INF)\n continue;\n val += rec(i + 1, right, nCmd - turns - (1 - ch), nd2, ni2) + 1;\n }\n if(0 && val == 2 && left == 2 && right == 3)\n printf(\"%d bord %d %d turns %d\\n\", val, i, ch, turns);\n if((isLow == 0 && dir == R) ||\n isLow == 1 && dir == L)\n *ret = max(*ret, val);\n else\n *ret = min(*ret, val);\n }\n }\n\n }\n if(*ret == -INF)\n *ret = INF;\n if(0)\n printf(\"left %d; right %d; cmd %d; dir %d; low %d; -> %d\\n\",\n left, right, nCmd, dir, isLow, *ret);\n return *ret;\n}\n\nint main() {\n scanf(\"%s %d\", cmd, &n);\n len = strlen(cmd);\n int ans = 0, i, j, k, r, e;\n for(i = 0; i < N; i++)\n for(j = 0; j < N; j++)\n for(k = 0; k < 55; k++)\n for(r = 0; r < 2; r++)\n for(e = 0; e < 2; e++)\n d[i][j][k][r][e] = -INF;\n for(i = n & 1; i <= n; i += 2) {\n ans = max(ans, -rec(0, len - 1, i, L, 0));\n if(rec(0, len - 1, i, R, 0) != INF)\n ans = max(ans, rec(0, len - 1, i, R, 0));\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "43ef17784162559a8149021e997a6522", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n\n#define author int\n#define sph_mp main() \n#define fr(i, a, b) for((i) = (a) ; (i) < (b) ; (i)++)\n#define frr(i, a, b) for((i) = (a) ; (i) >= (b) ; (i)--)\n\nint l, r, x, y;\nint a[1000], ai = 0;\n\n// Function to print the divisors\nvoid printDivisors(int n)\n{\n // Note that this loop runs till square root\n int i;\n for (i=1; i<=sqrt(n); i++)\n {\n if (n%i == 0)\n {\n // If divisors are equal, print only one\n if (n/i == i)\n \t{\n \t\ta[ai] = i;\n \t\tai++;\n\t\t\t\t}\n// printf(\"%d \", i);\n \n else // Otherwise print both\n \t{\n \t\ta[ai] = i;\n \t\ta[ai+1] = n/i;\n \t\tai += 2;\n\t\t\t\t}\n// printf(\"%d %d \", i, n/i);\n }\n }\n}\n \nint valid(int x) {\n\treturn l <= x && x <= r;\n}\n\nint gcd(int a, int b)\n{\n if (a == 0)\n return b;\n return gcd(b%a, 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}\n\n/* Driver program to test above function */\nauthor sph_mp {\n\tscanf(\"%d %d %d %d\", &l, &r, &x, &y);\n\tprintDivisors(y);\n\tint res = 0;\n\tint i, j;\n\tfr(i, 0, ai) \n\t\tfr(j, 0, ai) {\n\t\t\tif(valid(a[i]) && valid(a[j])) {\n\t\t\t\tif(gcd(a[i], a[j]) == x && lcm(a[i], a[j]) == y) \n\t\t\t\t\t{\n//\t\t\t\t\t\tprintf(\"%d %d\\n\", a[i], a[j]);\n\t\t\t\t\t\tres++;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\tprintf(\"%d\", res);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f6f814ea74ffe726db0eda8e0f2c7519", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n\nlong long int gcd(long long int a,long long int b)\n{\n\tif(b==0)\n\t\treturn a;\n\tgcd(b,a%b);\n}\n\nint main()\n{\t\n\tint i;\n\tlong long int l,r,x,y,pro,a,b;\n\tscanf(\"%lld%lld%lld%lld\",&l,&r,&x,&y);\n\t\n\ta=x;\n\tb=x;\n\ty=y/x;\n\tpro = sqrt(y);\n\tint ans=0;\n\tfor(i=1;i<=pro;i++)\n\t{\n\t\tif(y%i==0 && gcd(y/i,i)==1)\n\t\t{\n\t\t\tif(y/i==i)\n\t\t\t{\n\t\t\t\tif(x*i>=l && x*i<=r)\n\t\t\t\t\tans++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif((x*i>=l && x*i<=r )\t&& (x*(y/i)>=l && x*(y/i)<=r))\n\t\t\t\t\tans+=2;\n\t\t\t}\n\t\t}\n\n\t}\n\tprintf(\"%d\\n\",ans );\n\n\n\n\treturn 0;\t\n}\n \n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "911304e19bb1d9e90cc20e05d1b93550", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main()\n{\n int e,a,b,i, x, y, k, f, r, q;\n k=0;\n scanf(\"%d %d %d %d\",&a, &b, &x, &y);\n for (i=1;i<=sqrt(y);i++)\n {\n if ((y%i==0)&&(i<=b/x)&&(i>=a/x)&&(y/i<=b/x)&&(y/i>=a/x))\n {\n f=0;\n if (i>y/i)\n\n q=i;\n else\n q=y/i;\n\n for(r=2;r<=sqrt(q);r++)\n if ((i % r==0)&&(y/i%r==0))\n f=1;\n\n if (f==0)\n {\n k++;\n if (i!=y/i)\n k++;\n }\n\n }\n }\n printf(\"%d\",k);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6cd2d12c7eb09475befaddcd4981783", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint l,r,x,y;\nint gcd(int p,int q){\n\tint r;\n\twhile(q!=0){\n\t\tr=p%q;\n\t\tp=q;\n\t\tq=r;\n\t}\n\treturn p;\n}\nvoid run(){\n\tint i,j,k,c;\n\twhile(scanf(\"%d%d%d%d\",&l,&r,&x,&y)!=EOF){\n\t\tif(y%x!=0){\n\t\t\tprintf(\"0\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tj=y/x;\n\t\tc=0;\n\t\tfor(i=1;i<100007&&i<=j;i++){\n\t\t\tif(j%i==0){\n\t\t\t\tk=j/i;\n\t\t\t\tif(k=l&&i*x<=r&&k*x>=l&&k*x<=r){\n\t\t\t\t\tif(gcd(i,k)==x){\n\t\t\t\t\t\tc+=i==k?1:2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",c);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4892b_min.in\",\"rb\",stdin);\n\tfreopen(\"4892b_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "89fa0b0a38af6d361a2e233f5f3cd20c", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main()\n{\n int e,a,b,i, x, y, k, f, r, q;\n k=0;\n scanf(\"%d %d %d %d\",&a, &b, &x, &y);\n for (i=1;i<=sqrt(y);i++)\n {\n if ((y%i==0)&&(i<=b/x)&&(i>=a/x)&&(y/i<=b/x)&&(y/i>=a/x))\n {\n f=0;\n if (i>y/i)\n\n q=i;\n else\n q=y/i;\n\n for(r=2;r //r\n#include\n#include\n#include\n#include\n#include\n#include\n#define INF 0x3f3f3f\n#define MAX 100100\n#define LL long long\nusing namespace std;\nint main()\n{\n LL n,m,j,i;\n while(cin>>n!=EOF)\n {\n if(n&1)\n printf(\"1\\n\");\n else\n printf(\"2\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f76a5f20c7635920916b478794c0473", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main() {\n/* long n;\n unsigned long long t;\n scanf(\"%ld\",&n);\n t = 3*n*(n+1) +1;\n printf(\"%llu\\n\",t); \n*/\n long n;\n scanf(\"%ld\",&n);\n if(n%2==1)\n printf(\"%d\\n\",1);\n else\n printf(\"%d\\n\",2);\n}\n~ ", "lang_cluster": "C", "compilation_error": true, "code_uid": "ec321ee2a9e5bf153e8cd08d15f583c3", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "include\nint main()\n{\n long long n;\n scanf(\"%I64d\",&n);\n if(n%2==0)printf(\"2\");\n else printf(\"1\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "21513a12bc3fd017842dade431424418", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main(){\n\tint n;\n\tcin>>n;\n\tif(n%2==0)\n\t cout<<\"2\";\n\telse \n\t cout<<\"1\";\n\t return 0; \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b923ea907b6e98f29391048d4a1bb2e7", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\nint main ()\n{\n long long int n;\n int ans;\n cin>>n;\n ans=2-(n%2);\n cout<\n#include\nint main()\n{\n char s[100], r[100], back[100];\n int ch[26] = {0}, i, k=0;\n scanf(\"%s\", s);\n //cout<=0 && ch[i]==0; i--){\n\n }\n for(int j=0; j\nint main()\n{\n char c='Z',d;int ans=0;\n while(scnaf(\"%c\",&d)+1)\n if(d>c)c=d,ans=1;\n else ans++;\n while(ans--)cout<\n#include\nint main()\n{\n char s[100], r[100], back[100];\n int ch[26] = {0}, i, k=0;\n scanf(\"%s\", s);\n //cout<=0 && ch[i]==0; i--){\n\n }\n for(j=0; j\nint a['z'+2];\nint main() {\n for(char c=getchar();c!='\\n';a['z'+1] = a['z'+1] ^ ((a['z'+1] ^ (c-'a')) & -(a['z'+1] < (c-'a'))), c=getchar()) a[c-'a']++;\n \twhile(a[a['z'+1]]--) printf(\"%c\", a['z'+1]+'a');\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1a8a87d0bd09872488f6444ed41dc8b4", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n char c='Z',d;int ans=0;\n while(scanf(\"%c\",&d)+1)\n if(d>c)c=d,ans=1;\n else if(c==d) ans++;\n while(ans--)cout<\nint main()\n{\n int h,w,c;\n scanf(\"%d %d\",&h,&w);\n long long s1;\n s1 = h+w;\n for(i=1;i<=n;i++)\n s1 = (2*s1)%mod;\n printf(\"%I64d\\n\",s1);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "196e60b5e3079aebd6ad1ae3155c29d9", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "\n#include\n#define mod 998244353\nint main()\n{\n int h,w,i;\n scanf(\"%d %d\",&h,&w);\n long long p,p1,s3;\n p = 2;\n for(i=2;i<=h;i++)\n {\n p = ((p%mod)*(p%mod))%mod;\n }\n p1 = 2;\n for(i=2;i<=n;i++)\n {\n p1 = ((p1%mod)*(p1%mod))%mod;\n }\n s3 = ((p1%mod)*(p%mod))%mod;\n printf(\"%I64d\\n\",s3);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5a6987535c80ce6ae70d85e8ce5672bf", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#define mod 998244353\nint main()\n{\n int h,w;\n scanf(\"%d %d\",&h,&w);\n long long ans = ((1<\n#define mod 998244353\nint main()\n{\n int h,w;\n scanf(\"%d %d\",&h,&w);\n long long ans = (((1<\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd587e9efd9f46ff9006ae2ea9dbb5e0", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "ff979f8c67dacb8024221e349701c481", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c4181088fc7c6bd3ec6d462d35300580", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "477cdceb1e776dbaf60ab837f27539d2", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "094bef8ef4751748c15fc9f634cadc53", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define MAX 107\n#define MIN 1000007\n\nint main()\n{\n\tint x, n, i, a[MAX], j, ans = MIN;\n\tscanf(\"%d\", &n);\n\tfor(i=0;i x ? x : ans;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "86a4209c7e49703c3ebfc0fe74c38776", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \nint main(void)\n{\n int n,i,j=0;\n scanf(\"%d\", &n);\n int k[n]\n for(i=0;i\n\nint n;\nint A[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\",&n);\n int i,x;\n for(i=1;i<=n;i++){\n scanf(\"%d\",&A[i]);\n }\n int val=0,tv=0,mn=2147483647;\n for(x=1;x<=n;x++){\n tv=0;\n for(i=1;i<=n;i++){\n val=0;\n val+=ab(i-x)+i+x-2;\n val+=x+i-2+ab(x-i);\n tv+=(A[i]*val);\n }\n if(mn>tv)mn=tv;\n }\n printf(\"%d\\n\",mn);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "f51e636fd0afb7f65beeda90e6bd487a", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n+1],i,;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int u,units=0;\n\n for(i=1;i<=n;i++)\n {\n u=(i-1)*4;\n units=units+u*a[i];\n }\n printf(\"%d\",units);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "806025a55fb8e7c4696d05b5fd5d9ca9", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include\nvoid main()\n{\n\tint n,max=0,mi=0,sum=0,sum1=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0; i\nint main(){\n\tint a,b,c,d,e;\n\tscanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&e);\n\tprintf(\"%d\",min(a,min(b,min(c/2,min(d/7,e/4)))));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0e020a3347c9ed43580e168fbbbab772", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#define min(a,b) (a>b) (b):(a) \nint main(){\n\tint a,b,c,d,e,s=0;\n\tscanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&e);\n\tprintf(\"%d\",min(a,min(b,min(c/2,min(d/7,e/4)))));\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6703776a28a768247c57933d4c1cecd6", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint srx[6],sry,i;\nint min(int x,int y)\n{\n if(x\n\nint main()\n{\n int af, ar, am, mi, vit;\n scanf(\"%d %d %d %d %d\", &af, &ar, &am, &mi, &vit);\n am= am/2;\n mi=mi/7;\n vit=vit/4;\n if(vit<=af && vit<=ar && vit<=am && vit<=mi)\n {\n printf(\"%d\", vit);\n }\n else if(af<=ar && af<=am && af<=mi && af<=vit)\n {\n printf(\"%d\", af);\n }\n else if(ar<=af && ar<=am && ar<=mi && ar<=vit)\n {\n printf(\"%d\", ar);\n }\n else if(am<=af && am<=ar && am<=mi && am<=vit)\n {\n printf(\"%d\", am);\n }\n else if(mi<=af && mi<=ar && mi<=am && mi<=vit)\n {\n printf(\"%d\", mi);\n }\n\n main();\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "488d88341c521e8f4a621fe73b62e63a", "src_uid": "f914f9b7884cc04b990c7800c6be7b10", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int arr[5],i,arr2[]={1,1,2,7,4};\n int min=1000;\n for(i=0;i<5;i++)\n {\n \n scanf(\"%d\",&arr[i]);\n if(arr[i]/arr2[i]\n\nint a[10],i,j,k;\nchar c;\n\nint main\n{\n j=0;\n scanf(\"%d\",&k);\n for(i=0;i<5;i++)\n {\n for(j=0;j<5;j++)\n {\n scanf(\"%c\",&c);\n if(c=='1') a[1]++;\n if(c=='2') a[2]++;\n if(c=='3') a[3]++;\n if(c=='4') a[4]++;\n if(c=='5') a[5]++;\n if(c=='6') a[6]++;\n if(c=='7') a[7]++;\n if(c=='8') a[8]++;\n if(c=='9') a[9]++;\n }\n }\n j=0;\n for(i=1;i<10;i++)\n if(2*k\n#include \nint main()\n{\n int k;\n scanf(\"%d\\n\",&k);\n int i,j,l;\n char ch[4][4],str;\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",ch[i]);\n }\n int cnt[9];\n for(str='1';str<='9';str++)\n {\n cnt[str]=0;\n }\n char q,w;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n q=ch[i][j];\n if(q!='.')\n {\n cnt[q]++;\n }\n }\n }\n for(str='1';str<='9';str++)\n {\n if(cnt[str]<=2*k)\n l++;\n else \n {\n o=1;\n break;\n }\n }\n if(o==1)\n printf(\"NO\");\n if(l==9)\n printf(\"YES\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a9e0acb2330cca517de8946049bd22ff", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\n\nint main()\n{\n int k,i,a[10]={0};\n char s[5];\n scanf(\"%d\",&k);\n k=k*2;\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",s);\n if(s[0]!='.') \n\t\t{\n\t\t\ta[s[0]-'0']++;\n\t\t}\n if(s[1]!='.')\n\t\t{\n\t\t\ta[s[1]-'0']++;\n\t\t}\n if(s[2]!='.') \n\t\t{\n\t\t\ta[s[2]-'0']++;\n\t\t}\n if(s[3]!='.')\n\t\t{\n\t\t\ta[s[3]-'0']++;\n\t\t}\n }\n for(i=0;i<10;i++)\n { \n\t\tif(a[i]>k)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d02b4f60d40916a61b7716ff0798f5e6", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main()\n{\n int k;\n scanf(\"%d\\n\",&k);\n int i,j,k,l;\n char ch[4][4],str;\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",ch[i]);\n }\n int cnt[9];\n for(str='1';str<='9';str++)\n {\n cnt[str]=0;\n }\n char q,w;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n q=ch[i][j];\n if(q!='.')\n {\n cnt[q]++;\n }\n }\n }\n for(str='1';str<='9';str++)\n {\n if(cnt[str]<=2*k)\n l++;\n else \n {\n o=1;\n break;\n }\n }\n if(o==1)\n printf(\"NO\");\n if(l==9)\n printf(\"YES\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f661484ecbedb8ad1ebcd9743152b852", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n//#include\n\nusing namespace std;\n\nint main(void)\n{\n int k,i,j,conv,flag,q;\n scanf(\"%d\",&k);\n int a[9]={0};\n flag=0;\n char str[5];\n for(i=0; i<4; i++)\n {\n scanf(\"%s\",str);\n // printf(\"\\n%s\",str);\n for(q=0; q<4; q++)\n {\n conv=str[q];\n // printf(\"\\n c=%c d=%d\",str[q],conv);\n switch(conv)\n {\n case 49 : a[0]++;\n break;\n case 50 : a[1]++;\n break;\n case 51 : a[2]++;\n break;\n case 52 : a[3]++;\n break;\n case 53 : a[4]++;\n break;\n case 54 : a[5]++;\n break;\n case 55 : a[6]++;\n break;\n case 56 : a[7]++;\n break;\n case 57 : a[8]++;\n break;\n case 46 : break;\n }\n // }\n }\n }\n k*=2;\n for(i=0; i<9; i++)\n {\n if(a[i]>k)\n {\n flag=1;\n break;\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n // getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "53e5614d752a9c321dd016a9b8f03e8a", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint main()\n{\n int t,i,k,j,l,m,n,count,sum,count1;\n char s[10005],s1[10005];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n s1[0]=s[0];\n m=1;\n count=1;\n for(i=1;i\n#include\nint main()\n{\n char A[100];\n int n,i,j,k=0,m,l;\n\n scanf(\"%d\",&n);\n scanf(\"%s\",A);\n\n for(i=n;i>=0;i--)\n {\n l=0;\n if(i%2==0)\n {\n j=i/2;\n m=j;\n for(k=0;k\n\nint main(){\n\t\n\tint n,i,j,k,count=0,l=0,sum=0;\n\tchar s[100],s1[100];\n\t\n\tscanf(\"%d\",&n);\n\tgetchar();\n\t\n\tgets(s);\n\t\n\tl=strlen(s);\n\t\n\t//printf(\"l:%d\\n\",l);\n\tif(l%2!=0)\n\t\tj=l-1;\n\telse\n\t\tj=l;\t\n\t\n\twhile(j>=1){\n\t\t\n\t//\tprintf(\"\\nj:%d\\n\",j);\n\t\tfor(i=0;i<(j/2);i++){\n\t\t\t\n\t//\t\tprintf(\"s[%d]:%c,s[%d]:%c,\",i,s[i],(i+(j/2)),s[i+(j/2)]);\n\t\t\tif(s[i]!=s[i+(j/2)])\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t\tcount++;\n\t//\t\tprintf(\"count:%d\\n\",count);\t\t\t\n\t\t}\n\t\t\n\t\tif(count==(j/2)){\n\t\t\tsum=count;\n\t\t\tbreak;\n\t\t}\n\t\tcount=0;\n\t\n\t\tj=j-2;\t\n\t}\n\t\n\tif(sum!=0)\n\t\tprintf(\"%d\\n\",(sum+1)+(l-(2*sum)));\t\n\telse\n\t\tprintf(\"%d\\n\",strlen(s));\t\t\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "69ed064fbc4f19a918b504c546d93cc5", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main() {\n\tint i, j, k, len, flag = 0;\n\tchar str[100];\n\tscanf(\"%d\", &len);\n\tscanf(\"%s\", str);\n\tj = k = len / 2;\n\t\n\twhile(k > 0){\n\t\tj = k;\n\t\ti = 0;\n\t\twhile(str[i] == str[j] && j > i){\n\t\t\tif(i + 1 == k){\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t\tj++;\n\t\t}\n\t\tif(flag == 1)\n\t\t\tbreak;\n\t\tk--;\n\t}\t\n\tif(flag == 1)\n\t\tprintf(\"%d\\n\", len + 1 - k);\n\telse \n\t\tprintf(\"%d\\n\", len);\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a0139d3b23ab05f0c1b0ba01afe49d5d", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\n int n,i,j,k,c=1,m=0;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",a);\n for(i=0;im)\n m=c;\n }\n c=1;\n }\n }\n }\n if(m)\n printf(\"%d\",n-m+1);\n else\n printf(\"%d\",n);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "544a80b62adc7281241926962e50c773", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include\nint main(){\n int a,b,c,d,ans=0;\n scanf(%d %d %d %d,&a,&b,&c,&d);\n if (a>b){\n int temp=a;\n a=b;\n b=temp;\n }\n if (b>c){\n int temp=b;\n b=c;\n c=temp;\n }\n if (a>b){\n int temp=a;\n a=b;\n b=temp;\n }\n if (abs(b-a)\nint main()\n{\n int s[3],d;\n cin>>s[0]>>s[1]>>s[2]>>d;\n sort(s,s+3);\n cout<\n in main()\n { int a[3],i,d,e,j,x,y,z=0;\n for(i=0;i<3;i++)\n scanf(\"%d\",&a[i]);\n scanf(\"%d\",&d);\n for(i=0;i<3;i++)\n for(j=i;j<3;j++)\n if(a[j+1]\nint main()\n{\n long long int a[5],i,t,s,d,l;\n for(i=1;i<=4;i++)\n {scanf(\"%lld\",&a[i]);}\n for(l=1;l<=2;l++)\n {\n for(i=1;i<3;i++)\n {if(a[i+1]=a[4]&&a[3]-a[2]>=a[4])\n {printf(\"0\");}\n else\n {if(a[2]-a[1]>=a[4]&&a[3]-a[2]=a[4])\n {s=a[4]-a[2]+a[1];}\n if(a[2]-a[1]\n#include\nmain()\n{\nint i,j;\nlong long int e[3]; \nlong long int a,b,c,d;\nlong long int min,max,temp,mid;\nlong long int diff1,diff2;\nlong long int ans1=0,ans2=0;\nscanf(\"%lld %lld %lld %lld\",&a,&b,&c,&d);\ne[0]=a;\ne[1]=b;\ne[2]=c;\nfor(i=0;i<2;i++)\n {for(j=0;j<2;j++)\n {if(a[j]>a[j+1])\n {temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n diff1=(e[1]-e[0]);\n diff2=(e[2]-e[1]);\n if(diff1\n\nint main()\n{\n\tint n, i, n1 = 0, n2 = 0, ans;\n\tint s[110];\n\tscanf(\"%d\", &n);\n\tans = n;\n\tfor (i = 0; i < n; i++) scanf(\"%d\", &s[i]);\n\tfor (i = n-1; i >= 0; i--)\n\t{\n\t\tif (s[i] == 0)\n\t\t{\n\t\t\tn2++;\n\t\t\tn1 = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (n2 != 0)\n\t\t\t{\n\t\t\t\twhile (s[i] == 1 && i >= 0)\n\t\t\t\t{\n\t\t\t\t\tn1++;\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t\tif (n1 < n2)\n\t\t\t\t{\n\t\t\t\t\tans -= n1;\n\t\t\t\t\tn1 = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tans -= n2;\n\t\t\t\t\tn2 = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "95459bf0e988769d26e43b7c8e79efbd", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int i, n, z, o;\n int s[100] = { 0 }, a[2] = { 0 };\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) {\n scanf(\"%d \", s + i);\n }\n\n for (z = 0; z < n && s[z] != 1; z++) { }\n\n for (o = 0; i < n && s[n - 1 - o] == 1; o++) { }\n\n for (i = z; i < n - o; i++) {\n a[s[i]] += 1;\n }\n\n if (a[0] > a[1]) {\n printf(\"%d\\n\", z + a[0] + o);\n } else {\n printf(\"%d\\n\", z + a[1] + o);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7077a7e18ffd7a2828b689815a7565dd", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\n int n,m,k,f=1,i;\n scanf(\"%d\",&n);\n for(k=i=0;i\nvoid main()\n{\n int n,m,f=0,k=0,j=0,s=0,t=0,m1=0;\n scanf(\"%d\",&n);\n while(n--)\n {\n scanf(\"%d\",&m);\n if(m==0) { k++; t=0; m1++; }\n else if(m==1)\n {\n if(t==0)\n {\n if(j\nvoid main()\n{\n int n,m,f,k,j,s,t,m1;\n scanf(\"%d\",&n);\n f=m1=t=j=k=s=0;\n while(n--)\n {\n scanf(\"%d\",&m);\n if(m==0) { k++; t=0; m1++; }\n if(m==1)\n {\n if(t==0)\n {\n if(j\n#include \n\nint main()\n{\n long long a,b;\n scanf(\"%I64d %I64d\",&a,&b);\n if(a>[b){\n printf(\"%I64d\\n\",b/2);\n return 0;\n }\n else if((2*a-1)>=b){\n printf(\"%I64d\",((b/2)-(b-1-a)));\n }\n else printf(\"0\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "33fdc474f37cecd529f73bf33fe0294a", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main()\n{\n long long int n,k,i,j,s=0;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n long long int j=0;\n for(i=1;i<=n;i++){\n s=0;\n for(j=1;j\n#include \n\nint main()\n{\n long long a,b;\n scanf(\"%I64d %I64d\",&a,&b);\n if(a>[b){\n printf(\"%I64d\\n\",b/2);\n return 0;\n }\n else if((2*a-1)>=b){\n if((2*a-1)==b) \n printf(\"1\\n\");\n else printf(\"%I64d\",((b/2)-(b-1-a)));\n }\n else printf(\"0\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c050360b4cbba5fb00b5af4533529962", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\n\nmain(){\n long long a, b;\n cin>>a>>b;\n\n if(b a){\n cout<<\"0\"<\n#include \n\nint main()\n{\n long long a,b;\n scanf(\"%I64d %I64d\",&a,&b);\n if(a>[b){\n printf(\"%I64d\\n\",b/2);\n return 0;\n }\n else if((2*a-1)>=b){\n if((2*a-1)=>=b) \n printf(\"1\\n\");\n else printf(\"%I64d\",((b/2)-(b-1-a)));\n }\n else printf(\"0\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0b1f4f80e482a03e254f1383944dc7ff", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define N 19\n\nchar strL[N+1], strR[N+1];\nint l, r, i, n, j, sum, k;\nint bufL[N] = {0}, bufR[N] = {0};\nint *L, *R;\nint num[10] = {0}, has[10] = {0};\n\nint ok(void) {\n\tif(n == 0) {\n\t\treturn 1;\n\t}\n\tfor(j = 0; j < 10; j++) {\n\t\thas[j] = num[j];\n\t}\n\tfor(j = L[0]+1; j < R[0]; j++) {\n\t\tif(has[j] > 0) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\tif(has[L[0]] > 0) {\n\t\thas[L[0]]--;\n\t\tfor(i = 1; i < n+1; i++) {\n\t\t\tif(i >= n) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tfor(j = L[i]+1; j < 10; j++) {\n\t\t\t\tif(has[j] > 0) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(has[L[i]] > 0) {\n\t\t\t\thas[L[i]]--;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\thas[L[0]]++;\n\t}\n\tif(has[R[0]] > 0) {\n\t\thas[R[0]]--;\n\t\tfor(i = 1; i < n+1; i++) {\n\t\t\tif(i >= n) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tfor(j = 0; j < R[i]; j++) {\n\t\t\t\tif(has[j] > 0) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(has[R[i]] > 0) {\n\t\t\t\thas[R[i]]--;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\thas[R[0]]++;\n\t}\n\treturn 0;\n}\n\nint main(void) {\n\tscanf(\"%s%s\", strL, strR);\n\tl = strlen(strL);\n\tr = strlen(strR);\n\tL = bufL;\n\tR = bufR;\n\tfor(i = 0; i < l; i++) {\n\t\tL[N-l+i] = strL[i] - '0';\n\t}\n\tfor(i = 0; i < r; i++) {\n\t\tR[N-r+i] = strR[i] - '0';\n\t}\n\tfor(i = 0; i < N && L[i] == R[i]; i++);\n\tL += i;\n\tR += i;\n\tn = N - i;\n\tsum = 0;\n\tk = 0;\n\twhile(1) {\n\t\tfor(j = 0; sum > n; j++) {\n\t\t\tif(j >= 8) {\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t\tsum -= num[j];\n\t\t\tnum[j] = 0;\n\t\t\tnum[j+1]++;\n\t\t\tsum++;\n\t\t}\n\t\tnum[9] = n - sum;\n\t\t/*\n\t\tfor(j = 0; j < 10; j++) {\n\t\t\tfor(i = 0; i < num[j]; i++) {\n\t\t\t\tprintf(\"%d\", j);\n\t\t\t}\n\t\t}\n\t\t*/\n\t\tif(ok()) {\n\t\t\t//printf(\" ok\");\n\t\t\tk++;\n\t\t}\n\t\t//printf(\"\\n\");\n\t\tnum[0]++;\n\t\tsum++;\n\t}\n\tfinish:\n\tprintf(\"%d\\n\", k);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c72c3c7f10b7f9d4faf50cb7728d03d4", "src_uid": "adfa5f280eefbacdbaa4ad605402b57a", "difficulty": 2700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define N 19\n\nchar strL[N+1], strR[N+1];\nint l, r, i, n, j, sum, k;\nint bufL[N] = {0}, bufR[N] = {0};\nint *L, *R;\nint num[10] = {0}, has[10] = {0};\n\nint ok(void) {\n\tif(n == 0) {\n\t\treturn 1;\n\t}\n\tfor(j = 0; j < 10; j++) {\n\t\thas[j] = num[j];\n\t}\n\tfor(j = L[0]+1; j < R[0]; j++) {\n\t\tif(has[j] > 0) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\tif(has[L[0]] > 0) {\n\t\thas[L[0]]--;\n\t\tfor(i = 1; i < n+1; i++) {\n\t\t\tif(i >= n) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tfor(j = L[i]+1; j < 10; j++) {\n\t\t\t\tif(has[j] > 0) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(has[L[i]] > 0) {\n\t\t\t\thas[L[i]]--;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tfor(j = 0; j < 10; j++) {\n\t\thas[j] = num[j];\n\t}\n\tif(has[R[0]] > 0) {\n\t\thas[R[0]]--;\n\t\tfor(i = 1; i < n+1; i++) {\n\t\t\tif(i >= n) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tfor(j = 0; j < R[i]; j++) {\n\t\t\t\tif(has[j] > 0) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(has[R[i]] > 0) {\n\t\t\t\thas[R[i]]--;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\nint main(void) {\n\tscanf(\"%s%s\", strL, strR);\n\tl = strlen(strL);\n\tr = strlen(strR);\n\tL = bufL;\n\tR = bufR;\n\tfor(i = 0; i < l; i++) {\n\t\tL[N-l+i] = strL[i] - '0';\n\t}\n\tfor(i = 0; i < r; i++) {\n\t\tR[N-r+i] = strR[i] - '0';\n\t}\n\tfor(i = 0; i < N && L[i] == R[i]; i++);\n\tL += i;\n\tR += i;\n\tn = N - i;\n\tsum = 0;\n\tk = 0;\n\twhile(1) {\n\t\tfor(j = 0; sum > n; j++) {\n\t\t\tif(j >= 8) {\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t\tsum -= num[j];\n\t\t\tnum[j] = 0;\n\t\t\tnum[j+1]++;\n\t\t\tsum++;\n\t\t}\n\t\tnum[9] = n - sum;\n\t\t/*\n\t\tfor(j = 0; j < 10; j++) {\n\t\t\tfor(i = 0; i < num[j]; i++) {\n\t\t\t\tprintf(\"%d\", j);\n\t\t\t}\n\t\t}\n\t\t*/\n\t\tif(ok()) {\n\t\t\t//printf(\" ok\");\n\t\t\tk++;\n\t\t}\n\t\t//printf(\"\\n\");\n\t\tnum[0]++;\n\t\tsum++;\n\t}\n\tfinish:\n\tprintf(\"%d\\n\", k);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7f000463d53dfcd1d5d43138ac00996f", "src_uid": "adfa5f280eefbacdbaa4ad605402b57a", "difficulty": 2700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\nint r1,r2,c1,c2,d1,d2,a[2][2],i=1,j=0,k=0;\nscanf(\"%d%d%d%d%d%d\",&r1,&r2,&c1,&c2,&d1,&d2);\na[0][0]=0;\na[0][1]=1;\na[1][0]=0;\na[1][1]=0;\nwhile(1){\n if((r1==a[0][0]+a[0][1])&&(r2==a[1][0]+a[1][1])&&(c1==a[0][0]+a[1][0])&&(c2==a[0][1]+a[1][1])&&(d1==a[0][0]+a[1][1])&&(d2==a[0][1]+a[1][0])){\n printf(\"%d %d\\n%d %d\\\",a[0][0],a[0][1],a[1][0],a[1][1]);\n return 0;\n }\n a[0][0]=rand()%10;\n a[0][1]=rand()%10;\n a[1][0]=rand()%10;\n a[1][1]=rand()%10;\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3bfc96826a1833dcc4de2980d4c743ab", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint main(){\n\tint x,y,z,m,i,r[100][100],c[100][100],d[100][100];\n\t\tfor(i=0;i<2;i++)\t\n\t\tscanf(\"%d\",&r[0][i]);\n\t\tfor(i=0;i<2;i++)\t\n\t\tscanf(\"%d\",&c[0][i]);\n\t\tfor(i=0;i<2;i++)\t\n\t\tscanf(\"%d\",&d[0][i]);\n\t\t\n\t\t\n\t\ty=(d[0][0]+r[0][0]-c[0][1])/2;\n\t\tx=c[0][1]+y-d[0][0];\n\t\tz=d[0][1]+y-r[0][0];\n\t\tm=r[0][1]+y-c[0][0];\n\t//\tprintf(\"%d\",y);\n\t\n\t\tif((x+y)!=r[0][0] || (z+m)!=r[0][1] || (x+m)!=c[0][1] || (z+y)!=c[0][0] ||(m+y)!=d[0][0] || (x+z)!=rd[0][1]|| y==x || y==z || y==m || x==z || x==m || z==m ){\n\t\tprintf(\"-1\");\n\t}\n\t\telse\t{\n\t\tprintf(\"%d %d\\n\",y,x);\n\t\tprintf(\"%d %d\",z,m);\n\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t//\tsystem (\"pause\");\n\treturn 0;\n\t\t\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0ba8501e6229fb68fdca851e1e960634", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int r1,r2,c1,c2,d1,d2,i,j,k,l,c=0;\n scanf(\"%d %d %d %d %d %d\",&r1,&r2,&c1,&c2,&d1,&d2);\n if(r1<1||r2<1||c1<1||c1<1||d1<1||d2<1||r1>20||r2>20||c1>20||c2>20||d1>20||d2>20)\n printf(\"-1\");\n else\n {\n for(i=1;i<=9;i++)\n for(j=1;j<=9;j++)\n for(k=1;k<=9;k++)\n for(l=1;l<=9;l++)\n if(i+j==r1&&i+k==c1&&k+l==r2&&j+l==c2&&i+l==d1&&j+k==d2&&i!=k&&j!=l&&i!=l&&j!=k&&i!=j&&k!=l)\n {\n printf(\"%d %d\\n%d %d\",i,j,k,l);\n c=1;\n break;\n if(c==0)\n printf(\"-1\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "45dc2abe8d70a0b0a2ba7fc1793791c7", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int r1,r2,c1,c2,d1,d2,i,a,b,c,d,sign;\n while(scanf(\"%d %d\",&r1,&r2)!=EOF)\n {\n scanf(\"%d %d\",&c1,&c2);\n scanf(\"%d %d\",&d1,&d2);\n for(i=1,sign=0;i<=9;i++)\n {\n a=i;\n if(r1-a<0||r1-a>9)continue;\n b=r1-a;\n if(a==b)continue;\n if(c1+d2-a-b<0||(c1+d2-a-b)%2!=0||(c1+d2-a-b)>18)continue;\n c=(c1+d2-a-b)/2;\n if(b==c||a==c)continue;\n if(c2+r2+d1-a-b-c<0||(c2+r2+d1-a-b-c)%3!=0||(c2+r2+d1-a-b-c)>27)continue;\n d=(c2+r2+d1-a-b-c)/3;\n if(a==d||c==d||c==d)continue;\n if(a+b==r1&&a+c==c1&&b+d==c2&&b+c==d2&&a+d==d1&&c+d==r2&&b>=1&&b<=9&&c>=1&&c<=9&&d>=1&&d<=9)\n {sign++;break;}\n }\n if(sign!=0)\n printf(\"%d %d\\n%d %d\\n\",a,b,c,d);\n else\n printf(\"-1\\n\");\n }\n return 0;\n}\n\n\n#include \n#include \n\nint main()\n{\n\tint r1,r2,d1,d2,c1,c2;\n\tint a,b,c,d,flag;\n\twhile(~scanf(\"%d%d%d%d%d%d\",&r1,&r2,&c1,&c2,&d1,&d2))\n {\n flag=0;\n for (a=1;a<=9;a++)\n {\n b=r1-a;\n c=c1-a;\n d=d1-a;\n if (b+d==c2&&c+d==r2&&b+c==d2&&a!=b&&a!=c&&a!=d&&b!=c&&b!=d&&c!=d&&b>=1&&b<=9&&c>=1&&c<=9&&d>=1&&d<=9)\n {\n printf(\"%d %d\\n%d %d\\n\",a,b,c,d);\n }\n else\n flag++;\n }\n if(flag==9)\n printf(\"-1\\n\");\n }\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "6586b61501ce6e60a35f408e211a6057", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tfloat r1,r2,c1,c2,d1,d1,x1,x2,x3,x4;\n\tint a,b,c,d;\n\t\n\tscanf(\"%f%f%f%f%f%f\",&r1,&r2,&c1,&c2,&d1,&d2);\n\t\n\tif((r1+r2!=c1+c2)||(r1+r2!=d1+d2)||(c1+c2!=d1+d2))\n\t\tprintf(\"-1\");\n\telse\n\t{\n\t\tx1=(d1-r2+c1)/2;\n\t\tx2=(d2+r1-c1)/2;\n\t\tx3=(d2-r1+c1)/2;\n\t\tx4=(r2-c1+d1)/2;\n\t\t\n\t\ta=(int)(x1);\n\t\tb=(int)(x2);\n\t\tc=(int)(x3);\n\t\td=(int)(x4);\n\t\t\n\t\tif(a==x1&&b==x2&&c==x3&&d==x4)\n\t\t{\n\t\t\tif(a!=b&&a!=c&&a!=d&&b!=c&&b!=d&&c!=d&&a>0&&b>0&&c>0&&d>0&&a<10&&b<10&&c<10&&d<10)\n\t\t\t\tprintf(\"%d %d\\n%d %d\",a,b,c,d);\n\t\t\telse\n\t\t\t\tprintf(\"-1\");\n\n\t\t}\n\t\t\n\t\telse\n\t\t\tprintf(\"-1\");\n\t\t\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "78b19e1f79bc717531aa410c767b4f96", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nlong long int isPrime(long long int n) \n{ \n // Corner case \n if(n==2 || n==1)\n return 1;\n if(n%2==0)\n return 0;\n if (n <= 1) \n return 0; \n \n // Check from 2 to n-1 \n for (long long int i = 2; i <= sqrt(n) + 1; i++) \n if (n % i == 0) \n return 0; \n \n return 1; \n} \nint main()\n{\n long long int q, i, m; \n scanf(\"%lld\",&q);\n if(isPrime(q))\n {\n printf(\"1\\n0\");\n return 0;\n }\n for(i=2;i\n\nint main(int argc, char *argv[]) {\n long long n,i,a=0,b=0,aux=0;\n scanf(\"%I64d\",&n);\n aux=n;\n if(n<4){\n printf(\"1\\n0\");\n return 0;\n }\n if(n%2==0){\n a=2;\n n/=2;\n \n for(i=2;i\n#include\n#include\nlong long arr[40000005];\nchar str[2000001];\nchar 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}\nlong long isPrime(long long int n)\n{\n\tif (n <= 1) return 0;\n\tif (n <= 3) return 1;\n\tif (n%2 == 0 || n%3 == 0) return 0;\n\n\tfor (long long int i=5; i*i<=n; i=i+6)\n\t\tif (n%i == 0 || n%(i+2) == 0)\n\t\t\treturn 0;\n\treturn 1;\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\tif(n==1 || isPrime(n)==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<=40000005;i++)\n\t\t\tarr[i]=i;\n\t\tfor(i=2;i*i<=40000005;i++)\n\t\t\tif(arr[i]!=0)\n\t\t\t\tfor(j=0;j*i+i*i<=40000005;j++)\n\t\t\t\t\tarr[i*i+j*i]=0;\n\t\tfor(i=2;i<=40000005;i++)\n\t\t\tif(n%i==0 && arr[i]==0 && i!=n)\n\t\t\t{flag=1;break;}\n\t\t\t\n\t\tif(flag)\n\t\t{printf(\"1\\n\");printf(\"%lld\\n\",i);}\n\t\telse\n\t\t\tprintf(\"2\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "446c60a2274d041764cb0e2cca9c06b0", "src_uid": "f0a138b9f6ad979c5ca32437e05d6f43", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint arr[20000005];\nchar str[2000001];\nchar 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}\nlong long isPrime(long long int n)\n{\n\tif (n <= 1) return 0;\n\tif (n <= 3) return 1;\n\tif (n%2 == 0 || n%3 == 0) return 0;\n\n\tfor (long long int i=5; i*i<=n; i=i+6)\n\t\tif (n%i == 0 || n%(i+2) == 0)\n\t\t\treturn 0;\n\treturn 1;\n}\nint main()\n{\n\tlong long int num1, num2,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\tif(n==1 || isPrime(n)==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<20000005;i++)\n\t\t\tarr[i]=i;\n\t\tarr[1]=0;\n\t\tfor(i=2;i*i<20000005;i++)\n\t\t\tif(arr[i]!=0)\n\t\t\t\tfor(j=0;j*i+i*i<20000005;j++)\n\t\t\t\t\tarr[i*i+j*i]=0;\n\n\t\tfor(i=2;i<20000005;i++)\n\t\t\tif(arr[i]!=0 && n%i==0)\n\t\t\t{num1=i;break;}\n\t\tfor(i=2;i<20000005;i++)\n\t\t\tif(arr[i]!=0 && n%i==0)\n\t\t\t{\n\t\t\t\tif(i==num1 && n%(i*i)==0)\n\t\t\t\t{num2=i;break;}\n\t\t\t\tif(i!=num1)\n\t\t\t\t{num2=i;break;}\n\t\t\t}\n\t\tfor(i=2;i<20000005;i++)\n\t\t\tif(arr[i]!=0 && n%i==0)\n\t\t\t{\n\t\t\t\tif(num1==num2 && n%(i*i*i)==0)\n\t\t\t\t{flag=1;break;}\n\t\t\t\tif(i!=num1 && i!=num2)\n\t\t\t\t{flag=1;break;}\n\t\t\t\tif(i==num1 || i==num2)\n\t\t\t\t{\n\t\t\t\t\tif(n%(num1*num1*num2)==0 || n%(num2*num2*num1)==0)\n\t\t\t\t\t{flag=1;break;}\n\t\t\t\t}\n\t\t\t}\n\t//\tprintf(\"%lld %lld\\n\",num1, num2);\n\t\tif(flag)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\tprintf(\"%lld\\n\",num1*num2);\n\t\t}\n\t\telse\n\t\t\tprintf(\"2\\n\");\n\t\t/*\n\t\tfor(i=2;i<=20000005;i++)\n\t\t\tif(n%i==0 && arr[i]==0 && i!=n)\n\t\t\t{flag=1;break;}\n\t\tif(flag)\n\t\t{printf(\"1\\n\");printf(\"%lld\\n\",i);}\n\t\telse\n\t\t\tprintf(\"2\\n\");\n\t\t\t*/\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9d03d8341bb580cf893d91d16312a2ea", "src_uid": "f0a138b9f6ad979c5ca32437e05d6f43", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n long long int q,i,num,cnt,c,arr[10000000000000] ;\n\n scanf(\"%I64d\",&q) ;\n\n if(q==1){\n printf(\"1\\n0\\n\") ;\n }\n\n else{\n\n num=sqrt(q) ;\n\n c=0;\n cnt=0;\n while(q%2==0){\n cnt++;\n q=q/2 ;\n arr[c]=2;\n c++;\n }\n for(i=3;i<=num;i=i+2){\n while(q%i==0){\n cnt++;\n q=q/i ;\n arr[c]=i ;\n c++;\n }\n }\n if(q>2){\n cnt++;\n arr[c]=q ;\n c++;\n }\n\n if(cnt==2){\n printf(\"2\\n\") ;\n }\n else if(cnt==1){\n printf(\"1\\n0\\n\") ;\n }\n else{\n printf(\"1\\n\") ;\n printf(\"%I64d\\n\",(arr[0]*arr[1])) ;\n }\n }\n\n return 0 ;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "039f31776c9118fee45d23de84deab91", "src_uid": "f0a138b9f6ad979c5ca32437e05d6f43", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n\n{\n\tint n,i,j,k=0,m;\n scanf(\"%d\",&n);\n\tchar col[n];\n\tscanf(\"%s\",col);\n\tloop:\n\ti=0;\n\t\tif(col[i]=='B'){\n\t\t\tcol[i]='R';\n\t\t\tk++;\n\t\t\tgoto loop;\n\t\t}\n\t\telse if(col[i]=='R'){\n\t\t\tfor(j=i;j\n#include \n\nint isSolution(char *,int);\nvoid swap(char *x,char *y)\n{\n char t=*x;\n *x=*y;\n *y=t;\n\n}\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char S[50];\n scanf(\"%s\",S);\n int k=0;\n int m=n-1;\n while(k\n\nint main()\n\n{\n\tint n,i,j,k=0,m;\n scanf(\"%d\",&n);\n\tchar col[n];\n\tscanf(\"%s\",col);\n\tloop:\n\tfor(i=0;i\n#include\nint main()\n{\n int n,i,j;\n unsigned long k=0;\n scanf(\"%d\",&n);\n char ch[n];\n scanf(\"%s\",ch);\n i=0;\n if(ch[i]=='B'){\n ch[i]='R';\n }\n loop:\n if(ch[i]=='R'){\n for(j=i;j\n#include\n#include\nint main()\n{\n int n,i;\n unsigned long s=0;\n char c[50];\n scanf(\"%d\",&n);\n printf(\"\\n\");\n scaf(\"%s\",&c);\n for(i=0;i\n#include\nint main(void) {\n int n,i,j;\n char s[200];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0;i\n#include\n#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar* str = (char*)malloc(n*sizeof(char));\n\tscanf(\"%s\",str);getchar();\n\tfor(int i=0;i=3 && str[i]=='o' && str[i+1]=='g' && str[i+2]=='o'){\n\t\t\tint k=i+3;\n\t\t\twhile(n-k>=2 && str[k]=='g' && str[k+1]=='o')k+=2;\n\t\t\tprintf(\"***\");\n\t\t\ti=k-1;\n\t\t}\n\t\telse printf(\"%c\",str[i]);\n\t}\n\tfree(str);\n} \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "83116f0b76c6b0f1709d7c26193b2069", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int T;\n scanf(\"%d\",&T);\n char s[200]=\"\";\n getchar();\n for (int i=0;i\n#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",&a);\n int i=0 ;\n while(a[i]!='\\0')\n {if(a[i]=='o')\n {if(a[i+1]=='g')\n if(a[i+2]=='o')\n {printf(\"***\");i+=3;}\n while(a[i]!='\\0' && a[i]=='g' && a[i+1]=='o')\n i+=2;}\n else\n {printf(\"%c\",a[i]); i++ ;}}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc56da2ef8c0330f8674b710907ad2ab", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0} {"lang": "GNU C", "source_code": "\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a9c1d7f3762e0ae1959e91021a1e2a34", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n\nstruct dxy\n{\n\tlong long d;\n\tlong long x;\n\tlong long y;\n};\n\nlong long gcd(long long a, long long b)\n{\n\t return (a*b == 0) ? (a + b) : gcd(b, a%b);\n}\n\nstruct dxy ext_euc(long long a, long long b)\n{\n\tlong long x, y;\n\tstruct dxy ans;\n\tif (b == 0)\n\t{\n\t\tans.d = a;\n\t\tans.x = 1;\n\t\tans.y = 0;\n\t\treturn ans;\n\t}\n\t\n\tans = ext_euc(b, a%b);\n\tx = ans.y;\n\ty = ans.x - (a/b)*ans.y;\n\t\n\tans.x = x;\n\tans.y = y;\n\treturn ans;\n}\n\nlong long box(long long numer, long long denom)\n{\n\tif (numer % denom == 0 || numer * denom >= 0)\n\t{\n\t\treturn numer / denom;\n\t}\n\t\n\treturn (numer / denom) - 1;\n}\n\nint main()\n{\n\tlong long a1, a2, b1, b2;\n\tlong long L, R;\n\tlong long alpha1, alpha2, r, start, end;\n\tlong long p, p1, q, i, j;\n\tlong long hcf;\n\tstruct dxy temp;\n\t\n\tscanf(\"%lld %lld %lld %lld %lld %lld\", &a1, &b1, &a2, &b2, &L, &R);\n\t\n\thcf = gcd(a1, a2);\n\tif ((b2 - b1) % hcf != 0)\n\t{\n\t\tprintf(\"%d\\n\", 0);\n\t\treturn 0;\n\t}\n\t\n\tr = box((b2 - b1), hcf);\n\talpha1 = box(a1, hcf);\n\talpha2 = box(a2, hcf);\n\t\n\ttemp = ext_euc(alpha1, -alpha2);\n\tp = temp.x * r;\n\tp1 = temp.y * r;\n\t\n\tstart = box((L-b1), a1) + 1;\n\tstart -= ((L-b1) % a1) == 0 ? 1 : 0;\n\tend = box((R-b1), a1);\n\t\n\tq = box((start-p), alpha2) + 1;\n\tq -= ((start-p) % alpha2) == 0 ? 1 : 0;\n\t\n\tj = 0;\n\tfor (i = q; i <= box((end-p), alpha2); i++)\n\t{\n\t\tif (p + i*alpha2 >=0 && p1 + i*alpha1 >= 0)\n\t\t{\n\t\t\tj++;\n\t\t}\n\t}\n\t\n\t//printf(\"%lld %lld\\n\", start, end);\n\t//printf(\"%lld %lld %lld %lld\\n\", p, p1, q, r);\n\t//printf(\"%lld %lld\\n\", box((end-p), alpha2), box((start-p), alpha2));\n\t/*\n\tif (p + q*alpha2 < 0 || p1 + q*alpha1 < 0)\n\t{\n\t\tprintf(\"%d\\n\", 0);\n\t\treturn 0;\n\t}\n\t*/\n\tprintf(\"%lld\\n\", j);\n\treturn 0;\n}\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f16151df232333932d151b7bc3fdbcec", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "/*\n * 710D\n */\n\n#include \n\nvoid egcd(long long greater, long long lesser, \n\tlong long *d, long long *x, long long *y)\n{\n\tlong long tx, ty;\n\n\tif (lesser == 0) {\n\t\t*d = greater;\n\t\t*x = 1;\n\t\t*y = 0;\n\t\treturn;\n\t}\n\n\tegcd(lesser, greater % lesser, d, x, y);\n\n\ttx = *y;\n\tty = *x - (greater / lesser) * (*y);\n\t*x = tx;\n\t*y = ty;\n}\n\t\n\nlong long gcd(long greater, long lesser)\n{\n\tif (greater % lesser == 0)\n\t\treturn lesser;\n\treturn gcd(lesser, greater % lesser);\n}\n\nlong long left, right, a1, a2, b1, b2;\n\nint main(void)\n{\n\tlong long delta, lefti, righti;\n\tlong long d, c1, c2;\n\tdouble left0, right0, right1, right2, right3;\n\n\tscanf(\"%lld%lld%lld%lld%lld%lld\", &a1, &b1, &a2, &b2, &left, &right);\n\n\tif (a2 >= a1)\n\t\tegcd(a2, a1, &d, &c2, &c1);\t\n\telse\n\t\tegcd(a1, a2, &d, &c1, &c2);\n\n\tdelta = b2 - b1;\n\n\tif (delta % d) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\t/* x >= 0 */\n\tright1 = 1.0 * delta * c1 / a2;\n\n\t/* y >= 0 */\n\tright2 = -1.0 * delta * c2 / a1;\n\n\t/* left <= value <= right */\n\tleft0 = 1.0 * delta * c1 / a2 - 1.0 * d * (right - b1) / (1.0 * a1 * a2);\n\tright3 = 1.0 * delta * c1 / a2 - 1.0 * d * (left - b1) / (1.0 * a1 * a2);\n\n\tright0 = right1 < right2 ? right1 : right2;\n\tright0 = right0 < right3 ? right0 : right3;\n\n\tlefti = (long long)left0;\n\tif (left0 > 0 && lefti != left0)\n\t\tlefti += 1;\t\n\n\trighti = (long long)right0;\n\tif (right0 < 0 && righti != right0)\n\t\trighti -= 1;\n\n\n\tprintf(\"%lld\\n\", lefti > righti ? 0 : righti - lefti + 1);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "31a29eda93ac6c3fb7f4a71c9d1c37cb", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n\nlong long xy[2];\n\nint gcdxy(int a, int b) {\n\tif (b == 0) {\n\t\txy[0] = 1, xy[1] = 0;\n\t\treturn a;\n\t} else {\n\t\tint g = gcdxy(b, a % b);\n\t\tint tmp;\n\n\t\ttmp = xy[0] - a / b * xy[1];\n\t\txy[0] = xy[1];\n\t\txy[1] = tmp;\n\t\treturn g;\n\t}\n}\n\nint main() {\n\tint a1, b1, a2, b2, l, r, g;\n\tlong long x, b, n, k_, l_, cnt, cnt1, cnt2;\n\n\tscanf(\"%d%d%d%d%d%d\", &a1, &b1, &a2, &b2, &l, &r);\n\t/* (a1k + b1 = a2l + b2) = (a1k - a2l = b2 - b1) */\n\tg = gcdxy(a1, -a2);\n\tb = (long long) b2 - b1;\n\tif (b % g != 0)\n\t\tprintf(\"0\\n\");\n\telse {\n\t\tk_ = xy[0] * b / g, l_ = xy[1] * b / g;\n\t\tif (g < 0)\n\t\t\tg = -g;\n\t\tcnt2 = a2 / g;\n\t\tcnt1 = a1 / g;\n\t\tcnt = (long long) a1 / g * a2;\n\t\tk_ = (k_ % cnt2 + cnt2) % cnt2;\n\t\tl_ = (l_ % cnt1 + cnt1) % cnt1;\n\t\tx = a1 * k_ + b1 > a2 * l_ + b2 ? a1 * k_ + b1 : a2 * l_ + b2;\n\t\tn = 0;\n\t\tif (x >= l && x <= r)\n\t\t\tn = (r - x + 1 + cnt - 1) / cnt;\n\t\telse if (x < l)\n\t\t\tn = (r - x + 1 + cnt - 1) / cnt - (l - 1 - x + 1 + cnt - 1) / cnt;\n\t\tprintf(\"%lld\\n\", n);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7f241ed15234e50baac7518a03ef5692", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nstruct dxy\n{\n\tlong long d;\n\tlong long x;\n\tlong long y;\n};\n\nlong long gcd(long long a, long long b)\n{\n\t return (a*b == 0) ? (a + b) : gcd(b, a%b);\n}\n\nstruct dxy ext_euc(long long a, long long b)\n{\n\tlong long x, y;\n\tstruct dxy ans;\n\tif (b == 0)\n\t{\n\t\tans.d = a;\n\t\tans.x = 1;\n\t\tans.y = 0;\n\t\treturn ans;\n\t}\n\t\n\tans = ext_euc(b, a%b);\n\tx = ans.y;\n\ty = ans.x - (a/b)*ans.y;\n\t\n\tans.x = x;\n\tans.y = y;\n\treturn ans;\n}\n\nlong long box(long long numer, long long denom)\n{\n\tif (numer % denom == 0 || (numer >=0 && denom >= 0) || (numer < 0 && denom < 0))\n\t{\n\t\treturn numer / denom;\n\t}\n\t\n\treturn (numer / denom) - 1;\n}\n\nint main()\n{\n\tlong long a1, a2, b1, b2;\n\tlong long L, R;\n\tlong long alpha1, alpha2, r, start, end;\n\tlong long p, p1, q, q1, i, j, ans, base;\n\tlong long hcf;\n\tstruct dxy temp;\n\t\n\tscanf(\"%lld %lld %lld %lld %lld %lld\", &a1, &b1, &a2, &b2, &L, &R);\n\t\n\thcf = gcd(a1, a2);\n\tif ((b2 - b1) % hcf != 0)\n\t{\n\t\tprintf(\"%d\\n\", 0);\n\t\treturn 0;\n\t}\n\t\n\tr = box((b2 - b1), hcf);\n\talpha1 = box(a1, hcf);\n\talpha2 = box(a2, hcf);\n\t\n\ttemp = ext_euc(alpha1, -alpha2);\n\tp = temp.x * r;\n\tp1 = temp.y * r;\n\tif (temp.d < 0)\n\t{\n\t\tp = -p;\n\t\tp1 = -p1;\n\t}\n\t\n\tstart = box((L-b1), a1) + 1;\n\t//printf(\"start = %lld\\n\", start);\n\tstart -= ((L-b1) % a1) == 0 ? 1 : 0;\n\tend = box((R-b1), a1);\n\t\n\tq = box((start-p), alpha2) + 1;\n\tq -= ((start-p) % alpha2) == 0 ? 1 : 0;\n\tq1 = box((end-p), alpha2);\n\t//printf(\"q1 = %lld\\n\", q1);\n\t\n\tbase = box(-p, alpha2) + 1;\n\tbase -= (p % alpha2) == 0 ? 1 : 0;\n\tq = max(q, base);\n\t//printf(\"q = %lld\\n\", q);\n\t\n\tbase = box(-p1, alpha1) + 1;\n\tbase -= (p1 % alpha1) == 0 ? 1 : 0;\n\tq = max(q, base);\n\t//printf(\"q = %lld\\n\", q);\n\t\n\tans = q1 - (q - 1);\n\t//printf(\"ans = %lld\\n\", ans);\n\tif (ans < 0 )\n\t{\n\t\tans = 0;\n\t}\n\n\t/*\n\tj = 0;\n\tfor (i = q; i <= box((end-p), alpha2); i++)\n\t{\n\t\tif (p + i*alpha2 >=0 && p1 + i*alpha1 >= 0)\n\t\t{\n\t\t\tj++;\n\t\t}\n\t}\n\t*/\n\t//printf(\"start = %lld, end = %lld\\n\", start, end);\n\t//printf(\"p = %lld, p1 = %lld, q = %lld, r = %lld\\n\", p, p1, q, r);\n\t//printf(\"%lld %lld\\n\", box((end-p), alpha2), box((start-p), alpha2));\n\t/*\n\tif (p + q*alpha2 < 0 || p1 + q*alpha1 < 0)\n\t{\n\t\tprintf(\"%d\\n\", 0);\n\t\treturn 0;\n\t}\n\t*/\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f11ef1838a962ef0984f7f3372b9d70f", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "/*\n * 710D\n */\n\n#include \n\nlong long gcd(long greater, long lesser)\n{\n\tif (greater % lesser == 0)\n\t\treturn lesser;\n\treturn gcd(lesser, greater % lesser);\n}\n\nlong long left, right;\n\nvoid zero_case(long long a1, long long b1, long long b2)\n{\n\tif (a1 == 0) {\n\t\tif (b1 != b2)\n\t\t\tprintf(\"0\\n\");\n\t\telse if (left <= b1 && b1 <= right)\n\t\t\tprintf(\"1\\n\");\n\t\telse\n\t\t\tprintf(\"0\\n\");\n\t} else {\n\t\tif ((b2 - b1) % a1)\n\t\t\tprintf(\"0\\n\");\n\t\telse if (left <= b2 && b2 <= right)\n\t\t\tprintf(\"1\\n\");\n\t\telse\n\t\t\tprintf(\"0\\n\");\n\t}\n}\n\nint main(void)\n{\n\tlong long a1, b1, a2, b2;\n\tlong long y, k, left2, right2, p1, delta, gcdv;\n\tdouble tmp;\n\n\tscanf(\"%lld%lld%lld%lld%lld%lld\", &a1, &b1, &a2, &b2, &left, &right);\n\t\n\tif (a2 == 0) {\n\t\tzero_case(a1, b1, b2);\n\t\treturn 0;\n\t} else if (a1 == 0) {\n\t\tzero_case(a2, b2, b1);\n\t\treturn 0;\n\t}\n\n\tgcdv = gcd(a1 > a2 ? a1 : a2, a1 < a2 ? a1 : a2);\n\n\tp1 = a1 / gcdv;\n\n\t/* here is a lesson */\n\ttmp = 1.0 * (left - b2) / a2;\n\tleft2 = (long long)tmp;\n\tif (tmp > 0 && (left - b2) % a2)\n\t\tleft2 += 1;\n\n\ttmp = 1.0 * (right - b2) / a2;\n\tright2 = (long long)tmp;\n\tif (tmp < 0 && (right - b2) % a2)\n\t\tright2 -= 1;\n\n\n\tdelta = b2 - b1;\n\n\tfor (y = left2; y <= right2; ++y)\n\t\tif ((a2 * y + delta) % a1 == 0)\n\t\t\tbreak;\n\tif (y < 0) {\n\t\ttmp = -1 * y / p1;\n\t\tk = (long long)tmp;\n\t\tif (y % p1)\n\t\t\t++k;\n\t\ty += k * p1;\n\t}\n\n\tif (a2 * y + delta < 0) {\n\t\ttmp = -1.0 * (a2 * y + delta) / (a2 * p1);\n\t\tk = (long long)tmp;\n\t\tif ((a2 * y + delta) % (a2 * p1))\n\t\t\tk += 1;\n\t\ty += k * p1;\n\t}\n\n\n\tprintf(\"%lld\\n\", y > right2 ? 0 : (right2 - y) / p1 + 1);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8828a4a78bfc6e88fdd331f8bfef8d4e", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\nint main()\n{\n\tint n,i;\n\tchar c[]=\"ROYGBIV\";\n\tcin >> n;\n\tcout <\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n r=n%7;\n n=n/7;\n for(i=0;i\nint num;\nint n;\nchar eggs_colour[n] = \"ROYGBIV\";\nint main()\n{\n scanf(\"%d\",&n);\n for(num=n;7<=num<=100;num++)\n printf(\"%c\",eggs_colour);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "82cceec08ee20e4cb1110a28d22295a7", "src_uid": "dc3817c71b1fa5606f316e5e94732296", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nvoid main(){\n\tint n,i=1,z,j,f,o;\n\tscanf(\"%d\",&n);\n\tz=n/7;\n\tf=n-(z*7);\n\tfor(j=1;j<=z;j++){\n\tfor(i=1;i<=7;i++){\n\tif(i==1)\n\tprintf(\"R\");\n\telse if(i==2)\n\tprintf(\"Y\");\n\telse if(i==3)\n\tprintf(\"G\");\n\telse if(i==4)\n\tprintf(\"B\");\n\telse if(i==5)\n\tprintf(\"I\");\n\telse if(i==6)\n\tprintf(\"V\");\n\telse if(i==7)\n\tprintf(\"O\");\n}}\nfor(o=1;o<=f;o++){\nif(o==1)\n\tprintf(\"R\");\n\telse if(o==2)\n\tprintf(\"Y\");\n\telse if(o==3)\n\tprintf(\"G\");\n\telse if(o==4)\n\tprintf(\"B\");\n\telse if(o==5)\n\tprintf(\"I\");\n\telse if(o==6)\n\tprintf(\"V\");\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e602f935aecd9064e7ea9c1b5a7c4e31", "src_uid": "dc3817c71b1fa5606f316e5e94732296", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nvoid main(){\n\tint n,i=1,z,j,f,o;\n\tscanf(\"%d\",&n);\n\tz=n/7;\n\tf=n-(z*7);\n\tfor(j=1;j<=z;j++){\n\tfor(i=1;i<=7;i++){\n\tif(i==1)\n\tprintf(\"R\");\n\telse if(i==2)\n\tprintf(\"Y\");\n\telse if(i==3)\n\tprintf(\"G\");\n\telse if(i==4)\n\tprintf(\"B\");\n\telse if(i==5)\n\tprintf(\"I\");\n\telse if(i==6)\n\tprintf(\"V\");\n\telse if(i==7)\n\tprintf(\"O\");\n}}\nfor(o=2;o<=f+1;o++){\n if(o==7)\n\tprintf(\"Y\");\n\telse if(o==2)\n\tprintf(\"G\");\n\telse if(o==3)\n\tprintf(\"B\");\n\telse if(o==4)\n\tprintf(\"I\");\n\telse if(o==5)\n\tprintf(\"V\");\n\telse if(i==6)\n\tprintf(\"O\");\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "eaea37629997ac96b0b0742907d8a4e9", "src_uid": "dc3817c71b1fa5606f316e5e94732296", "difficulty": 1200.0} {"lang": "GNU C11", "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\n#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)\n#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)\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\ni32 calc (i64 p, const i32 c, const i32 k) {\n i32 *dp = (i32 *) calloc (c + 1, sizeof (i32));\n dp[c] = 1;\n i32 *prob = (i32 *) calloc (c + 1, sizeof (i32));\n for (i32 i = 0; i <= c; ++i) {\n prob[i] = inv (i + 1);\n }\n for (i32 i = 0; i < k; ++i) {\n i32 sum = 0;\n for (i32 j = 0; j <= c; ++j) {\n i32 v = (i64) prob[j] * dp[j] % mod;\n ADD(sum, v);\n }\n for (i32 j = 0; j <= c; ++j) {\n i32 assign = sum;\n i32 v = (i64) prob[j] * dp[j] % mod;\n SUB(sum, v);\n dp[j] = assign;\n }\n }\n p %= mod;\n i32 ans = 0;\n for (i32 i = c; i >= 0; --i) {\n ans = ((i64) p * ans + dp[i]) % mod;\n }\n free (dp);\n free (prob);\n return ans;\n}\n\nvoid run (void) {\n i64 n = read_int();\n i32 k = read_int();\n i64 ans = 1;\n for (i64 p = 2; p * p <= n; ++p) {\n if (n % p != 0) continue;\n i32 c = 0;\n while (n % p == 0) {\n n /= p;\n ++c;\n }\n ans = ans * calc (p, c, k) % mod;\n }\n if (n > 1) ans = ans * calc (n, 1, k) % mod;\n print_int (ans);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8ee2815aee21474794608b92fd83a6ea", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n\ntypedef long long int int64;\n\nstatic void printInt(int64 n){\n if(n<0){putchar('-');n=-n;}\n if(n==0){putchar('0');return;}\n int s[20];int len=0;\n while(n>0){s[len++]=n%10+'0';n/=10;}\n while(len>0){putchar(s[--len]);}\n}\nstatic int64 readInt(void){\n int prev='\\0';int c=getchar();\n while(!('0'<=c && c<='9')){prev=c;c=getchar();}\n int64 res=0;\n while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}\n return prev=='-'?-res:res;\n}\n\n#define POS(i,j) ((i)*(c+1)+(j))\n\nconst int mod=1000000007;\n\nint inv(int a){\n int t=1;\n while(a>1){\n t=(int64)t*(mod-mod/a)%mod;\n a=mod%a;\n }\n return t;\n}\n\nvoid run(void){\n int64 n=readInt();\n int k=readInt();\n int ans=1;\n int64 p;\n for(p=2;p*p<=n;p++){\n if(n%p!=0) continue;\n int c=0;\n while(n%p==0){\n n/=p;\n c++;\n }\n int *dp=(int *)calloc((k+1)*(c+1),sizeof(int));\n dp[POS(0,c)]=1;\n int i,j,l;\n for(i=0;i1){\n int dp[2]={0,1};\n for(int i=0;i\n\n#define MD\t1000000007\n#define L\t50\n#define K\t10000\n\nlong long dp[L + 1][L + 1][K + 1];\n\nvoid init() {\n\tstatic long long dq[L + 1][L + 1][K + 1];\n\tstatic int inv[L + 2];\n\tint i1, i2, i, j;\n\n\tfor (i = 1; i <= L + 1; i++) {\n\t\tlong long x = 1;\n\n\t\twhile (x % i != 0)\n\t\t\tx += MD;\n\t\tinv[i] = x / i % MD;\n\t}\n\tfor (i1 = 0; i1 <= L; i1++) {\n\t\tdp[i1][i1][0] = dq[i1][i1][0] = 1;\n\t\tfor (i2 = i1 + 1; i2 <= L; i2++)\n\t\t\tdq[i1][i2][0] = (dq[i1][i2][0] + dq[i1][i2 - 1][0]) % MD;\n\t\tfor (j = 1; j <= K; j++)\n\t\t\tfor (i2 = i1; i2 <= L; i2++) {\n\t\t\t\tdq[i1][i2][j] = dp[i1][i2][j] = dq[i1][i2][j - 1] * inv[i2 + 1] % MD;\n\t\t\t\tif (i2 > i1)\n\t\t\t\t\tdq[i1][i2][j] = (dq[i1][i2][j] + dq[i1][i2 - 1][j]) % MD;\n\t\t\t}\n\t}\n}\n\nint solve(long long a, int cnt, int k) {\n\tint i, sum;\n\tlong long p;\n\n\ta %= MD;\n\tp = 1;\n\tsum = 0;\n\tfor (i = 0; i <= cnt; i++) {\n\t\tsum = (sum + p * dp[i][cnt][k]) % MD;\n\t\tp = p * a % MD;\n\t}\n\treturn sum;\n}\n\nint main() {\n\tlong long n, ans;\n\tint k, a;\n\n\tscanf(\"%lld%d\", &n, &k);\n\tinit();\n\tans = 1;\n\tfor (a = 2; a <= n / a; a++)\n\t\tif (n % a == 0) {\n\t\t\tint cnt = 0;\n\n\t\t\twhile (n % a == 0) {\n\t\t\t\tn /= a;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tans = ans * solve(a, cnt, k) % MD;\n\t\t}\n\tif (n > 1)\n\t\tans = ans * solve(n, 1, k) % MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2a7d39bb33e580bacb3e1dc9c0f19656", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200.0} {"lang": "GNU C11", "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\n#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)\n#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)\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\ni32 calc (const i64 p, const i32 c, const i32 k) {\n i32 *dp = (i32 *) calloc (c + 1, sizeof (i32));\n dp[c] = 1;\n i32 *prob = (i32 *) calloc (c + 1, sizeof (i32));\n for (i32 i = 0; i <= c; ++i) {\n prob[i] = inv (i + 1);\n }\n for (i32 i = 0; i < k; ++i) {\n i32 sum = 0;\n for (i32 j = 0; j <= c; ++j) {\n i32 v = (i64) prob[j] * dp[j] % mod;\n ADD(sum, v);\n }\n for (i32 j = 0; j <= c; ++j) {\n i32 assign = sum;\n i32 v = (i64) prob[j] * dp[j] % mod;\n SUB(sum, v);\n dp[j] = assign;\n }\n }\n i32 ans = 0;\n for (i32 i = c; i >= 0; --i) {\n ans = ((i64) p * ans + dp[i]) % mod;\n }\n free (dp);\n free (prob);\n return ans;\n}\n\nvoid run (void) {\n i64 n = read_int();\n i32 k = read_int();\n i64 ans = 1;\n for (i64 p = 2; p * p <= n; ++p) {\n if (n % p != 0) continue;\n i32 c = 0;\n while (n % p == 0) {\n n /= p;\n ++c;\n }\n ans = ans * calc (p, c, k) % mod;\n }\n if (n > 1) ans = ans * calc (n, 1, k) % mod;\n print_int (ans);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n220x218x26x45:gori ymkw$ emacs 1.c\n220x218x26x45:gori ymkw$ gg 1.c\n220x218x26x45:gori ymkw$ cat 1.c\n#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\n#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)\n#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)\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\ni32 calc (i64 p, const i32 c, const i32 k) {\n i32 *dp = (i32 *) calloc (c + 1, sizeof (i32));\n dp[c] = 1;\n i32 *prob = (i32 *) calloc (c + 1, sizeof (i32));\n for (i32 i = 0; i <= c; ++i) {\n prob[i] = inv (i + 1);\n }\n for (i32 i = 0; i < k; ++i) {\n i32 sum = 0;\n for (i32 j = 0; j <= c; ++j) {\n i32 v = (i64) prob[j] * dp[j] % mod;\n ADD(sum, v);\n }\n for (i32 j = 0; j <= c; ++j) {\n i32 assign = sum;\n i32 v = (i64) prob[j] * dp[j] % mod;\n SUB(sum, v);\n dp[j] = assign;\n }\n }\n p %= mod;\n i32 ans = 0;\n for (i32 i = c; i >= 0; --i) {\n ans = ((i64) p * ans + dp[i]) % mod;\n }\n free (dp);\n free (prob);\n return ans;\n}\n\nvoid run (void) {\n i64 n = read_int();\n i32 k = read_int();\n i64 ans = 1;\n for (i64 p = 2; p * p <= n; ++p) {\n if (n % p != 0) continue;\n i32 c = 0;\n while (n % p == 0) {\n n /= p;\n ++c;\n }\n ans = ans * calc (p, c, k) % mod;\n }\n if (n > 1) ans = ans * calc (n, 1, k) % mod;\n print_int (ans);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "deb7825559935178f39e2bfa4e19569b", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a,ta;\n int b,tb;\n int hh,mm;\n int i;\n int dem=0;\n scanf(\"%d%d%d%d%d:%d\",&a,&ta,&b,&tb,&hh,&mm);\n int x = hh*60+mm+ta;\n int y = hh*60+mm;\n for(i=5*60; i<=23*60+59; i+=b)\n {\n if(i < x && i+tb > y )\n dem++;\n }\n printf(\"%d\",dem);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c043a6d9d505565b2c4dd00d2e26aec6", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define INIT_DAY 300\n#define END_DAY 1440\n\nint main(int argc, char* argv[]) {\n\tint a, ta, b, tb;\n\tint hh, mm;\n\tint start, end;\n\tint init_run;\n int acum = 0;\n \n\tscanf(\"%i %i\", &a, &ta);\n\tscanf(\"%i %i\", &b, &tb);\n\tscanf(\"%d:%d\", &hh, &mm);\n\tstart = (hh * 60) + mm;\n\tend = start + ta;\n\t\n\tinit_run = INIT_DAY;\n\twhile (init_run < END_DAY) {\n\t\tif ( ((init_run + tb) > start) && \n \t\t ( end > init_run) ) {\n \t\t\tacum++;\n \t\t}\n \tinit_run = init_run + b;\n }\n printf(\"%i\\n\", acum);\n \treturn 0; \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9704ffd90d53952b18b8cc3341d928d6", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint i,a,b,ta,tb,h,m,t,count=0;\n\tscanf(\"%d %d\",&a,&ta);\n\tscanf(\"%d %d\",&b,&tb);\n\tscanf(\"%d:%d\",&h,&m);\n\tt=h*60+m;\n\tfor(i=300;i<1440;i=i+b){\n\t\tif(i+tb>t && i\nchar s[100];\nint main() {\n int k = 0,true=1, n, pos = 1, neg = 0;\n while (true) {\n char c;\n scanf(\" %c\", &c);\n scanf(\" %c\", &c);\n\n if (c == '=') break;\n if (c == '+') pos++;\n if (c == '-') neg++;\n\n s[k++] = c;\n }\n\n scanf(\"%d\", &n);\n\n if (pos - n * neg > n || n * pos - neg < n) {\n printf(\"Impossible\\n\");\n\n return 0;\n }\n\n printf(\"Possible\\n\");\n\n int S = 0,i=0,x=1;\n for (i = 0; i < k; i++) {\n int sgn = 1;\n if (i > 0 && s[i - 1] == '-') sgn = -1;\n\n if (sgn == 1) pos--;\n if (sgn == -1) neg--;\n for (x = 1; x <= n; x++)\n {\n if (S + x * sgn + pos - n * neg <= n && S + x * sgn + n * pos - neg >= n) {\n printf(\"%d %c \", x, s[i]);\n\n S += x * sgn;\n\n break;\n }\n }\n\t}\n\n printf(\"%d = %d\\n\", abs(n), n);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0fc6d3a8bc5175d6cb67bef36bdae27a", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint main() {\n\tint a, ta, b, tb;\n\tscanf(\"%d%d%d%d\", &a, &ta, &b, &tb);\n\tint h, min;\n\tscanf(\"%d%*c%d\", &h, &min);\n\tmin += h * 60 - 300;\n\t\n\tint bdepart = min - tb > 0 ? min - tb : 0;\n\n\tint ar = min + ta > 1139 ? 1139 : min + ta;\n\n\tprintf(\"%d\\n\", (ar - 1) / b - (bdepart + b - 1) / b + 1);\n\tsystem(\"pause\");\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "239db5f32cb87a2a43a9cff551b4b757", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "\n\n \n| In English \u041f\u043e-\u0440\u0443\u0441\u0441\u043a\u0438\noe15 | Logout\n\n \nHOMECONTESTSGYMPROBLEMSETGROUPSRATINGAPICALENDAR\n\n\n\nPROBLEMSSUBMIT CODEMY SUBMISSIONSSTATUSHACKSROOMSTANDINGSCUSTOM INVOCATION\n \nGeneral \n \n#\tAuthor\tProblem\tLang\tVerdict\tTime\tMemory\tSent\tJudged\t \t \n32033940\tContestant:\noe15\t887B - 25\tGNU C\tWrong answer on pretest 4\t15 ms\t0 KB\t2017-11-03 21:32:03\t2017-11-03 21:32:04\t Add to favourites\tCompare\n \n\u2192 Source\n#include \n#include \nint search(int *b,int n,int key)\n{\n\tint i,f=0;\n\tfor(i=0;i\n\nint length(int n) {\n\treturn n == 0 ? 0 : length(n / 10) + 1;\n}\n\nint main() {\n\tstatic int aa[3][6];\n\tint n, i, j, x;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < 6; j++)\n\t\t\tscanf(\"%d\", &aa[i][j]);\n\tfor (x = 1; ; x++) {\n\t\tint good;\n\n\t\tgood = 0;\n\t\tif (length(x) == 1) {\n\t\t\tint i, j;\n\n\t\t\tfor (i1 = 0; i1 < n; i1++)\n\t\t\t\tfor (j1 = 0; j1 < 6; j1++) {\n\t\t\t\t\tint a;\n\n\t\t\t\t\ta = aa[i1][j1];\n\t\t\t\t\tif (a == x) {\n\t\t\t\t\t\tgood = 1;\n\t\t\t\t\t\tgoto done;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t} else if (length(x) == 2) {\n\t\t\tint i1, i2, j1, j2;\n\n\t\t\tfor (i1 = 0; i1 < n; i1++)\n\t\t\t\tfor (j1 = 0; j1 < 6; j1++)\n\t\t\t\t\tfor (i2 = 0; i2 < n; i2++)\n\t\t\t\t\t\tfor (j2 = 0; j2 < 6; j2++)\n\t\t\t\t\t\t\tif (i1 != i2) {\n\t\t\t\t\t\t\t\tint a, b;\n\n\t\t\t\t\t\t\t\ta = aa[i1][j1];\n\t\t\t\t\t\t\t\tb = aa[i2][j2];\n\t\t\t\t\t\t\t\tif (a == x / 10 && b == x % 10) {\n\t\t\t\t\t\t\t\t\tgood = 1;\n\t\t\t\t\t\t\t\t\tgoto done;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t} else {\n\t\t\tint i1, i2, i3, j1, j2, j3;\n\n\t\t\tfor (i1 = 0; i1 < n; i1++)\n\t\t\t\tfor (j1 = 0; j1 < 6; j1++)\n\t\t\t\t\tfor (i2 = 0; i2 < n; i2++)\n\t\t\t\t\t\tfor (j2 = 0; j2 < 6; j2++)\n\t\t\t\t\t\t\tfor (i3 = 0; i3 < n; i3++)\n\t\t\t\t\t\t\t\tfor (j3 = 0; j3 < 6; j3++)\n\t\t\t\t\t\t\t\t\tif (i1 != i2 && i2 != i3) {\n\t\t\t\t\t\t\t\t\t\tint a, b, c;\n\n\t\t\t\t\t\t\t\t\t\ta = aa[i1][j1];\n\t\t\t\t\t\t\t\t\t\tb = aa[i2][j2];\n\t\t\t\t\t\t\t\t\t\tc = aa[i3][j3];\n\t\t\t\t\t\t\t\t\t\tif (a == x / 100 && b == x / 10 && c == x % 10) {\n\t\t\t\t\t\t\t\t\t\t\tgood = 1;\n\t\t\t\t\t\t\t\t\t\t\tgoto done;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t}\ndone:\n\t\tif (!good)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\", x - 1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b558579ef78ce68dfa647bf69c22b834", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint n, cube[3][6],v[3];\n\nint dfs(int num){\n\tif (num == 0)return 1;\n\tfor (int i = 0; i < n; i++){\n\t\tif (v[i])continue;\n\t\tint f = 0;\n\t\tfor (int j = 0; j < 6; j++)\n\t\t\tif (num % 10 == cube[i][j])f = 1;\n\t\tif (!f)continue;\n\t\tv[i] = 1;\n\t\tif (dfs(num / 10))return 1;\n\t\tv[i] = 0;\n\t}\n\treturn 0;\n}\nvoid main(){\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < n; i++)\n\t\tfor (int j = 0; j < 6; j++)scanf(\"%d\", &cube[i][j]);\n\n\tfor (int i = 0; i < 1000; i++){\n\t\tfor (int j = 0; j < n; j++)v[j] = 0;\n\t\tif (!dfs(i)){\n\t\t printf(\"%d\\n\", i - 1);\n\t\t return; \n\t\t}\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "49c77a7567976a664736e9db6dc04e6e", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nvoid *my_malloc(int size)\n{\n void *ans = malloc(size);\n if(ans == NULL)\n {\n exit(EXIT_FAILURE);\n }\n return ans;\n}\n\nvoid clear(int *v, int l)\n{\n int i;\n for(i = 0; i < l; i ++)\n {\n v[i] = 0;\n }\n}\n\nvoid fun(int *v, int **m, int *order, int i, int k)\n{\n if(i == -1)\n {\n v[k] = 1;\n return;\n }\n int j;\n for(j = 0; j < 6; j ++)\n {\n fun(v, m, order, i - 1, k * 10 + m[order[i]][j]);\n }\n}\n\nint main(void)\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tint *v = my_malloc((int)pow(10, n) * sizeof(int));\n\tint **m = my_malloc(n * sizeof(int*));\n\t\n\tclear(v, (int)pow(10, n));\n\t\n\tint i, j;\n\tfor(i = 0; i < n; i ++)\n\t{\n\t m[i] = my_malloc(6 * sizeof(int));\n\t for(j = 0; j < 6; j ++)\n\t {\n\t scanf(\"%d\", m + i + j);\n\t }\n\t}\n\t\n\tif(n == 3)\n\t{\n\t int *order = my_malloc(3 * sizeof(int));\n\t for(i = 0; i < n; i ++)\n \t{\n \t int x, y, z;\n \t for(x = 0; x < n; x ++)\n \t {\n \t for(y = 0; y < n; y ++)\n \t {\n \t if(y == x)\n \t {\n \t continue;\n \t }\n \t for(z = 0; z < n; z ++)\n \t {\n \t if(z == x || z == y)\n \t {\n \t continue;\n \t }\n \t order[0] = x, order[1] = y, order[2] = z;\n \t fun(v, m, order, i, 0);\n \t }\n \t }\n \t }\n \t}\n \tfree(order);\n\t}else if(n == 2)\n\t{\n\t int *order = my_malloc(2 * sizeof(int));\n\t for(i = 0; i < n; i ++)\n \t{\n \t int x, y;\n \t for(x = 0; x < n; x ++)\n \t {\n \t for(y = 0; y < n; y ++)\n \t {\n \t if(y == x)\n \t {\n \t continue;\n \t }\n \t order[0] = x, order[1] = y;\n \t fun(v, m, order, i, 0);\n \t }\n \t }\n \t}\n \tfree(order);\n\t}else\n\t{\n\t int *order = my_malloc(sizeof(int));\n\t for(i = 0; i < n; i ++)\n \t{\n \t int x, y;\n \t for(x = 0; x < n; x ++)\n \t {\n \t order[0] = x;\n \t fun(v, m, order, i, 0);\n \t }\n \t}\n \tfree(order);\n\t}\n\t\n\tint ans = 1;\n\twhile(ans < (int)pow(10, n))\n\t{\n\t if(!v[ans])\n\t {\n\t break;\n\t }\n\t ans ++;\n\t}\n\t\n\tprintf(\"%d\",ans - 1);\n\t\n\tfree(v);\n\tfree(m);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1af8e4393a9f284113679f38be9056ef", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint n, cube[3][6],v[3];\n\nint dfs(int num){\n\tif (num == 0)return 1;\n\tfor (int i = 0; i < n; i++){\n\t\tif (v[i])continue;\n\t\tint f = 0;\n\t\tfor (int j = 0; j < 6; j++)\n\t\t\tif (num % 10 == cube[i][j])f = 1;\n\t\tif (!f)continue;\n\t\tv[i] = 1;\n\t\tif (dfs(num / 10))return 1;\n\t\tv[i] = 0;\n\t}\n\treturn 0;\n}\nint main(){\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < 3; i++)\n\t\tfor (int j = 0; j < 6; j++)scanf(\"%d\", &cube[i][j]);\n\n\tfor (int i = 0; i < 1000; i++){\n\t\tfor (int j = 0; j < n; j++)v[j] = 0;\n\t\tif (!dfs(i))return printf(\"%d\\n\", i - 1);\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9a9fcf38cf77c427caef3525a0f8d627", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\nfloat NAN = 0.0/0.0;\nfloat a1(float x,float y,float z)\n{\n\tif(x==1)\n\treturn 1;\n\telse if(x>1)\n\treturn z*log(y)+ log(log(x));\n\telse if(x<1 && y<1 && z<1)\n return z*log(y)+ log(log(1/x));\n else \n return NAN;\n }\n \nfloat a2(float x,float y,float z)\n{\n\tif(x==1.0)\n\treturn 1.0;\n\telse if(x>1.0)\n\treturn log(z)+log(y)+ log(log(x));\n\telse if(x<1.0 && y<1.0 && z<1.0)\n return log(z)+log(y)+ log(log(1/x));\n else \n return NAN;\n }\n \n \n\t\n\t\nint main()\n{\n\tfloat x,y,z;\n\tscanf(\"%f %f %f\",&x,&y,&z);\n\tfloat a[12];\n\tchar pat[12][10]= {\"x^y^z\\0\",\n\t\t\t\t\t\t\t \"x^z^y\\0\",\n\t\t\t\t\t\t\t \"(x^y)^z\\0\",\n\t\t\t\t\t\t\t \"(x^z)^y\\0\",\n\t\t\t\t\t\t\t \"y^x^z\\0\",\n\t\t\t\t\t\t\t \"y^z^x\\0\",\n\t\t\t\t\t\t\t \"(y^x)^z\\0\",\n\t\t\t\t\t\t\t \"(y^z)^x\\0\",\n\t\t\t\t\t\t\t \"z^x^y\\0\",\n\t\t\t\t\t\t\t \"z^y^x\\0\",\n\t\t\t\t\t\t\t \"(z^x)^y\\0\",\n\t\t\t\t\t\t\t \"(z^y)^x\\0\"\n\t\t\t\t\t\t\t };\n\ta[0]=a1(x,y,z);\n\ta[1]=a1(x,z,y);\n\ta[2]=a2(x,y,z);\n a[3]=a2(x,z,y);\n a[4]=a1(y,x,z);\n\ta[5]=a1(y,z,x);\n\ta[6]=a2(y,x,z);\n a[7]=a2(y,z,x);\n a[8]=a1(z,x,y);\n\ta[9]=a1(z,y,x);\n\ta[10]=a2(z,x,y);\n a[11]=a2(z,y,x);\n \n float ans;\n int pos,i;\n if(x>1)\n {\n ans = a[0];\n pos =0;\n }\n else if(y>1)\n {\n\t ans = a[4];\n\t pos=4;\n\t }\n\t else\n\t {\n\t\t ans = a[8];\n\t\t pos =8;\n\t\t }\n \n \n if(x<1 && y<1 && z<1)\n {\n for(i=11;i>=0;--i)\n {\n if(a[i]<=ans)\n {\n\t ans = a[i];\n\t pos = i;\n\t }\n\t }\n\t }\n\t \n\telse\n\t{\n for(i=11;i>=0;--i)\n {\n if(a[i]>=ans)\n {\n\t ans = a[i];\n\t pos = i;\n\t }\n\t }\n\t }\n \n printf(\"%s\",pat[pos]);\n return 0;\n }\n\t\t ", "lang_cluster": "C", "compilation_error": true, "code_uid": "5845c67fb147b17f66922ba5b09b4228", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nusing namespace std; \ndouble x,y,z;\ndouble a[9];\n\n\nint main()\n{\n\tchar count[9][10]={\"x^y^z\",\n \"x^z^y\",\n\t\t\t\t\t \"(x^y)^z\",\n\t\t\t\t\t \"y^x^z\",\n\t\t\t\t\t \"y^x^z\",\n\t\t\t\t\t \"(y^x)^z\", \n\t\t\t\t\t \"z^x^y\",\n\t\t\t\t\t \"z^y^x\",\n\t\t\t\t\t \"(z^x)^y\"} ;\n\tint i,max;\n\tscanf(\"%lf%lf%lf\",&x,&y,&z);\n\ta[0]=pow(y,z)*log(x);\n\ta[1]=pow(z,y)*log(x);\n\ta[2]=y*z*log(x);\n\ta[3]=pow(x,z)*log(y);\n\ta[4]=pow(z,x)*log(y);\n\ta[5]=x*z*log(y);\n\ta[6]=pow(x,y)*log(z);\n\ta[7]=pow(y,x)*log(z);\n\ta[8]=x*y*log(z);\n\tfor(i=1,max=0;i<=8;i++)\n\t{\n\t\tif(a[i]>a[max])max=i;\n\t}\n\tprintf(\"%s\",count[max]);\n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "29ab168eb3774e47e40cd4db67643899", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nusing namespace std; \ndouble x,y,z;\ndouble a[9];\n\n\nint main()\n{\n\tchar count[9][10]={\"x^y^z\",\n \"x^z^y\",\n\t\t\t\t\t \"(x^y)^z\",\n\t\t\t\t\t \"y^x^z\",\n\t\t\t\t\t \"y^x^z\",\n\t\t\t\t\t \"(y^x)^z\", \n\t\t\t\t\t \"z^x^y\",\n\t\t\t\t\t \"z^y^x\",\n\t\t\t\t\t \"(z^x)^y\"} ;\n\tint i,max;\n\tscanf(\"%lf%lf%lf\",&x,&y,&z);\n\ta[0]=pow(y,z)*log(x);\n\ta[1]=pow(z,y)*log(x);\n\ta[2]=y*z*log(x);\n\ta[3]=pow(x,z)*log(y);\n\ta[4]=pow(z,x)*log(y);\n\ta[5]=x*z*log(y);\n\ta[6]=pow(x,y)*log(z);\n\ta[7]=pow(y,x)*log(z);\n\ta[8]=x*y*log(z);\n\tfor(i=1,max=0;i<=8;i++)\n\t{\n\t\tif(a[i]>a[max])max=i;\n\t}\n\tprintf(\"%s\",count[max]);\n} \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7b3088d28686d3451b05b6c630363945", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main () {\n\t\n\tdouble x, y, z;\n\t\n\tdouble max;\n\tint ind = 0;\n\t\n\tscanf(\"%lf %lf %lf\", &x, &y, &z);\n\t\n\tif (x - 1.0 < 1e-6 && y - 1.0 < 1e-6 && z - 1.0 < 1e-6) {\n\t\t\n\t\tmax = 1000000;\n\t\t\n\t\tif (z * log(y) + log(log(1 / x)) - max < -1e-6) {\n\t\t\tmax = z * log(y) + log(log(1 / x));\n\t\t\tind = 1;\n\t\t}\n// printf(\"%.15lf\\n\", z * log(y) + log(log(1 / x)));\n\t\tif (y * log(z) + log(log(1 / x)) - max < -1e-6) {\n\t\t\tmax = y * log(z) + log(log(1 / x));\n\t\t\tind = 2;\n\t\t}\n// printf(\"%.15lf\\n\", y * log(z) + log(log(1 / x)));\n\t\tif (log(y) + log(z) + log(log(1 / x)) - max < -1e-6) {\n\t\t\tmax = log(y) + log(z) + log(log(1 / x));\n\t\t\tind = 3;\n\t\t}\n// printf(\"%.15lf\\n\", log(y) + log(z) + log(log(1 / x)));\n\t\t\n\t\t\n\tif (z * log(x) + log(log(1 / y)) - max < -1e-6) {\n\t\t\tmax = z * log(x) + log(log(1 / y));\n\t\t\tind = 5;\n\t\t}\n// printf(\"%.15lf\\n\", z * log(x) + log(log(1 / y)));\n\t\tif (x * log(z) + log(log(1 / y)) - max < -1e-6) {\n\t\t\tmax = x * log(z) + log(log(1 / y));\n\t\t\tind = 6;\n\t\t}\n// printf(\"%.15lf\\n\", x * log(z) + log(log(1 / y)));\n\t\tif (log(x) + log(z) + log(log(1 / y)) - max < -1e-6) {\n\t\t\tmax = log(x) + log(z) + log(log(1 / y));\n\t\t\tind = 7;\n\t\t}\n// printf(\"%.15lf\\n\", log(x) + log(z) + log(log(1 / y)));\n\t\t\n\t\t\n\tif (y * log(x) + log(log(1 / z)) - max < -1e-6) {\n\t\t\tmax = y * log(x) + log(log(1 / z));\n\t\t\tind = 9;\n\t\t}\n// printf(\"%.15lf\\n\", y * log(x) + log(log(1 / z)));\n\t\tif (x * log(y) + log(log(1 / z)) - max < -1e-6) {\n\t\t\tmax = x * log(y) + log(log(1 / z));\n\t\t\tind = 10;\n\t\t}\n// printf(\"%.15lf\\n\", x * log(y) + log(log(1 / z)));\n\t\tif (log(x) + log(y) + log(log(1 / z)) - max < -1e-6) {\n\t\t\tmax = log(x) + log(y) + log(log(1 / z));\n\t\t\tind = 11;\n\t\t}\n// printf(\"%.15lf\\n\", log(x) + log(y) + log(log(1 / z)));\n\t\t\n\t\t\n\t} else {\n\t\t\n\t\tmax = -1000;\n\t\t\n\t\tif (x - 1.0 > 0.01) {\n\t\t\tif (z * log(y) + log(log(x)) - max > 1e-6) {\n\t\t\t\tmax = z * log(y) + log(log(x));\n\t\t\t\tind = 1;\n\t\t\t}\n// printf(\"%.15lf\\n\", z * log(y) + log(log(x)));\n\t\t\tif (y * log(z) + log(log(x)) - max > 1e-6) {\n\t\t\t\tmax = y * log(z) + log(log(x));\n\t\t\t\tind = 2;\n\t\t\t}\n// printf(\"%.15lf\\n\", y * log(z) + log(log(x)));\n\t\t\tif (log(y) + log(z) + log(log(x)) - max > 1e-6) {\n\t\t\t\tmax = log(y) + log(z) + log(log(x));\n\t\t\t\tind = 3;\n\t\t\t}\n// printf(\"%.15lf\\n\", log(y) + log(z) + log(log(x)));\n\t\t}\n\t\t\n\t\tif (y - 1.0 > 0.01) {\n\t\t\tif (z * log(x) + log(log(y)) - max > 1e-6) {\n\t\t\t\tmax = z * log(x) + log(log(y));\n\t\t\t\tind = 5;\n\t\t\t}\n// printf(\"%.15lf\\n\", z * log(x) + log(log(y)));\n\t\t\tif (x * log(z) + log(log(y)) - max > 1e-6) {\n\t\t\t\tmax = x * log(z) + log(log(y));\n\t\t\t\tind = 6;\n\t\t\t}\n// printf(\"%.15lf\\n\", x * log(z) + log(log(y)));\n\t\t\tif (log(x) + log(z) + log(log(y)) - max > 1e-6) {\n\t\t\t\tmax = log(x) + log(z) + log(log(y));\n\t\t\t\tind = 7;\n\t\t\t}\n// printf(\"%.15lf\\n\", log(x) + log(z) + log(log(y)));\n\t\t}\n\t\t\n\t\tif (z - 1.0 > 0.01) {\n\t\t\tif (y * log(x) + log(log(z)) - max > 1e-6) {\n\t\t\t\tmax = y * log(x) + log(log(z));\n\t\t\t\tind = 9;\n\t\t\t}\n// printf(\"%.15lf\\n\", y * log(x) + log(log(z)));\n\t\t\tif (x * log(y) + log(log(z)) - max > 1e-6) {\n\t\t\t\tmax = x * log(y) + log(log(z));\n\t\t\t\tind = 10;\n\t\t\t}\n// printf(\"%.15lf\\n\", x * log(y) + log(log(z)));\n\t\t\tif (log(x) + log(y) + log(log(z)) - max > 1e-6) {\n\t\t\t\tmax = log(x) + log(y) + log(log(z));\n\t\t\t\tind = 11;\n\t\t\t}\n// printf(\"%.15lf\\n\", log(x) + log(y) + log(log(z)));\n\t\t}\n\t}\n\t\n\tswitch (ind) {\n\t\tcase 1:\n\t\t\tprintf(\"x^y^z\\n\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"x^z^y\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"(x^y)^z\\n\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tprintf(\"(x^z)^y\\n\");\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"y^x^z\\n\");\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tprintf(\"y^z^x\\n\");\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tprintf(\"(y^x)^z\\n\");\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tprintf(\"(y^z)^x\\n\");\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tprintf(\"z^x^y\\n\");\n\t\t\tbreak;\n\t\tcase 10:\n\t\t\tprintf(\"z^y^x\\n\");\n\t\t\tbreak;\n\t\tcase 11:\n\t\t\tprintf(\"(z^x)^y\\n\");\n\t\t\tbreak;\n\t\tcase 12:\n\t\t\tprintf(\"(z^y)^x\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"ERROR\\n\");\n\t}\n\t\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1ef874525dffa37013346674f0ce0e0", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n#include \n\ndouble aa[12];\nint sign[12];\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\n\tif (sign[i] != sign[j])\n\t\treturn sign[j] - sign[i];\n\tif (sign[i] == 0)\n\t\treturn i - j;\n\treturn aa[i] == aa[j] ? i - j : aa[i] > aa[j] ? -sign[i] : sign[i];\n}\n\nvoid power(int i, double x, double y, double z) {\n\tif (x == 1)\n\t\tsign[i] = 0;\n\telse if (x > 1) {\n\t\tsign[i] = 1;\n\t\taa[i] = z * log(y) + log(log(x));\n\t} else {\n\t\tsign[i] = -1;\n\t\taa[i] = z * log(y) + log(-log(x));\n\t}\n}\n\nvoid power_(int i, double x, double yz) {\n\tif (x == 1)\n\t\tsign[i] = 0;\n\telse if (x > 1) {\n\t\tsign[i] = 1;\n\t\taa[i] = log(yz) + log(log(x));\n\t} else {\n\t\tsign[i] = -1;\n\t\taa[i] = log(yz) + log(-log(x));\n\t}\n}\n\nint main() {\n\tstatic char ss[12][16] = {\n\t\t\"x^y^z\", \"x^z^y\", \"(x^y)^z\", \"(x^z)^y\",\n\t\t\"y^x^z\", \"y^z^x\", \"(y^x)^z\", \"(y^z)^x\",\n\t\t\"z^x^y\", \"z^y^x\", \"(z^x)^y\", \"(z^y)^x\" };\n\tstatic int ii[12];\n\tdouble x, y, z;\n\tint i;\n\n\tscanf(\"%lf%lf%lf\", &x, &y, &z);\n\tpower(0, x, y, z);\n\tpower(1, x, z, y);\n\tpower_(2, x, y * z);\n\tpower_(3, x, y * z);\n\tpower(4, y, x, z);\n\tpower(5, y, z, x);\n\tpower_(6, y, x * z);\n\tpower_(7, y, x * z);\n\tpower(8, z, x, y);\n\tpower(9, z, y, x);\n\tpower_(10, z, x * y);\n\tpower_(11, z, x * y);\n\tfor (i = 0; i < 12; i++)\n\t\tii[i] = i;\n\tqsort(ii, 12, sizeof *ii, compare);\n\tprintf(\"%s\\n\", ss[ii[0]]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "18aa81e090872fc01c8ac3697e2fe0b5", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "842ba8428b4b39f069f06e25f30d25c2", "src_uid": "ed5f913afe829c65792b54233a256757", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define max2(a,b) (a= L[n]; i--)\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++) {\n char pos = 0;\n if (G[n] == 0)\n pos |= P[i][a+1][b][c] += P[i-L[n]][a][b][c];\n if (G[n] == 1)\n pos |= P[i][a][b+1][c] += P[i-L[n]][a][b][c];\n if (G[n] == 2)\n pos |= P[i][a][b][c+1] += P[i-L[n]][a][b][c];\n\n if (pos && i > max_d)\n max_d = i;\n }\n count[G[n]] = min(count[G[n]] + 1, N/2+1);\n }\n\n u64 r = 0;\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++)\n if (P[T][a][b][c]) {\n for (int g = 0; g < 3; g++)\n r = add2(r, mul3(fact3(a,b,c), perm[a][b][c][g], P[T][a][b][c]));\n }\n return r;\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b712000db0dfb2972cd493528ca5043f", "src_uid": "ed5f913afe829c65792b54233a256757", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define max2(a,b) (a= L[n]; i--)\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++) {\n int pos = 0;\n if (G[n] == 0)\n pos |= !!add2i(P[i][a+1][b][c], P[i-L[n]][a][b][c]);\n if (G[n] == 1)\n pos |= !!add2i(P[i][a][b+1][c], P[i-L[n]][a][b][c]);\n if (G[n] == 2)\n pos |= !!add2i(P[i][a][b][c+1], P[i-L[n]][a][b][c]);\n\n if (pos && i > max_d)\n max_d = i;\n }\n count[G[n]] = min2(count[G[n]] + 1, N/2);\n }\n\n u64 r = 0;\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++)\n if (P[T][a][b][c])\n for (int g = 0; g < 3; g++)\n add2i(r, mul3(fact3(a,b,c), perm[a][b][c][g], P[T][a][b][c]));\n return r;\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 for (n = 2; n <= N; n++)\n for (i = 0; i <= n/2+1; i++)\n for (j = 0; j <= min2(n - i, n/2+1); 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());\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cbb911d71049ca0be19be23b36174f00", "src_uid": "ed5f913afe829c65792b54233a256757", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define max2(a,b) (a= L[n]; i--)\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++) {\n char pos = 0;\n if (G[n] == 0)\n pos |= P[i][a+1][b][c] |= P[i-L[n]][a][b][c];\n if (G[n] == 1)\n pos |= P[i][a][b+1][c] |= P[i-L[n]][a][b][c];\n if (G[n] == 2)\n pos |= P[i][a][b][c+1] |= P[i-L[n]][a][b][c];\n\n if (pos && i > max_d)\n max_d = i;\n }\n count[G[n]] = min(count[G[n]] + 1, N/2+1);\n }\n\n u64 r = 0;\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++)\n if (P[T][a][b][c]) {\n for (int g = 0; g < 3; g++)\n r = add2(r, mul2(fact3(a,b,c), perm[a][b][c][g]));\n }\n return r;\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9d0654ec5f6e99285829cd856d234aa", "src_uid": "ed5f913afe829c65792b54233a256757", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define max2(a,b) (a= L[n]; i--)\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++) {\n int pos = 0;\n if (G[n] == 0)\n pos |= add2i(P[i][a+1][b][c], P[i-L[n]][a][b][c]);\n if (G[n] == 1)\n pos |= add2i(P[i][a][b+1][c], P[i-L[n]][a][b][c]);\n if (G[n] == 2)\n pos |= add2i(P[i][a][b][c+1], P[i-L[n]][a][b][c]);\n\n if (pos && i > max_d)\n max_d = i;\n }\n count[G[n]] = min(count[G[n]] + 1, N/2+1);\n }\n\n u64 r = 0;\n for (a = 0; a <= count[0]; a++)\n for (b = 0; b <= count[1]; b++)\n for (c = 0; c <= count[2]; c++)\n if (P[T][a][b][c]) {\n for (int g = 0; g < 3; g++)\n add2i(r, mul3(fact3(a,b,c), perm[a][b][c][g], P[T][a][b][c]));\n }\n return r;\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 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "7d89132ca67132a92fb0b6ca0747d2c7", "src_uid": "ed5f913afe829c65792b54233a256757", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "##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\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;l;;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "207f68f9f7bea1a073130ae93055c38d", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100.0} {"lang": "GNU C", "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);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c04fbc04988f828d15ddf687b1befe22", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "unsigned a,b,c,x=1;\nint main()\n{\n for( scanf(\"%d%d\",&a,&c) ; a|c ; x*=3 , a/=3 , c/=3 )\n b+=(3+c%3-a%3)%3*x;\n printf(\"%d\",b);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "897bda5305799fe6faf766edbb3bd0e3", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "unsigned a,b,c,x=1;\nint main(){\nfor(scanf(\"%d%d\",&a,&c);a|b;x*=3,a/=3,c/=3)b+=(3+c%3-a%3)%3*x;\nprintf(\"%d\",b);exit(0);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d813b793f3d3365174bae6857f200fb5", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100.0} {"lang": "GNU C", "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\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"22\");\n else if (n == 4) puts(\"58\");\n else __builtin_trap();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f257f04d9b592d3dcc084a8b6d3d73c6", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n printf(\"4\");\n else if(n==2)\n printf(\"22\");\n else if(n==3)\n printf(\"27\");\n else if(n==4)\n printf(\"58\");\n else if(n==5)\n printf(\"85\");\n else if(n==6)\n printf(\"94\");\n else if(n==7)\n printf(\"121\");\n else if(n==8)\n printf(\"166\");\n else if(n==9)\n printf(\"202\");\n else if(n==10)\n printf(\"265\");\n else if(n==11)\n printf(\"274\");\n else if(n==12)\n printf(\"319\");\n else if(n==13)\n printf(\"346\");\n else if(n==14)\n printf(\"355\");\n else if(n==15)\n printf(\"378\");\n else if(n==16)\n printf(\"382\");\n else if(n==17)\n printf(\"391\");\n else if(n==18)\n printf(\"438\");\n else if(n==19)\n printf(\"454\");\n else if(n==20)\n printf(\"483\");\n else if(n==21)\n printf(\"517\");\n else if(n==22)\n printf(\"526\");\n else if(n==23)\n printf(\"535\");\n else if(n==24)\n printf(\"562\");\n else if(n==25)\n printf(\"576\");\n else if(n==26)\n printf(\"588\");\n else if(n==27)\n printf(\"627\");\n else if(n==28)\n printf(\"634\");\n else if(n==29)\n printf(\"636\");\n else(n==30)\n printf(\"645\");\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "57a7a165577849210070a87d81b0e41b", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\tprintf(\"%d\", 30 - a);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e97ead8bc9f6c2f9aa78a043e75032f1", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:31/03/2019 \n*/\n#include\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 long long n;\n scanf(\"%lld\",&n);\n long long a=n*n*n;\n printf(\"%lld\\n\",ans);\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ccdd21b3e92a873ee5a8977ab6779b6a", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nint man(void)\n{\n int a=0;\n scanf(\"%d\",&a);\n printf(\"%d\\n\",3*a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6752555f742fcb5c4eaea2a999c2935f", "src_uid": "bf65a25185e9ea5b71e853723b838b04", "difficulty": 1700.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "16412fcd51cb161f64ffa77a2fae5937", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "575852726bfce31ca1773eb3480fed0b", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "90e05bfc2f2855cb9f4957fb92c66af0", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "GNU C", "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) __builtin_trap();\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "43b820cf191bb61e766d17a16b85cb1e", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{int i,j,k,n;\nscanf(\"%d\",&n);\nif(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", "lang_cluster": "C", "compilation_error": false, "code_uid": "39ab4320f2dd821f674a03fab62d7b83", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define M 200000000\n\nint aa[M], bb[M];\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\n\treturn bb[j] - bb[i];\n}\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tstatic int ii[M];\n\tint n, m, i, x, cnt;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < m; i++) {\n\t\tscanf(\"%d%d\", &aa[i], &bb[i]);\n\t\tii[i] = i;\n\t}\n\tqsort(ii, m, sizeof *ii, compare);\n\tcnt = 0;\n\tfor (i = 0; i < m && n > 0; i++) {\n\t\tx = min(aa[ii[i]], n);\n\t\tcnt += (x * bb[ii[i]]);\n\t\tn -= x;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1cb277c0d61de6b6e4f937ce89be5156", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "\tLL sum=0LL;\n\tint mas[11];\n\tint r[11];\n\n\tfor(i=0;i<=10;i++){\n\tr[i]=0;\n\t}\n\tscanf(\"%d %d\",&n,&m);\n\n\tfor(i=0;i0){\n\t\tif(r[s]>=k){\n\t\t\tsum+=(k*1LL*s);\n\t\t\tbreak;\n\t\t}\n\t\tsum+=(r[s]*1LL*s);\n\t\tk-=r[s];\n\t\ts--;\n\t\t//printf(\":%I64d \",sum);\n\t}\n\t\n\tprintf(\"%I64d\",sum);\n\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f0bac06a5c8f7195cd150b31dedc05c8", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\ntypedef struct{\n\n int n_of_matches;\n int n_matchbox;\n \n\n}container;\n\nint cmpfunc (const void * a, const void * b) {\n return ( -*(int*)a + *(int*)b );\n}\n\nint main(void) {\n\n int n, m, cnt = 0, sum = 0;\n scanf(\"%d %d\", &n, &m);\n\n container arr[m];\n\n for(int i = 0; i < m; i++){\n scanf(\"%d\", &arr[i].n_matchbox);\n scanf(\"%d\", &arr[i].n_of_matches);\n }\n\n qsort(arr, m, sizeof(container), cmpfunc);\n\n if(n == 0){\n printf(\"0\");\n return 0;\n }\n \n\n for(int i = 0; i < m; i++){\n\n for(int j = 0; j < arr[i].n_matchbox; j++){\n sum += arr[i].n_of_matches;\n cnt++;\n\n if(cnt == n){\n printf(\"%d\", sum);\n return 0;\n }\n }\n }\n\n printf(\"%d\", sum);\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ca2179e80bfeac7b166634f5cf37bb87", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nstruct box\n{\n int matchbox;\n int match;\n} a[20];\n\nint q[12000010];\n\nint main(void)\n{\n int n,m,sum,start,i,k,j;\n struct box t;\n while(scanf(\"%d%d\",&n,&m) != EOF)\n {\n for(i = 0;i \n#include\nstruct box\n{\n int matchbox;\n int match;\n} a[20];\n\nint q[10000010];\n\nint main(void)\n{\n int n,m,sum,start,i,k,j;\n struct box t;\n while(scanf(\"%d%d\",&n,&m) != EOF)\n {\n for(i = 0;i \n#include\nint main()\n{\n\tlong long n;\n\tint c,i=0,rev[10],rev1[10],num1[10],num[10],j,k,m,l1,l,p,q,count=0;\n\tscanf(\"%I64d\",&n);\n\tc=n;\n\twhile(c!=0)\n\t{\n\t\trev[i]=c%10;\n\t\tc/=10;\n\t\ti++;\n\t}\n\tl=i-1;\n\t\n\tfor(j=l,k=0;j>0,k0;i--)\n\t{\n\t\tfloat sqrti=sqrt(i);\n\t\tint sqrtii=sqrt(i);\n\t\tif(sqrti-sqrtii==0)\n\t\t{\n\t\t\tcount=0;\n\t\t\tj=0;\n\t\t\tc=i;\n\t\t\twhile(c!=0)\n\t\t\t{\n\t\t\t\trev1[j]=c%10;\n\t\t\t\tc/=10;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tl1=j-1;\n\t\t\t\n\t\t\tfor(k=l1,m=0;k>=0,m0&&count==l1+1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",l-l1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"-1\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a55c96fc6949be6947e8a84ebfcfa71", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint minimal_changes(int n)\n{\n int ret , min , found = 0, other , ten_pow = 1;\n double res = sqrt((double)n);\n if(n == 0) return -1;\n if(res == (int)res)\n {\n return 0;\n }\n while(n / ten_pow)\n {\n other = (n /(10 * ten_pow)) * ten_pow + n % ten_pow ;\n ret = minimal_changes(other);\n if(ret != -1)\n {\n if(!found)\n {\n min = ret;\n found = 1;\n }\n min = ret < min ? ret : min;\n }\n ten_pow *= 10;\n }\n if(found)\n {\n return 1 + min;\n }\n return -1;\n}\n\nint main()\n{\n int n ;\n scanf(\"%d\" , &n);\n printf(\"%d\" , minimal_changes(n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "12220ba3505d2319b474efd58ab4c09e", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tlong long n;\n\tint c,i=0,rev[10],rev1[10],num1[10],num[10],j,k,m,l1,l,p,q,count=0;\n\tscanf(\"%I64d\",&n);\n\tc=n;\n\twhile(c!=0)\n\t{\n\t\trev[i]=c%10;\n\t\tc/=10;\n\t\ti++;\n\t}\n\tl=i-1;\n\t\n\t//for(j=l,k=0;j>0,k0;i--)\n\t{\n\t\tfloat sqrti=sqrt(i);\n\t\tint sqrtii=sqrt(i);\n\t\tif(sqrti-sqrtii==0)\n\t\t{\n\t\t\tcount=0;\n\t\t\tj=0;\n\t\t\tc=i;\n\t\t\twhile(c!=0)\n\t\t\t{\n\t\t\t\trev1[j]=c%10;\n\t\t\t\tc/=10;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tl1=j-1;\n\t\t\t\n\t\t\t//for(k=l1,m=0;k>=0,m=0;p--)\n\t\t\t{\n\t\t\t\tfor(;q>=0;q--)\n\t\t\t\t{\n\t\t\t\t\tif(rev1[p]==rev[q])\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tq--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(q0&&count==l1+1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",l-l1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"-1\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "442fb43a118da6e715529b95bd4bf6b8", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tlong long n;\n\tint c,i=0,rev[10],rev1[10],num1[10],num[10],j,k,m,l1,l,p,q,count=0;\n\tscanf(\"%I64d\",&n);\n\tc=n;\n\twhile(c!=0)\n\t{\n\t\trev[i]=c%10;\n\t\tc/=10;\n\t\ti++;\n\t}\n\tl=i-1;\n\t\n\tfor(j=l,k=0;j>0,k0;i--)\n\t{\n\t\tfloat sqrti=sqrt(i);\n\t\tint sqrtii=sqrt(i);\n\t\tif(sqrti-sqrtii==0)\n\t\t{\n\t\t\tcount=0;\n\t\t\tj=0;\n\t\t\tc=i;\n\t\t\twhile(c!=0)\n\t\t\t{\n\t\t\t\trev1[j]=c%10;\n\t\t\t\tc/=10;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tl1=j-1;\n\t\t\t\n\t\t\tfor(k=l1,m=0;k>=0,m0&&count==l1+1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",l-l1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"-1\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "01e2b51c5df04ee6b646bcc5bfb6cf5c", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint minimal_changes(int n)\n{\n int ret , min , found = 0, other , ten_pow = 1;\n double res = sqrt((double)n);\n if(res == (int)res)\n {\n return 0;\n }\n if(n == 0) return -1;\n while(n / ten_pow)\n {\n other = (n /(10 * ten_pow)) * ten_pow + n % ten_pow ;\n ret = minimal_changes(other)\n if(ret != -1)\n {\n if(!found)\n {\n min = ret;\n found = 1;\n }\n min = ret < min ? ret : min;\n }\n ten_pow *= 10;\n }\n if(found)\n {\n return 1 + min;\n }\n return -1;\n}\n\nint main()\n{\n int n ;\n scanf(\"%d\" , &n);\n printf(\"%d\" , minimal_changes(n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ad1114ba76d26132b369ff4cbafce266", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\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];\nint next[N];\nint pre[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+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//printf( \"p = %d\\n\", i );\n }\n//printf( \"%d\\n\", c[0] );\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\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 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 shu_chu( output );\n return 0;\n} \n \n \n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb19f2d3bfa75f9a0d41acdee7872747", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nint main(){\n int n ;\n scanf(\"%d\",&n);\n int r = n % 9;\n int a[9];\n for(int 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(int i=0;i<9;i++)\n for(int j=i+1;j<9;j ++ )\n ans += (long long) a[i]*a[j]*a[i*j%9];\n\n ans *=2;\n for(int i=0;i<9;i++)\n ans+=(long long) a[i]*a[i]*a[i*i%9];\n \n for(int 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "726ab12393c18eab3af55bb10458b3c1", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nlong long c[9],z;\nint n;\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++)\n c[i%9]++,z-=n/i;\n for(int i=0;i<9;i++)\n for(int j=0;j<9;j++)\n z+=c[i]*c[j]*c[i*j%9];\n printf(\"%I64d\",z);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3ba1e60022d40a5bfd1d8577e5b0b0bc", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "long long c[9],z;\nint n;\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++)\n c[i%9]++,z-=n/i;\n for(int i=0;i<9;i++)\n for(int j=0;j<9;j++)\n z+=c[i]*c[j]*c[i*j%9];\n printf(\"%d\",z);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7f182596cbeb7eeec058392ff4e7baae", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\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];\nint next[N];\nint pre[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+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//printf( \"p = %d\\n\", i );\n }\nprintf( \"%d\\n\", c[0] );\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\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 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 shu_chu( output );\n return 0;\n} \n \n \n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "76645c78ebb870f7b53b0c41f194c893", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "\n\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-x;\n break;\n }\n }\n printf(\"%lld %lld\\n\",ans,ans1);\n }\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "8c6d51a0fdeb73d1552593dc698ad2cb", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\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", "lang_cluster": "C", "compilation_error": true, "code_uid": "828bbe99c2546b230c0cc90037e47a2d", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int tests;\n scanf(\"%d\",&tests);\n while(tests--)\n {\n int min_v=1000000009;\n int min_l,min_h;\n int n;\n scanf(\"%d\",&n);\n int l=1,h=n-1;\n while(l<=h)\n {\n \n if(h%l==0&&min_v>h)\n {\n min_v=high;\n min_l=l;\n min_h=h;\n }\n l++;\n h--;\n }\n printf(\"%d %d\\n\",min_l,min_h);\n }\n return 0;\n}\n\nint find_min(int i,int j)\n{\n return i\nunsigned long long minlcm(unsigned long long int n);\n\nint main()\n{\n unsigned long long int t,n,i;\n scanf(\"%llu\",&t);\n for(i=1 ;i<=t ;i++)\n {\n scanf(\"%llu\",&n);\n minlcm(n);\n\n\n }\n\n\n}\nunsigned long long int minlcm(unsigned long long int n)\n{ unsigned long long int a,b,c,d,i,min,e,f;\n for(i=1 ;i<=n/2 ;i++)\n {\n\n a=i;\n b=n-i;\n min=n;\n while(a!=0)\n {\n c=b%a;\n b=a;\n a=c;\n }\n d=(n-i)*i/b;\n if(d\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-x;\n break;\n }\n }\n printf(\"%lld %lld\\n\",ans,ans1);\n }\n return 0;\n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "1610034d5dedb6a4e755c770630a442f", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\n//#include \n#include \n#include \n__int64 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 pr__int64f(\"%I64d %I64d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n pr__int64f(\"0 %I64d\\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 \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 pr__int64f(\"%I64d %I64d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n pr__int64f(\"0 %I64d\\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 \n__int64 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 pr__int64f(\"%I64d %I64d\\n\",x1,x2);\n return 0;\n }else\n if(t==t2){\n pr__int64f(\"0 %I64d\\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\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 //m1=1000000*1000000*1000000;\n //printf(\"%lld\",m1);\n \n scanf(\"%d %d %d %d %d\",&t1,&t2,&x1,&x2,&t);\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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b648cdd4ff67512ec92a188195b85b3a", "src_uid": "87a500829c1935ded3ef6e4e47096b9f", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint q=0,w=0,e=0,a[100],k,n,i,j;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0 ; iq)\n\t\t\t\te+=q;\n\t\t\telse\n\t\t\t\te+=w;\n\t}\n\t\t\tprintf(\"%d\",e);\n\t\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eccff175d60f7c5bebd927e51efd27f4", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n \nint min(int a,int b){ \n return a>b?b:a; \n} \n \nint a[105]; \n \nint main() \n{ \n int n,k; \n while(scanf(\"%d%d\",&n,&k)+1) \n { \n for(int i=0;i\n#include \n\nchar Data[101][101];\n\nint main()\n{\n int N,K,i,j,k,Ans,AllOne,AllTwo,Min;\n int A[100];\n scanf(\"%d %d\",&N,&K);\n for(i=0; i\n#include\nint main(){\nint k,n,i,j;\nint count1,count2,count=0;\nint *a;\nscanf(\"%d %d\",&n,&k);\na=(int*)malloc(n*sizeof(int));\nfor(i=0;icount2) count=count2+count;\nelse count=count1+count;\n }\n printf(\"%d\",count);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e0542da2e0130c58ea84ac3cc35bc26a", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\nint k,n,i,j;\nint count1,count2,count=0;\nint *a;\nscanf(\"%d %d\",&n,&k);\na=(int*)malloc(n*sizeof(int));\nfor(i=0;icount2) count=count2+count;\nelse count=count1+count;\n }\n printf(\"%d\",count);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "62b490a9a952aa19cf183ab3402d51c0", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0} {"lang": "GNU C11", "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 slot =\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b006d250a46653a283384d7d48cadba4", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c29861e6c55ced20216a992f0aaedada", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "280f89de941ade9d9170dd6576902de8", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n\n#define N 101\n\nint set1[100000000]={0};\nint set2[100000000]={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", "lang_cluster": "C", "compilation_error": false, "code_uid": "6b297ec6824d6185951c0e3b36898499", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "GNU C", "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 d+=2;\n }\n else\n {\n d=2*a;\n }\n }\n\n printf(\"%I64d\\n\",d);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "95ba0cfc5411589516348771415f20bc", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "693bea654f9d3928c532279a34d666c1", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "15effb9449dc49f3a19de923a2b45468", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n%2==0)\n ans = n/2;\n else\n ans=(n-1)/2;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dcb7db480f2dff5e65c3158543339335", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "\t#include\n\t#include\n\tint main()\n\t{\n \t\tlong long int n,i;\n\t\tcin >> n;\n\t\ti= n%2 ? n/2+1 : n/2;\n\t\tcout << i;\n\t\treturn 0;\n\t}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e4f5bf0a491d46e1bc706a8c030eac28", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "32030e13503f37dcc9bbca9b627d8601", "src_uid": "30e95770f12c631ce498a2b20c2931c7", "difficulty": 1100.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "012ba5dbcf1af3b280b8efcb7952f3e7", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0} {"lang": "GNU C", "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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "ccca0b4317cdf68f77239e7c80686518", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#pragma warning(disable:4996)\nusing namespace std;\nint main()\n{\n\tint a, b, c, i, j, k;\n\tchar s[10];\n\tint m[6][6];\n\tint flag;\n\tmapmp;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0744af3dba83e3ac47da880d4b265060", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nint main() {\n\tint test;\n\tchar inp[11];\n\tint check=0;\n\tscanf (\"%d\\n\", &test );\n\tgets(inp);\n\tfor (int x=0;x=2)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9538e049651469d83a4746358cf5a650", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\ntypedef unsigned long long int u_int;\n\nint main(void){\n u_int a,b;\n u_int i,j;\n u_int an;\n u_int counta=0,countb=0;\n scanf(\"%llu %llu\",&a,&b);\n if(a>b){\n an=a%b;\n do{\n counta+=an;\n countb+=a-an;\n an=(an+a)%b;\n }while(an!=0);\n counta+=b;\n countb+=a-b;\n if(counta>countb) puts(\"Dasha\");\n else if(counta==countb) puts(\"Equal\");\n else puts(\"Masha\");\n }else{\n b+=a;\n a=b-a;\n b-=a;\n an=a%b;\n do{\n counta+=an;\n countb+=a-an;\n an=(an+a)%b;\n }while(an!=0);\n counta+=b;\n countb+=a-b;\n if(counta>countb) puts(\"Masha\");\n else if(counta==countb) puts(\"Equal\");\n else puts(\"Dasha\");\n }\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "633542eb30febdabc5c0ef971033eb04", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint lcm(int a,int b)\n{\n\tint i=1;\n\twhile(!(i%a==0 && i%b==0))\n\t\ti++;\n\treturn i;\n}\nint main()\n{\n\tint a,b,max,min;\n\tscanf(\"%d%d\",&a,&b);\n\tmax=(a>b)?a:b;\n\tmin=(a>b)?b:a;\n\tint l=lcm(a,b);\n\tif(fabs(l/min-l/max)>1)\n\t{\n\t\tif(a\n\n#define ull long long \n\n\nvoid swap(ull int* a,ull int* b)\n{\n\t*a=*a+*b;\n\t*b=*a-*b;\n\t*a=*a-*b;\n}\n\null int find_lcm(ull int big,ull int small)\n{\n\tull int i=0;\n\tif(big\n\nint main()\n{\n int a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tint d, m;\n\td = m = 0;\n\tint nd, nm;\n\tnd = a;\n\tnm = b;\n\twhile( nd != nm)\n\t{\n\t if(ndm)\n\t printf(\"Dasha\\n\");\n\telse\n\t printf(\"Masha\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d6ee0fd46cc29d8e891148efa613fabd", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint a[13];\n\tfor(i=2;i<11;i++)\n\t\ta[i]=4;\n\tfor(i=)\n\tscanf(\"\")\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d39d883293faeea0c664e4602874a79b", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n unsigned long long int n,a,b,a1,b1,area,requ,q,flag=0,x,y;\n scanf(\"%lld %lld %lld\",&n,&a,&b);\n q=a;\n area=a*b;\n requ=(6*n);\n if(area>=requ)\n {\n printf(\"%lld\\n\",area);\n printf(\"%lld %lld\",a,b);\n\n }\n else\n {\n if((requ%a)==0)\n {\n a1=a;\n b1=(requ/a);\n x=b1;\n y=a1;\n }\n else if(requ%b==0)\n {\n b1=b;\n a1=requ/b;\n x=b1;y=a1;\n }\n else\n {\n\n\n while(1)\n {\n a++;\n if((requ%a)==0)\n {\n a1=a;\n b1=requ/a;\n if(b1b1)\n {\n y=a1;\n x=b1;\n }\n if(a1=requ)\n break;\n }\n\n\n\n\n\n }\n\n\n\n\n\n }\n\n\n\n\n\n\n printf(\"%lld\\n\",(x*y));\n printf(\"%lld %lld\",y,x);\n\n\n\n }\n return 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0b4f8e6b5e6bd9141a977dbdf359c1f4", "src_uid": "6a2a584d36008151d18e5080aea5029c", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n unsigned long long int n,a,b,a1,b1,area,requ,flag=0,x,y;\n scanf(\"%lld %lld %lld\",&n,&a,&b);\n x=a;\n y=b;\n area=a*b;\n\n requ=(6*n);\n if(area>=requ)\n {\n printf(\"%lld\\n\",area);\n printf(\"%lld %lld\",a,b);\n\n }\n else\n {\n if((requ%x)==0)\n {\n a1=x;\n b1=(requ/x);\n }\n else if((requ%y)==0)\n {\n b1=y;\n a1=requ/y;\n }\n else\n {\n\n\n while(1)\n {\n x++;\n\n if((requ/x)\n#include\n#include\n//||\n//\\n\nint main()\n{long long int a,b,c,d,e,f,p,q,r,s,sum=0,sum1=0,min=1000000001*1000000001;\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n\n if(b*c>=(a*6))\n {\n printf(\"%lld\\n\",b*c);\n printf(\"%lld %lld\",b,c);\n return 0;\n }\n\n\n p=b;\n q=c;\nif(p%6!=0)\n p=p+6-(p%6);\n\n while(1)\n { if(p*q>=(a*6))\n break;\n q=q+1;\n\n }\n if(p*q<=min)\n {\n min=p*q;\n e=p;\n f=q;\n }\n\n\n p=b;\n q=c;\n if(q%6!=0)\n q=q+6-(q%6);\n while(1)\n { if(p*q>=(a*6))\n break;\n p=p+1;\n\n }\n if(p*q<=min)\n {\n min=p*q;\n e=p;\n f=q;\n }\n\n\n p=b;\n q=c;\n if(p%2!=0)\n p=p+2-(p%2);\nif(q%3!=0)\n q=q+3-(q%3);\n while(1)\n {\n if(p*q>=(a*6))\n break;\n q=q+3;\n }\n if(p*q<=min)\n {\n min=p*q;\n e=p;\n f=q;\n }\n p=b;\n q=c;\n if(p%3!=0)\n p=p+3-(p%3);\n if(q%2!=0)\n q=q+2-(q%2);\n while(1)\n {\n if(p*q>=(a*6))\n break;\n q=q+2;\n }\n if(p*q<=min)\n {\n min=p*q;\n e=p;\n f=q;\n }\n p=b;\n q=c;\n if(p%3!=0)\n p=p+3-(p%3);\nif(q%2!=0)\n q=q+2-(q%2);\n while(1)\n {\n if(p*q>=(a*6))\n break;\n p=p+3;\n }\n if(p*q<=min)\n {\n min=p*q;\n e=p;\n f=q;\n }\n p=b;\n q=c;\n if(p%2!=0)\n p=p+2-(p%2);\nif(q%3!=0)\n q=q+3-(q%3);\n while(1)\n {\n if(p*q>=(a*6))\n break;\n p=p+2;\n }\n if(p*q<=min)\n {\n min=p*q;\n e=p;\n f=q;\n }\n printf(\"%lld\\n\",min);\n printf(\"%lld %lld\",e,f);\n return 0;}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9bf60bfd56837a230aa4a32c175412e5", "src_uid": "6a2a584d36008151d18e5080aea5029c", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n\nint main()\n{\n long long n, a, b, s, tmps, tmpa, tmpb, tmp;\n scanf(\"%I64d %I64d %I64d\", &n, &a, &b);\n s = 1000000000000;\n if (a > b)\n {\n tmp = a; a = b; b = tmp;\n }\n tmpb = b; tmpa = a;\n if (a*b < 6 * n)\n {\n while (tmpa <= sqrt(float(6.0*n))+1)\n {\n tmpb = ceil(6.0*n / tmpa);\n tmps = tmpa*tmpb;\n if (tmps < s&& tmps >=6*n)\n {\n s = tmps;\n a = tmpa;\n b = tmpb;\n }\n tmpa++;\n }\n }\n else s = a*b;\n printf(\"%I64d\\n%I64d %I64d\", s, a, b);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "427fad2a47e1f6b638ef1e199f11caa2", "src_uid": "6a2a584d36008151d18e5080aea5029c", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n long long n,a,b,temp;\n scanf(\"%I64d%I64d%I64d\",&n,&a,&b);\n long long area=6*n,raiz,area1=1000000000000000000;\n if(area<=a*b) printf(\"%I64d\\n%I64d %I64d\\n\",a*b,a,b);\n else{\n int ind=0;\n if(a>b) temp=a, a=b, b=temp, ind=1;\n raiz=(long long)sqrt(6*n);\n long long i,j,ans1,ans2;\n for(i=1;i<=raiz+1;i++){\n if(i>=a){\n j=(6*n+i-1)/i;\n j=max(j,b);\n if(i*j>=6*n && area1 > i*j ){\n area1=i*j;\n ans1=i;\n ans2=j;\n }\n }\n }\n if(ind)\n printf(\"%I64d\\n%I64d %I64d\\n\",area1,ans2,ans1);\n else\n printf(\"%I64d\\n%I64d %I64d\\n\",area1,ans1,ans2);\n }\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0a307cac6fa9427ca90787d04152fd35", "src_uid": "6a2a584d36008151d18e5080aea5029c", "difficulty": 2000.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1e9a1d6d744a72038944dc6361d09b0", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \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#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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "39a5b44408405051778b70da6fa252d6", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "difficulty": 1200.0} {"lang": "GNU C11", "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=1e10+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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c166bc941bae0d0a972ab3382628a65b", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\r\nusing 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\n__int64 a[18258], res[18258];\n\nint main()\n{\n a[0] = 1;\n res[0] = 1;\n for(int i = 1; i < 18258; ++ i)\n {\n a[i] = 2 * a[i - 1];\n res[i] = a[i] * 6 + res[i - 1];\n }\n int n;\n while(~scanf(\"%d\", &n))\n printf(\"%I64d\\n\", res[n - 1]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f344c29362626afb025195ba44c835a", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(){\n\tlong int n;\n\tcin >> n ;\n\tcout << (12 * n * (n-1) + 2)/2 << endl;\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6c24a3647e8e546c1a7677d406cc8e65", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint iIn1,iIn2,iIn3,iIn4;\nint main()\n{\n cin>>iIn1>>iIn2>>iIn3>>iIn4;\n cout<<(((iIn1^iIn2)&(iIn3|iIn4))^((iIn2&iIn3)|(iIn1^iIn4)));\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c68390f3921d2be7d504e2fa8abf0a22", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "main()\n{\nint n;\nscanf(\"%d\",&n);\nprintf(\"%d\",6*n*(n\u22121)+1);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "68a1d9eff578380c14f452794edf8efc", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main(void){\n int iIn1,iIn2,iIn3,iIn4;\n scanf(\"%d %d %d %d\",&iIn1,&iIn2,&iIn3,&iIn4);\n printf(\"%d\", ((iIn\n 1^iIn2) & (iIn3 | iIn4\n )) ^ ((iIn2&iIn3) | (iIn1^iIn4)));\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "636ca6d1c96bf8616a1461e6bde75bfb", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n#define INF (1LL << 60)\n\nstruct point\n{\n int x;\n int y;\n};\n\nstruct point p[4][2];\nint q[4];\ndouble g[4];\n\nint check(struct point p1, struct point p2)\n{\n if (p1.x == p2.x && p1.y == p2.y)\n {\n return 1;\n }\n return 0;\n}\n\nvoid solve()\n{\n int i, j, k, t, f;\n for (i = 0; i < 4; i ++)\n {\n if (check(p[i][0], p[i][1]))\n {\n printf(\"NO\\n\");\n return;\n }\n k = t = 0;\n for (j = 0; j < 4; j ++)\n {\n f = 0;\n if (j == i)\n {\n continue;\n }\n if (check(p[i][0], p[j][0]))\n {\n k ++;\n f = 1;\n }\n if (check(p[i][0], p[j][1]))\n {\n k ++;\n f = 1;\n }\n if (k > 1)\n {\n printf(\"NO\\n\");\n return;\n }\n if (check(p[i][1], p[j][0]))\n {\n t ++;\n f = 1;\n }\n if (check(p[i][1], p[j][1]))\n {\n t ++;\n f = 1;\n }\n if (t > 1)\n {\n printf(\"NO\\n\");\n return;\n }\n if (f == 0)\n {\n q[i] = j;\n }\n }\n if (k != 1 || t != 1)\n {\n printf(\"NO\\n\");\n return;\n }\n if (p[i][0].x == p[i][1].x)\n {\n g[i] = INF;\n }\n else\n {\n g[i] = (double)(p[i][1].y - p[i][0].y) / (p[i][1].x - p[i][0].x);\n }\n }\n for (i = 1; i < 4; i ++)\n {\n if (g[i] != g[0])\n {\n break;\n }\n }\n if (i == 4)\n {\n printf(\"NO\\n\");\n return;\n }\n for (i = 0; i < 4; i ++)\n {\n if (g[i] != g[q[i]])\n {\n printf(\"NO\\n\");\n return;\n }\n }\n printf(\"YES\\n\");\n}\n\nint main()\n{\n int i;\n for (i = 0; i < 4; i ++)\n {\n scanf(\"%d%d%d%d\", &p[i][0].x, &p[i][0].y, &p[i][1].x, &p[i][1].y);\n }\n solve();\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1f13ea2a6075f6fbb46f3efcb14b3526", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\n#define INF (1LL << 60)\n#define EPS (1e-7)\n\nstruct point\n{\n int x;\n int y;\n};\n\nstruct point p[4][2];\nint q[4];\ndouble g[4];\n\nint check(struct point p1, struct point p2)\n{\n if (p1.x == p2.x && p1.y == p2.y)\n {\n return 1;\n }\n return 0;\n}\n\nint judge(double value)\n{\n if (value > -1.0)\n {\n if (value + 1.0 < EPS)\n {\n return 1;\n }\n return 0;\n }\n if (-1.0 - value < EPS)\n {\n return 1;\n }\n return 0;\n}\n\nvoid solve()\n{\n int i, j, k, t, f;\n for (i = 0; i < 4; i ++)\n {\n if (check(p[i][0], p[i][1]))\n {\n printf(\"NO\\n\");\n return;\n }\n k = t = 0;\n for (j = 0; j < 4; j ++)\n {\n f = 0;\n if (j == i)\n {\n continue;\n }\n if (check(p[i][0], p[j][0]))\n {\n k ++;\n f = 1;\n }\n if (check(p[i][0], p[j][1]))\n {\n k ++;\n f = 1;\n }\n if (k > 1)\n {\n printf(\"NO\\n\");\n return;\n }\n if (check(p[i][1], p[j][0]))\n {\n t ++;\n f = 1;\n }\n if (check(p[i][1], p[j][1]))\n {\n t ++;\n f = 1;\n }\n if (t > 1)\n {\n printf(\"NO\\n\");\n return;\n }\n if (f == 0)\n {\n q[i] = j;\n }\n }\n if (k != 1 || t != 1)\n {\n printf(\"NO\\n\");\n return;\n }\n if (p[i][0].x == p[i][1].x)\n {\n g[i] = INF;\n }\n else\n {\n g[i] = (double)(p[i][1].y - p[i][0].y) / (p[i][1].x - p[i][0].x);\n }\n }\n for (i = 1; i < 4; i ++)\n {\n if (g[i] != g[0])\n {\n break;\n }\n }\n if (i == 4)\n {\n printf(\"NO\\n\");\n return;\n }\n for (i = 0; i < 4; i ++)\n {\n if (g[i] != g[q[i]])\n {\n printf(\"NO\\n\");\n return;\n }\n for (j = i + 1; j < 4; j ++)\n {\n if (j != q[i])\n {\n if (g[i] == INF)\n {\n if (g[j] != 0)\n {\n printf(\"NO\\n\");\n return;\n }\n }\n else if (g[i] == 0)\n {\n if (g[j] != INF)\n {\n printf(\"NO\\n\");\n return;\n }\n }\n else\n {\n if (g[j] == INF || judge(g[i] * g[j]) == 0)\n {\n printf(\"NO\\n\");\n return;\n }\n }\n }\n }\n }\n printf(\"YES\\n\");\n}\n\nint main()\n{\n int i;\n for (i = 0; i < 4; i ++)\n {\n scanf(\"%d%d%d%d\", &p[i][0].x, &p[i][0].y, &p[i][1].x, &p[i][1].y);\n }\n solve();\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d7f09097d3fe47e54efac0cb63115e94", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint x[8],y[8];\n\nint main() {\n\tint i,j;\n\tfor (i=0;i<8;i++) scanf(\"%d %d\\n\",&x[i],&y[i]);\n\tfor (i=0;i<8;i++) {\n\t\tif (i&1)\n\t\t\tif ((x[i]==x[i-1])==(y[i]==y[i-1]))\n\t\t\t\tbreak;\n\t\tint c=0;\n\t\tfor (j=0;j<8;j++) if (x[j]==x[i]&&y[j]==y[i]) c++;\n\t\tif (c!=2) break;\n\t\tc=0;\n\t\tfor (j=0;j<8;j++) if (x[j]==x[i]) c++;\n\t\tif (c!=4) break;\n\t}\n\tprintf(\"%s\\n\",i<8?\"NO\":\"YES\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b0e4f4f8c0825b25f8daef8f3a3de4cd", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int a,i,j,k;\n long long temp[4][4];\n long long tmp;\n long long verticalLines[4][4];\n long long horizontalLines[4][4];\n long long test1,test2;\n int flag=0;\n int verticalfound=0;\n int horizontalfound=0;\n\n for(i=0; i<4; i++)\n {\n for(j=0; j<4; j++)\n {\n scanf(\"%lld\",&temp[i][j]);\n }\n }\n\n //CHECKING VERTICAL AND HORIZONTAL LINES\n j=0;\n k=0;\n for(i=0; i<4 && !flag; i++)\n {\n if(temp[i][0]==temp[i][2] && temp[i][1]!=temp[i][3]) //VERTICAL LINE\n {\n for(a=0;a<4;a++)\n {\n verticalLines[j][a]=temp[i][a];\n }\n\n if(verticalLines[j][1]>verticalLines[j][3])\n {\n tmp=verticalLines[j][1];\n verticalLines[j][1]=verticalLines[j][3];\n verticalLines[j][3]=tmp;\n }\n\n j++;\n\n if(j==1)\n {\n if(verticalLines[0][0]==verticalLines[1][0])\n {\n flag=1;\n }\n }\n \n if(j>2)\n {\n flag=1;\n }\n\n }\n else if(temp[i][1]==temp[i][3] && temp[i][0]!=temp[i][2]) //HORIZONTAL LINE\n {\n for(a=0;a<4;a++)\n {\n horizontalLines[k][a]=temp[i][a];\n }\n\n if(horizontalLines[k][0]>horizontalLines[k][2])\n {\n tmp=horizontalLines[k][0];\n horizontalLines[k][0]=horizontalLines[k][2];\n horizontalLines[k][2]=tmp;\n }\n \n if(k==1)\n {\n if(horizontalLines[0][1]==horizontalLines[1][1])\n {\n flag=1;\n }\n }\n\n k++;\n if(k>2)\n {\n flag=1;\n }\n }\n else\n {\n flag=1;\n }\n }\n\n\n if(flag==1)\n {\n printf(\"NO\");\n return 0;\n }\n\n //CHECKING INTERSECTION\n //VERTICAL LINES\n if( (verticalLines[0][1]==verticalLines[1][1]) && (verticalLines[0][3]==verticalLines[1][3]))\n {\n verticalfound=1;\n }\n\n //HORIZONRAL LINES\n if(horizontalLines[0][0]==horizontalLines[1][0] && horizontalLines[0][2]==horizontalLines[1][2])\n {\n horizontalfound=1;\n }\n\n if ( !(verticalfound==1 && horizontalfound==1) )\n {\n printf(\"NO\");\n return 0;\n }\n \n //POSITIVE AREA\n if(!((verticalLines[0][0]>0 || verticalLines[1][0]>0) && (horizontalLines[0][1]>0 || horizontalLines[1][1]>0)))\n {\n printf(\"NO\");\n\n }\n else\n {\n printf(\"YES\");\n }\n\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5bc037e0e4aea12a3e26b2497655fdb8", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \nint lenght(long long x,long long y,long long x1,long long y1){\n long long k;\n k=pow((x1-x),2)+pow((y1-y),2);\n return sqrt(k);\n}\nint main()\n{\n int i,j,flag=1;\n long long A[4][4];\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n scanf(\"%lli\",&A[i][j]);\n if(A[i][j]<0) {\n flag=0;\n }\n }\n }\n if(flag==1){\n for(i=0;i<4&&flag;i++){\n if((A[i][0]!=A[i][2])&&(A[i][1]!=A[i][3])){\n flag=0;\n }\n }\n }\n int tmp[4];\n int c=0,u;\n if(flag==1){\n for(i=0;i<4&&flag;i++){\n int f=1;\n for(u=0;u\nint main()\n{\n int n,h,m,i,j,num,ans=0;\n scanf(\"%d%d%d\",&n,&h,&m);\n int l[n],r[n],x[n],a[n];\n for(i=0; i=l[j] && i<=r[j])\n num=x[j];\n }\n ans=ans+(num*num);\n }\n printf(\"%d\\n\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b76b77af0be7d09e9a6dab1ed0eb6024", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "//https://codeforces.com/problemset/problem/1162/A\n/*\n\u041e\u043f\u044f\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\n\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\n1 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\n\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\n256 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\n\u0432\u0432\u043e\u0434\n\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u0432\u043e\u0434\n\u0432\u044b\u0432\u043e\u0434\n\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\n\n\u0412\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043c\u0430 \u043d\u0430 \u0443\u043b\u0438\u0446\u0435. \u041d\u0430 \u0443\u043b\u0438\u0446\u0435 \u0435\u0441\u0442\u044c n\n\u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043c\u0430. \u042d\u0442\u0438 \u043c\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u044b \u0441\u043b\u0435\u0432\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u043e \u043e\u0442 1 \u0434\u043e n. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043c \u0441 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0441\u043e\u0442\u043e\u0439 \u043e\u0442 0 \u0434\u043e h\n\n.\n\n\u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0435\u0441\u043b\u0438 \u0434\u043e\u043c \u0438\u043c\u0435\u0435\u0442 \u0432\u044b\u0441\u043e\u0442\u0443 a\n, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0442 \u043d\u0435\u0433\u043e \u043f\u0440\u0438\u0431\u044b\u043b\u044c \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 a2\n\n\u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432.\n\n\u0413\u043e\u0440\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 m\n\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439. \u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 i-\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c, \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043e\u043c \u043e\u0442 li \u0434\u043e ri (\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e) \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 xi\n\n.\n\n\u0412\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043c\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043f\u0440\u0438\u0431\u044b\u043b\u044c. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043f\u0440\u0438\u0431\u044b\u043b\u044c.\n\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\n\u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0440\u0438 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 n\n, h \u0438 m (1\u2264n,h,m\u226450\n\n) \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0441\u0442, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439.\n\n\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 m\n\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0440\u0438 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 li, ri \u0438 xi (1\u2264li\u2264ri\u2264n, 0\u2264xi\u2264h) \u2014 \u043b\u0435\u0432\u0430\u044f \u0438 \u043f\u0440\u0430\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 (\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e) i\n\n-\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f \u0432\u044b\u0441\u043e\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u043c \u043e\u0442\u0440\u0435\u0437\u043a\u0435.\n\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\n\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043f\u0440\u0438\u0431\u044b\u043b\u044c.\n\u041f\u0440\u0438\u043c\u0435\u0440\u044b\n\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n\n3 3 3\n1 1 1\n2 2 3\n3 3 2\n\n\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n\n14\n\n\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n\n4 10 2\n2 3 8\n3 4 7\n\n\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435\n\u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n\n262\n\n\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435\n\n\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c 3\n\u0434\u043e\u043c\u0430, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0441\u043e\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 3, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c 3 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043e\u043c \u043c\u0435\u0436\u0434\u0443 1 \u0438 1 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 1. \u0412\u0442\u043e\u0440\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043e\u043c \u043c\u0435\u0436\u0434\u0443 2 \u0438 2 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 3. \u0422\u0440\u0435\u0442\u044c\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043e\u043c \u043c\u0435\u0436\u0434\u0443 3 \u0438 3 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 2\n\n.\n\n\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043c\u0430 \u0432\u044b\u0441\u043e\u0442\u043e\u0439 [1,3,2]\n. \u042d\u0442\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041e\u0431\u0449\u0430\u044f \u043f\u0440\u0438\u0431\u044b\u043b\u044c \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 12+32+22=14\n\n.\n\n\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c 4\n\u0434\u043e\u043c\u0430, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0441\u043e\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 10, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c 2 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043e\u043c \u043e\u0442 2 \u0434\u043e 3 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 8. \u0412\u0442\u043e\u0440\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043e\u043c \u043e\u0442 3 \u0434\u043e 4 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 7\n\n.\n\n\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043c\u0430 \u0432\u044b\u0441\u043e\u0442\u043e\u0439 [10,8,7,7]\n. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0438\u0431\u044b\u043b\u044c \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 102+82+72+72=262. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u043e\u043c 3, \u0438 \u043e\u0431\u0430 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0445\u043e\u0442\u044f \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u044f\u0432\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0434\u043e\u043c 1, \u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 10 (h=10).\n*/\n#include \n#include \nconst int MAX = 51;\n\nint max (int a, int b){ if (a>b) return a; else return b;}\nint min (int a, int b){ if (a\nint main()\n{\n int n,h,m,i,j,ans=0;\n scanf(\"%d%d%d\",&n,&h,&m);\n int l[n],r[n],x[n],a[n];\n for(i=0; i=l[j] && i<=r[j])\n {\n if(num>x[j])\n num=x[j];\n }\n }\n ans=ans+(num*num);\n }\n printf(\"%d\\n\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2306a6f740677acdd9ed0e0bd6cbd3fb", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint m,n,h;\n\tint l[30],r[30],h1[30];\n\tscanf(\"%d%d%d\",&n,&h,&m);\n\tfor (int i = 1; i <= m; ++i)\n\t{\n\t\tscanf(\"%d%d%d\",&l[i],&r[i],&h1[i]);\n\t}\n\tint p[30];\n\tfor (int i = 1; i <=n ; ++i)\n\t{\n\t\tp[i]=h*h;\n\t}\n\tfor (int i = 1; i <= m; ++i)\n\t{\n\t\tfor (int j = l[i]; j <= r[i]; ++j)\n\t\t{\n\t\t\tp[j]=h1[i]*h1[i];\n\t\t\t//printf(\"%d:-%d\\t\",p[j],j);\n\t\t}\n\t}\n\t//printf(\"\\n\");\n\tint t=0;\n\tfor (int i = 1; i <= n; ++i)\n\t{\n\t\tt=t+p[i];\n\t}\n\tprintf(\"%d\\n\",t);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7c0948e78399e003c186bcf0952dfb1a", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,h,m,i,maxprof=0,j,b,c;\n scanf(\"%d%d%d\",&n,&h,&m);\n int a[n];\n int l[m],r[m],x[m];\n for(i=0;i\n#include \n#define mian main\n#define MAXN 103\n#define INF 0x3f3f3f3f\n#define MIN(a,b) ((a)<(b)?(a):(b))\nint read () {\n int x = 0; char ch = getchar();\n while (ch < '0' || ch > '9') ch = getchar();\n while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}\\\n return x;\n}\nint vis[MAXN], a[MAXN], b[MAXN], len;\nint mian (void) {\n int n = read(), m = read();\n int i, l[2];\n l[0] = read();\n for (i = 1; i < m; ++i) {\n l[i % 2] = read();\n int t = (l[i%2] - l[(i+1)%2] + n) % n;\n if (t == 0) t = n;\n if ((vis[t] || a[l[(i+1)%2]]) && a[l[(i+1)%2]] != t) {\n printf(\"-1\\n\");\n return 0;\n }\n vis[t] = 1;\n a[l[(i+1)%2]] = t;\n }\n for (i = 1; i <= n; ++i) {\n if (!vis[i]) b[len++] = i, vis[i] = 1;\n }\n for (i = 1; i <= n; ++i) {\n if (a[i] == 0)\n a[i] = b[--len];\n printf(\"%d \", a[i]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8fe0ded3158d8999a8438c17a32be9ad", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint seq[101], num[101], included[101];\n\nint main(void)\n{\n\tint a, b, n, m, f = 0;\n\tscanf(\"%d %d\", &n, &m);\n\tfor (a = 1; a <= m; a = a + 1)\n\t{\n\t\tint cmp;\n\t\tscanf(\"%d\", &seq[a]);\n\t\tif (a - 1)\n\t\t{\n\t\t\tcmp = seq[a] - seq[a - 1];\n\t\t\tif (cmp > 0)\n\t\t\t{\n\t\t\t\tif (included[cmp] && num[seq[a - 1]] == 0 || (num[seq[a - 1]] && num[seq[a - 1]] != cmp))\n\t\t\t\t{\n\t\t\t\t\tputs(\"-1\");\n\t\t\t\t\tf = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tincluded[cmp] = 1;\n\t\t\t\tnum[seq[a - 1]] = cmp;\n\t\t\t}\n\t\t\telse if (cmp <= 0)\n\t\t\t{\n\t\t\t\tcmp = n + cmp;\n\t\t\t\tif ((included[cmp] && num[seq[a - 1]] == 0) || (num[seq[a-1]] && num[seq[a-1]] != cmp))\n\t\t\t\t{\n\t\t\t\t\tputs(\"-1\");\n\t\t\t\t\tf = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tincluded[cmp] = 1;\n\t\t\t\tnum[seq[a - 1]] = cmp;\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tfor (a = 1; a <= n; a = a + 1)\n\t{\n\t\tif (num[a] == 0)\n\t\t{\n\t\t\tfor (b = 1; b <= n; b = b + 1)\n\t\t\t{\n\t\t\t\tif (!included[b])\n\t\t\t\t{\n\t\t\t\t\tnum[a] = b;\n\t\t\t\t\tincluded[b] = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (num[a] == 0)\n\t\t\t{\n\t\t\t\tf = 1;\n\t\t\t\tputs(\"-1\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (f == 0)\n\t{\n\t\tfor (a = 1; a <= n; a = a + 1)\n\t\t\tprintf(\"%d \", num[a]);\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "eecf9a979e11ecdb2104b827f98a41fa", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\"stdio.h\"\n#include\"string.h\"\n#include\"math.h\"\n#include\"stdlib.h\"\n#include\"ctype.h\"\n#include\"limits.h\"\n#include\"time.h\"\n\nint main()\n{\n\tclock_t lnh=clock();\n\tint n,m,x=1,c;\n\tscanf(\"%d%d\",&n,&m);\n\tint a[100]={0},d[100]={0},ac[100]={0},i,j,l[m];\n\tfor(i=0;i=l[i+1]);\n\t\td[c-1]=1;\n\t\tif(a[l[i]-1]!=c && a[l[i]-1])\n\t\tx=0;\n\t\telse\n\t\ta[l[i]-1]=c;\n\t}\n\t\n\tfor(i=j=0;i1)\n\tx=0;\n\tif(!x)\n\tprintf(\"-1\");\n\telse\n\t{\n\t\tfor(i=0;i\nint ans[104],indx[104],vec[104],y[104];\nint main()\n{\n\tint n,m,l[103],i,flag=0,k=0,count=0,p=0,temp;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=0;i\n#include \n#include \n#define min(a,b) (a < b ? a : b)\ntypedef long long ll;\nll n, m, a[100000], l[200], vis[200], vist[200];\n\nbool solve(){\n\tll i, j;\n\tfor(i = 1; i < m; i++){\n\t\tif(l[i + 1] > l[i]){\n\t\t\tif(a[l[i]] && a[l[i]] != l[i + 1] - l[i]) return false;\n\t\t\ta[l[i]] = l[i + 1] - l[i];\n\t\t}\n\t\telse if(l[i + 1] == l[i]){\n\t\t\tif(a[l[i]] && a[l[i]] != n) return false;\n\t\t\ta[l[i]] = n;\n\t\t\t\n\t\t\tfor(j = 1; j <= n; j++)\tif(a[j]) vis[a[j]] = 1;\n\t\t\tfor(j = 1; j <= n; j++){\n\t\t\t\tif(!a[j]){\n\t\t\t\t\tfor(ll k = 1; k <= n; k++){\n\t\t\t\t\t\tif(!vis[k]){\n\t\t\t\t\t\t\ta[j] = k;\n\t\t\t\t\t\t\tvis[k] = 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} \n\t\t\t}// 1 2 3 4 5 \n\t\t\tbreak;\n\t\t}\n\t\telse{\n\t\t\tif(a[l[i]] && a[l[i]] != n - l[i] + l[i + 1]) return false;\n\t\t\ta[l[i]] = n - l[i] + l[i + 1];\n\t\t\t//vist[a[l[i]]] = l[i];\n\t\t}\n\t}\n\t\n\t//check:\n\tfor(i = 1; i <= n; i++) if(!a[i]) return false;\n\tfor(i = 1; i <= n; i++) \n\t\tfor(j = 1; j <= n; j++) if(i != j && a[j] == a[i]) return false;\n\tfor(i = 1;)\n\treturn true;\n}\n\nint main(void){\n\tll i, j, k;\n\tscanf(\"%lld%lld\", &n, &m);\n\tfor(i = 1; i <= m ; i++) scanf(\"%lld\", l + i);\n\tif (solve()) for(i = 1; i <= n; i++) printf(\"%lld \", a[i]);\n\telse puts(\"-1\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "98232a4ab88a34b86ae6ff7646e205a3", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint n,k,i;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;i<=n%k;i++)\n printf(\"%d \",n/k);\nfor(;i\nint main()\n{\n\tint n, m, i;\n\tscanf(\"%d%d\", &n, &m);\n\tif (n%m==0) \n {\n for (i = 0; i < m; i++) \n {\n printf(\"%d \", n/m);\n }\n\telse\n\t{\n\t\tfor (i = 0; i < n%m; i++)\n {\n printf(\"%d \", n/m+1);\n }\n\t\tfor (i = 0; i < (m-(n%m)); i++) \n { \n printf(\"%d \", n/m);\n }\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "afbc5d4d4e40cf75799571009667a90d", "src_uid": "0b2c1650979a9931e00ffe32a70e3c23", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n do{\n if(n%m==0){printf(\"%d \",n/m);continue;}\n else{\n printf(\"%d \",n/m);\n n=n-n/m;\n m--;\n }\n }while(m)\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b3eeb0441bae2c90f6d6a27464a75728", "src_uid": "0b2c1650979a9931e00ffe32a70e3c23", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nint n,k,i;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;i<=n/k;i++)\n printf(\"%d \",n/k);\nfor(i=0;i\nint main(){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n do{\n if(n%m==0){printf(\"%d \",n/m);continue;}\n else{\n printf(\"%d \",n/m);\n n=n-n/m;\n m--;\n }\n }while(m);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d05edc5da183f464c257b187d69091ac", "src_uid": "0b2c1650979a9931e00ffe32a70e3c23", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\nchar h[10],p[10],d[10],c;\nint m=0,n=0,i=0,k=0,j=0,l=0,t=0,q=0,w=0,e=0,r=0,a=0,b=0;\n\n\tif (q!=1)\n\t{printf(\"1\");\nwhile((c=getchar())!='\\n')\n{h[i]=c;\nn++;\n}}\n\tif (w!=1)\n\t{printf(\"2\");\nwhile((c=getchar())!='\\n')\n{p[k]=c;\nm++;\n}}\nif (e!=1)\n{printf(\"3\");\nwhile((c=getchar())!='\\n')\n{d[j]=c;\nl++;\n}}\n\n\nif (((n==8)&&(m==5)&&(l==5))||((n==5)&&(m==4)&&(l==4))||((n==4)&&(m==8)&&(l==8)))\nprintf(\"F\"); \nelse if (((n==5)&&(m==8)&&(l==5))||((n==4)&&(m==5)&&(l==4))||((n==8)&&(m==4)&&(l==8)))\nprintf(\"M\");\nelse if (((n==5)&&(m==5)&&(l==8))||((n==4)&&(m==4)&&(l==5))||((n==8)&&(m==8)&&(l==4)))\nprintf(\"S\"); \nelse if (((n==5)&&(m==8)&&(l==8))||((n==4)&&(m==5)&&(l==5))||((n==8)&&(m==4)&&(l==4)))\nprintf(\"?\");\nelse if (((n==8)&&(m==5)&&(l==8))||((n==5)&&(m==4)&&(l==5))||((n==4)&&(m==8)&&(l==4)))\nprintf(\"?\");\nelse if (((n==8)&&(m==8)&&(l==5))||((n==5)&&(m==5)&&(l==4))||((n==4)&&(m==4)&&(l==8)))\nprintf(\"?\");\nelse printf(\"?\");\n\n/*\n{\n\tif (q==1)\n\t{ a=m; b=l;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\n\tprintf(\"M\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (w==1)\n\t{ a=n; b=l;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (e==1)\n\t{ a=n; b=m;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"M\");t=1;}}\n}\n}\n}\n*/\n/*\nwhile (t!= 1)\n{\n\tif (q!=1)\n\t{printf(\"1\");\nn=getchar();\n}\n\tif (w!=1)\n\t{printf(\"2\");\nm=getchar();\n\t}\nif (e!=1)\n{printf(\"3\");\nl=getchar();}\n\nif (r!=1)\n{\nif (((n=='s')&&(m=='p')&&(l=='p'))||((n=='s')&&(m=='r')&&(l=='r'))&&((n=='r')&&(m=='r')&&(l=='s')))\n{\n\tprintf(\"F\"); t=1;}\nelse if (((n=='p')&&(m=='s')&&(l=='p'))||((n=='r')&&(m=='p')&&(l=='r'))&&((n=='s')&&(m=='r')&&(l=='s')))\n{printf(\"M\"); t=1;}\nelse if (((n=='p')&&(m=='p')&&(l=='s'))||((n=='r')&&(m=='r')&&(l=='p'))&&((n=='s')&&(m=='s')&&(l=='r')))\n{printf(\"S\"); t=1;}\nelse if (((n=='p')&&(m=='s')&&(l=='s'))||((n=='r')&&(m=='p')&&(l=='p'))||((n=='s')&&(m=='r')&&(l=='r')))\n{q=1;\nr=1;}\nelse if (((n=='s')&&(m=='p')&&(l=='s'))||((n=='p')&&(m=='r')&&(l=='p'))||((n=='r')&&(m=='s')&&(l=='r')))\n{w=1;\nr=1;}\nelse if (((n=='s')&&(m=='s')&&(l=='p'))||((n=='p')&&(m=='p')&&(l=='r'))||((n=='r')&&(m=='r')&&(l=='s')))\n{e=1;\nr=1;}\n}\nelse\n{\n\tif (q==1)\n\t{ a=m; b=l;\nif (((a=='s')&&(b=='p'))||((a=='p')&&(b=='r'))&&((a=='r')&&(b=='s')))\n{\n\tprintf(\"M\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (w==1)\n\t{ a=n; b=l;\nif (((a=='s')&&(b=='p'))||((a=='p')&&(b=='r'))&&((a=='r')&&(b=='s')))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (e==1)\n\t{ a=n; b=m;\nif (((a=='s')&&(b=='p'))||((a=='p')&&(b=='r'))&&((a=='r')&&(b=='s')))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"M\");t=1;}}\n}\n}\n}\n\n*/\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b7898d762d45395bfe883535cb4054e", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \nmain()\n{\nchar h[10],p[10],d[10],z[8]=\"scissors\",x[5]=\"paper\",c[4]=\"rock\";\nint m=0,n=0,i=0,k=0,j=0,l=0,t=0,q=0,w=0,e=0,r=0,a=0,b=0,g=1;\nscanf(\"%s\", h);\nn = strlen(h);\n\nscanf(\"%s\", p);\nm = strlen(p);\n\nscanf(\"%s\", d);\nl = strlen(d);\n/*\n\tif (q!=1)\n\t{printf(\"1\");\nwhile((c=getchar())!='\\n')\n{h[i]=c;\nn++;\n}}\n\tif (w!=1)\n\t{printf(\"2\");\nwhile((c=getchar())!='\\n')\n{p[k]=c;\nm++;\n}}\nif (e!=1)\n{printf(\"3\");\nwhile((c=getchar())!='\\n')\n{d[j]=c;\nl++;\n}}*/\n/*\nif (h[0]=='s')\n{\nfor(i=0;i\nmain()\n{\nchar h[10],p[10],d[10],c;\nint m=0,n=0,i=0,k=0,j=0,l=0,t=0,q=0,w=0,e=0,r=0,a=0,b=0;\n\n\tif (q!=1)\n\t{printf(\"1\");\nwhile((c=getchar())!='\\n')\n{h[i]=c;\nn++;\n}}\n\tif (w!=1)\n\t{printf(\"2\");\nwhile((c=getchar())!='\\n')\n{p[k]=c;\nm++;\n}}\nif (e!=1)\n{printf(\"3\");\nwhile((c=getchar())!='\\n')\n{d[j]=c;\nl++;\n}}\n\n\nif (((n==8)&&(m==5)&&(l==5))||((n==5)&&(m==4)&&(l==4))&&((n==4)&&(m==8)&&(l==8)))\nprintf(\"F\"); \nelse if (((n==5)&&(m==8)&&(l==5))||((n==4)&&(m==5)&&(l==4))&&((n==8)&&(m==4)&&(l==8)))\nprintf(\"M\");\nelse if (((n==5)&&(m==5)&&(l==8))||((n==4)&&(m==4)&&(l==5))&&((n==8)&&(m==8)&&(l==4)))\nprintf(\"S\"); \nelse if (((n==5)&&(m==8)&&(l==8))||((n==4)&&(m==5)&&(l==5))||((n==8)&&(m==4)&&(l==4)))\nprintf(\"?\");\nelse if (((n==8)&&(m==5)&&(l==8))||((n==5)&&(m==4)&&(l==5))||((n==4)&&(m==8)&&(l==4)))\nprintf(\"?\");\nelse if (((n==8)&&(m==8)&&(l==5))||((n==5)&&(m==5)&&(l==4))||((n==4)&&(m==4)&&(l==8)))\nprintf(\"?\");\n\n/*\n{\n\tif (q==1)\n\t{ a=m; b=l;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\n\tprintf(\"M\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (w==1)\n\t{ a=n; b=l;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (e==1)\n\t{ a=n; b=m;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"M\");t=1;}}\n}\n}\n}\n*/\n/*\nwhile (t!= 1)\n{\n\tif (q!=1)\n\t{printf(\"1\");\nn=getchar();\n}\n\tif (w!=1)\n\t{printf(\"2\");\nm=getchar();\n\t}\nif (e!=1)\n{printf(\"3\");\nl=getchar();}\n\nif (r!=1)\n{\nif (((n=='s')&&(m=='p')&&(l=='p'))||((n=='s')&&(m=='r')&&(l=='r'))&&((n=='r')&&(m=='r')&&(l=='s')))\n{\n\tprintf(\"F\"); t=1;}\nelse if (((n=='p')&&(m=='s')&&(l=='p'))||((n=='r')&&(m=='p')&&(l=='r'))&&((n=='s')&&(m=='r')&&(l=='s')))\n{printf(\"M\"); t=1;}\nelse if (((n=='p')&&(m=='p')&&(l=='s'))||((n=='r')&&(m=='r')&&(l=='p'))&&((n=='s')&&(m=='s')&&(l=='r')))\n{printf(\"S\"); t=1;}\nelse if (((n=='p')&&(m=='s')&&(l=='s'))||((n=='r')&&(m=='p')&&(l=='p'))||((n=='s')&&(m=='r')&&(l=='r')))\n{q=1;\nr=1;}\nelse if (((n=='s')&&(m=='p')&&(l=='s'))||((n=='p')&&(m=='r')&&(l=='p'))||((n=='r')&&(m=='s')&&(l=='r')))\n{w=1;\nr=1;}\nelse if (((n=='s')&&(m=='s')&&(l=='p'))||((n=='p')&&(m=='p')&&(l=='r'))||((n=='r')&&(m=='r')&&(l=='s')))\n{e=1;\nr=1;}\n}\nelse\n{\n\tif (q==1)\n\t{ a=m; b=l;\nif (((a=='s')&&(b=='p'))||((a=='p')&&(b=='r'))&&((a=='r')&&(b=='s')))\n{\n\tprintf(\"M\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (w==1)\n\t{ a=n; b=l;\nif (((a=='s')&&(b=='p'))||((a=='p')&&(b=='r'))&&((a=='r')&&(b=='s')))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (e==1)\n\t{ a=n; b=m;\nif (((a=='s')&&(b=='p'))||((a=='p')&&(b=='r'))&&((a=='r')&&(b=='s')))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"M\");t=1;}}\n}\n}\n}\n\n*/\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3b5cac05cf6615a2d0c29197aeb5432", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\nchar h[10],p[10],d[10],c;\nint i=0,k=0,j=0,n=0,m=0,l=0,t=0,q=0,w=0,e=0,r=0,a=0,b=0;\n\nwhile (t!= 1)\n{\n\tif (q!=1)\n\t{printf(\"1\");\nwhile((c=getchar())!='\\n')\n{h[i]=c;\nn++;\n}}\n\tif (w!=1)\n\t{printf(\"2\");\nwhile((c=getchar())!='\\n')\n{p[k]=c;\nm++;\n}}\nif (e!=1)\n{printf(\"3\");\nwhile((c=getchar())!='\\n')\n{d[j]=c;\nl++;\n}}\n\nif (r!=1)\n{\nif (((n==8)&&(m==5)&&(l==5))||((n==5)&&(m==4)&&(l==4))&&((n==4)&&(m==8)&&(l==8)))\n{\n\tprintf(\"F\"); t=1;}\nelse if (((n==5)&&(m==8)&&(l==5))||((n==4)&&(m==5)&&(l==4))&&((n==8)&&(m==4)&&(l==8)))\n{printf(\"M\"); t=1;}\nelse if (((n==5)&&(m==5)&&(l==8))||((n==4)&&(m==4)&&(l==5))&&((n==8)&&(m==8)&&(l==4)))\n{printf(\"S\"); t=1;}\nelse if (((n==5)&&(m==8)&&(l==8))||((n==4)&&(m==5)&&(l==5))||((n==8)&&(m==4)&&(l==4)))\n{q=1;\nr=1;}\nelse if (((n==8)&&(m==5)&&(l==8))||((n==5)&&(m==4)&&(l==5))||((n==4)&&(m==8)&&(l==4)))\n{w=1;\nr=1;}\nelse if (((n==8)&&(m==8)&&(l==5))||((n==5)&&(m==5)&&(l==4))||((n==4)&&(m==4)&&(l==8)))\n{e=1;\nr=1;}\n}\nelse\n{\n\tif (q==1)\n\t{ a=m; b=l;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\n\tprintf(\"M\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (w==1)\n\t{ a=n; b=l;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"S\"); t=1;}}\nelse if (e==1)\n\t{ a=n; b=m;\nif (((a==8)&&(b==5))||((a==5)&&(b==4))&&((a==4)&&(b==8)))\n{\nprintf(\"F\"); t=1;}\nelse {printf(\"M\");t=1;}}\n}\n}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "54d85c28913dfd0d6c060cc7cd0af881", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nchar F[10];\nchar M[10];\nchar S[10];\n\nint main(void)\n{\n scanf(\"%s\",F);\n scanf(\"%s\",F);\n scanf(\"%s\",F);\n \n int f,m,s;\n \n if(F[0]=='p')\n f=1;\n else if(F[0]=='r')\n f=2;\n else if(F[0]=='s')\n f=3;\n else\n f=4;\n \n \n if(M[0]=='p')\n m=1;\n else if(M[0]=='r')\n m=2;\n else if(M[0]=='s')\n m=3;\n else\n m=4;\n \n \n if(S[0]=='p')\n s=1;\n else if(S[0]=='r')\n s=2;\n else if(S[0]=='s')\n s=3;\n else\n s=4;\n \n \n if(f==1&&m==2&&s==2)\n printf(\"F\");\n else if(f==2&&m==3&&s==3)\n printf(\"F\");\n else if(f==3&&m==1&&s==1)\n printf(\"F\");\n else if(m==1&&f==2&&s==2)\n printf(\"M\");\n else if(m==2&&f==3&&s==3)\n printf(\"M\");\n else if(m==3&&f==1&&s==1)\n printf(\"M\");\n else if(s==1&&m==2&&f==2)\n printf(\"S\");\n else if(s==2&&m==3&&f==3)\n printf(\"S\");\n else if(s==3&&m==1&&f==1)\n printf(\"S\");\n else\n printf(\"?\");\n \n return 0;\n}\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2cd798185f192ac2f499d6e21821796c", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include\nint beu(int a)\n{\n int k=0,i,q;\n int b=a;\n while (a>0)\n {\n if (a%2==0) k++;\n else break;\n a/=2;\n }\n q=b/(pow(2,k));\n if (q==(pow(2,k+1)-1)) return 1;\n else return 0;\n}\nint main()\n{\n int n,i;\n scanf(\"%d\" ,&n);\n for (i=n;i>0;i++)\n {\n if (n%i==0 && beu(i)==1)\n {printf(\"%d\" ,i);\n break;}\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "11b5b8f7ab1b1126608dafecc8147545", "src_uid": "339246a1be81aefe19290de0d1aead84", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#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\treturn b;\n}\n\n\nint main()\n{\n\tint i,n,a[105],j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i\n#include\nint main()\n{\n long int n,k=0,i,c,d=0;\n scanf(\"%ld\",&n);\n while(1)\n {\n if(pow(2,k)>=n)\n {\n c=k;\n break;\n }\n k++;\n }\n for(i=c;i>=0;i--)\n {\n d=(pow(2,i)-1)*pow(2,i-1);\n if(n%d==0)\n {\n break;\n }\n }\n printf(\"%ld\",d);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c9e871f2f86fc8d93380d62ae1d29056", "src_uid": "339246a1be81aefe19290de0d1aead84", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "\tint num, largenum,i;\n\tscanf(\"%d\",&num);\n\tfor(int i=1;i\n#include \n#include\nlong long uocdep(int n) {\n\tint beauty;\n\tif (n % 2 != 0) return 1;\n\tint chantren = floor(((log(n) + log(2))*1.0) / (2 * log(2)))+1;\n\tfor (int i = chantren; i >= 0; i--) {\n\t\tbeauty = (pow(2, i) - 1)*pow(2, i - 1);\n\t\tif (n%beauty == 0) return beauty;\n\t}\n}\nint main() {\n\tint n;\n\tscanf_s(\"%d\", &n);\n\tlong long dapan = uocdep(n);\n\tprintf(\"%I64d\", dapan);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "05f809fee21bc045b8910d415cefd961", "src_uid": "339246a1be81aefe19290de0d1aead84", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long k;\n scanf(\"%lld\",&k);\n char c[10]=\"s\";\n char s[15]=\"codeforces\";\n k=k-1;\n printf(\"%s\",s);\n while(k--)\n {\n printf(\"%c\",'s');\n }\n printf(\"\\n\");\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "14f1eb9ef1d5b2e7c287185e0b00dec9", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nint main()\n{\n long long k,a;\n int i,j,t=0;\n scanf(\"%llu\",&k);\n int q[10];\n char p[11]=\"codeforces\";\n int put=0;\n for(i=0;i<10;i++)\n {\n q[i]=1;\n }\n while(1)\n {\n a=1;\n for(i=0;i<10;i++)\n {\n a*=q[i];\n }\n if(a>=k)\n {\n break;\n }\n q[a]++;\n a++;\n }\n for(i=0;i<10;i++)\n {\n for(j=0;j\nint main(void)\n{\n\tunsigned long long k; //k\u7684\u4e2a\u6570\u662f2\u768416\u6b21\u65b9\n\tunsigned long long asn;\n\tscanf_s(\"%llu\", &k);\n\tchar s[10] = \"codeforces\";\n\tchar q[11]; // \u50a8\u5b58codeforces\u6bcf\u4e2a\u5b57\u7b26\u7684\u91cd\u590d\u6b21\u6570\n\t//\u6bcf\u4e2a\u5b57\u7b26\u81f3\u5c11\u8981\u91cd\u590d\u51fa\u73b0\u4e00\u6b21\n\tint ten = 0;\n\tfor (int i = 0; i < 10; i++)\n\t\tq[i] = 1; \n\twhile (1)\n\t{\n\t\tasn = 1;\n\t\tfor (int i = 0; i < 10; i++)\n\t\t\tasn = asn * q[i];\n\t\tif (asn >= k)\n\t\t\tbreak;\n\t\tif (ten == 10)\n\t\t\tten = 0;\n\t\tq[ten]++;\n\t\tten++;\n\t}\n\tfor (int i = 0; i < 10; i++)\n\t\tfor (int j = 0; j < q[i]; j++)\n\t\t\tprintf(\"%c\", s[i]);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "83aa697b55ea8ce5bc38f055239083a0", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n int a[10];\n for(int i=0;i<10;i++)\n a[i]=1;\n char substr[11]=\"codeforces\";\n int k=1;\n long long int p=0;\n while(k\n#include\n#include\n#include\n\nint main()\n{\n\tlong long int k,i,j,a,b,l,flag=0;\n\tscanf(\"%lld\",&k);\n\tchar arr[15] =\"codeforces\";\n\t// for(i=0;i<10;i++)\n\t// {\n\t// \tprintf(\"%c-%lld\\n\",arr[i],i);\n\t// }\n\ta=1,b=2;\n\twhile(1)\n\t{\n\t\tfor(i=0;i<=10;i++)\n\t\t{\n\t\t\tif(long long int(pow(b,i)*pow(a,10-i))>=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(flag==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\ta++;\n\t\tb++;\n\t}\n\tfor(j=1;j<=i;j++)\n\t{\n\t\tfor(l=1;l<=b;l++)\n\t\t{\n\t\t\tprintf(\"%c\",arr[j-1]);\n\t\t}\n\t}\n\tfor(j=i+1;j<=10;j++)\n\t{\n\t\tfor(l=1;l<=a;l++)\n\t\t{\n\t\t\tprintf(\"%c\",arr[j-1]);\n\t\t}\n\t}\n\tprintf(\"\\n\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1719f86f6c62610bf62862891728fd42", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#define mod 1000000007\ntypedef long long int ll;\nll expo(ll x,ll k)\n{\n\tll result=1;\n\twhile(k>0)\n\t{\n\t\tif(k%2==1)\n\t\t\tresult=result*x%mod;\n\t\tx=x*x%mod;\n\t\tk=k/2;\n\t}\n\treturn result;\n}\nint main()\n{\n\tlong long int x,k,ans;\n\tscanf(\"%lld%lld\",&x,&k);\n\tif(x==0)\n\t\treturn 0;\n\tx=x%mod;\n\tx=(2*x-1)%mod;\n\tk=expo(2,k);\n\tprintf(\"%lld\\n\",(x*k+1)%mod);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "15fade1a09fd1a63802bb9d4849d10fd", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MOD 1000000007\n\nlong long int modexp(long long int b, long long int e) {\n\tlong long int i = 1;\n\twhile (e != 0) {\n\t\tif (e&1) {\n\t\t\ti = (i*b) % MOD;\n\t\t}\n\t\te >>= 1;\n\t\tb = (b*b) % MOD;\n\t}\n\treturn i;\n}\n\nint main(void) {\n\tlong long int x, k;\n\tscanf(\"%lld%lld\", &x, &k);\n\tx %= MOD;\n\n\tlong long int exp = modexp(2, k);\n\tlong long int ans = (x * exp * 2) % MOD;\n\tans = (ans-exp+1) % MOD;\n\n\tif (ans < 0) {\n\t\tans += MOD;\n\t}\n\tprintf(\"%lld\\n\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "95774e1dcd5825ba6de37e96a18428d2", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MOD 1000000007\n\nlong long int modexp(long long int b, long long int e) {\n\tlong long int i = 1;\n\twhile (e != 0) {\n\t\tif (e&1) {\n\t\t\ti = (i*b) % MOD;\n\t\t}\n\t\te >>= 1;\n\t\tb = (b*b) % MOD;\n\t}\n\treturn i;\n}\n\nint main(void) {\n\tlong long int x, k;\n\tscanf(\"%lld%lld\", &x, &k);\n\tx %= MOD;\n\n\tif (x == 0) {\n\t\tprintf(\"%lld\\n\", x);\n\t}\n\n\tlong long int exp = modexp(2, k);\n\tlong long int ans = (x * exp * 2) % MOD;\n\tans = (ans-exp+1) % MOD;\n\n\tif (ans < 0) {\n\t\tans += MOD;\n\t}\n\tprintf(\"%lld\\n\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e7ba0093188554be79d3791b379b1107", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define ll long long\n#define MOD 1000000007\nll g_pow(ll k)\n{\n\tll x=2,e=1;\n\twhile(k)\n\t{\n\t\tif(k%2)\n\t\t{\n\t\t\te*=x;\n\t\t\te%=MOD;\n\t\t}\n\t\tk/=2;\n\t\tx*=x;\n\t\tx%=MOD;\n\t}\n\treturn e;\n}\nint main()\n{\n\tll x,k,res;\n\tscanf(\"%I64d%I64d\",&x,&k);\n\tx%=MOD;\n\tif(x==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tif(k==0)\n\t{\n\t\tres=2*x;\n\t\tif(res>MOD)\n\t\t\tres%=MOD;\n\t\tprintf(\"%I64d\",res);\n\t\treturn 0;\n\t}\n\tres=g_pow(k+1)*x-g_pow(k)+1+MOD;\n\tif(res>MOD)\n\t\tres%=MOD;\n\tprintf(\"%I64d\",res);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "072f64a28b9fdf907a7ea5a70421ebed", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define MOD 1000000007\nunsigned long long int power(unsigned long long int x, unsigned long long int y, long int p)\n{\n unsigned 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}\nint main()\n{\n unsigned long long int x,k,a,b,c,d;\n scanf(\"%llu %llu\",&x,&k);\n if(x==0)\n {\n printf(\"0\");\n }\n else\n {\n if(k==0)\n {\n printf(\"%llu\",2*x);\n }\n else\n {\n a=power(2,k+1,MOD);\n a=(a*(x%MOD))%MOD;\n d=power(2,k,MOD);\n d=(d-1)%MOD;\n printf(\"%llu\",a-d);\n }\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "facf307cc845679485d510ada8faae22", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0} {"lang": "GNU C", "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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a616122cca874316a340635de851f78", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b55c8ddbe0c7aa23add0b2fc94d3772f", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "7c3747d204f68e8aeea2af7507acf335", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\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&&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#include\nint main()\n{\n\tchar A[101];\n\tscanf(\"%s\",A);\n\tint len=strlen(A);\n\tint falg=0;\n\tfor(int i=0;i\n#include\n#include\nint main()\n{\n longi,flag=0;\n char s[100];\n scanf(\"%s\",s);\n if(strlen<3)\n printf(\"No\");\n else{\n for(i=0;i\n#include\n#include\nint main()\n{\n long i,flag=0;\n char s[100];\n scanf(\"%s\",s);\n for(i=0;i\nint main()\n{\n char s[100];\n int i,j,k=0;\n scanf(\"%s\",s);\n\n for(i=0; s[i]!='\\0'; i++)\n {\n for(j=i; j<3; j++)\n {\n if(s[i]!='.' && s[i+1]!='.' && s[i+2]!='.')\n {\n if(s[i]!=s[i+1] && s[i+1]!=s[i+2] && s[i+2]!=s[i])\n {\n k=1;\n }\n }\n }\n }\n\n if(k==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;", "lang_cluster": "C", "compilation_error": true, "code_uid": "b9f98593b300e1004447c1554106f8fd", "src_uid": "ba6ff507384570152118e2ab322dd11f", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main() {\n char str[101];\n scanf(\"%s\",&st);\n char *sa=strstr(st,\"ABC\"),*sb=strstr(st,\"ACB\"),*sc=strstr(st,\"BCA\"),*sd=strstr(st,\"BAC\"),*se=strstr(st,\"CAB\"),*sf=strstr(st,\"CBA\");\n if(sa!=NULL||sb!=NULL||sc!=NULL||sd!=NULL||se!=NULL||sf!=NULL)\n printf(\"Yes\");\n else\n printf(\"No\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2e8e4e4242658d6acf79e4cf08f4bc85", "src_uid": "ba6ff507384570152118e2ab322dd11f", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tint i,n,k,j=0;\n\tscanf(\"%d %d\",&n,&k);\n\tint n1=n;\n\tint a[n];\n\tfor(i=2;i<=sqrt(n);i++){\n\t\twhile(n%i==0){\n\t\t\ta[j]=i;\n\t\t//\tprintf(\"%d \",a[j]);\n\t\t\tn/=i;j++;\n\t\t}\n\t}\n\t\tif(n>1){\n\t\t\ta[j]=n;\n\t\t\t//printf(\"%d \",a[j]);\n\t\t\tn/=i;j++;\n\t\t}\n\t//printf(\"\\n%d\\n\",j);\n\tif(k>j){\n\t\tprintf(\"-1\\n\");return 0;\n\t}\n int prod=1;\n\tfor(i=0;i\n#include \n\nint *k_Factorization(int k,int n,int try);\nvoid swap(int* product,int try);\n\n\nint main(){\n\tlong int i,k,n;\n\tlong int *result;\n\tscanf(\"%d %d\",&n,&k);\n\tif(k==2){\n\t\tprintf(\"%d %d\",2,n/2);\n\t\treturn 0;\n\t}\n\tresult=k_Factorization(k,n,0);\n\tif(result == NULL){\n\t\tprintf(\"%d\\n\",-1);\n\t\treturn 0;\n\t}\n\n\tfor(i=0;i1){n*=*product; swap(product,try); try--; p--; }\n\t\tif(try<=k && n<1){break;}\n\t\twhile(n%i==0){\n\t\t\t*p++=i;\n\t\t\tn/=i;\n\t\t\ttry++;\n\t\t}}\n\treturn NULL;\n\t\n\n\n}\n\nvoid swap(int* product,int try){\n\tlong int i,*p;\n\tp=product+1;\n\tfor(i=0;i\n#include \n\nint main()\n{\n int n,k,i=0,j,l,x,c=0;\n scanf(\"%d %d\",&n,&k);\n int a[k];\n x=a[0]=n;\n while(i\n#include\n#define T 100010\nint P[T];\nint siv();\nint main()\n{int a,b,c,i,k,n[100050],p=0;\n scanf(\"%d %d\",&a,&b);i=2;k=0;\n while(a>=1)\n {\n if(a%i==0)\n {\n a=a/i;k++;if(k==b){p++;if(a!=1)n[p]=a;else n[p]=i;if(p==b)break;}\n else\n {p++;n[p]=i;}\n }\n else i++;\n }\n if(p\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2ef62550b6c07a6f04cf166e55dbe042", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar input[10000000],real[100000],point[10000];\nint main()\n{\n int p,q,l,x,max,z,t,c,d,m;\n scanf(\"%s\",input);\n max=strlen(input);\n int i,j,k;\n z=0;\n c=0;\n t=0;\n d=0;\n l=0;\n for(i=0;i\n#include\nint main ()\n{\n int l,b,c,d,e,f,g,h,i,j;\n char a[200];\n gets(a);\n l=strlen(a);\n for(i=0;i=e)\n {\n if(h>e)\n {\n for(i=0;i\n#include \n#include \ntypedef signed char byte;\n#define REPEAT(token, num) for (token = 0; token < num; token++)\nstatic inline void POPQUEUE(void *arr, size_t length, size_t itemSize) { memmove(arr, arr+itemSize, length*itemSize); }\nstatic inline void REMOVEELEM(void *arr, size_t offset, size_t length, size_t itemSize) { memmove(arr+(offset*itemSize), arr+((offset+1)*itemSize), (length-offset)*itemSize); }\nstatic inline void REMOVEELEMS(void *arr, size_t offset, size_t numElems, size_t length, size_t itemSize) { memmove(arr+(offset*itemSize), arr+((offset+numElems)*itemSize), (length-offset)*itemSize); }\n//#define DEBUG\n#ifdef DEBUG\n#define PRINTF printf\n#else\n#define PRINTF(...)\n#endif\n\ntypedef long digit;\ntypedef long num_digits;\n\ndigit allDigits[200];\nnum_digits decimalPoint = 1, oldNumDigits, numDigits, numChars, power;\nchar string[200];\n\nint main() {\n num_digits i;\n char store;\n \n allDigits[0] = getchar()-'0', numDigits = 1;\n getchar(); //period\n while ((store = getchar()) != 'e') allDigits[numDigits++] = store-'0';\n scanf(\"%li\", &power);\n decimalPoint += power;\n oldNumDigits = numDigits;\n REPEAT(i, decimalPoint-oldNumDigits) allDigits[numDigits++] = 0;\n if (decimalPoint == numDigits) numChars = numDigits;\n else numChars = numDigits+1;\n REPEAT(i, numChars) {\n if (i == decimalPoint) putchar('.');\n else putchar(allDigits[i-(i > decimalPoint)]+'0');\n }\n putchar('\\n');\n \n exit(0);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d966fbaaaaeea456f68b76d48413db86", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#define L 10\n\nint main() {\n int a, b = 0;\n char db[L];\n int i;\n for (i = 0; i < L; i++) {\n db[i] = 'a';\n }\n while (~scanf(\"%d.%s\", &a, &db)) {\n char d[L];\n for (i = 0; i < L; i++) {\n d[i] = 'a';\n }\n int j = 0, k = 0, num_len = 0;\n while (db[j] != 'e') {\n d[k] = db[j];\n j++;\n k++;\n num_len++;\n }\n char b_temp[L];\n int b_len = 0;\n j++;\n while (db[j] != 'a') {\n b_temp[b_len] = db[j];\n b_len++;\n j++;\n }\n b_len -= 1;\n k = 1;\n for (i = b_len-1; i >= 0; i--) {\n b += (b_temp[i] - '0') * k;\n k *= 10;\n }\n if (d[0] == 0 && d[1] == 'a') {\n printf(\"%d\", a);\n for (i = 0; i < b; i++) {\n printf(\"0\");\n }\n printf(\"\\n\");\n }\n else {\n i = 0;\n j = 0;\n if (a == 0) {\n if (b == 0) {\n printf(\"%d\", a);\n }\n }\n else {\n printf(\"%d\", a);\n }\n k = 0;\n while (i < num_len && i < b) {\n printf(\"%c\", d[i]);\n i++;\n }\n if (i < num_len) {\n printf(\".\");\n while (i < num_len) {\n printf(\"%c\", d[i]);\n i++;\n }\n }\n else if (i < b) {\n while (i < b) {\n printf(\"0\");\n i++;\n }\n }\n printf(\"\\n\");\n }\n return 0;\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "84ed84685b4c6d777c12802b24b5b38e", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \ntypedef signed char byte;\n#define REPEAT(token, num) for (token = 0; token < num; token++)\n#define getchar getchar_unlocked\n#define putchar putchar_unlocked\nstatic inline void POPQUEUE(void *arr, size_t length, size_t itemSize) { memmove(arr, arr+itemSize, length*itemSize); }\nstatic inline void REMOVEELEM(void *arr, size_t offset, size_t length, size_t itemSize) { memmove(arr+(offset*itemSize), arr+((offset+1)*itemSize), (length-offset)*itemSize); }\nstatic inline void REMOVEELEMS(void *arr, size_t offset, size_t numElems, size_t length, size_t itemSize) { memmove(arr+(offset*itemSize), arr+((offset+numElems)*itemSize), (length-offset)*itemSize); }\n//#define DEBUG\n#ifdef DEBUG\n#define PRINTF printf\n#else\n#define PRINTF(...)\n#endif\n\ntypedef long digit;\ntypedef long num_digits;\n\ndigit allDigits[200];\nnum_digits decimalPoint = 1, oldNumDigits, numDigits, numChars, power;\nchar string[200];\n\nint main() {\n num_digits i;\n char store;\n \n allDigits[0] = getchar()-'0', numDigits = 1;\n getchar(); //period\n while ((store = getchar()) != 'e') allDigits[numDigits++] = store-'0';\n scanf(\"%li\", &power);\n decimalPoint += power;\n oldNumDigits = numDigits;\n REPEAT(i, decimalPoint-oldNumDigits) allDigits[numDigits++] = 0;\n if (decimalPoint == numDigits) numChars = numDigits;\n else numChars = numDigits+1;\n REPEAT(i, numChars) {\n if (i == decimalPoint) putchar('.');\n else putchar(allDigits[i-(i > decimalPoint)]+'0');\n }\n putchar('\\n');\n \n exit(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a14bd4f9ce7a1c3fdbfaaaea6820d7e0", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/contest/1204/submission/59190290 (Dukkha) */\n#include \n#include \n\n#define N 100\n\nint main() {\n\tstatic char s[N + 1];\n\tint n, i, zero;\n\t\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tzero = 1;\n\tfor (i = 1; i < n; i++)\n\t\tif (s[i] != '0') {\n\t\t\tzero = 0;\n\t\t\tbreak;\n\t\t}\n\tcnt = (n - 1) / 2 + 1;\n\tif (n % 2 != 0 && zero)\n\t\tcnt--;\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e6205a64d5d3445467e237b211fcb3cf", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int i=0,k=1,h,len,flag=0;\n char a[101],b;\n scanf(\"%s\",&a);\n while(a[i]!=NULL)\n {\n i++;\n }\n len = i\n for(k=0;k<=i;k++)\n {\n if((k!=0)&&(a[k]=='1'))\n { \n flag=1;\n break;\n }\n \n \n\n }\n if((i==1)&&a[0]=='1')\n len=0;\n if((i==1)&&a[0]=='0')\n len=0;\n if(flag==1)\n len++;\nprintf(\"%d\",len/2);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c2a136b62b8aa5d82e9dce5c4006879", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/contest/1204/submission/59190290 (Dukkha) */\n#include \n#include \n\n#define N 100\n\nint main() {\n\tstatic char s[N + 1];\n\tint n, i, zero;\n\t\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tzero = 1;\n\tfor (i = 1; i < n; i++)\n\t\tif (cc[i] != '0') {\n\t\t\tzero = 0;\n\t\t\tbreak;\n\t\t}\n\tcnt = (n - 1) / 2 + 1;\n\tif (n % 2 != 0 && zero)\n\t\tcnt--;\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "44e437c1375e205befacf95572c99e05", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "i,w;main(c){while(c=getchar(),~c)w|=c*(i++>0);printf(\"%d\"i/2-(~i&1&~w));}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cfeb8cb861fb8efac05ce9b22b848aa8", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\nint main(void)\n{\n char *binary = malloc(sizeof(char) * 200);\n scanf(\"%s\", binary);\n\n int lenb = strlen(binary);\n __int128 decimal = 0;\n for (int i = 0; i < lenb; i++)\n {\n decimal += (binary[i] - '0') * pow(2, (lenb-1) - i);\n }\n\n for (int i = 0; i < 50; i++)\n {\n if (decimal <= pow(4, i))\n {\n printf(\"%i\\n\", i);\n break;\n }\n }\n\n free(binary);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "77c8d0211046ff60c446ceb989877c07", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define max 20\n\nvoid sort(char[], int, int);\nvoid merge(char[], int, int, int);\n\nvoid swap(char[], int, int);\n\nint main()\n{\n\tchar a[max], b[max];\n\t\n\tscanf(\"%[^\\n]%*c%[^\\n]%*c\", a, b);\n\t\n\tint la = strlen(a), lb = strlen(b);\n\t\n\tsort(a, 0, la - 1);\n\t\n\tif(la < lb)\n\t{\n\t\tputs(a);\n\t\treturn 1;\n\t}\n\t\n\tint n = la;\n\tchar s[n + 1];\n\ts[n] = 0;\n\t\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tint j = i;\n\t\twhile(a[j] > b[i])\n\t\t\tj++;\n\t\t\n\t\tif(a[j] < b[i])\n\t\t{\n\t\t\tswap(a, i, j);\n\t\t\t\n\t\t\tsort(a, i + 1, n - 1);\n\t\t\tputs(a);\n\t\t\t\n\t\t\treturn 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(int k = 0; k < i; k++)\n\t\t\t\ts[k] = a[k];\n\t\t\t\n\t\t\ts[i] = a[j], s[j] = a[i];\n\t\t\t\n\t\t\tfor(int k = n - 1; k > i; k--)\n\t\t\t{\n\t\t\t\tif(k != j)\n\t\t\t\t\ts[(n - 1) - k + (i + 1)] = a[k];\n\t\t\t}\n\t\t\t\n\t\t\tif(strcmp(s, b) < 0)\n\t\t\t\tswap(a, i, j);\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile(a[j] == b[i])\n\t\t\t\t\tj++;\n\t\t\t\t\n\t\t\t\tswap(a, i, j);\n\t\t\t\t\n\t\t\t\tsort(a, i + 1, n - 1);\n\t\t\t\tputs(a);\n\t\t\t\t\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t}\n\t\tsort(a, i + 1, n - 1);\n\t}\n\t\n\tputs(a);\n}\n\nvoid swap(char a[], int i, int j)\n{\n\tint temp = a[i];\n\ta[i] = a[j];\n\ta[j] = temp;\n}\n\nvoid sort(char a[], int p, int r)\n{\n\tif(p < r)\n\t{\n\t\tint q = (p + r) / 2;\n\t\t\n\t\tsort(a, p, q);\n\t\tsort(a, q + 1, r);\n\t\t\n\t\tmerge(a, p, q, r);\n\t}\n}\n\nvoid merge(char a[], int p, int q, int r)\n{\n\tint l1 = q - p + 1, l2 = r - q;\n\tchar b[l1 + 1], c[l2 + 1];\n\t\n\tfor(int i = 0; i < l1; i++)\n\t\tb[i] = a[p + i];\n\tfor(int j = 0; j < l2; j++)\n\t\tc[j] = a[q + 1 + j];\n\t\t\n\tb[l1] = c[l2] = '0' - 1;\n\t\n\tint i = 0, j = 0;\n\t\n\tfor(int k = p; k <= r; k++)\n\t{\n\t\tif(b[i] > c[j])\n\t\t{\n\t\t\ta[k] = b[i];\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta[k] = c[j];\n\t\t\tj++;\n\t\t}\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0a64109310db6497ba5745e24622a14a", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "//Code by 27.\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include \n#include \n#include\n#include\nusing namespace std;\nconst unsigned long long BIGEST=1000000000000000000+1000000000000000000;\nconst long long BIGER=1000000000000000000;\nconst int BIG=1000000000;\nconst int MOD=19260817;\nbool f[20];\nstring st1,st2;\nstring mn=\"\";\nbool cmp(char &a,char &b)\n{\n\treturn a>b;\n}\nint ypa(int k,string st)\n{\n\t//cout<>st1>>st2;\n\tif(st1.size()\nunsigned __int64 ipow(unsigned long long int base, unsigned __int64 exp)\n{\n\tunsigned __int64 result = 1ULL;\n\twhile (exp)\n\t{\n\t\tif (exp & 1)\n\t\t{\n\t\t\tresult *= base;\n\t\t}\n\t\texp >>= 1;\n\t\tbase *= base;\n\t}\n\treturn result;\n}\nint main()\n{\n\tunsigned __int64 b = 0, a_length = 0, b_length = 0;\n\tchar temp;\n\tstatic unsigned __int64 freq[10];\n\twhile (scanf_s(\"%c\", &temp, 1))\n\t{\n\t\tif (temp == 10)\n\t\t\tbreak;\n\t\tfreq[temp - '0'] ++;\n\t\ta_length++;\n\t}\n\twhile (scanf_s(\"%c\", &temp, 1))\n\t{\n\t\tif (temp == 10)\n\t\t\tbreak;\n\t\tb += (unsigned __int64)(temp - '0') * ipow(10, b_length);\n\t\tb_length++;\n\t}\n\tif (b_length > a_length)\n\t\tb = ipow(10, a_length) - 1;\n\tint flag = 0;\n\tint flag2 = 0;\n\tunsigned __int64 num = 0;\n\tint first = -1;\n\tint second = -1;\n\tdo \n\t{\n\t\tflag2 = 0;\n\t\tif (first == -1)\n\t\t{\n\t\t\tfirst = b % 10;\n\t\t\tcontinue;\n\t\t}\n\t\telse if (second == -1)\n\t\t\tsecond = b % 10;\n\t\tfor (int i = 9; i >= 0; i--)\n\t\t{\n\t\t\tif ((flag == 1 || i <= first) && freq[i] > 0)\n\t\t\t{\n\t\t\t\tfreq[i] --;\n\t\t\t\tif (i < first)\n\t\t\t\t\tflag = 1;\n\t\t\t\tif (flag == 0)\n\t\t\t\t{\n\t\t\t\t\tfor (int p = 9; p >= 0; p--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (p <= second && freq[p] > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag2 = 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 (flag2 == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfreq[i] ++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfirst = second;\n\t\t\t\tsecond = -1;\n\t\t\t\tprintf(\"%i\", i);\n\t\t\t\tnum++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} while (b /= 10);\n\twhile (a_length - num > 0)\n\t{\n\t\tnum++;\n\t\tfor (int i = 9; i >= 0; i--)\n\t\t{\n\t\t\tif (freq[i] > 0)\n\t\t\t{\n\t\t\t\tfreq[i] --;\n\t\t\t\tprintf(\"%i\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "318a187fd6581bafb5641c93d7f2c460", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nusing namespace std;\n\nbool compare(size_t a, size_t b) { return a > b; }\n\nsize_t find_max_index(vector a, size_t v)\n{\n size_t i = 0, m = 0;\n\n for (size_t j = 0; j < a.size(); ++j) {\n if (a[j] <= v && a[j] > m) {\n i = j;\n m = a[j];\n }\n }\n\n return i;\n}\n\nint main()\n{\n vector a, b;\n\n char c = '0';\n while (cin.get(c) && c != '\\n') {\n a.push_back(c - '0');\n }\n while (cin.get(c) && c != '\\n') {\n b.push_back(c - '0');\n }\n\n vector::iterator it;\n for (it = a.begin(); it != a.end(); ++it) {\n cout << *it << \" \";\n }\n cout << endl;\n\n\n sort(a.begin(), a.end(), compare);\n\n cout << a.size() << b.size() << endl;\n if (b.size() > a.size()) {\n vector::iterator it;\n for (it = a.begin(); it != a.end(); ++it) {\n cout << *it;\n }\n cout << endl;\n } else if (b.size() == a.size()) {\n vector o;\n bool q = true;\n\n vector::iterator it;\n for (it = b.begin(); it != b.end(); ++it) {\n if (q && a.size()) {\n size_t i = find_max_index(a, *it);\n\n q = a[i] == *it;\n o.push_back(a[i]);\n a.erase(a.begin() + i);\n } else {\n o.insert(o.end(),a.begin(),a.end());\n break;\n }\n }\n\n for (it = o.begin(); it != o.end(); ++it) {\n cout << *it << \" \";\n }\n cout << endl;\n } else {\n cout << \"whaaaa\" << endl;\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4dbb711796842b27b3a817abff6e7bd8", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "\n#include \nunsigned __int64 ipow(int base, int exp)\n{\n\tunsigned __int64 result = 1ULL;\n\twhile (exp)\n\t{\n\t\tif (exp & 1)\n\t\t{\n\t\t\tresult *= (unsigned __int64)base;\n\t\t}\n\t\texp >>= 1;\n\t\tbase *= base;\n\t}\n\treturn result;\n}\nint main()\n{\n\tunsigned __int64 b = 0, a_length = 0, b_length = 0;\n\tchar temp;\n\tstatic unsigned __int64 freq[10];\n\twhile (scanf_s(\"%c\", &temp, 1))\n\t{\n\t\tif (temp == 10)\n\t\t\tbreak;\n\t\tfreq[temp - '0'] ++;\n\t\ta_length++;\n\t}\n\twhile (scanf_s(\"%c\", &temp, 1))\n\t{\n\t\tif (temp == 10)\n\t\t\tbreak;\n\t\tb += (unsigned __int64)(temp - '0') * ipow(10, b_length);\n\t\tb_length++;\n\t}\n\tif (b_length > a_length)\n\t\tb = ipow(10, a_length) - 1;\n\tint flag = 0;\n\tint num = 0;\n\tdo \n\t{\n\t\tnum++;\n\t\tfor (int i = 9; i >= 0; i--)\n\t\t{\n\t\t\tif ((flag == 1 || i <= b % 10) && freq[i] > 0)\n\t\t\t{\n\t\t\t\tif (i < b % 10)\n\t\t\t\t\tflag = 1;\n\t\t\t\tfreq[i] --;\n\t\t\t\tprintf(\"%i\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} while (b /= 10);\n\twhile (a_length - num > 0)\n\t{\n\t\tnum++;\n\t\tfor (int i = 9; i >= 0; i--)\n\t\t{\n\t\t\tif (freq[i] > 0)\n\t\t\t{\n\t\t\t\tfreq[i] --;\n\t\t\t\tprintf(\"%i\", i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0669b5cc4d0e864b9d1fd8f152513fd0", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,x,count=0,d;\n scanf(\"%d %d\",&n,&x);\n int a[n],i,j,temp,mid;\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}\nfor(i=0;i0)\n{\n x-count=d;\n if(d<0)\n d=-d;\n\nprintf(\"%d\",d);}\nelse\nprintf(\"0\");\nreturn 0;\n}\n\n\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "64e6e92b8fcf224fbcbce68a8af2adb2", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n int cnt=0;\n scanf(\"%d\",&n);\n int arr[n];\n int mex;\n scanf(\"%d\",&mex)\n for(int i=0; i=j)\n break;\n if(arr[i]!=j)\n cnt++;\n }\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "aa7d1a8418e7d48685fcd05e6145b424", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint mian()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tprintf(\"%d\\n\",a + b);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "9acd8da1cd5d947c6bf6a144632762ba", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint n, x, temp, i, count, flag;\n\tscanf(\"%d %d\", &n, &x)\n\tflag = count = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &temp);\n\t\tif (temp < x) count++;\n\t\tif (temp == x) flag = 1;\n\t}\n\tprintf(\"%d\\n\", flag ? x - count + 1 : x - count);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "41900513d38d4f57b220de0433cc8f03", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,x,count=0;\n scanf(\"%d %d\",&n,&x);\n int a[n],i,j,temp,mid;\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}\nfor(i=0;i0)\n{\n if(x-count<0)\n x-count=-(x-count);\n\nprintf(\"%d\",x-count);}\nelse\nprintf(\"0\");\nreturn 0;\n}\n\n\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "94101bfdea0ac447fc71ca52052545d9", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#define STR_MAX 5\n\nvoid leerCant(int *);\nvoid cargarDatos(const int, int *);\nchar* check(const int, int *);\n\nint main(void){\n int n;\n leerCant(&n);\n int vec[n];\n cargarDatos(n, vec);\n char * res=check(n, vec);\n printf(\"%s\", res);\n return 0;\n}\n\n\nvoid leerCant(int *n){\n scanf(\"%d\", n);\n return;\n}\n\n\nvoid cargarDatos(const int dim, int * v){\n int i;\n for (i=0;i\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\n\n\n\nint main()\n{\n int n,i,j;\n int a[10000];\n while(scanf(\"%d\",&n)==1)\n {\n for(i=0; i\nint main(void){\n int n, x, flag = 1;\n scanf(\"%d\", &n);\n if (n & 1 == 0) {\n flag = 0;\n }\n for (inti = 0; i < x; i++){\n scanf(\"%d\", &x);\n if ((i == 0 || i == x-1) && (x & 1 == 0)) {\n flag = 0;\n }\n }\n if (flag) {\n printf(\"Yes\\n\");\n } else {\n printf(\"No\\n\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "672f903f00fe85b2547036c7b60ee636", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n for (int i=0;i\nint shuzu[233];\nint mainz(){\n int n;\n scanf(\"%d\",&n);\n for(int i=0;i\nlong long int max,min,mid,ans,c[3];\n#define setmax c[0]>c[1]?(max=0,c[2]>c[max]?max=2:1):(max=1,c[2]>c[max]?max=2:1)\n#define setmin c[0]<=c[1]?(min=0,c[2]<=c[min]?min=2:1):(min=1,c[2]<=c[min]?min=2:1)\n#define setmid (max+min)==1?mid=2:(max+min)==2?mid=1:mid=0\n#define setall (setmax,setmin,setmid,1)\nint main()\n{\n scanf(\"%lld %lld %lld\",&c[0],&c[1],&c[2]); \n while(setall)\n {\n if((c[max]-2)>=0 && (c[mid]-1)>=0)\n {\n c[max]-=2;\n c[mid]-=1;\n ans++;\n }\n else if(c[0]==1 && c[1]==1 && c[2]==1)\n {\n ans++;\n break;\n }\n else break;\n } \n printf(\"%lld\\n\",ans);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "23c53ec55683ae65095494caca7b863c", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\nvoid min(int *a, int *b) {\n if(*a > *b) {\n int tmp = *a;\n *a = *b;\n *b = tmp;\n }\n}\n\nvoid min(int *a, int *b, int *c) {\n min(a, b);\n min(b, c);\n min(a, b);\n}\n\nint main() {\n int a,b,c;\n scanf(\"%d%d%d\", &a, &b, &c);\n min(&a, &b, &c);\n int done = a;\n b-=a;\n c-=a;\n if (b*2 <= c) {\n done += b;\n } else {\n done += c/2;\n }\n printf(\"%d\", done);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9811a9e3df856d31ec9f00daec511276", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nlong long int max,min,mid,ans,c[3];\n#define setmax() c[0]>c[1]?(max=0,c[2]>c[max]?max=2:1):(max=1,c[2]>c[max]?max=2:1)\n#define setmin() c[0]<=c[1]?(min=0,c[2]<=c[min]?min=2:1):(min=1,c[2]<=c[min]?min=2:1)\n#define setmid() (max+min)==1?mid=2:(max+min)==2?mid=1:mid=0\n#define setall() (setmax(),setmin(),setmid(),1)\nint main()\n{\n\tscanf(\"%lld %lld %lld\",&c[0],&c[1],&c[2]);\t\t\t\n\twhile(setall())\n\t{\n\t\tif((c[max]-2)>=0 && (c[mid]-1)>=0)\n\t\t{\n\t\t\tc[max]-=2;\n\t\t\tc[mid]-=1;\n\t\t\tans++;\n\t\t}\n\t\telse if(c[0]==1 && c[1]==1 && c[2]==1)\n\t\t{\n\t\t\tans++;\n\t\t\tbreak;\n\t\t}\n\t\telse break;\n\t}\t \t\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7ff3658e94d48281045cb93ba4771473", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nlong long int max,min,mid,ans,c[3],lol;\n#define setmax() c[0]>c[1]?(max=0,c[2]>c[max]?max=2:1):(max=1,c[2]>c[max]?max=2:1)\n#define setmin() c[0]<=c[1]?(min=0,c[2]<=c[min]?min=2:1):(min=1,c[2]<=c[min]?min=2:1)\n#define setmid() (max+min)==1?mid=2:(max+min)==2?mid=1:mid=0\n#define setall() (setmax(),setmin(),setmid())\nint main()\n{\n\tscanf(\"%lld %lld %lld\",&c[0],&c[1],&c[2]);\t\n\tlol=setall();\t\t\n\twhile(1)\n\t{\n\t\tif((c[max]-2)>=0 && (c[mid]-1)>=0)\n\t\t{\n\t\t\tc[max]-=2;\n\t\t\tc[mid]-=1;\n\t\t\tans++;\n\t\t\tlol=setall();\n\t\t}\n\t\telse if(c[0]==1 && c[1]==1 && c[2]==1)\n\t\t{\n\t\t\tans++;\n\t\t\tbreak;\n\t\t}\n\t\telse break;\n\t}\t \t\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6c61ff25972283d17be3c6bd68cd65ea", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\nint cases(int r, int g, int b);\n\nint main(){\n\n int r, g, b;\n\n scanf(\"%d %d %d\", &r, &g, &b);\n\n printf(\"%d\", cases(r, g, b));\n\n return 0;\n}\n\nint cases(int r, int g, int b){\n if(r==g && g==b)\n return r;\n if(r==g && g>b)\n {\n return (r+b+g)/3;\n }\n if(r==g && gg && g>b)\n {\n if(r>g+b)\n return g+b;\n return (r+g+b)/3\n }\n if(r>b && b>g)\n return cases(r, b, g);\n if(g>r && r>b)\n return cases(g, r, b);\n if(g>b && b>r)\n return cases(g, b, r);\n if(b>r && r>g)\n return cases(b, r, g);\n if(b>g && g>r)\n return cases(b, g, r);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c47e3d5492032560d96e3eb8c1a73ae0", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{long long int a,b,i,j,k=0,t,y;\nscanf(\"%I64d %I64d\",&a,&b);\nfor(i=a;i<=b;i++)\n{if((i-(i%10))==0)\n{k++;}\nelse\n{\nt=i%10;\nif(t!=0)\n{j=i;\nwhile(j/10!=0)\n{j=j/10;}\nif(t==j)\nk++;\n}}}printf(\"%I64d\",k);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eb9678ee528c51fbd5581e2b2f492ca6", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \nchar s[20], s1[20], s2[20];\nint judge()\n{\n if ( s[0] == s[strlen(s)-1] )\n return 1;\n else\n return 0;\n}\nvoid add_one()\n{\n int i, j;\n s[strlen(s)-1]++;\n if ( s[strlen(s)-1] < '9'+1 )\n ;\n else{\n i = strlen(s)-1;\n while ( i > 0 && s[i] == '9'+1 ){\n s[i] = '0';\n s[i-1]++;\n i--;\n }\n if ( i == 0 ){\n if ( s[i] == '9'+1 ){\n for ( j = strlen(s)-1; j >= 0; j-- )\n s[j+1] = s[j];\n s[1] = '0';\n s[0] = '1';\n }\n }\n }\n}\nint main()\n{ \n long long int num;\n while ( scanf(\"%s %s\", s1, s2) != EOF ){\n num = 0;\n strcpy(s, s1);\n while ( strcmp(s,s2) ){\n if ( judge() ) num++;\n add_one();\n }\n printf(\"%I64d\\n\", num);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "81c3048003043e5f8a1f86f0cb9baee3", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \"string.h\"\n#include \"stdio.h\"\n#include \"stdlib.h\"\nint main()\n{long long i,j,k,a,b,sum;\nchar c[18];\nwhile(scanf(\"%I64d%I64d\",&a,&b)!=-1)\n{sum=0;\nfor(i=a;i<=b;i++)\n{itoa((int)i,c,10);\nif(c[strlen(c)-1]==c[0])sum++;}\nprintf(\"%I64d\\n\",sum);\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3ca236a72689336291f0b1d39fce1407", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \"string.h\"\n#include \"stdio.h\"\n#include \"stdlib.h\"\nint main()\n{long int i,j,k,a,b,sum;\nchar c[18];\nwhile(scanf(\"%ld%ld\",&a,&b)!=-1)\n{sum=0;\nfor(i=a;i<=b;i++)\n{itoa((int)i,c,10);\nif(c[strlen(c)-1]==c[0])sum++;}\nprintf(\"%ld\\n\",sum);\n}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b8201f686de270fd00a0eea3f9b390f", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long long n,m,sum,sum1,sum11,sum2,sum21,s,n1,n12,n2,n3,m1,m12,m2,m3;\n int b,a,j,k,l;\n while(scanf(\"%I64d%I64d\",&n,&m)!=EOF)\n {\n n3=n;\n m3=m;\n b=0;\n a=1;\n sum=0;\n sum1=0;\n sum2=0;\n j=k=0;\n n2=n%10;\n while(n>0)\n {\n j++;\n n1=n%10;\n n=n/10; \n }\n n12=n1;\n if(n10)\n {\n k++;\n m1=m%10;\n m=m/10; \n }\n m12=m1;\n if(m1>m2)\n {\n m1--;\n b=1;\n }\n if(j==k)\n {\n if(j>=3)\n {\n s=10;\n for(l=0;lm1)\n sum=0;\n else\n sum=m1-n1+1;\n } \n }\n else\n {\n if((j==1)&&(k==2))\n {\n sum=10-n1+m1;\n }\n else \n {\n if((j==2)||(j==1&&k>=3))\n {\n sum1=10-n1;\n }\n else\n {\n s=10;\n for(l=0;l\n#include \nint main()\n{\n long long int w,m,k,ma,ha=1,total=0,temp;\n int i,j,t;\n scanf(\"%I64d%I64d%I64d\", &w,&m,&k);ma=m; w= w/k;\n for(i=0;ma;i++)ma /=10;\n ha=pow(10,i);\n while(1){\n temp = ha-m;\n if(w<=temp*i){printf(\"%I64d\", w/i+total);return 0;}\n total += ha-m;\n w-=(temp*i);\n m=ha;ha*=10;i++;\n }\n return 0;\n }", "lang_cluster": "C", "compilation_error": false, "code_uid": "a921b7085081524eec059ac73a9b2f48", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nlong long digit(long long r)\n{\n long long c=0;\n while(r)\n {\n c++;\n r/=10;\n }\n return c;\n}\n\nint main()\n{\n int j;\n\tlong long w,m,k,temp,val,p,d,s,i,x,ans;\n\twhile(scanf(\"%I64d%I64d%I64d\",&w,&m,&k)!=EOF)\n\t{\n\t\ti=digit(m); p=1;\n for(j=0;j=0)\n\t\t{\n\t\t\tans+=s; temp=w;\n\t\t\ts=p-m; m=p; p*=10;\n\t\t\tval=s*i*k;\n\t\t\tif(val<0)\n\t\t\tbreak; \n\t\t\tw-=val; i++;\n\t\t}\n\t\td=digit(m)-1; x=(temp)/(d*k); ans+=x;\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6d0d3187e04c659e3d032a36c6730629", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n long long n,m,k,i,j=0,s=0;\n scanf(\"%lld %lld %lld\",&n,&m,&k);\n n/=k;\n for(i=1;i<=m;i*=10)j++;//printf(\"%lld %lld %lld %lld\\n\",i,j,m,(i-m)*j*k);\n for(;(i-m)*j \n# include \nint main(){\n\tlong long int w,m,k,g,A[30],B[30],i,c,d,l=0;\n\tw=10;\n\tA[0]=0;\n\tB[0]=0;\n\tfor(i=1;i<19;i++){\n\t\tA[i]=w-1;\n\t\tB[i]=w;\n\t\tw*=10;\n\t}\n\tscanf(\"%I64d%I64d%I64d\",&w,&m,&k);\n\tc=w;\n\td=m;\n\tg=log10(m)+1;\n\twhile(c>0){\n\t\tif(((double)c/(double)g)/(double)k>=A[g]-m+1){ \n\t\t\tc=c-k*g*(A[g]-m+1);\n\t\t\tl=l+A[g]-m+1;\n\t\t\tm=B[g];\n\t\t\tg=log10(m)+1;\n\t\t}\n\t\telse{\n\t\t\tl=l+((double)c/(double)g)/(double)k;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",l);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ab2028bb552a53fd119ae3f4b9ac373", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include long long w, m, k, ten, ans;int main(){ int tx; scanf(\"%I64d%I64d%I64d\", &w, &m, &k); ten = 9; tx = 1; w /= k; while (ten < m){ ten = ten * 10 + 9; tx++; } if ((ten - m + 1) * tx > w){ printf(\"%I64d\\n\", w / tx); return 0; } w -= (ten - m + 1) * tx; ans = (ten - m + 1); ten++; tx++; while ((ten * 10 - ten) * tx <= w){ w -= (ten * 10 - ten) * tx; ans += (ten * 10 - ten); ten *= 10; tx++; } printf(\"%I64d\\n\", ans + w / tx); return 0;}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e63d039c1b33bc56e1bb6c01cfd0409a", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n//Written By GHATAK...\nint main()\n{\n int a[12];\n for(int i=0;i<12;i++)\n {\n a[i]=i+1;\n }\n char c[10];\n int b[14],q=0,z=0,t1,t2,t3;\n gets(c);\n for(int i=0;c[i]!='\\0';i++)\n {\n if((c[i]=='C')&&(c[i+1]=='#'))\n {\n b[q]=2;\n i++;\n q++;\n }\n if((c[i]=='C')&&(c[i+1]!='#'))\n {\n b[q]=1;\n q++;\n }\n if((c[i]=='D')&&(c[i+1]!='#'))\n {\n b[q]=3;\n q++;\n }\n if((c[i]=='D')&&(c[i+1]=='#'))\n {\n b[q]=4;\n i++;\n }\n if((c[i]=='E')&&(c[i+1]!='#'))\n {\n b[q]=5;\n q++;\n }\n if((c[i]=='F')&&(c[i+1]!='#'))\n {\n b[q]=6;\n q++;\n }\n if((c[i]=='F')&&(c[i+1]=='#'))\n {\n b[q]=7;\n q++;\n i++;\n }\n if((c[i]=='G')&&(c[i+1]!='#'))\n {\n b[q]=8;\n q++;\n }\n if((c[i]=='G')&&(c[i+1]=='#'))\n {\n b[q]=9;\n q++;\n i++;\n }\n if((c[i]=='A')&&(c[i+1]!='#'))\n {\n b[q]=10;\n q++;\n }\n if((c[i]=='B')&&(c[i+1]!='#'))\n {\n b[q]=11;\n q++;\n }\n if((c[i]=='H')&&(c[i+1]!='#'))\n {\n b[q]=12;\n q++;\n }\n }\n\n t1=b[0];\n t2=b[1];\n t3=b[2];\n int diff1,diff2;\n //t1,t2,t3\n diff1=telll(t1,t2);\n diff2=telll(t2,t3);\n z=display(diff1,diff2);\n if(z==1)\n {\n return 0;\n }\n //t1,t3,t2\n diff1=telll(t1,t3);\n diff2=telll(t3,t2);\n z=display(diff1,diff2);\n if(z==1)\n {\n return 0;\n }\n //t2,t1,t3\n diff1=telll(t2,t1);\n diff2=telll(t1,t3);\n z=display(diff1,diff2);\n if(z==1)\n {\n return 0;\n }\n //t2,t3,t1\n diff1=telll(t2,t3);\n diff2=telll(t3,t1);\n z=display(diff1,diff2);\n if(z==1)\n {\n return 0;\n }\n //t3,t2,t1\n diff1=telll(t3,t2);\n diff2=telll(t2,t1);\n z=display(diff1,diff2);\n if(z==1)\n {\n return 0;\n }\n //t3,t1,t2\n diff1=telll(t3,t1);\n diff2=telll(t1,t2);\n z=display(diff1,diff2);\n if(z==1)\n {\n return 0;\n }\n printf(\"strange\");\n return 0;\n\n}\nint display(int a,int b)\n{\n if((a==4)&&(b==3))\n {\n printf(\"major\");\n return 1;\n }\n if((a==3)&&(b==4))\n {\n printf(\"minor\");\n return 1;\n }\n return 0;\n}\nint telll(int a,int b)\n{\n int diff;\n if(a<=b)\n {\n diff=b-a;\n }\n else\n {\n diff=b-a+12;\n }\n return diff;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "459bc003ae194a1839b075c1792ef316", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define norm(X) (((X) + N) % N)\n#define N 12\ntypedef enum _triad { major, minor, strange } triad;\n\nint pos(char note[3])\n{\n static char sample[N][3] =\n {\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\"};\n int i = 0;\n while (strcmp(note, sample[i])) i++;\n return i;\n}\n\ntriad det(int a, int b, int c)\n{\n int d;\n if (b < a) { d = b; b = a; b = d; }\n if (c < a) { d = c; c = a; a = d; }\n if (c < b) { d = c; c = b; b = d; }\n if (norm(b - a) == 4 && norm(c - b) == 3 || // a, b, c\n norm(c - b) == 4 && norm(a - c) == 3 || // b, c, a\n norm(a - c) == 4 && norm(b - a) == 3) // c, a, b\n return major;\n else if (norm(b - a) == 3 && norm(c - b) == 4 || // a, b, c\n norm(c - b) == 3 && norm(a - c) == 4 || // b, c, a\n norm(a - c) == 3 && norm(b - a) == 4) // c, a, b\n return minor;\n else\n return strange;\n}\n\nchar *triad_str(triad t)\n{\n switch (t) {\n case major: return \"major\";\n case minor: return \"minor\";\n case strange: return \"strange\";\n default: return \"\";\n }\n}\n\nint main()\n{\n int a[3], t;\n char note[3];\n for (t = 0; t < 3; t++) {\n scanf(\"%s\", note);\n a[t] = pos(note);\n }\n printf(triad_str(det(a[0], a[1], a[2])));\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3cbfb2f1cacdc91718975d8f9d2d4b95", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main(){\n\tchar s[4];int a[3],p,q;\n\tfor(int i=0;i<3;i++){\n\t\tscanf(\"%s\",s);\n\t\tswitch(s[0]){\n\t\t\tcase 'C':a[i]=1;break;\n\t\t\tcase 'D':a[i]=3;break;\n\t\t\tcase 'E':a[i]=5;break;\n\t\t\tcase 'F':a[i]=6;break;\n\t\t\tcase 'G':a[i]=8;break;\n\t\t\tcase 'H':a[i]=10;break;\n\t\t\tcase 'A':a[i]=11;break;\n\t\t\tcase 'B':a[i]=12;break;\n\t\t}\n\t\tif(strlen(s)==2)a[i]++;\n\t}\n\tp=a[1]-a[0];\n\tq=a[2]-a[1];\n\tif(p<0)p+=12;\n\tif(q<0)q+=12;\n\tif(p==4&&q==3)\n\tprintf(\"major\");\n\telse if(p==3&&q==4)\n\tprintf(\"minor\");\n\telse\n\tprintf(\"strange\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "19b3d53e6deb134adbf0cd92ba1eb6ac", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n/* Written by Nishant Mittal aka nishantwrp */\nint chordtoindex(char *a) {\nif (*a == 'C') {\n a++;\n if (*a == '#') {\n return 2;\n } else {\n return 1;\n }\n}\nif (*a == 'D') {\n a++;\n if (*a == '#') {\n return 4;\n } else {\n return 3;\n }\n}\nif (*a == 'E') {\n return 5;\n}\nif (*a == 'F') {\n a++;\n if (*a == '#') {\n return 7;\n } else {\n return 6;\n }\n}\nif (*a == 'G') {\n a++;\n if (*a == '#') {\n return 9;\n } else {\n return 8;\n }\n}\nif (*a == 'A') {\n return 10;\n}\nif (*a == 'B') {\n return 11;\n}\nif (*a == 'H') {\n return 12;\n}\nreturn 0;\n}\nint distancefind(int a,int b) {\nint count = 0;\nint i = b;\nwhile (i != a) {\n count++;\n if (i == 12) {\n i = 1;\n } else {\n i++;\n }\n}\nreturn count;\n}\nint main()\n{\nchar chord1[3],chord2[3],chord3[3];\nint pos1,pos2,pos3;\nint i=0;\nwhile(i<3) {\nchar tmp;\nscanf(\"%c\",&tmp);\nif (tmp == ' ') {\n break;\n}else {\nchord1[i] = tmp;\n}\ni++;\n}\nint j=0;\nwhile(j<3) {\nchar tmp;\nscanf(\"%c\",&tmp);\nif (tmp == ' ') {\n break;\n}else {\nchord2[j] = tmp;\n}\nj++;\n}\nint k=0;\nwhile(k<3) {\nchar tmp;\nscanf(\"%c\",&tmp);\nif (tmp == '\\n') {\n break;\n}else {\nchord3[k] = tmp;\n}\nk++;\n}\nint ansset = 0;\npos1 = chordtoindex(chord1);\npos2 = chordtoindex(chord2);\npos3 = chordtoindex(chord3);\n//Minor\nif (distancefind(pos2,pos1) == 3 && distancefind(pos3,pos2) == 4) {\n ansset = 1;\nprintf(\"minor\");\n}else if (distancefind(pos2,pos3) == 3 && distancefind(pos1,pos2) == 4) {\n ansset = 1;\nprintf(\"minor\");\n}else if (distancefind(pos1,pos2) == 3 && distancefind(pos3,pos1) == 4) {\n ansset = 1;\nprintf(\"minor\");\n}else if (distancefind(pos1,pos3) == 3 && distancefind(pos2,pos1) == 4) {\n ansset = 1;\nprintf(\"minor\");\n} else if (distancefind(pos3,pos1) == 3 && distancefind(pos2,pos3) == 4) {\n ansset = 1;\nprintf(\"minor\");\n} else if (distancefind(pos3,pos2) == 3 && distancefind(pos1,pos3) == 4) {\n ansset = 1;\nprintf(\"minor\");\n}//Major\nif (distancefind(pos2,pos1) == 4 && distancefind(pos3,pos2) == 3) {\n ansset = 1;\nprintf(\"major\");\n}else if (distancefind(pos2,pos3) == 4 && distancefind(pos1,pos2) == 3) {\n ansset = 1;\nprintf(\"major\");\n}else if (distancefind(pos1,pos2) == 4 && distancefind(pos3,pos1) == 3) {\n ansset = 1;\n\n}else if (distancefind(pos1,pos3) == 4 && distancefind(pos2,pos1) == 3) {\n ansset = 1;\nprintf(\"major\");\n}else if (distancefind(pos3,pos1) == 4 && distancefind(pos2,pos3) == 3) {\n ansset = 1;\nprintf(\"major\");\n}else if (distancefind(pos3,pos2) == 4 && distancefind(pos1,pos3) == 3) {\n ansset = 1;\nprintf(\"major\");\n}\nif (ansset != 1) {\n printf(\"strange\");\n}\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "90dcd42ba7f17aa0d100de4c751425f9", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nchar arr[15][4]={\"C\", \"C#\", \"D\",\"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\"};\nint main()\n{\nint pos1=0,pos2=0,pos3=0,i,arr2[4],q=0;\nchar arr1[5][5];\nfor(i=0;i<3;i++)\nscanf(\"%s\",arr1[i]);\nwhile(strcmp(arr1[0],arr[pos1]))\npos1++;\narr2[0]=pos1;\nwhile(strcmp(arr1[1],arr[pos2]))\npos2++;\narr2[1]=pos2;\nwhile(strcmp(arr1[2],arr[pos3]))\npos3++;\narr2[2]=pos3;\n//printf(\"%d\",pos3);\nfor(i=0;i<3;i++)\n{\nif(((arr2[i]+3)%12==arr2[(i+1)%3]&&(arr2[(i+1)%3]+4)%12==arr2[(i+2)%3])||((arr2[i]+3)%12==arr2[(i+2)%3]&&(arr2[i]+4)%12==arr2[(i+1)%3]))\n{\nq=1;\nprintf(\"minor\\n\");\n}\nelse if(((arr2[i]+4)%12==arr2[(i+1)%3]&&(arr2[(i+1)%3]+3)%12==arr2[(i+2)%3])||((arr2[i]+4)%12==arr2[(i+2)%3]&&(arr2[i]+3)%12==arr2[(i+1)%3]))\n{\n q=1;\n printf(\"major\\n\");\n}\n}\nif(q==0)\nprintf(\"strange\\n\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab536e4b90687ed4ed768cdb7b45afa0", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\n\nint main() {\n\t// your code goes here\n\tint n;\n\tcin>>n;\n\tint a[n];\n\tfor(int i=0;i>a[i];\n\t\t\n\t}\n int unique = 1;\n\n for (int out = 1; out < n && a[out]!=0; ++out)\n {\n \n \n int is_unique = 1;\n for (int inner = 0; is_unique && inner < out; ++inner)\n { \n \n if (a[inner] == a[out]) is_unique = 0;\n }\n if (is_unique) ++unique;\n }\n\tcout<\n\nint f[600];\nint main()\n{\n int n,i,cnt=0;\n scanf(\"%d\", &n);\n int a[n];\n for(i = 0 ; i< n; i++)\n scanf(\"%d\", &a[i]);\n for(i = 1 ; i <= n; i++)\n {\n\n if(f[a[i]] = 0 )\n f[a[i]] = 1;\n\n }\n for( i = 0 ; i < 600; i++)\n {\n if(f[i] == 1)\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a00e8888f4e3a00266ce8359b1582260", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0} {"lang": "GNU C", "source_code": "\n#include \n#include \n#include \n\nint deleteDuplicates(std::vector v, int n);\n\nint main()\n{\n int n = 0;\n std::scanf(\"%d\", &n);\n std::vector vec;\n for (int a = 0; a < n; a++)\n {\n int b = 0;\n std::scanf(\"%d\", &b);\n vec.push_back(b);\n }\n std::sort(vec.begin(), vec.end());\n int m = deleteDuplicates(vec, n);\n int l = vec[0] == 0 ? m - 1 : m;\n printf(\"%d\", l);\n}\n\nint deleteDuplicates(std::vector v, int n)\n{\n if (n==0 || n==1)\n return n;\n std::vector temp;\n int j = 0;\n for (int i=0; i\n/*#include\n#include*/\nusing namespace std;\nint z[1000];\nint main()\n{\n\tint n;\n\tfor(int i=0;i<1000;i++) z[i]=0;\n\tcin>>n;\n\tint t;\n\tint num=0;\n\tfor(int i=0;i>t;\n\t\tif(z[t]==0&&t!=0) z[t]=1,num++;\n\t}\n\tcout<\n\nint f[600];\nint main()\n{\n int n,i,cnt=0;\n scanf(\"%d\", &n);\n int a[n];\n for(i = 0 ; i< n; i++)\n scanf(\"%d\", &a[i]);\n for(i = 1 ; i <= n; i++)\n {\n\n if(f[a[i]] == 0 )\n f[a[i]] = 1;\n\n }\n for( i = 0 ; i < 600; i++)\n {\n if(f[i] == 1)\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b358636d6e3ef12d2f6fdc4d4116c8ab", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nlong long int maximo(long long int a, long 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}\n\nint main()\n{\n\tlong long int A,B,C,D;\n\tscanf(\"%lld %lld %lld %lld\", &A, &B, &C, &D);\n\t\n\tlong long int alfa,beta;\n\tlong long int total = 0;\n\tfor ( alfa = A; alfa <= B; ++alfa )\n\t{\n\t\tlong long int st = maximo(alfa+B, C+1);\n\t\tif ( alfa+C > D )\n\t\t{\n\t\t\tif ( st > D )\n\t\t\t{\n\t\t\t\t//printf(\"pase 1: alfa %lld st %lld \", alfa, st );\n\t\t\t\ttotal += (D-C+1)*(C-B+1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n //printf(\"pase 2: alfa %lld st %lld \", alfa, st );\n\t\t\t\ttotal += (D-C)*(D-C+1)/2 - (st-C)*(st-C-1)/2 + (D-C+1)*(alfa+C-D);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n //printf(\"pase 3: alfa %lld st %lld \", alfa, st );\n\t\t\ttotal += (alfa)*(alfa+1)/2 - (st-C)*(st-C-1)/2;\n\t\t}\n\t\t//printf(\"Parcial total: %lld\\n\", total);\n\t}\n\t\n\tprintf(\"%lld\\n\", total);\n\t\n\t//system(\"pause\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "98c8085b976d626a1ca010d2bd11e0a7", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n#define max(a,b) ((a>b)?(a):(b))\n\nlong long ways[1000006];\n\nint main() {\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tint tx = b - a, ty = c - b, lz = c - a - b, rz = d - a - b;\n\tlong long ans = 0;\n\tfor( int z=0; z<=rz; ++z ) {\n\t\tint l=0, r=z;\n\t\tif( r > tx )\n\t\t\tr = tx;\n\t\t// ( z - r, z - l )\n\t\tif( z - l > ty )\n\t\t\tl = z - ty;\n\t\tways[z] = max(0, r - l + 1);\n\t\tif( z > 0 )\n\t\tways[z] += ways[z-1];\n\t}\n\tfor( int z = max(0,lz); z<=rz; ++z ) {\n\t\tans += ways[z];\n\t}\n\tprintf(\"%lld\\n\", (((1ll*(b-a+1))*(c-b+1))*(d-c+1)) - ans);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1caf5946081cf15d6619c6ad20e7e7b2", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tlong long int A,B,C,D,i;\n\tlong long int res=0;\n\tscanf(\"%lld%lld%lld%lld\",&A,&B,&C,&D);\n\tfor(i=C;i<=D;i++)\n\t{\n\t\tif(i+2>=A+B)\n\t\t\tres+=((i-A-B+2)*(i-A-B+1))/2;\n\t\tif(i+2>=2*b+1)\n\t\t\tres-=((i-2*B+1)*(i-2*B))/2;\n\t\tif(i+2>=A+C+1)\n\t\t\tres-=((i-A-C+1)*(i-A-C))/2;\n\t\tif(i-B-C>=0)\n\t\t\tres+=((i-B-C)*(i-B-C-1))/2;\n\t}\n\tres=(B-A+1)*(C-B+1)*(D-C+1)-res;\n\tprintf(\"%lld\\n\",res);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "af7e7169134824c00685d04a9c6d4d9c", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "// C program to print largest contiguous array sum \n#include\ntypedef long long int ll;\nll max(ll a,ll b){\n return (a>b?a:b);\n}\nll min(ll a,ll b){\n return (a=c;i--)\n {\n for(int j=b;j<=c;j++)\n {\n low2=max(a,i-j+1);\n high2=min(low2,b+1);\n ans+=(b-high2+1);\n }\n }\n printf(\"%lld\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "db6dd79f14f93322be9cce63cf00f57a", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n\nlong long int XY(int A, int B, int C, int X_plus_Y)\n{\n\tlong long int x = 0;\n\tint i;\n\tint j;\n\tfor(i=A;i<=B;i++)\n\t{\n\t\tj = X_plus_Y - i;\n\t\tif( (B<=j) && (j<=C) )\n\t\t{\n\t\t\tx++;\n\t\t}\n\t}\n\t\n\treturn x;\n}\n\nlong long int Z(int C, int D, int X_plus_Y)\n{\n\tint min;\n\tlong long int z;\n\tif( X_plus_Y-1 <= D)\n\t{\n\t\tmin = X_plus_Y-1;\n\t}\n\telse\n\t{\n\t\tmin = D;\n\t}\n\t\n\tz = min - C + 1;\n\tif(z<0)\n\t{\n\t\treturn 0;\n\t}\n\t\n\treturn z;\n}\n\nint main()\n{\n\t// variable in description\n\tint T;\n\tint A, B, C, D; \n\t// variable to support\n\tlong long int ans;\n\tlong long int XY_num;\n\tlong long int Z_num;\n\t// variable to judge\n\tint i;\n\tint j;\n\tint k;\n\t\n\t\tscanf(\"%d %d %d %d\",&A,&B,&C,&D);\n\t\t\n\t\tans = 0;\n\t\t\n\t\tfor(j=A+B;j<=B+C;j++)\n\t\t{\n\t\t\tXY_num = XY(A,B,C,j);\n\t\t\tZ_num = Z(C,D,j);\n\t\t\tans += XY_num*Z_num;\n\t\t\t//printf(\"%d %d\\n\",XY_num,Z_num);\n\t\t}\n\t\t\n\t\tprintf(\"%lld\\n\",ans);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0e17d427c1ec1b36e994e6d811d32346", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n#define MAX 200000\nint temp[MAX];\nvoid mergesort(int a[],int indices[],int first,int last)\n{\n if(first==last) return;\n int middle=(first+last)/2;\n mergesort(a,indices,first,middle);\n mergesort(a,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]]=last) return;\n int i,j,s;\n for(i=first;i<=last;i++)\n {\n for(j=i;j>0&&a[indices[j]]>a[indices[j-1]];j--)\n {\n s=indices[j-1];\n indices[j-1]=indices[j];\n indices[j]=s;\n }\n }\n}\nint main()\n{\n int n,i,j,m;\n scanf(\"%d %d\",&n,&m);\n int a[n],indices[n];\n int fails[n];\n for(i=0;i\n#include\nint sa(const void * a,const void * b){\n return(*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,c[200],i=0,j=0,k=0,d,e,f;\n scanf(\"%d %d\",&n,&m);\n while(n--){\n scanf(\"%d\",&c[i]);\n k+=c[i];\n i++;\n if(k<=m)\n printf(\"0 \");\n else{\n qsort(c,i-1,sizeof(int),sa);\n d=m-c[i-1];\n e=0;\n for(j=0;;j++){\n e+=c[j];\n if(e>d)\n break;\n }\n f=i-j-1;\n printf(\"%d \",f);\n }\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2cfc742730637d14d5672244086d50dc", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \nvoid quicksort(int a[],int low,int high );\n \nint partion(int a[],int low,int high);\nint main(void) {\n\t// your code goes here\n\tint i,c,n,m,j,sum;\n\tscanf(\"%d %d\", &n,&m);\n\tint a[n],s[n],b[n];\n\tfor(i=0;i=0;j--)\n\t\t\t{\n\t\t\t\tsum+=b[j];\n\t\t\t\tc++;\n\t\t\t\tif(s[i]-sum<=m)\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprintf(\"%d \", c);\n\t\t}\n\t}\n \n\treturn 0;\n}\n void quicksort(int a[],int low,int high)\n{\n\tif(low\nvoid quicksort(int a[],int low,int high );\n \n int partion(int a[],int low,int high);\nint main(void) {\n\t// your code goes here\n\tint i,c,n,m,j,sum;\n\tscanf(\"%d %d\", &n,&m);\n\tint a[n],s[n],b[n];\n\tfor(i=0;i=0;j--)\n\t\t\t{\n\t\t\t\tsum+=b[j];\n\t\t\t\tc++;\n\t\t\t\tif(s[i]-sum<=m)\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprintf(\"%d \", c);\n\t\t}\n\t}\n \n\treturn 0;\n}\n void quicksort(int a[],int low,int high)\n{\n\tif(low\n#include \n\nint bsrch(int v, int *a, int h)\n{\n int p, l = 0;\n\n while (l < h) {\n p = (l + h) / 2;\n\n // printf(\"%d : %d : %d [%d]\\n\", l, p, h, a[p]);\n if (a[p] < v)\n l = p + 1;\n else\n h = p;\n\n // printf(\"%d %d [%d]\\n\", l, h, a[p]);\n }\n\n return l;\n}\n\n#define max(a,b) (a>b?a:b)\nint main() {\n int n, M;\n int *m_sum;\n\n // printf(\"x\\n\");\n // int x[] = {2,4,4,10};\n // printf(\"%d\\n\", bsearch(4,x,3));\n // printf(\"%d\\n\", bsearch(2,x,3));\n // printf(\"%d\\n\", bsearch(1,x,3));\n // return 0;\n\n scanf(\"%d %d\", &n, &M);\n m_sum = (int*)malloc(sizeof(int) * n + 1);\n m_sum[0] = 0;\n m_sum++;\n\n int t = 0;\n for (int i=0; i M)\n k = bsrch(t - M, m_sum, i) + 1;\n\n printf(\"%d \", k);\n\n for (int j = i; j >= 0; j--)\n m_sum[j] = max(m_sum[j], m_sum[j - 1] + v);\n }\n printf(\"\\n\");\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "85e061f4df3be0dfa4dbb4dd9f3c0499", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "e66b1527ad86155cd0d78a70eb9361e4", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "GNU C", "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\nstruct list {\nint x;\nstruct list*next;\n}\nint main()\n{\n char str[20];\n int i;j;\n scanf(\"%s\",str);\n int x=strlen(str);\n for(i=0;i\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#include\nint main(void)\n{\n\tchar a[30],t;\n\tint i,k,alen,max,s;\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\tbreak;\n\t\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aeab4263a06da5136bb1146e329d3da5", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n\n\nint main()\n{\n char letter = 'a';\n char string[10100];\n scanf(\"%s\" , string);\n\n for(int i = 0 ; string[i] ; i++){\n if(string[i] <= (letter) )\n {\n if((string[i] = letter++) == 'z')\n {printf(string); return 0;}\n }\n counter++;\n }\n printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "adade1a7701387e97a9718c21cc689c0", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n char str[100000];\n\n scanf(\"%s\",str);\n\n int i,j=0;\n char sub[27]='\\0';\n\n for(i=0;str[i]!='\\0';i++){\n int x=str[i]-'a';\n if(x==j){\n sub[j]=str[i];\n j++;\n sub[j]='\\0';\n if(j==26){\n printf(\"%s\\n\",sub);\n break;\n }\n }\n else if(x==j-1){\n sub[j]=str[i]+1;\n j++;\n sub[j]='\\0';\n if(j==26){\n printf(\"%s\\n\",sub);\n break;\n }\n }\n }\n\n if(j<26){\n printf(\"%d\\n\",-1);\n }\n\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7191c9c27fdd26711b987aa55f6e8f7c", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nchar s[100001], c = 'a';\nint i;\n\nint main ()\n{\n scanf ( \"%s\", s );\n\n for ( i = 0; s[i]; ++ i )\n if ( s[i] <= a ) s[i] = a ++;\n else if ( a > 'z' ) break;\n \n if ( a <= 'z' ) puts ( \"-1\" );\n else puts ( s );\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c4e2fdd746825dce9fbebec3b57cebda", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nchar s[100001], c = 'a';\nint i;\n\nint main ()\n{\n scanf ( \"%s\", s );\n\n for ( i = 0; s[i]; ++ i )\n if ( s[i] <= a ) s[i] = a ++;\n \n if ( a <= 'z' ) puts ( \"-1\" );\n else puts ( s );\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2ba0ad0695e221fcc1387af275d1be40", "src_uid": "f8ad543d499bcc0da0121a71a26db854", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int letter=0,i,j,len;\n char s2[]=\"abcdefghijklmnopqrstuvwxyz\",s[100001];\n scanf(\"%s\",s);\n len=strlen(s);\n for(i=0,j=97;i\nint main()\n{\n\tint m,i,c=0;\n\tscanf(\"%d\",&m);\n\tfor(i=1;i<=500005;i++)\n\t{\n\t\tint x=i;\n\t\tint ans =0;\n\t\twhile(x>0)\n\t\t{\n\t\t\tans+=x/5;\n\t\t\tx/=5;\n\t\t\t}\n\t\t\tif(ans==m)\n\t\t\t{\n\t\t\t\t++c;\n\t\t\t\tprintf(\"%d \",i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(c==0)\n\t\t\tprintf(\"%d\",c);\n\t\t\treturn 0;\n\t\t\t}\n\t\t", "lang_cluster": "C", "compilation_error": false, "code_uid": "a8a7334832fb43078eaed775942afb41", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nlong long e(int m)\n{return m==0?1:10*e(m-1);}\nint main()\n{\n\tint m,i;\n\twhile(~scanf(\"%d\",&m))\n\t{\n\t\tint a[2]={0,0};\n\t long long sum=1;\n\t\tint j=0;\n\t\tfor(i=1;;i++)\n\t\t{\n\t\t\tsum*=i;\n\t\t if(!(sum%e(m))&&sum%e(m+1))\n\t\t\t{\n\t\t\t\tif(!j)a[j]=a[j+1]=i,j=1;\n\t\t\t\telse a[j]=i;\n\t\t\t}\n\t\t\tif(!(sum%e(m+1)))break;\n\t\t}\n\t\tif(a[0])\n\t\t{\n printf(\"%d\\n\",a[1]-a[0]+1);\n\t\tfor(;a[0]\nint main(void)\n{\n\tint m,i,lt,index,count,x;\n\tscanf(\"%d\",&m);\n\t\n\tlt = m*5;\n\tcount = 0;\n\tfor(i = 5;i<=lt;i+=5)\n\t{\n\t\tif((i%5==0)&&((i/5)%5!=0))\n\t\t\tcount+=1;\n\t\telse if((i%25==0)&&((i/25)%5!=0))\n\t\t\tcount+=2;\n\t\telse if((i%125==0)&&((i/125)%5!=0))\n\t\t\tcount+=3;\n\t\telse if((i%625==0)&&((i/625)%5!=0))\n\t\t\tcount+=4;\n\t\telse if((i%3125==0)&&((i/3125)%5!=0))\n\t\t\tcount+=5;\n\t\telse if((i%15625==0)&&((i/15625)%5!=0))\n\t\t\tcount+=6;\n\t\telse if((i%78125==0)&&((i/78125)%5!=0))\n\t\t\tcount+=7;\n\t\telse if((i%390625==0)&&((i/390625)%5!=0))\n\t\t\tcount+=8;\n\n\t\tif(count==m)\n\t\t{\n\t\t\tprintf(\"%d %d %d %d %d\\n\",i,i+1,i+2,i+3,i+4);\n\t\t\tbreak;\n\t\t}\n\t\telse if(count>m)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0ed3175470c9e7b6a52881bb228d25d1", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "difficulty": 1300.0} {"lang": "GNU C11", "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\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 n;\n\tS(\"%d\", &n);\n\tint a = 1;\n\tint count = 0;\n\twhile (count < n)\n\t{\n\t\ta *= 5;\n\t\tint z = a;\n\t\twhile (z % 5 == 0)\n\t\t{\n\t\t\tz /= 5;\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (count == n)\n\t{\n\t\tP(\"5\\n\");\n\t\tfor (int i = 0; i < 5; i++)\n\t\t\tP(\"%d \", a + i);\n\t\treturn (0);\n\t}\n\tP(\"0\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cd5ca6482a5d5dc7da0f73011a8a55d2", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\nlong long int ar[10000];\nlong long int a,b,c,count=0;\nlong long k,n,i,j;\nlong long two=0,five=0;\nscanf(\"%lld\",&n);\n\nfor(i=5;;i++)\n{\n five=0;\n for(j=5;j<=i;j=j+5)\n {\n k=j;\n while(k%5==0)\n {\n five++;\n k=k/5;\n }\n\n }\n if(five==n){ar[count]=i;count++;}\n if(five>n){break;}\n}\nprintf(\"%lld\\n\",count);\nfor(i=0;i\n \nint n,k;\n \nint main(){\n\tscanf(\"%d %d\", &n,&k);\n\tfor(int i=k-1;i>0;i--){\n\t ll val;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0eccc511c7215f2b84eae9bd4b135410", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": true, "code_uid": "87b364367a236307209725b615b4aa08", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n\tlong int a,b;\n\tscanf(\"%ld%ld\",&a,&b);\n\tint flag=1;\n\tlong int x=1;\n\twhile(flag !=0){\n\t\tint rem = (x/b);\n\t\tint mod = (x%b);\n\t\tif(rem*mod == a){\n\t\t\tflag=0;\n\t\t}\n\t\tif(flag ==0){\n\t\t\tprintf(\"%ld\\n\",x);\n\t\t}\n\t\tx = x+1;\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cea16ddcff7d1de7f7a6ed75b2daa307", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0} {"lang": "GNU C11", "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(1){\n int r=x%b;\n if(r!=0)\n\tif((x/b)*r == a) break;\n\tx++;\n}\n\t\t\tprintf(\"%ld\\n\",x);\n\n\t\t\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "18535da4cd51e3c644f8073985017ba0", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0} {"lang": "GNU C11", "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 = 0; i < k; 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "83945eeedad8cfc07ac7c7e87bd0737d", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "/* Author Kh. Assaduzzaman Sohan */\n\n#include\n#include\n#include\n#define mod 100000007\nchar x[11][11],y[11][11];\nint main()\n{\n int i,j,k,d=0,X=0;\n\n for(i=0; i<10; i++) scanf(\"%s\",x[i]);\n\n //for(i=0; i<10; i++) printf(\"%s\\n\",x[i]);\n\n for(i=0; i<10; i++)\n {\n for(j=0; j<10; j++)\n {\n y[i][j]=x[j][i];\n }\n }\n //Checking horizontal\n for(i=0; i<10; i++)\n {\n for(j=0; j<6; j++)\n {\n X=0;\n d=0;\n if(x[i][j]=='X') X++;\n if(x[i][j+1]=='X') X++;\n if(x[i][j+2]=='X') X++;\n if(x[i][j+3]=='X') X++;\n if(x[i][j+4]=='X') X++;\n if(x[i][j]=='.') d++;\n if(x[i][j+1]=='.') d++;\n if(x[i][j+2]=='.') d++;\n if(x[i][j+3]=='.') d++;\n if(x[i][j+4]=='.') d++;\n\n if((X==4&&d==1)|| X==5)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n //Checking vertical\n for(i=0; i<10; i++)\n {\n for(j=0; j<6; j++)\n {\n X=0;\n d=0;\n if(y[i][j]=='X') X++;\n if(y[i][j+1]=='X') X++;\n if(y[i][j+2]=='X') X++;\n if(y[i][j+3]=='X') X++;\n if(y[i][j+4]=='X') X++;\n if(y[i][j]=='.') d++;\n if(y[i][j+1]=='.') d++;\n if(y[i][j+2]=='.') d++;\n if(y[i][j+3]=='.') d++;\n if(y[i][j+4]=='.') d++;\n\n if((X==4&&d==1)|| X==5)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n //Checking diagonal\n for(i=0; i<6; i++)\n {\n for(j=0; j<6; j++)\n {\n X=0;\n d=0;\n if(x[i][j]=='X') X++;\n if(x[i+1][j+1]=='X') X++;\n if(x[i+2][j+2]=='X') X++;\n if(x[i+3][j+3]=='X') X++;\n if(x[i+4][j+4]=='X') X++;\n if(x[i][j]=='.') d++;\n if(x[i+1][j+1]=='.') d++;\n if(x[i+2][j+2]=='.') d++;\n if(x[i+3][j+3]=='.') d++;\n if(x[i+4][j+4]=='.') d++;\n\n if((X==4&&d==1)|| X==5)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n for(i=9; i>=4; i--)\n {\n for(j=9; j>=4; j--)\n {\n X=0;\n d=0;\n if(x[i][j]=='X') X++;\n if(x[i-1][j-1]=='X') X++;\n if(x[i-2][j-2]=='X') X++;\n if(x[i-3][j-3]=='X') X++;\n if(x[i-4][j-4]=='X') X++;\n if(x[i][j]=='.') d++;\n if(x[i-1][j-1]=='.') d++;\n if(x[i-2][j-2]=='.') d++;\n if(x[i-3][j-3]=='.') d++;\n if(x[i-4][j-4]=='.') d++;\n\n if((X==4&&d==1)|| X==5)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n for(i=0; i<6; i++)\n {\n for(j=9; j>=4; j--)\n {\n X=0;\n d=0;\n if(x[i][j]=='X') X++;\n if(x[i+1][j-1]=='X') X++;\n if(x[i+2][j-2]=='X') X++;\n if(x[i+3][j-3]=='X') X++;\n if(x[i+4][j-4]=='X') X++;\n if(x[i][j]=='.') d++;\n if(x[i+1][j-1]=='.') d++;\n if(x[i+2][j-2]=='.') d++;\n if(x[i+3][j-3]=='.') d++;\n if(x[i+4][j-4]=='.') d++;\n\n if((X==4&&d==1)|| X==5)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n for(i=9; i>=4; i--)\n {\n for(j=0; j<6; j++)\n {\n X=0;\n d=0;\n if(x[i][j]=='X') X++;\n if(x[i-1][j+1]=='X') X++;\n if(x[i-2][j+2]=='X') X++;\n if(x[i-3][j+3]=='X') X++;\n if(x[i-4][j+4]=='X') X++;\n if(x[i][j]=='.') d++;\n if(x[i-1][j+1]=='.') d++;\n if(x[i-2][j+2]=='.') d++;\n if(x[i-3][j+3]=='.') d++;\n if(x[i-4][j+4]=='.') d++;\n\n if((X==4&&d==1)|| X==5)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b246b7bc932d30659f6d6190daf45da", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nusing namespace std;\nchar a[12][12];\ntypedef struct node {\n\tint aa,bb,cc,dd,ee,ff,gg,hh;\n} node;\nnode b[11][11];\nint c[]= {-1,-1,-1,0,1,1,1,0};\nint d[]= {-1,0,1,-1,1,0,-1,1};\nint dfs(int e,int w,int t,int p) {\n\tif(e<1||e>10||w<1||e>10||a[e][w]=='O') {\n\t\treturn p;\n\t}\n\tif(p!=0&&a[e][w]=='.') return p;\n\tif(a[e][w]=='X') p++;\n\tint xx=e+c[t];\n\tint yy=w+d[t];\n\tdfs(xx,yy,t,p);\n}\nint main() {\n\tfor(int i=1; i<=10; i++) {\n\t\tfor(int j=1; j<=10; j++) {\n\t\t\tscanf(\"%c\",&a[i][j]);\n\t\t}\n\t\tgetchar();\n\t}\n\tint flag=0;\n\tfor(int i=1; i<=10; i++) {\n\t\tfor(int j=1; j<=10; j++) {\n\t\t\tif(a[i][j]=='.') {\n\t\t\t\tfor(int k=0; k<=3; k++) {\n\t\t\t\t\tint sum=dfs(i,j,k,0)+dfs(i,j,k+4,0);\n\t\t\t\t\tif(sum>=4) {\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(flag==1) break;\n\t\t}\n\t\tif(flag==1) break;\n\t}\n\tif(flag==1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3dde51e73d5a3ae0b86213d8c4a6a569", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nusing namespace std;\nint main(){\n\n int i=0,j;\n char matrix[10][10];\n char s[12];\n\n\n while(i<10){\n scanf(\"%s\",s);\n for(j=0;j<10;j++){\n matrix[i][j]=s[j];\n }\n i++;\n }\n\n\n for (i=0;i<10;i++){\n for (j=0;j<10;j++){\n if (matrix[i][j]=='X'){ //achou o primeiro x\n if ((matrix[i][j-1]=='.')&&(matrix[i][j+1]=='X')&&(matrix[i][j+2]=='X')&&(matrix[i][j+3]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i][j+1]=='.')&&(matrix[i][j+2]=='X')&&(matrix[i][j+3]=='X')&&(matrix[i][j+4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i][j+1]=='X')&&(matrix[i][j+2]=='.')&&(matrix[i][j+3]=='X')&&(matrix[i][j+4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i][j+1]=='X')&&(matrix[i][j+2]=='X')&&(matrix[i][j+3]=='.')&&(matrix[i][j+4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i][j+1]=='X')&&(matrix[i][j+2]=='X')&&(matrix[i][j+3]=='X')&&(matrix[i][j+4]=='.')){\n printf(\"YES\\n\");\n exit(0);\n }\n\n\n\n\n\n if ((matrix[i-1][j]=='.')&&(matrix[i+1][j]=='X')&&(matrix[i+2][j]=='X')&&(matrix[i+3][j]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j]=='.')&&(matrix[i+2][j]=='X')&&(matrix[i+3][j]=='X')&&(matrix[i+4][j]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j]=='X')&&(matrix[i+2][j]=='.')&&(matrix[i+3][j]=='X')&&(matrix[i+4][j]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j]=='X')&&(matrix[i+2][j]=='X')&&(matrix[i+3][j]=='.')&&(matrix[i+4][j]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j]=='X')&&(matrix[i+2][j]=='X')&&(matrix[i+3][j]=='X')&&(matrix[i+4][j]=='.')){\n printf(\"YES\\n\");\n exit(0);\n }\n\n\n\n\n if ((matrix[i-1][j-1]=='.')&&(matrix[i+1][j+1]=='X')&&(matrix[i+2][j+2]=='X')&&(matrix[i+3][j+3]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j+1]=='.')&&(matrix[i+2][j+2]=='X')&&(matrix[i+3][j+3]=='X')&&(matrix[i+4][j+4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j+1]=='X')&&(matrix[i+2][j+2]=='.')&&(matrix[i+3][j+3]=='X')&&(matrix[i+4][j+4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j+1]=='X')&&(matrix[i+2][j+2]=='X')&&(matrix[i+3][j+3]=='.')&&(matrix[i+4][j+4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j+1]=='X')&&(matrix[i+2][j+2]=='X')&&(matrix[i+3][j+3]=='X')&&(matrix[i+4][j+4]=='.')){\n printf(\"YES\\n\");\n exit(0);\n }\n\n\n\n\n if ((matrix[i-1][j+1]=='.')&&(matrix[i+1][j-1]=='X')&&(matrix[i+2][j-2]=='X')&&(matrix[i+3][j-3]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j-1]=='.')&&(matrix[i+2][j-2]=='X')&&(matrix[i+3][j-3]=='X')&&(matrix[i+4][j-4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j-1]=='X')&&(matrix[i+2][j-2]=='.')&&(matrix[i+3][j-3]=='X')&&(matrix[i+4][j-4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j-1]=='X')&&(matrix[i+2][j-2]=='X')&&(matrix[i+3][j-3]=='.')&&(matrix[i+4][j-4]=='X')){\n printf(\"YES\\n\");\n exit(0);\n }\n if ((matrix[i+1][j-1]=='X')&&(matrix[i+2][j-2]=='X')&&(matrix[i+3][j-3]=='X')&&(matrix[i+4][j-4]=='.')){\n printf(\"YES\\n\");\n exit(0);\n }\n printf(\"NO\\n\");\n exit(0);\n }\n }\n }\n}\n\n/* 1519395180448 */\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c6dff74a0cd3a2ef4513ed8a1fbe8a46", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nchar matrix[10][10];\nchar trash;\nint found = 0;\n\nint main()\n{\n\tint i, ii, j, jj;\n\tint count = 0, step = 0;\n\t\n\tfor (i = 0; i < 10; i++)\n\t{\n\t\tfor (j = 0; j < 10; j++)\n\t\t{\n\t\t\tscanf(\"%c\", &matrix[i][j]);\n\t\t}\n\t\tscanf(\"%c\", &trash);\n\t}\n\n\tfor (i = 0; i < 10; i++)\n\t{\n\t\tfor (j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (matrix[i][j] == '.')\n\t\t\t{\n\t\t\t\t//down\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii < 9 && step < 5);\n\t\t\t\t{\n\t\t\t\t\tii++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\t\n\t\t\t\t// up\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\t\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\n\t\t\t\t//right\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (jj < 9 && step < 5);\n\t\t\t\t{\n\t\t\t\t\tjj++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\n\t\t\t\t// left\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (jj >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tjj--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\n\t\t\t\t//right up\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii >= 1 && jj < 9 && step < 5);\n\t\t\t\t{\n\t\t\t\t\tii--;\n\t\t\t\t\tjj++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// left down\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii < 9 && jj >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii++;\n\t\t\t\t\tjj--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\n\t\t\t\t//left up\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii >= 1 && jj >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii--;\n\t\t\t\t\tjj--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// right down\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii < 9 && jj < 9 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii++;\n\t\t\t\t\tjj++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n\n/* 1519409842134 */\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "70bc89f69354f350b4795e51c53bdbe5", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include \n\nchar matrix[10][10];\nchar trash;\nint found = 0;\n\nint main()\n{\n\tint i, ii, j, jj;\n\tint count = 0, step = 0;\n\t\n\tfor (i = 0; i < 10; i++)\n\t{\n\t\tfor (j = 0; j < 10; j++)\n\t\t{\n\t\t\tscanf(\"%c\", &matrix[i][j]);\n\t\t}\n\t\tscanf(\"%c\", &trash);\n\t}\n\n\tfor (i = 0; i < 10; i++)\n\t{\n\t\tfor (j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (matrix[i][j] == '.')\n\t\t\t{\n\t\t\t\t//down\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii < 9 && step < 5);\n\t\t\t\t{\n\t\t\t\t\tii++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\t\n\t\t\t\t// up\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\t\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\n\t\t\t\t//right\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (jj < 9 && step < 5);\n\t\t\t\t{\n\t\t\t\t\tjj++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\n\t\t\t\t// left\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (jj >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tjj--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\n\t\t\t\t//right up\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii >= 1 && jj < 9 && step < 5);\n\t\t\t\t{\n\t\t\t\t\tii--;\n\t\t\t\t\tjj++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// left down\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii < 9 && jj >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii++;\n\t\t\t\t\tjj--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\n\t\t\t\t//left up\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii >= 1 && jj >= 1 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii--;\n\t\t\t\t\tjj--;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// right down\n\t\t\t\tjj = j;\n\t\t\t\tii = i;\n\t\t\t\twhile (ii < 9 && jj < 9 && step < 5)\n\t\t\t\t{\n\t\t\t\t\tii++;\n\t\t\t\t\tjj++;\n\t\t\t\t\tif (matrix[ii][jj] == 'X')\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tstep++;\n\t\t\t\t\t\tif (count == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\treturn 0;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcount = 0;\n\t\t\t\tstep = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n\n/* 1519409463713 */\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d93206acab7c6ef55fa4607cdde17a98", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint i, j, k;\n\tint n, m;\n\tint a, b, c;\n\tint x, y;\n\tdouble l;\n\t__int64 ll;\n __int64 sum = 0;\n\t__int64 int temp;\n\tscanf(\"%d %d\", &m, &b);\n\tfor (i = 0; i <= m*b; i++)\n\t{\n\t\ttemp = 0;\n\t\ty = b - i / m;\n\t\tl = b - (i*1.0) / m;\n\t\tif (l < y)\n\t\t{\n\t\t\ty -= 1;\n\t\t}\n\t\tll=i+1;\n\t\tll*=i;\n\t\tll/=2;\n\t\tll*=(y+1);\n\t\ttemp+=ll;\n \t//temp += (((i+1)*i)/2)*(y + 1);\n \tll=y;\n \tll*=y+1;\n \tll/=2;\n \tll*=y+1;\n\t\t\n\t temp+=ll;\t\n\t//temp += ((y*(y+1))/2)*(i + 1);\n\t\tif (sum <= temp)\n\t\t{\n\t\t\tsum = temp;\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", sum);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ba4d80a1249b395ee6126d93a07a7966", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n int m,b;\n scanf(\"%d %d\",&m, &b);\n int i;\n long long int max=0,ans;\n for(i=0;i<=b;i++)\n {\n ans=(i*(i+1))/2;\n ans*=((m*b-m*i+1));\n ans+=(i+1)*((m*b-m*i)*(m*b-m*i+1))/2;\n if(max\n#include \n\nint ZA[10000][10000];\n\nint main()\n{\n\tint x, x1, y, z, z1, m, b;\n\n\tscanf(\"%d%d\", &m, &b);\n\tfor (y = b; y >= 0; --y) {\n\t\tx1 = floor((b - y) * m);\n\t\tfor (x = 0; x <= x1; ++x)\n\t\t\tZA[x][y] = x + y;\n\t}\n\tz1 = 0;\n\tfor (y = 0; y <= b; ++y) {\n\t\tx1 = floor((b - y) * m);\n\t\tfor (x = 0; x <= x1; ++x) {\n\t\t\tz = 0;\n\t\t\tif (x > 0)\n\t\t\t\tz += ZA[x - 1][y];\n\t\t\tif (y > 0)\n\t\t\t\tz += ZA[x][y - 1];\n\t\t\tif (x > 0 && y > 0)\n\t\t\t\tz -= ZA[x - 1][y - 1];\n\t\t\tZA[x][y] += z;\n\t\t\tif (ZA[x][y] > z1)\n\t\t\t\tz1 = ZA[x][y];\n\t\t}\t\t\n\t}\n\tprintf(\"%d\\n\", z1);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "08637d859f257c6805963d28023fab4a", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0} {"lang": "GNU C", "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\nmain()\n{\n //freopen(\"in.txt\", \"r\", stdin);\n int m, b, n, i, j, max, k;\n\n scanf(\"%d %d\", &m, &b);\n\n int a[b-1][3];\n\n j = 1;\n max = 0;\n for(i = 1; imax)\n {max = a[i][0]; j = i;}\n\n //printf(\"%d \", a[i]);\n }\n\n long long sum = 0, sum1, sum2;\n\n for(i = 0; i<=a[j][1]; i++)\n {\n for(k = 0; k<=a[j][2]; k++)\n {sum = sum + k + i;}\n }\n\n sum1 = b*(b+1)/2;\n sum2 = (m*b)(m*b+1)/2;\n\n sum1 = sum1>sum2?sum1:sum2;\n sum = sum>sum1?sum:sum1;\n\n printf(\"%I64d\", sum);\n\n\n\n\n}\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "6e60b572b5af5ca6ad45d6d4d86ba22f", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "int main()\n{\n\tint i, j, k;\n\tint n, m;\n\tint a, b, c;\n\tint x, y;\n\tdouble l;\n\t__int64 sum = 0;\n\t __int64 temp;\n\tscanf(\"%d %d\", &m, &b);\n\tfor (i = m*b; i >=(m*b)/(m+1)-1; i--)\n\t{\n\t\ttemp = 0;\n\t\ty = b - i / m;\n\t\tl = b - (i*1.0) / m;\n\t\tif (l < y)\n\t\t{\n\t\t\ty -= 1;\n\t\t}\n\t\tfor (j = 0; j <= i; j++)\n\t\t{\n\t\t\ttemp += j*(y+1);\n\t\t}\n\t\tfor (j = 0; j <= y; j++)\n\t\t{\n\t\t\ttemp += j*(i+1);\n\t\t}\n\t\tif (sum <= temp)\n\t\t{\n\t\t\tsum = temp;\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", sum);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5ecb9572c22a84736d846e95e488954a", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "main()\n{int i,q,r,temp,t,a[15]={0},b[15]={0},s[15]={0},j,k;\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;\nwhile(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n//for(i=1;i<=14;i++) printf(\"\\n%d\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{temp=s[j];s[j]=s[j+1];s[j+1]=temp;}\nprintf(\"\\n%d\",s[14]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "85b914a61cc8ff511f137c7b9305734c", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nint i,j,a[101],s[101]={0},max;\n\nint main()\n{\n\tfor (i=1;i<=14;i++) scanf(\"%d\",&a[i]);\n\tfor (i=15;i<=28;i++) a[i]=a[i-14];\n\tfor (i=1;i<=14;i++)\n\tif (a[i])\n\t{\n\t\t\n\t\tfor (j=i+1;j<=i+a[i];j++) \n\t\tif (a[j]%2==1) s[i]+=a[j]+1;\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "82698c788eda879abe38450a500accdb", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#define int long long int\n#define inti int\ninti main()\n{\n int a[14] ;\n int d[14];\n for(int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n for(int i = 0; i<14;i++) d[i] = a[i];\n int c ; int c1 = 0; int c2 = 0;\n for(int i = 0; i<14;i++)\n {\n 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(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(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(int j = 0; j<14;j++) d[i] = a[i];\n }\n \n printf(\"%lld\",c2);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0d5edfa7b3bfbcb42cb20c08f4f1d13e", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0} {"lang": "GNU C", "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}#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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "eb6389a33df259510b36b6f914c1522f", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n#define n 14\nint main(){\n int count=0,max=0,b,c,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;i14){\n \t\tint a =c[i]; c[i]=0;\n \t\tb = a/n;\n \t\tfor(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 return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "12504b25e37af434316adad4c89dbb78", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint main(){\r\n int n=0;\r\n scanf(\"%d\",&n);\r\n if(n==1)\r\n printf(\"3\");\r\n else if(n==2)\r\n printf(\"5\");\r\n else\r\n printf(\"%d\",(4+n+(n-3)/3));\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e14e1d535ea32eab8d8e6871b47ba4fa", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint main(){\r\n int n=0;\r\n scanf(\"%d\",&n);\r\n if(n==1)\r\n printf(\"3\");\r\n else if(n==2)\r\n printf(\"5\");\r\n else\r\n printf(\"%d\",(4+n+(n-3)/3));\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd018500ad823f883e9019194c1382b0", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint main() {\r\n long long int n, min;\r\n scanf(\"%lld\", &n);\r\n if(n <= 3) {\r\n printf(\"%lld\", n*2+1);\r\n }\r\n else if(n == 4){\r\n printf(\"%lld\", n*2);\r\n }\r\n else if((n-1) % 3 == 0) {\r\n printf(\"%lld\", n*2-(((n-4)/3)*2));\r\n }\r\n else if(n % 3 == 0){\r\n min = ((n-3)/3)-1;\r\n min *= 2;\r\n min++;\r\n printf(\"%lld\", (n*2)-min);\r\n }\r\n else {\r\n min = ((n-2)/3)-1;\r\n min *= 2;\r\n min++;\r\n printf(\"%lld\", (n*2)-min);\r\n }\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b1549c5d6beb4fc90599789825fed27", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\r\nint main(){\r\n long long int n,j=3;\r\n scanf(\"%lld\",&n);\r\n if(n<=3){\r\n printf(\"%lld\",(2*n+1));\r\n }else{\r\n if(n%3==1){\r\n printf(\"%lld \",(4*(1+(n/3))));\r\n }else if(n%3==2){\r\n n=n-n/3;\r\n printf(\"%lld\",(2*n+1));\r\n }else if(n%3==0){\r\n n=n-n/3+1;\r\n printf(\"%lld\",(2*n+1));\r\n }\r\n }\r\n // if(n==1){\r\n // printf(\"3\");\r\n // }else if(n==2){\r\n // printf(\"5\");\r\n // }else {\r\n // if((2*j)%4==0){\r\n\r\n // }else{\r\n // printf(\"%lld\",(2*j+1));\r\n\r\n // }\r\n // }\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f097b8ccfa9cf2486b198a693112a1d0", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n\tlong long int n, ans;\n int diff[3] = {0,1,3};\n\tscanf(\"%lld\",&n);\n\tans = n - 1;\n\tif(ans == 0)\n\t\tans = 3;\n\telse\t\n\t\tans = 4 + 4 * (ans / 3) + diff[ans%3] ;\n\tprintf(\"%lld\\n\",ans);\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "97d3dded2236e16bbf8b4bd4d3ddd2ed", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\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\tprintf(\"%d\",(a+b+c)*(a+b+c)-a*a-c*c-e*e);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5635ffbac5d26af3c89c9737ccdec429", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0} {"lang": "GNU C", "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 int x=(a1+a2+a3)*(a1+a2+a3)-a1*a1-a3*a3-a5*a5;\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "07918cec10acbe93240341c38818e451", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int a[6];\n int i;\n\n for(i=0; i<6; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n\n printf(\"%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 return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5a989234fd594780d6c9bc490a620d01", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\n\nint main() {\n int a,b,v1,v2,i=3,is,ans;\n while(i--) is=scanf(\"%d %d\",&a,&b);\n v1=a,v2=b;\n ans=2*b+1;\n int count=0;\n while(v1--) {ans+=2*(b+(++count));}\n while(v2--) {ans+=2*(b+(count--));}\n printf(\"%d\",ans);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "037997045d1fe936bb270df6e9f9b179", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int a[6];\n for(int i=0;i<6;i++) \n scanf(\"%d\",&a[i]);\n int rem = (a[0] + a[1] + a[2]);\n rem = rem*rem;\n rem -= a[0]*a[0];\n rem -= a[2]*a[2];\n rem -= a[4]*a[4];\n printf(\"%d\\n\",rem);;\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "05fc99fbff365c2b452f24907a35d860", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nvoid quicksort(int x[1000],int first,int last){\n int pivot,j,temp,i;\n\n if(firstx[pivot])\n j--;\n if(i\n\nint absl(int x){\n\tif (x<0) return -x;\n\telse return x;\n}\n\nint main(){\n\tint st[100];\n\tint n,i,j,max,count,t;\n\tscanf(\"%d\",&n);\n\tfor (i=0;i \nvoid quicksort(int x[1000],int first,int last){\n int pivot,j,temp,i;\n\n if(firstx[pivot])\n j--;\n if(i\n//#include\n\nint main()\n{\n\tint n,j,i,h[100],T,max=0,submax;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i=h[i])&&(h[j]<=h[i]+T))\n\t\t\t\tsubmax++;\n\t\t}\n\t\tif(submax>max)\n\t\t\tmax=submax;\n\t}\n\tprintf(\"%d\",max);\n\t//return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d9fd37d5e5300b81f2ced16870667382", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n//#include\n\nint main()\n{\n\tint n,j,i,h[100],T,g[100],max=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i=h[i])&&(h[j]<=h[i]+T))\n\t\t\t\tg[i]++;\n\t\t}\n\t}\n\tfor(i=0;imax)\n\t\t\tmax=g[i];\n\t}\n\tprintf(\"%d\",max);\n\t//return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f9d831987f6f9e192185e721eb598224", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\n#include\r\n\r\nint main()\r\n{\r\nint t;\r\nscanf(\"%d\",&t);\r\nwhile(t--)\r\n{\r\n\tint n,m,k;\r\n\tscanf(\"%d %d %d\",&n,&m,&k);\r\n\tif(n%2==0&&m%2==0)\r\n\t{\r\n\t\tif(k%2==0)\r\n\t\t printf(\"Yes\\n\");\r\n\t\telse\r\n printf(\"No\\n\");\r\n }\r\n else if(m%2==0)\r\n {\r\n \tif((k-m/2)>=0&&(k-m/2)%2==0)\r\n \t printf(\"Yes\\n\");\r\n\t\telse\r\n printf(\"No\\n\");\r\n }\r\n else\r\n {\r\n \tif(k<=(n*m/2-n/2)&&k%2==0)\r\n \t printf(\"Yes\\n\");\r\n\t\telse\r\n printf(\"No\\n\");\r\n }\r\n}\r\nreturn 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9d00f73ecfcfaae4c1771c3bc15d0b7", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\r\nint main()\r\n{int t;\r\n scanf(\"%d\",&t);\r\n while(t--)\r\n {int n,m,k;\r\n scanf(\"%d %d %d\",&n,&m,&k);\r\n if(n%2 == 0 && m %2 == 0 && k&1)\r\n printf(\"NO\\n\");\r\n else if(n&1 && ((2*k < m) || (2*k-m)%4))\r\n printf(\"NO\\n\");\r\n else if(m&1 && (((n*m)-2*k < n) || (((n*m)-2*k)-n)%4))\r\n printf(\"NO\\n\");\r\n else\r\n printf(\"YES\\n\");\r\n }\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e876eb36937ef730bc09e932d794a1a", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "/*\r\n * @\u9898\u76ee: \r\n * @\u7b97\u6cd5: \r\n * @Author: Blore\r\n * @Language: c++11\r\n * @Date: 2021-08-06 09:23:07\r\n * @LastEditors: Blore\r\n * @LastEditTime: 2021-08-06 11:14:30\r\n */\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 n, m, k1;\r\n scanf(\"%d%d%d\", &n, &m, &k1);\r\n int k2 = n * m / 2 - k1;\r\n if (m % 2 == 1)\r\n {\r\n k2 -= n / 2;\r\n if (k2 < 0)\r\n {\r\n puts(\"NO\");\r\n continue;\r\n }\r\n }\r\n else if (n % 2 == 1)\r\n {\r\n k1 -= m / 2;\r\n if (k1 < 0)\r\n {\r\n puts(\"NO\");\r\n continue;\r\n }\r\n }\r\n if (k1 * k2 % 2 != 0)\r\n puts(\"NO\");\r\n else\r\n puts(\"YES\");\r\n }\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "144234c87763f652e49d22a0d2bfb733", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\r\nint main()\r\n{\r\n\tint n,m,t,k;\r\n\tscanf(\"%d\",&t);\r\n\twhile(t--){\r\n\t\tscanf(\"%d %d %d\",&n,&m,&k);\r\n\t\tint sum=n*m/2;\r\n\t\tif(n%2==1){\r\n\t\t\tsum-=m/2;\r\n\t\t\tk-=m/2;\r\n\t\t}\r\n\t\tif(m%2==1){\r\n\t\t\tsum-=n/2;\r\n\t\t}\r\n\t\tif(k<0||k%2==1||k>sum){\r\n\t\t\tprintf(\"NO\\n\");\r\n\t\t}else printf(\"YES\\n\");\r\n\t}\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "781830ccb6e1f53e2bc5d19589ef2075", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\r\nint check_domino_row_even(int row, int col, int k) {\r\n\tint a[100][100] = { 0 };\r\n\t//xep domina ngang tu tren xuong duoi\r\n\tint cur_row = 0;\r\n\tint cur_col = 0;\r\n\twhile (1) {\r\n\t\tif (k > row) {\r\n\t\t\t/*for (int i = cur_row; i < row; i++) {\r\n\t\t\t\tfor (int j = cur_col; j <= cur_col + 1; j++) {\r\n\t\t\t\t\ta[i][j] = 1;\r\n\t\t\t\t}\r\n\t\t\t}*/\r\n\t\t\tcur_col += 2;\r\n\t\t\tk = k - row;\r\n\t\t}\r\n\t\telse {\r\n\t\t\t/*for (int i = cur_row; i < k; i++) {\r\n\t\t\t\tfor (int j = cur_col; j <= cur_col + 1; j++) {\r\n\t\t\t\t\ta[i][j] = 1;\r\n\t\t\t\t}\r\n\t\t\t}*/\r\n\t\t\tcur_row = k;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t//xep domino doc tu tren xuong\r\n\tif ((row - cur_row) % 2 == 1) {\r\n\t\treturn 0;\r\n\t}\r\n\telse if (cur_row == (row - 1)) {\r\n\t\treturn 0;\r\n\t}\r\n\telse if (cur_row == row) {\r\n\t\treturn 1;\r\n\t}\r\n\telse {\r\n\t\treturn 1;\r\n\t}\r\n}\r\nint check_domino_row_odd(int row, int col, int k) {\r\n\tint a[100][100] = { 0 };\r\n\t//xep domino ngang theo chieu ngang\r\n\tint cur_col = 0, cur_row = 0;\r\n\twhile (1) {\r\n\t\tif (k > col/2) {\r\n\t\t\t/*for (int i = cur_col; i < col; i++) {\r\n\t\t\t\ta[cur_row][i] = 1;\r\n\t\t\t}*/\r\n\t\t\tk = k - (col / 2);\r\n\t\t\tcur_row++;\r\n\t\t}\r\n\t\telse {\r\n\t\t\t/*for (int i = cur_col; i < 2 * k; i++) {\r\n\t\t\t\ta[cur_row][i] = 1;\r\n\t\t\t}*/\r\n\t\t\tcur_col = 2 * k;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t} \r\n\tif (cur_col == col) {\r\n\t\tcur_row++;\r\n\t\tif ((row - cur_row) % 2 == 0) return 1;\r\n\t\telse return 0;\r\n\t}\r\n\telse return 0;\r\n}\r\nint check_domino(int row, int col, int k) {\r\n\tif (row % 2 == 1) return check_domino_row_odd(row, col, k);\r\n\telse return check_domino_row_even(row, col, k);\r\n}\r\nint main() {\r\n\tint row, col, k;\r\n\tint result[100] = { 0 };\r\n\tint n = 0;\r\n\tscanf_s(\"%d\", &n);\r\n\tfor (int i = 0; i < n; i++) {\r\n\t\tscanf_s(\"%d%d%d\", &row, &col, &k);\r\n\t\tresult[i] = check_domino(row, col, k);\r\n\t}\r\n\tfor (int i = 0; i < n; i++) {\r\n\t\tif (result[i] == 1) printf(\"\\nYES\");\r\n\t\telse printf(\"\\nNO\");\r\n\t}\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6f39e7307ccbb7e54418e550c810e36f", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long power(int m, int pow){\n if (pow == 1)\n return m;\n else{\n long long val = power(m, pow/2);\n val = (val * val) %1000000007;\n\n if (pow%2)\n val = (val * (long long)m) % 1000000007;\n return val;\n }\n\n}\n\n\nint main()\n{\n int n, m, k;\n scanf(\"%d %d %d\", &n, &m, &k);\n\n if (k == 1)\n printf(\"%d\\n\", power(n,m));\n else{\n\n if (n>k){\n\n if (k%2)\n printf(\"%d\\n\", (m*m)%1000000007);\n else\n printf(\"%d\\n\", m);\n }\n\n else{\n int pow = k/2 + k%2;\n\n printf(\"%I64d\\n\", power(m,pow));\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d532b9e4ab4784fae5b29631a0e33673", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef long long ll;\n\nconst int mod = 1000000007;\n\nvoid solve(int n, int m, int k)\n{\n ll ans;\n int i;\n if (k == 1)\n {\n ans = 1;\n for (i = 0; i < n; i ++)\n {\n ans *= m;\n if (ans >= mod)\n {\n ans %= mod;\n }\n }\n }\n else if (k & 1)\n {\n ans = m * m;\n }\n else\n {\n ans = m;\n }\n ans %= mod;\n printf(\"%I64d\\n\", ans);\n}\n\nint main()\n{\n int n, m, k;\n while (scanf(\"%d%d%d\", &n, &m, &k) == 3)\n {\n solve(n, m, k);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee3022d3ca166b75f9405363aef71ad9", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint sq(int x, int y) {\n int i, a;\n\n a = 1;\n for (i = 0; i < y; i++) {\n a = a * x;\n while (a >= 1000000007) a -= 1000000007;\n }\n\n return a;\n}\n\nint main() {\n int n, m, k;\n\n scanf(\"%d%d%d\", &n, &m, &k);\n \n if (k == 1 || k > n) printf(\"%d\", sq(m, n));\n else if (k == n) printf(\"%d\", sq(m, (n+1)/2));\n else if (k%2 == 1) printf(\"%d\", sq(m, 2));\n else printf(\"%d\", m);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2e5fd369bf2d5211c9eab2c60a325cc9", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n,m,k;\n\tint i;\n\t__int64 sum;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tif(k==1)\n\t{\n\t\tsum=1;\n\t\tfor(i=1;i<=n;i++)\n\t\tsum=((sum%1000000007)*(m%1000000007))%1000000007;\n\t\tprintf(\"%I64d\\n\",sum);\n\t}\n\telse if(k==n)\n\t{\n\t\tsum=1;\n\t\tfor(i=0;i<(n+1)/2;i++)\n\t\tsum=((sum%1000000007)*(m%1000000007))%1000000007;\n\t\tprintf(\"%I64d\\n\",sum);\n\t}\n\telse if(k>n)\n\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tprintf(\"%d\\n\",m);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8941dd9052dbbd997dd31513b398b1ef", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\n#define BASE 1000000007\n\nint pow(int a, int b) {\n\tif (b == 0) return 1;\n\tif (b == 1) return a;\n\n\tlong ans = pow(a, b/2);\n\tans = (ans * ans) % BASE;\n\tans = (ans * pow(a, b%2)) % BASE;\n\treturn (int) ans;\n}\n\nint main(void) {\n\tint n, m, k;\n\tscanf(\"%d %d %d\", &n, &m, &k);\n\t\n\tif (k > n) printf(\"%d\\n\", pow(m, n));\n\telse if (k == n) printf(\"%d\\n\", pow(m, (n + 1)/2));\n\telse if (k % 2) printf(\"%d\\n\", m*m);\n\telse printf(\"%d\\n\", m);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9546fdf2f7f5f5a0a2d5b880864b0934", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "104124e142c08e20c2275ee977c74c86", "src_uid": "51d1c79a52d3d4f80c98052b6ec77222", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include \nusing namespace std;\nchar s1[20][150];\nchar s2[20][150];\nchar x[20];\nint main()\n{\n int n;\n while(scanf(\"%d\",&n)!=EOF)\n {\n scanf(\"%s\",x);\n for(int i=0;i\nint main()\n{\n scanf (\"%d\",n);\n if (n%2==0) printf (\"home\");\n else \n printf (\"contest\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5b7861c68c126dbf3adcc2e543c5c4c6", "src_uid": "51d1c79a52d3d4f80c98052b6ec77222", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n int n;\n scanf(\"%d\", &n);\n if (n % 2 == 0) {\n puts(\"home\");\n } else {\n puts(\"contest\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c2fc43d6b8305bc25ef6eb7e73fbcd6", "src_uid": "51d1c79a52d3d4f80c98052b6ec77222", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{ \t\n int n,i,j; \t\n char s[10]; \t\n scanf(\"%d\",&n); \t\n for(i=; i<=n+1; i++)\t scanf(\"%s\",s);\n if(n%2==0)\tprintf(\"home\");\n else printf(\"contest\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "42e929f3b9bbdd8e4ae8001469ef2b58", "src_uid": "51d1c79a52d3d4f80c98052b6ec77222", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint requires_substitute(char string[], int index1, int index2) {\n if (index1 != 0 && index2 != 0) return 0;\n if (index1 == 1 || index2 == 1) {\n if (string[2] == '0') return 1;\n } if (string[1] == '0') return 1;\n}\nint requires_substitute_fifty(char string[], int index1, int index2) {\n if (index1 == 0 && index2 != 1 && string[1] == '0') return 1;\n else return 0;\n}\nint substitute(char string[], int index1, int index2, int size) {\n int res = -1;\n for (int i = 0; i < size; i++) {\n if (i != index1 && i != index2 && string[i] != '0') {\n res = i;\n break;\n }\n }\n return res;\n}\n\nint main() {\n char string[20];\n scanf(\"%s\", string);\n int nums[5];\n for (int i = 0; i < 5; i++) {\n nums[i] = -1;\n }\n int switchZero = 1;\n int size = strlen(string);\n for (int i = 0; i < size; i++) {\n if (string[i] == '2') {\n nums[0] = i;\n } else if (string[i] == '5') {\n nums[1] = i;\n } else if (string[i] == '7') {\n nums[2] = i;\n } else if (string [i] == '0') {\n if (switchZero) {\n nums[3] = i;\n switchZero = 0;\n } else {\n nums[4] = i;\n switchZero = 1;\n }\n }\n }\n\n if (nums[3] > nums[4] || nums[4] == -1) {\n int tmp = nums[3];\n nums[3] = nums[4];\n nums[4] = tmp;\n }\n int steps[4];\n for (int i = 0; i < 4; i++) \n steps[i] = -1;\n if (nums[1] != -1) {\n if (nums[0] != -1) {\n int step_count = 0;\n if (size > 2 && requires_substitute(string, nums[1], nums[0])) {\n int sub = substitute(string, nums[1], nums[0], size);\n if (sub != -1) {\n step_count += sub;\n if (sub > nums[0])\n step_count --;\n if (sub > nums[1]) \n step_count --;\n }\n }\n if (nums[1] < nums[0]) {\n step_count ++;\n }\n step_count += size - nums[1] - 1;\n step_count += size - nums[0] - 2;\n steps[0] = step_count;\n } if (nums[2] != -1) {\n int step_count = 0;\n if (size > 2 && requires_substitute(string, nums[1], nums[2])) {\n int sub = substitute(string, nums[1], nums[2], size);\n if (sub != -1) {\n step_count += sub;\n if (sub > nums[2])\n step_count --;\n if (sub > nums[1]) \n step_count --;\n }\n }\n if (nums[1] < nums[2]) {\n step_count ++;\n }\n step_count += size - nums[1] - 1;\n step_count += size - nums[2] - 2;\n steps[1] = step_count;\n } if (nums[4] != -1) {\n int step_count = 0;\n if (size > 2 && requires_substitute_fifty(string, nums[1], nums[4])) {\n int sub = substitute(string, nums[1], nums[4], size);\n if (sub != -1) {\n step_count += sub;\n }\n }\n if (nums[1] > nums[4]) {\n step_count ++;\n }\n step_count += size - nums[1] - 1;\n step_count += size - nums[4] - 2;\n steps[2] = step_count;\n }\n } if (nums[3] != -1 && nums[4] != -1) {\n int step_count = 0;\n step_count += size - nums[3] - 1;\n step_count += size - nums[4] - 2;\n steps[3] = step_count;\n }\n int min = -1;\n for (int i = 0; i < 4; i ++) {\n \n if (steps[i] != -1) {\n if (min == -1 || steps[i] < min) {\n min = steps[i];\n }\n }\n }\n printf(\"%d\", min);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "37576a0d6023268569275c14f1b35f9a", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define INF 100000001\n\ntypedef long long int int64;\n\ntypedef struct Number\n{\n\tint size;\n\tint *digits;\n} Number;\n\nint CountDigits(int64 num)\n{\n\tint digits = 0;\n\tdo {\n\t\tdigits += 1;\n\t\tnum /= 10;\n\t} while (num != 0);\n\treturn digits;\n}\n\nint* MakeVector(int size, int init_val)\n{\n\tint *vec = (int*)malloc(sizeof(int) * size);\n\tint i;\n\n\tfor (i = 0; i < size; ++i) {\n\t\tvec[i] = init_val;\n\t}\n\treturn vec;\n}\n\nNumber MakeNumber(int64 num)\n{\n\tNumber res;\n\tres.size = CountDigits(num);\n\tres.digits = MakeVector(res.size, 0);\n\n\tint i = 0;\n\tdo {\n\t\tres.digits[i] = num % 10;\n\t\ti += 1;\n\t\tnum /= 10;\n\t} while (num != 0);\n\n\treturn res;\n}\n\nNumber Clone(Number num)\n{\n\tNumber clone;\n\tclone.size = num.size;\n\tclone.digits = MakeVector(clone.size, 0);\n\n\tint i;\n\tfor (i = 0; i < clone.size; ++i) {\n\t\tclone.digits[i] = num.digits[i];\n\t}\n\treturn clone;\n}\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint FindFirst(int vec[], int left, int right, int val)\n{\n\twhile (left < right) {\n\t\tif (vec[left] == val) {\n\t\t\treturn left;\n\t\t}\n\t\tleft += 1;\n\t}\n\treturn -1;\n}\n\nint SecondNonZero(Number num)\n{\n\tint pos = -1;\n\tint i;\n\n\tfor (i = 0; i + 1 < num.size; ++i) {\n\t\tif (num.digits[i] != 0) {\n\t\t\tpos = i;\n\t\t}\n\t}\n\treturn pos;\n}\n\nint HasSuffix(Number num, Number suffix)\n{\n\tif (num.size < suffix.size) {\n\t\treturn 0;\n\t}\n\n\tint i;\n\tfor (i = 0; i < suffix.size; ++i) {\n\t\tif (num.digits[i] != suffix.digits[i]) {\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 1;\n}\n\nvoid Swap(int *a, int *b)\n{\n\tint aux = *a;\n\t*a = *b;\n\t*b = aux;\n}\n\nint Malformed(Number num)\n{\n\treturn num.digits[num.size - 1] == 0;\n}\n\nint CountSwapsToSuffix(Number num, Number suffix)\n{\n\tNumber cnum = Clone(num);\n\tint count = 0;\n\tint i;\n\n\tfor (i = 0; i < suffix.size; ++i) {\n\t\tint pos = FindFirst(cnum.digits, i, cnum.size, suffix.digits[i]);\n\t\tif (pos == -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\twhile (cnum.digits[i] != suffix.digits[i]) {\n\t\t\tSwap(cnum.digits + pos, cnum.digits + pos - 1);\n\t\t\tif (Malformed(cnum)) {\n\t\t\t\tSwap(cnum.digits + pos, cnum.digits + pos - 1);\n\n\t\t\t\tint other = SecondNonZero(cnum);\n\t\t\t\tif (other == -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tSwap(cnum.digits + other, cnum.digits + other + 1);\n\n\t\t\t} else {\n\t\t\t\tpos -= 1;\n\t\t\t}\n\t\t\tcount += 1;\n\t\t}\n\n\t\tif (cnum.digits[i] != suffix.digits[i]) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tint good = HasSuffix(cnum, suffix);\n\tfree(cnum.digits);\n\n\treturn good ? count : INF;\n}\n\nint CountSwaps(int64 num, const Number suffixes[], int suffix_count)\n{\n\tNumber number = MakeNumber(num);\n\tint count = INF;\n\n\tint i;\n\tfor (i = 0; i < suffix_count; ++i) {\n\t\tint swaps = CountSwapsToSuffix(number, suffixes[i]);\n\t\tcount = min(count, swaps);\n\t}\n\tfree(number.digits);\n\n\treturn count;\n}\n\nint main()\n{\n\tint64 num;\n\tscanf(\"%I64d\", &num);\n\n\tNumber zero_suffix;\n\tzero_suffix.size = 2;\n\tzero_suffix.digits = MakeVector(2, 0);\n\n\tconst Number kSuffixes[] = {\n\t\tMakeNumber(25), MakeNumber(50), MakeNumber(75), zero_suffix,\n\t};\n\tint suffix_count = sizeof(kSuffixes) / sizeof(kSuffixes[0]);\n\n\tint res = CountSwaps(num, kSuffixes, suffix_count);\n\tprintf(\"%d\\n\", (res < INF ? res : -1));\n\n\tint i;\n\tfor (i = 0; i < suffix_count; ++i) {\n\t\tfree(kSuffixes[i].digits);\n\t}\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a902846ee14e99f5ea40720cff0c44bc", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n\tchar dig[20], exp[20];\n\tscanf(\" %s\", dig);\n\tint tam=strlen(dig), i, j;\n\n\tif(tam==1)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\n\tif(tam==2)\n\t{\n\t\tif(dig[0]=='2' && dig[1]=='5') printf(\"0\");\n\t\telse if(dig[0]=='5' && dig[1]=='2') printf(\"1\");\n\t\telse if(dig[0]=='5' && dig[1]=='0') printf(\"0\");\n\t\telse if(dig[0]=='7' && dig[1]=='5') printf(\"0\");\n\t\telse if(dig[0]=='5' && dig[1]=='7') printf(\"1\");\n\t\telse printf(\"-1\");\n\t\treturn 0;\n\t}\n\n\tint freq[10]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0};\n\tfor(i=0;i=2) && (freq[1] || freq[2] || freq[3] || freq[4] || freq[5] || freq[6] || freq[7] || freq[8] || freq[9]))\n\t{\n\t\tstrcpy(exp, dig);\n\t\tact=0;\n\n\t\ti=tam-1;\n\t\twhile(exp[i]!='0') i--;\n\n\t\tfor(j=i+1;j=2 || freq[3] || freq[4] || freq[5]>=2 || freq[6] || freq[7] || freq[8] || freq[9]))\n\t{\n\t\tstrcpy(exp, dig);\n\t\tact=0;\n\n\t\ti=tam-1;\n\t\twhile(exp[i]!='5') i--;\n\n\t\tfor(j=i+1;j=2 || freq[6] || freq[7] || freq[8] || freq[9]))\n\t{\n\t\tstrcpy(exp, dig);\n\t\tact=0;\n\n\t\ti=tam-1;\n\t\twhile(exp[i]!='0') i--;\n\n\t\tfor(j=i+1;j=2 || freq[6] || freq[7]>=2 || freq[8] || freq[9]))\n\t{\n\t\tstrcpy(exp, dig);\n\t\tact=0;\n\n\t\ti=tam-1;\n\t\twhile(exp[i]!='5') i--;\n\n\t\tfor(j=i+1;j\n#include \n#include \n\nint requires_substitute(char string[], int index1, int index2) {\n if (index1 != 0 && index2 != 0) return 0;\n if (index1 == 1 || index2 == 1) {\n if (string[2] == '0') return 1;\n } if (string[1] == '0') return 1;\n}\nint requires_substitute_fifty(char string[], int index1, int index2) {\n if (index1 == 0 && index2 != 1 && string[1] == '0') return 1;\n else return 0;\n}\nint substitute(char string[], int index1, int index2, int size) {\n int res = -1;\n for (int i = 0; i < size; i++) {\n if (i != index1 && i != index2 && string[i] != '0') {\n res = i;\n break;\n }\n }\n return res;\n}\n\nint main() {\n char string[20];\n scanf(\"%s\", string);\n int nums[5];\n for (int i = 0; i < 5; i++) {\n nums[i] = -1;\n }\n int switchZero = 1;\n int size = strlen(string);\n for (int i = 0; i < size; i++) {\n if (string[i] == '2') {\n nums[0] = i;\n } else if (string[i] == '5') {\n nums[1] = i;\n } else if (string[i] == '7') {\n nums[2] = i;\n } else if (string [i] = '0') {\n if (switchZero) {\n nums[3] = i;\n switchZero = 0;\n } else {\n nums[4] = i;\n switchZero = 1;\n }\n }\n }\n\n if (nums[3] > nums[4]) {\n int tmp = nums[3];\n nums[3] = nums[4];\n nums[4] = tmp;\n }\n int steps[4];\n for (int i = 0; i < 4; i++) \n steps[i] = -1;\n if (nums[1] != -1) {\n if (nums[0] != -1) {\n int step_count = 0;\n if (size > 2 && requires_substitute(string, nums[1], nums[0])) {\n int sub = substitute(strimg, nums[1], nums[0], size);\n if (sub != -1) {\n step_count += sub;\n }\n }\n if (nums[1] < nums[0]) {\n step_count ++;\n }\n step_count += size - nums[1] - 1;\n step_count += size - nums[0] - 2;\n steps[0] = step_count;\n } if (nums[2] != -1) {\n int step_count = 0;\n if (size > 2 && requires_substitute(string, nums[1], nums[2])) {\n int sub = substitute(strimg, nums[1], nums[2], size);\n if (sub != -1) {\n step_count += sub;\n }\n }\n if (nums[1] < nums[2]) {\n step_count ++;\n }\n step_count += size - nums[1] - 1;\n step_count += size - nums[2] - 2;\n steps[1] = step_count;\n } if (nums[4] != -1) {\n int step_count = 0;\n if (size > 2 && requires_substitute_fifty(string, nums[1], nums[4])) {\n int sub = substitute(strimg, nums[1], nums[4], size);\n if (sub != -1) {\n step_count += sub;\n }\n }\n if (nums[1] < nums[4]) {\n step_count ++;\n }\n step_count += size - nums[1] - 1;\n step_count += size - nums[4] - 2;\n steps[2] = step_count;\n }\n } if (nums[3] != -1 && nums[4] != -1) {\n int step_count = 0;\n step_count += size - nums[1] - 1;\n step_count += size - nums[4] - 2;\n steps[3] = step_count;\n }\n int min = -1;\n for (int i = 0; i < 4; i ++) {\n if (steps[i] != -1) {\n if (min == -1 || steps[i] < min) {\n min = steps[i];\n }\n }\n }\n printf(\"%d\", min);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3f94b1f83002e37e711086fc0d3f8a03", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\nint first(char s[],int len){\n int i,five=-1,two=-1;\n for(i=0;iara[i]){\n temp=ara[i];\n ara[i]=ara[j];\n ara[j]=temp;\n }\n }\n }\n for(i=0;i<4;i++){\n if(ara[0]!=-1){\n printf(\"%d\\n\",ara[i]);\n break;\n }\n }\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3d0cf7687b65135868ec587a22e12279", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \nint max(int *a, int n)\n{\n\tint max = *a;\n\tint i;\n\tfor (i = 1; i < n; i++)\n\t\tif (max < *(a + i))\n\t\t\tmax = *(a + i);\n\treturn max;\n}\nint main()\n{\n\tchar str[105];\n\tchar s2[105][105] = { 0 };\n\tchar s1[105] = { 0 };\n\tint a[105] = { 0 };\n\tint len, i,j,k,l,n=0,m;\n\tscanf(\"%s\", str);\n\tlen = strlen(str);\n\tfor (i = 1; i < len; i++)\n\t{\n\t\tmemset(s2, 0, sizeof(s2));\n\t\tmemcpy(s2[0], str, len-i);\n\t\tmemset(a, 0, sizeof(a));\n\t\tn = 0;\n\t\ta[0] += 1;\n\t\tn++;\n\t\tfor (j = 1; j <= i; j++)\n\t\t{\n\t\t\tmemset(s1, 0, sizeof(s1));\n\t\t\tfor (k = 0; k < len - i; k++)\n\t\t\t\ts1[k] = str[k + j];\n\t\t\tfor (m = 0; m < n; m++)\n\t\t\t{\n\t\t\t\tif (strcmp(s1, s2[m]) == 0)\n\t\t\t\t{\n\t\t\t\t\ta[m]++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (m >= n)\n\t\t\t{\n\t\t\t\ta[n]++;\n\t\t\t\tstrcpy(s2[n], s1);\n\t\t\t}\t\n\t\t}\n\t\tif (max(a, n) >= 2)\n\t\t{\n\t\t\tprintf(\"%d\\n\", max(a, n));\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"0\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ce6823733c99dabd03d9acfffaf9280", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n\tint sum,i,j,k,l,n,m,a[1000];\n\tchar c[100000];\n\tscanf(\"%s\",c);\n\tint z = strlen(c);\n\ta[0] = c[i]-'a'+1;\n\tint ans=0,tmp;\n\tfor(i=0;ians)\n\t\t\tans = sum;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f5289be0e0e23d7ecaa4d9830fd0cf38", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n\nint subs(char* str, int n)\n{\n\tint x=0,flag=0;\n\tfor(int i=n-1;i>0;i--)\n\t{\n\t\tfor(int j=0;j\n#include \n\n\nint main()\n{\n char str[101];\n char buf[101];\n gets(str);\n\n int i = 0;\n for(i = strlen(str) - 1; i > 0; --i)\n {\n memset(buf, 0, 101);\n strncpy(buf, str, i);\n if(strstr(str + 1, buf) != NULL) break;\n }\n\n printf(\"%d\", i);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "16fc0766c9271399b9eb3a4e022ed484", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \nint subs(char* str, int n)\n{\n\tint t1=0,t=1,t2=0,flag=0,p1=982451653;\n\tint x=0;\n\tfor(int i=n-1,k1;i>0;i--)\n\t{\n\t\tt1=0,t=1;\n//\t\tprintf(\"%d\\n\",i);\n\t\tfor(k1=0;k10)\n\t\t\t{\n\t\t\t\tt1=((t1-(int)(str[j-1]-96)*t)*10+(int)(str[j+i-1]-96))%p1;\n//\t\t\t\tprintf(\"%d\\n\",t1);\t\n\t\t\t}\n\t\t\tfor(k2=j+1;k2<=n-i;k2++)\n\t\t\t{\n\t\t\t\tif(k2!=j+1)\n\t\t\t\t{\n\t\t\t\t\tt2=((t2-(int)(str[k2-1]-96)*t)*10+(int)(str[k2+i-1]-96))%p1;\n//\t\t\t\t\tprintf(\"%d\\n\",t2);\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tt2=((t1-(int)(str[j]-96)*t)*10+(int)(str[j+i]-96))%p1;\n//\t\t\t\t\tprintf(\"%d\\n\",t2);\t\n\t\t\t\t}\n\t\t\t\tif(t2==t1)\n\t\t\t\t{\n\t\t\t\t\tfor(int k=0;k\n\nint main() {\n\tlong long n, b;\n\tscanf(\"%lld%lld\", &n, &b);\n\tlong long ans = 1000000000000000000;\n\tfor( long long i=2, p, l, tn, cans; i*i <= b; ++i ) {\n\t\tif( b%i )\n\t\t\tcontinue;\n\t\tfor( l=0, p=1; b%i == 0 ; b /= i )\n\t\t\tl++;\n\t\tcans = 0;\n\t\tfor( tn=n/i; tn; tn /= i ) cans += tn;\n\t\tif( cans/l < ans )\n\t\t\tans = cans/l;\n\t}\n\tif( b != 1 ) {\n\t\tlong long i=b, l=1;\n\t\tfor( tn=n/i; tn; tn /= i ) cans += tn;\n\t\tif( cans/l < ans )\n\t\t\tans = cans/l;\t\t\n\t}\n\tprintf(\"%lld\\n\", ans);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3d0ee04c312dc30a9006cdd1ee31dc43", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define BMAX 1000005\n\ntypedef long long ll;\n\nll min(ll a, ll b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tll i;\n\tll n, b;\n\tscanf(\"%lld %lld\", &n, &b);\n\tll val = b;\n\tll max_zeros = 1000000000000000000LL;\n\tfor (i=2; i <= (ll)sqrt(val) && max_zeros > 0; i++) {\n\t\t//printf(\"val,i = %lld,%lld\\n\", val, i);\n\t\tll need = 0;\n\t\tll has = 0;\n\t\twhile (val % i == 0) {\n\t\t\tval /= i;\n\t\t\tneed++;\n\t\t}\n\t\tif (need > 0) {\n\t\t\tll div = n;\n\t\t\tll k = i;\n\t\t\twhile (div > k) {\n\t\t\t\thas += div / k;\n\t\t\t\tk *= i;\n\t\t\t}\n\t\t\tmax_zeros = min(max_zeros, has / need);\n\t\t\t//printf(\"new max %lld\\n\", max_zeros);\n\t\t}\n\t}\n\tif (val > 1) {\n\t\ti = val;\n\t\tll need = 0;\n\t\tll has = 0;\n\t\twhile (val % i == 0) {\n\t\t\tval /= i;\n\t\t\tneed++;\n\t\t}\n\t\tif (need > 0) {\n\t\t\tll div = n;\n\t\t\tll k = i;\n\t\t\twhile (div >= k) {\n\t\t\t\thas += div / k;\n\t\t\t\tk *= i;\n\t\t\t}\n\t\t\tmax_zeros = min(max_zeros, has / need);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", max_zeros);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3921c909fd05c6be9adaa740da3dfaa8", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define BMAX 1000005\n\ntypedef long long ll;\n\nll min(ll a, ll b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tll i;\n\tll n, b;\n\tscanf(\"%lld %lld\", &n, &b);\n\tll val = b;\n\tll max_zeros = BMAX;\n\tfor (i=2; i <= (int)sqrt(val) && max_zeros > 0; i++) {\n\t\t//printf(\"val,i = %lld,%lld\\n\", val, i);\n\t\tint need = 0;\n\t\tint has = 0;\n\t\twhile (val % i == 0) {\n\t\t\tval /= i;\n\t\t\tneed++;\n\t\t}\n\t\tif (need > 0) {\n\t\t\tll div = n;\n\t\t\tll k = i;\n\t\t\twhile (div > k) {\n\t\t\t\thas += div / k;\n\t\t\t\tk *= i;\n\t\t\t}\n\t\t\tmax_zeros = min(max_zeros, has / need);\n\t\t}\n\t}\n\tif (val > 1) {\n\t\ti = val;\n\t\tint need = 0;\n\t\tint has = 0;\n\t\twhile (val % i == 0) {\n\t\t\tval /= i;\n\t\t\tneed++;\n\t\t}\n\t\tif (need > 0) {\n\t\t\tll div = n;\n\t\t\tll k = i;\n\t\t\twhile (div >= k) {\n\t\t\t\thas += div / k;\n\t\t\t\tk *= i;\n\t\t\t}\n\t\t\tmax_zeros = min(max_zeros, has / need);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", max_zeros);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b2a6f877d9c4b7513a97f6d8e6c40690", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n\nint main() {\n\tlong long n, b;\n\tscanf(\"%lld%lld\", &n, &b);\n\tlong long ans = 1000000000000000000;\n\tfor( long long i=2, p, l, tn, cans; b>1; ++i ) {\n\t\tif( b%i )\n\t\t\tcontinue;\n\t\tfor( l=0, p=1; b%i == 0 ; b /= i )\n\t\t\tl++;\n\t\tcans = 0;\n\t\tfor( tn=n/i; tn; tn /= i ) cans += tn;\n\t\tif( cans/l < ans )\n\t\t\tans = cans/l;\n\t}\n\tprintf(\"%lld\\n\", ans);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "296441a4ec34b46812a476793fc58afe", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define BMAX 1000005\n\ntypedef long long ll;\n\nll min(ll a, ll b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tll i;\n\tll n, b;\n\tscanf(\"%lld %lld\", &n, &b);\n\tll val = b;\n\tll max_zeros = 1000000000000000000LL;\n\tfor (i=2; i <= /*(ll)sqrt(*/val/*)*/ && max_zeros > 0; i++) {\n\t\t//printf(\"val,i = %lld,%lld\\n\", val, i);\n\t\tll need = 0;\n\t\tll has = 0;\n\t\twhile (val % i == 0) {\n\t\t\tval /= i;\n\t\t\tneed++;\n\t\t}\n\t\tif (need > 0) {\n\t\t\tll k = i;\n\t\t\tll div = n;\n\t\t\twhile (div >= k && k > 0) {\n\t\t\t\t//printf(\"div %lld\\n\", div);\n\t\t\t\thas += div / k;\n\t\t\t\tk *= i;\n\t\t\t}\n\t\t\tmax_zeros = min(max_zeros, has / need);\n\t\t\t//printf(\"new max %lld\\n\", max_zeros);\n\t\t}\n\t}\n\t/*if (val > 1) {\n\t\ti = val;\n\t\tll need = 0;\n\t\tll has = 0;\n\t\twhile (val % i == 0) {\n\t\t\tval /= i;\n\t\t\tneed++;\n\t\t}\n\t\tif (need > 0) {\n\t\t\tll div = n;\n\t\t\tll k = i;\n\t\t\twhile (div >= k) {\n\t\t\t\thas += div / k;\n\t\t\t\tk *= i;\n\t\t\t}\n\t\t\tmax_zeros = min(max_zeros, has / need);\n\t\t}\n\t}*/\n\tprintf(\"%lld\\n\", max_zeros);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7d30245f020816f5741399988dd47bc3", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nlong long int pow2(long long int a,long long int b,long long int n)\n{\n long long int x=1;\n long long int y=a;\n while(b>0){\n if(b&1)\n x=((x%n)*(y%n))%n;\n y=((y%n)*(y%n))%n;\n b=b>>1;\n }\n return x%n;\n}\nint main()\n{\n long long int n,m,k,ans;\n long long int mod=1e9+7;\n scanf(\"%lld %lld %lld\",&n,&m,&k);\n if(k==-1 && (n+m)%2!=0)\n {\n printf(\"0\\n\");\n }\n else\n {\n ans=pow2( pow2(2,n-1,mod),m-1, mod);\n printf(\"%lld\\n\",ans);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9e75f239f03637c372cd1ae20e33d062", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n\n\nlong long int insaneMod(long long int a, long long int mods[19]){\n long long int temp;\n long long int result = 1ll;\n int ct;\n int counter = 0;\n while(a > 0){\n ct = a % 10;\n temp = 1ll;\n for(int ct2 = 1 ; ct2 <= ct ; ct2++){\n temp = temp * mods[counter];\n temp %= 1000000007;\n }\n result *= temp;\n result %= 1000000007;\n a = a / 10;\n counter++;\n }\n return result;\n}\n\nlong long int modToPower(long long int a , long long int b){\n long long int temp , result;\n int remainders[19];\n remainders[1] = a;\n int ct;\n for(ct = 2 ; ct <= 18 ; ct++){\n long long int temp = remainders[ct - 1];\n int ct2;\n for(ct2 = 1; ct2 <= 9 ; ct2++){\n temp *= remainders[ct - 1];\n temp = temp % (1000000007);\n }\n remainders[ct] = temp;\n }\n\n\n\n\n}\n\nint main(){\n\n long long int mods[19];\n mods[0]= 2;\n mods[1] = 1024;\n int ct;\n for(ct = 2 ; ct <= 18 ; ct++){\n long long int temp = mods[ct - 1];\n int ct2;\n for(ct2 = 1; ct2 <= 9 ; ct2++){\n temp *= mods[ct - 1];\n temp = temp % (1000000007);\n }\n mods[ct] = temp;\n }\n\n long long int n, m;\n int k;\n scanf(\"%lld%lld%d\", &n, &m, &k);\n if(k == -1 && n % 2 != m % 2){\n printf(\"0\");\n return 0;\n }else{\n long long int result;\n result = insaneMod(n-1 , mods);\n long long int remainders[19];\n remainders[0] = result;\n int cts;\n for(cts = 1 ; cts <= 18 ; cts++){\n long long int temp = remainders[cts - 1];\n int ct2;\n for(ct2 = 1; ct2 <= 9 ; ct2++){\n temp *= remainders[cts - 1];\n temp = temp % (1000000007);\n }\n remainders[cts] = temp;\n }\n\n\n result = insaneMod(m - 1, remainders);\n printf(\"%lld\", result);\n return 0;\n }\n}\n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a6aacc1221b97b1d1b1cd81620f90229", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nlong long int m=1000000007;\nlong long int power(long long int x,long long int y,long long int m)\n{\n long long int temp;\n if(y==0)\n return 1;\n temp=power(x,y/2,m);\n if(y%2==0)\n return ((temp%m)*(temp%m))%m;\n else\n return (x*(((temp%m)*(temp%m))%m)%m)%m;\n}\nint main()\n{\n\tlong long int n,p,k,ans,ans1;\n\tscanf(\"%lld %lld %lld\",&n,&p,&k);\n\tif(k==-1 && (n+p)%2==1)\n\tans=0;\n\telse\n\t{\n\tans=power(2,(n-1),m);\n\tans=power(ans,p-1,m);\n\t}\n//ans=(ans*ans1)%m;\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9d4325831aebd74d7009cf8749169d1b", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\n\nint main(){\n\n long long int a[1000000007];\n long long int n, m;\n int k;\n scanf(\"%lld%lld%d\", &n, &m, &k);\n if(k == -1 && n % 2 != m % 2){\n printf(\"0\");\n return 0;\n }else{\n printf(\"Hi\");\n }\n printf(\"Hello\");\n\n\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e9730625ad570e743a839c5bbca7deb5", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define uLL unsigned long long\n#define uL unsigned long long\nchar str[1000000];\nconst uLL P=1000000007;\nuL exgcd(uL a,uL c)\n{\n\tstatic uL gcd;\n\tuL k;\n\tuLL x;\n\tif (a==0)\n\t{\n\t\tgcd=c;\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\tk=c%a;\n\t\tif (k==0)\n\t\t{\n\t\t\tgcd=a;\n\t\t\treturn 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tx=exgcd(a%k,k);\n\t\t}\n\t}\n\treturn (x*c-c/a*gcd)/k;\n}\ninline uLL mod64(uLL a,uLL b,uLL c)\n{\n\tuLL t,t2;\n\ta=a%c;b=b%c;\n\tfor (t=0;a>0;a=a>>1)\n\t{\n\t\tif (a&1)\n\t\t{\n\t\t\tt2=c-t;\n\t\t\tif (t2=b) {b=b<<1;} else {b=(b<<1)-c;}\n\t}\n\treturn t;\n}\n\ninline uLL expmod64(uLL a,uLL b,uLL p)\n{\n\tuLL t;\n\ta=a%p;b=b%p;\n\tfor (t=1;b;b=b>>1)\n\t{\n\t\tif (b&1)\n\t\t{\n\t\t\tt=mod64(t,a,p);\n\t\t}\n\t\ta=mod64(a,a,p);\n\t}\n\treturn t;\n}\nint main()\n{\n\tuLL n,m,k,t1,t2,ans;\n\tscanf(\"%llu %llu %llu\",&n,&m,&k);\n\tt1=expmod64(2,n,P);\n\tt2=exgcd(expmod64(2,m,P),P);\n\tans=expmod64(t1,m,P);\n\tt1=exgcd(t1,P);\n\tans=ans*2%P;\n\tans=ans*t1%P;\n\tans=ans*t2%P;\n\tprintf(\"%llu\\n\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7282136b2dd9d81886434ce1db3c53cd", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n \nint bigger(int n1, int n2);\n \nint main(){\n\tint b, g, n;\n \n\tscanf(\"%d\", &b);\n\tscanf(\"%d\", &g);\n\tscanf(\"%d\", &n);\n \n\tif(b >= n && g >= n) printf(\"%d\", n + 1);\n\telse if(b >= n && g < n) printf(\"%d\", 1 + g);\n\telse if(b < n && g >= n) printf(\"%d\", 1 + b);\n\telse if(b + g > n) printf(\"%d\", (g + b - bigger(a, b)) - (n - bigger(g, b)) + 1 );\n\telse printf(\"1\");\n \n\treturn 0;\n}\n \nint bigger(int n1, int n2){\n return (-(n1 >= n2) & n1) + (-(n1 < n2) & n2);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dd5de654a855aa10ca84e24168e4d430", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n\n{\n int a,b,g,n,s;\n scanf(\"%d%d%d\", &b,&g,&n);\n if(b>=g)\n a=g;\n else a=b;\n s=b+g-n;\n if(s==0)\n printf(\"1\\n\");\n else if(s>=a)\n {\n if(a+1>=n+1)\n printf(\"%d\\n\", n+1);\n else\n printf(\"%d\\n\", a+1);\n \n }\n else\n printf(\"%d\\n\", s+1);\n return 0\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e77150d95e81e0c77e1064dc217c7030", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nint main() {\n int b,g,n,ans=0;\n\tscanf(\"%d%d%d\",&b,&g,&n);\n\tfor (int i=0;i<=b;i++) {\n\t j=n-i;\n\t \n\t ans+=(j>=0 && j<=g);\n\t}\n\tprintf(\"%d\\n\",ans);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "197417969891e44b6a14403401fe51fd", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nint bigger(int n1, int n2);\n\nint main(){\n\tint b, g, n;\n\n\tscanf(\"%d\", &b);\n\tscanf(\"%d\", &g);\n\tscanf(\"%d\", &n);\n\n\tif(b >= n && g >= n) printf(\"%d\", n + 1);\n\telse if(b >= n && g < n) printf(\"%d\", 1 + g);\n\telse if(b < n && g >= n) printf(\"%d\", 1 + b));\n\telse if(b + g >= n) printf(\"%d\", n - bigger(g, b))\n\telse printf(\"1\");\n\n\treturn 0;\n}\n\nint bigger(int n1, int n2){\n return (-(n1 >= n2) & n1) + (-(n1 < n2) & n2);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c18769df4bf03b8a6b358e20ffd3fc2e", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": " #include\n \n int main(){\n long long int a,b,c;\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n if(a==0 && b==0 && c==0){\n printf(\"0\");\n \n \n }\n else{\n long long int d=c-a;\n long long int e=c-b;\n if(ab && c>b && b\n#include \n#include \n#include \nusing namespace std;\n#define mem(a, b) memset(a, b, sizeof a)\n#define IN freopen(\"in.txt\", \"r\", stdin)\n#define DEBUG(a) cout << (a) << endl\ntypedef long long ll;\nconst int INF = 0x3f3f3f3f;\nint mod = 1e9 + 7;\nconst int maxn = 1e5 + 10;\nint main()\n{\n int i,n,m,j,k=1,l,max1=1;\n scanf(\"%d\",&n);\n m=n;max1=1;k=1;\n while(m>0)\n {\n j=m%10;\n m=m/10;\n max1=max1*j;\n }\n for(i=1;;i++)\n {\n m=n; int ans=1;\n l=pow(10,i);\n m=(m/l-1)*l;\n if(m<0)break;\n m=m+l-1;\n while(m>0)\n {\n j=m%10;\n m=m/10;\n ans=ans*j;\n }\n max1=max(max1,ans);\n }\n printf(\"%d\\n\",max1);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ed7662bca235fc1a29cb52c79d4650fe", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \nusing namespace std;\n#define mem(a, b) memset(a, b, sizeof a)\n#define IN freopen(\"in.txt\", \"r\", stdin)\n#define DEBUG(a) cout << (a) << endl\ntypedef long long ll;\nconst int INF = 0x3f3f3f3f;\nint mod = 1e9 + 7;\nconst int maxn = 1e5 + 10;\nint main()\n{\n int i,n,m,j,k=1,l,max1=1;\n while(~scanf(\"%d\",&n)){\n m=n;max1=1;k=1;\n while(m>0)\n {\n j=m%10;\n m=m/10;\n max1=max1*j;\n }\n for(i=1;;i++)\n {\n m=n; int ans=1;\n l=pow(10,i);\n m=(m/l-1)*l;\n if(m<0)break;\n m=m+l-1;\n while(m>0)\n {\n j=m%10;\n m=m/10;\n ans=ans*j;\n }\n max1=max(max1,ans);\n }\n printf(\"%d\\n\",max1);\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5899d281ccc02fcae2854f572bdd424b", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include\n#include\nusing namespace std;\nint ans;\nchar c[11], tmpc[11];\nint prod( char *ch)\n{\n\tint pr = 1, id = 0;\n\twhile (ch[id])\n\t{\n\t\tpr *= ch[id] - '0';\n\t\tid++;\n\t}\n\treturn pr;\n}\nint main()\n{\n\t//freopen(\"input.txt\", \"r\", stdin);\t\n\tscanf(\"%s\", c);\n\tint l = 0;\n\twhile (c[l])\n\t\tl++;\n\tans = prod(c);\n\tfor (int i = 0; i < l; i++) {\n\t\tif (c[l] - '0' == 0)\n\t\t\tcontinue;\n\t\tfor (int j = 0; j < i; j++)\n\t\t\ttmpc[j] = c[j];\n\t\ttmpc[i] = (c[i] - '0' - 1) + '0';\n\t\tfor (int j = i + 1; j < l; j++)\n\t\t\ttmpc[j] = '9';\n\t\tint tmppr = prod(tmpc);\n\t\tif (tmppr > ans)\n\t\t\tans = tmppr;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ad31d37e36261a18819dda09133acf10", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\n#include\n\nint main()\n{\n int n,i,rem;\n vector arr;\n vector arr1;\n\n cin>>n;\n int l=0;\n int k=0;\n\n while(n!=0)\n { \n rem=n%10;\n \n arr.push_back(rem);\n if(n<10)\n {\n arr1.push_back(n-1);\n }\n else \n {\n arr1.push_back(9);\n }\n n=n/10;\n }\n reverse(arr.begin(),arr.end());\n reverse(arr1.begin(),arr1.end());\n int product =1;\n int ultimate=0;\n int j;\n if(arr[0]==1)\n {\n ultimate=pow(9, arr.size()-1);\n }\n else\n {\n for(i=0;iultimate)\n {\n ultimate=product;\n }\n product=1;\n }}\n cout<\n#include \n#include \n#include \n#include \n\n//srand(time(NULL));\n//nombre_aleatoire = rand();\n\ntypedef struct cel\n{\n\tint number;\n\tint value;\n}cell;\n\nint main ()\n{\n\tint a,j=1,i=10,s=1,aux;\n\tcell t[11],max;\n\tscanf(\"%d\",&a);\n\n\tt[0].number=a;\n\taux=a;\n\twhile(aux>=1)\n\t{\n\t\ts=s*(aux%10);\n\t\taux=aux/10;\n\t}\n\tt[0].value=s;\n\twhile(a/i!=0)\n\t{\n\t\n\t\ts=1;\n\t\taux=a;\n\t\taux=aux-(aux%i+1);\n\t\tt[j].number=aux;\n\t\t\n\t\t\n\t\twhile(aux>=1)\n\t\t{\n\t\t\ts=s*(aux%10);\n\t\t\taux=aux/10;\n\t\t}\n\t\tt[j].value=s;\n\t\tj++;\n\t\ti=i*10;\n\t}\n\tmax.value=t[0].value;\n\tmax.number=0;\n\tfor(i=0;imax.value)\n\t\t{\n\t\t\tmax.value=t[i].value;\n\t\t\tmax.number=i;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\\n\",max.value);\n\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9214199d952293a16eb0806bb44fc34d", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include\n#include\n#include\n#include\ntypedef long long ll;\nusing namespace std;\nint num[120];\nint main()\n{\n int n,i,m;\n memset(num,0,sizeof(num));\n scanf(\"%d%d\",&n,&m);\n for(i=0;i=n)\n ans=i;\n else break;\n }\n printf(\"%d\\n\",ans);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cdda8c81d8c3a489d7d895c7294a6379", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\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\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\nvoid mergeSort(int arr[], int l, int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2;\n\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n\n merge(arr, l, m, r);\n }\n}\n\n\nint main()\n{\n int i,j,n,m;\n cin>>n>>m;\n int c[n],b[m];\n for(i=0;i>c[i];\n }\n for(i=0;i>b[i];\n }\n int st=0,count=0;\n for(i=0;i=c[j])\n {\n count++;\n st=j+1;\n break;\n }\n }\n if(j==n)\n break;\n }\n cout<\n#include\n#include\n#include\n#define G1I(i) int i; scanf(\"%d\",&i)\n#define G2I(i,j) int i,j; scanf(\"%d%d\",&i,&j)\n#define G3I(i,j,k) int i,j,k ; scanf(\"%d%d%d\",&i,&j,&k)\n#define g1i(i) scanf(\"%d\",&i)\n#define g2i(i,j) scanf(\"%d%d\",&i,&j)\n#define g3i(i,j,k) scanf(\"%d%d%d\",&i,&j,&k)\n#define G1C(c) char c; scanf(\"%c\",&c)\n#define g1c(c) scanf(\"%c\",&c)\n#define G1S(s,len) char s[len]; scanf(\"%s\",s)\n#define Fin(i,m,n) for(int i = m;i < n;i++)\n#define lli long long int\n#define G1lli(i) lli i; scanf(\"%I64d\",&i);\n#define G2lli(i,j) lli i,j,k; scanf(\"%I64d%I64d\",&i,&j);\n#define G3lli(i,j,k) lli i,j,k; scanf(\"%I64d%I64d%I64d\",&i,&j,&k);\n#define g1lli(i) scanf(\"%I64d\",&i)\n#define g2lli(i,j) scanf(\"%I64d%I64d\",&i,&j)\n#define g3lli(i,j,k) scanf(\"%I64d%I64d%I64d\",&i,&j,&k)\n#define P1I(i) printf(\"%d\",i)\n\nint Types[101];\n\nint compare(const void* a,const void* b){\n\treturn *(int*)b - *(int*)a;\n}\n\nint main(){\n\tG2I(n,m);\n\tint cnt = 0;\n\tFin(i,0,m){\n\t\tG1I(type);\n\t\tif(Types[type] == 0) cnt++;\n\t\tTypes[type]++;\n\t}\n\tqsort(Types,101,sizeof(int),compare);\n\tint days = 0;\n\tint eat[n];\n\tFin(i,0,n) eat[i] = i;\n\twhile(1){\n\t\tint flag = 1;\n\t\tFin(i,0,n){\n\t\t\tif(Types[eat[i]] > 0){\n\t\t\t\tTypes[eat[i]]--;\n\t\t\t}else{\n\t\t\t\tflag = 0;\n\t\t\t\tFin(j,0,cnt){\n\t\t\t\t\tif(Types[j] - days - 1 >= 0){\n\t\t\t\t\t\tTypes[j] -= days + 1;\n\t\t\t\t\t\tTypes[eat[i]] += days;\n\t\t\t\t\t\teat[i] = 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) break;\n\t\t\t}\n\t\t}\n\t\tif(!flag) break;\n\t\tdays++;h\n\t}\n\tP1I(days);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ab6eb54736fdfeec7957fccca83a7e59", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\nint main()\n{\n int count[2000] ={0};\n int arr[1000] ={0}; \n int n,m,i;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i0){\n brr[b]=i;\n b++;\n }\n }\n \n if(b>=n){\n max = 0;\n for(i=0;i=0){\n int f = 0;\n for(i=0;i=n){\n printf(\"%d\\n\",max);\n break;\n }\n max = max - 1;\n }\n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d625887b4a9491e55bc6221802006358", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define MAX 101\n\nint main() {\n\tint i, aux, temp;\n\tint n, m, k;\n\tint vec[MAX] = {0};\n\n\t// reding the number of participants and the number of food packages\n\tscanf(\"%d %d\", &n, &m);\n\n\t// storing the quantity of each element in the array, using the value itself as an index (0 based array)\n\tfor (i = 0; i < m; i++) {\n\t\tscanf(\"%d\", &aux);\n\n\t\tvec[aux - 1]++;\n\t\t// printf(\"%d\\n\", vec[aux - 1]);\n\t}\t\n\n\t// this outerloop will go from the greatest possible number of days\n\t// to the least one\n\tfor (i = MAX - 1; i >= 0; i--) {\n\t\tk = 0;\n\n\t\t// this innerloop will go through all of the elements in the array \n\t\tfor (aux = 0; aux < MAX; aux++) {\n\n\t\t\ttemp = vec[aux];\n\t\t\t// this inner loop will check how many times the current element can fit\n\t\t\t// into the number of days\n\t\t\twhile(temp >= i) {\n\t\t\t\tk++;\n\t\t\t\ttemp -= i;\n\t\t\t}\n\t\t}\n\n\t\t// here we verify if the number of people fed is at least equal to the number\n\t\t// of participants\n\t\tif (k >= n) {\n\t\t\tprintf(\"%d\\n\", i);\n\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprintf(\"0\\n\");\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "25cf39e3d706b4c59f6798964e625826", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "include \n\nstruct {\n\tchar valor, naipe;\n\tvalor = 0;\n\tnaipe = 0;\t\n} card ;\n\nint main(){\n\tstruct card* primeira, segunda;\n\tchar trunfo, c;\n\tscanf (\"%c\", &trunfo);\n\tscanf (\"%c\", &c); \n\tscanf (\"%c\", &c);\n\tprimeira->valor = c;\t\n\tscanf (\"%c\", &c);\n\tprimeira->naipe = c;\t\n\tscanf (\"%c\", &c);\n\tsegunda->valor = c;\t\n\tscanf (\"%c\", &c);\n\tsegunda->valor = c;\t\n\tif (primeira->naipe == trunfo){\n\t\tif (segunda->naipe != trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse {\n\t\t\tif (primeira->valor > segunda->valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\n\n\t}\n\telse {\n\t\tif (segunda->naipe == trunfo)\n\t\t\tprintf (\"NO\");\n\t\telse {\n\t\t\tif (primeira->valor > segunda->valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\t\n\t}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "341ca45a821ea89c0186931a139bfb77", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nstruct carta{\n\tint valor\n\tchar naipe;\n\tcarta.valor = 0;\n\tcarta.naipe = 0;\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 '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 '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.valor = c;\t\n\tif (primeira.naipe == trunfo){\n\t\tif (segunda.naipe != trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\n\n\t}\n\telse {\n\t\tif (segunda.naipe == trunfo)\n\t\t\tprintf (\"NO\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\t\n\t}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b2809f9489064e5495e9f6beca94952c", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nstruct {\n\tchar valor, naipe;\n\tvalor = '0';\n\tnaipe = '0';\n} card ;\n\nint main(){\n\tstruct card primeira;\n\tstruct card segunda;\n\tchar trunfo, c;\n\tscanf (\"%c\", &trunfo);\n\tscanf (\"%c\", &c); \n\tscanf (\"%c\", &c);\n\tprimeira.valor = c;\t\n\tscanf (\"%c\", &c);\n\tprimeira.naipe = c;\t\n\tscanf (\"%c\", &c);\n\tsegunda.valor = c;\t\n\tscanf (\"%c\", &c);\n\tsegunda.valor = c;\t\n\tif (primeira.naipe == trunfo){\n\t\tif (segunda.naipe != trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\n\n\t}\n\telse {\n\t\tif (segunda.naipe == trunfo)\n\t\t\tprintf (\"NO\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\t\n\t}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "28876e69ace5c68729bed7a8d35b14c0", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nstruct {\n\tchar valor, naipe;\n\tcarta.valor = 0;\n\tcarta.naipe = 0;\n} carta ;\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\tprimeira.valor = c;\t\n\tscanf (\"%c\", &c);\n\tprimeira.naipe = c;\t\n\tscanf (\"%c\", &c);\n\tsegunda.valor = c;\t\n\tscanf (\"%c\", &c);\n\tsegunda.valor = c;\t\n\tif (primeira.naipe == trunfo){\n\t\tif (segunda.naipe != trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\n\n\t}\n\telse {\n\t\tif (segunda.naipe == trunfo)\n\t\t\tprintf (\"NO\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\t\n\t}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0d2a6a92f9e1d8cef0a459d7735fe1e9", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\nstruct carta{\n\tint valor;\n\tchar naipe;\n\tcarta.valor = 0;\n\tcarta.naipe = 0;\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 '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 '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.valor = c;\t\n\tif (primeira.naipe == trunfo){\n\t\tif (segunda.naipe != trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\n\n\t}\n\telse {\n\t\tif (segunda.naipe == trunfo)\n\t\t\tprintf (\"NO\");\n\t\telse {\n\t\t\tif (primeira.valor > segunda.valor)\n\t\t\t\tprintf (\"YES\");\n\t\t\telse\n\t\t\t\tprintf (\"NO\");\n\t\t}\t\n\t}\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b698074aa36c150935ca70c4752c1058", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n unsigned long long n,m,k,left,right,mid,temp;\n\n scanf(\"%I64u\",&m);\n left=0;\n right=(long long)0xffffffffffffffff;\n while(left=k*k*k)\n {\n temp+=n/(k*k*k);\n k++;\n }\n if(temp==m)printf(\"%I64u\\n\",n);\n else printf(\"-1\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b952dfce3ec3e5b9b76ab6c22633a9de", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint main(){\n\tunsigned long long m,temp,sum,numb,high,low,mid,min,i,j,sqr;\n\tscanf(\"%\"PRIu64,&m);\n\thigh=m*8+1;\n\tlow=1;\n\tmin=high+1;\n\twhile ((high-low)>1){\n\t\t//printf(\"%\"PRIu64\" %\"PRIu64,high,low);\n\t\tsum=0;\n\t\tmid = (high+low)/2;\n\t\tfor(i=0;i=mid)break;\n\t\tsqr = i;\n\t\t//printf(\" %\"PRIu64,sqr);\n\t\tfor(j=2;j<=sqr;j++){\n\t\t\ttemp=j*j*j;\n\t\t\tnumb=mid/temp;\n\t\t\tsum+=numb;\n\t\t}\n\t\t//printf(\" %\"PRIu64\"\\n\",sum);\n\t\tif (sum==m) if (mid < min) min = mid;\n\t\tif(sum>=m)high=mid;\n\t\telse low = mid;\n\t}\n\tif(min<(8*m+1))printf(\"%\"PRIu64,min);\n\telse printf(\"-1\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "61e56ac30405b8662178a7a5d07ad059", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tlong long int c,m,k=2,p,s=0,i,a,b,power[100005]={0,1};\n\tscanf(\"%lld\",&m);\n\tfor(i=1;i<100005;i++)\n\tpower[i]=pow(i,3);\n\twhile(s0)\n\t\t\t{\n\t\t\t\ts=s+i/power[c];\n\t\t\t\tc++;\n\t\t\t}\n\t\t\tif(s>=m)\n\t\t\tbreak;\n\t\t}\n\t\tif(s==m)\n\t\tprintf(\"%lld\\n\",i);\n\t\telse\n\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9249201d2319e0e27648e7488f5ca37f", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n long long n,m,k,left,right,mid,temp;\n\n scanf(\"%I64d\",&m);\n left=0;\n right=0x7fffffff;\n while(left=k*k*k)\n {\n temp+=n/(k*k*k);\n k++;\n }\n if(temp==m)printf(\"%I64d\\n\",n);\n else printf(\"-1\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a6f4a74db6cf20473e23d426550aebe5", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong long int c,m,k=2,p,s=0,i,a,b,power[100005]={0,1};\n\tscanf(\"%lld\",&m);\n\tfor(i=1;i<100005;i++)\n\tpower[i]=i*i*i;\n\twhile(s0)\n\t\t\t{\n\t\t\t\ts=s+i/power[c];\n\t\t\t\tc++;\n\t\t\t}\n\t\t\tif(s>=m)\n\t\t\tbreak;\n\t\t}\n\t\tif(s==m)\n\t\tprintf(\"%lld\\n\",i);\n\t\telse\n\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "94b0a2f5cf9c1538aca4217535d9aef5", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nmain()\n{\n int n,i,y,t;\n char a;\n scanf(\"%d%c\", &n, &a);\n y=n/4;\n if (n%4!=0)\n {\n t=y*14;\n if (n%2==0)#include \n#include \n\nmain()\n{\n int n,i,y,t;\n char a;\n scanf(\"%d%c\", &n, &a);\n y=n/4;\n if (n%4!=0)\n {\n t=y*14;\n if (n%2==0)\n {\n t+=7;\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n else\n {\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n }\n else\n {\n y--;\n t=y*13;\n if (n%2==0)\n {\n t+=7;\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n else\n {\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n }\n printf(\"%d\", t);\n}\n {\n t+=7;\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n else\n {\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n }\n else\n {\n y--;\n t=y*13;\n if (n%2==0)\n {\n t+=7;\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n else\n {\n switch (a)\n {\n case 'a':\n {\n t+=4;\n break;\n }\n case 'b':\n {\n t+=5;\n break;\n }\n case 'c':\n {\n t+=6;\n break;\n }\n case 'd':\n {\n t+=3;\n break;\n }\n case 'e':\n {\n t+=2;\n break;\n }\n case 'f':\n {\n t+=1;\n break;\n }\n }\n }\n }\n printf(\"%d\", t);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d4c4d1b8f8a26cdee6424e55f264db35", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "int main(void) {\n int seats[6] = {4, 5, 6, 3, 2, 1};\n int row, seat;\n scanf(\"%d%c\", &row, &seat);\n row--;\n printf(\"%d\", row / 4 * 16 + n % 2 * 7 + seats[seat - 'a']);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7b7b3036df6fef0a59f711bc8d2e5973", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nusing namespace std;\nint main()\n{\n char c[1010],d[1100],e[1210],f[1010],ch,o[1010],p[1010];;\n int i,j,k,l=0,s=0,g=0,h=0;\n gets(c);gets(d);\n for(i=0;i\n#include \n\n#define ll long long\n\nchar seat[20];\n\nint colRet(char ch);\n\nint main(void)\n{\n ll len, rem = 0, lastDigits, ans = 0;\n char col;\n scanf(\"%s\", seat);\n \n len = (ll)strlen(seat);\n col = seat[len-1];\n \n for(ll i = 0; i < len - 1; i++)\n {\n rem *= 10;\n rem += seat[i] - '0';\n }\n \n ans = (rem / 4) * 16;\n \n lastDigits = rem % 4;\n \n if (lastDigits == 1 || lastDigits == 3)\n {\n ans += colRet(col);\n }\n else if (lastDigits == 2 || lastDigits == 4)\n {\n ans += 7 + colRet(col);\n }\n \n printf(\"%I64d\\n\", ans);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9e691a718c83284f6e5646678aeafafc", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tint i,serve=0,n;\n\tchar s[2];\n\tscanf(\"%s\",s);\n\tn=s[0]-'0';\n\tserve=(n-1)/4*16;\n\tif(n%2==1){\n\t\tif(s[1]=='d'||s[1]=='e'||s[1]=='f'){\n\t\t\n\t\tserve=serve+'g'-s[1];\n}\nelse{\n\tserve=serve+4+s[1]-'a';\n}\n\t}\n\telse{\n\t\tif(s[1]=='d'||s[1]=='e'||s[1]=='f'){\n\t\t\n\t\tserve=serve+'g'-s[1]+7;\n}\nelse{\n\tserve=serve+s[1]-'a'+11;\n}\n\t}\n\tprintf(\"%d\",serve);\n\t\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ad067494d66ec6051da5dd472e24c5a2", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0} {"lang": "GNU C", "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 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "1baecbba628ebde489d4db31262d7482", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "266e0fe7962e88396e1adb2171423a01", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0} {"lang": "GNU C", "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#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 int a,b,sum,max=0,p,x,y,ans,i,c;\n scanf(\"%d %d\",&a,&b);\n x=a;\n y=b;\n while(a)\n {\n p=a%10;\n if(p>max)\n max=p;\n a=a/10;\n }\n while(b)\n {\n p=b%10;\n if(p>max)\n max=p;\n b=b/10;\n }\n max++;\n i=0;\n a=0;\n while(x)\n {\n c=x%10;\n a=a+(c*ceil(pow(max,i)));\n i++;\n x=x/10;\n }\n b=0;\n i=0;\n while(y)\n {\n c=y%10;\n b=b+(c*ceil(pow(max,i)));\n i++;\n y=y/10;\n }\n sum=a+b;\n ans=ceil(log(sum+1)/log(max));\n printf(\"%d\\n\",ans);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d5051b6cbfd88df93c5902ff1b0dd3eb", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "\nint pow(int a,int b)\n{\n int ans=1,i;\n for(i=0;i0)\n {\n ans+=pow(base,i)*(a%10); \n // printf(\"ans=%d \",pow(base,i)); \n a/=10;\n i++;\n }\n i=0;\n while(b>0)\n {\n ans+=(int)pow(base,i)*(b%10); \n //printf(\"ans=%d \",ans); \n b/=10;\n i++;\n }\n //printf(\"ans=%d \",ans); \n return ans;\n}\nint leng(int n,int base)\n{\n int c=0;\n if(n>9)\n return 0;\n else\n return 1;\n return c;\n}\n \nint m(int a)\n{\n int ma=0;\n while(a!=0)\n {\n if(mam(b)?(m(a)+1):(m(b)+1);\n //printf(\"%d\",s);\n for(i=s;i<=16;i++)\n {\n n=sum(a,b,i);\n // printf(\"%dsdssd\",n);\n if(ans\n#include\nint main()\n{\n long long int max=0,a=0,x,y,sum=0,s_1=0,s_2=0,b=0,r=0,cary=0,num=0,i;\n double d;\n scanf(\"%lld %lld\",&x,&y);\n s_1=x;\n while(s_1!=0)\n {\n s_2=(s_1%10);\n s_1=(s_1/10);\n if(max<=s_2)max=s_2;\n else continue;\n }\n s_1=y;\n while(s_1!=0)\n {\n s_2=(s_1%10);\n s_1=(s_1/10);\n if(max<=s_2)max=s_2;\n else continue;\n }\n for(i=1;((x!=0)||(y!=0));i++)\n {\n a=(x%10);\n b=(y%10);\n x=(x/10);\n y=(y/10);\n sum=(a+b)+cary;\n cary=sum/(max+1);\n r=(sum%(max+1));\n num=(num*10)+r;\n }\n if(cary!=0)printf(\"%lld\",i);\n else printf(\"%lld\",(i-1));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "131850ac11c1e2879748322a930780c3", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint max(int a, int b) {\n\treturn a >= b ? a : b;\n}\n\nint main(void) {\n\tchar a[5];\n\tchar b[5];\n\t\n\tscanf(\"%s%s\", &a, &b);\n\t\n\tint a_length = strlen(a);\n\tint b_length = strlen(b);\n\t\n\tint max_digit = 0;\n\tint i;\n\tfor (i = 0; i < a_length; i++) {\n\t\ta[i] -= '0';\n\t\tmax_digit = max(max_digit, a[i]);\n\t}\n\t\n\tfor (i = 0; i < b_length; i++) {\n\t\tb[i] -= '0';\n\t\tmax_digit = max(max_digit, b[i]);\n\t}\n\t\n\tint base = max_digit + 1;\n\t\n\ti = a_length - 1;\n\tint j = b_length - 1;\n\tint carry = 0;\n\tint sum;\n\twhile (i >= 0 || j >= 0) {\n\t\tsum = 0;\n\t\tif (i >= 0) { sum += a[i]; i--; }\n\t\tif (j >= 0) { sum += b[j]; j--; }\n\t\tsum += carry;\n\t\tcarry = sum / base;\n\t}\n\t\n\tint result = max(a_length, b_length);\n\tif (carry) result++;\n\t\n\tprintf(\"%d\\n\", result);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8047cf27297ec6c32c00ac6b153a17ba", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint main()\n{\n int a[101]={0},b[101]={0},ans[101]={0};\n int i,j,k,temp,la,lb,max;\n char t[101]={'0'};\n k=0;\n scanf(\"%s\",t);\n max=0;\n la=strlen(t);\n for (i=la;i>=1;i--)\n {\n a[la-i+1]=t[i-1]-'0';\n if (a[la-i+1]>max) max=a[la-i+1];\n }\n scanf(\"%s\",t);\n lb=strlen(t);\n for (i=lb;i>=1;i--)\n {\n b[lb-i+1]=t[i-1]-'0';\n if (b[lb-i+1]>max) max=b[lb-i+1];\n }\n max++;\n if (la>lb) k=la;\n else k=lb;\n temp=0;\n for (i=1;i<=k;i++)\n {\n ans[i]=a[i]+b[i]+temp;\n temp=ans[i] / max;\n ans[i]=ans[i] % max;\n }\n if (temp!=0) {k++; ans[k]=temp;}\n printf(\"%d\",k);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "de8a23712d964681b8c59f672e2a818a", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\n\nint main() {\n\tlong long n;\n\twhile (scanf(\"%lld\", &n) == 1)\n\t\tprintf(\"%lld\\n\", n-1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8454f4563284aa81ef69b2fad656234c", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tint a,b,c,k;\n\tlong long int n;\n\tcin>>n;\n\ta=1;\n\tb=1;\n\tc=0;\n\tk=a+b;\n\twhile(k<=n)\n\t{ c++;\n\t a=b;\n\t \tb=k;\n\t k=a+b;\t\n\t}\n cout<<(c)<\n\nint main ()\n{\n int i, a[120], A[120], n;\n A[1] = 2;\n A[2] = 3;\n scanf (\"%d\", &n);\n for (int i = 3; i < i++)\n {\n A[i] = a[i-1] + a[i-2];\n }\n for (int i = 1; i < i++)\n {\n if (A[i] > n)\n {\n printf (\"%d\\n\", i-1);\n break;\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "500700d1be79fcd10f36f7272111bb78", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nusing namespace std;\n\ntypedef long long LL;\nll a[120];\n\nint main ()\n{\n ll n;\n A[1] = 2;\n A[2] = 3;\n scanf (\"%lld\", &n);\n for (int i = 3; i < i++)\n {\n A[i] = a[i-1] + a[i-2];\n }\n for (int i = 1; i < i++)\n {\n if (A[i] > N)\n {\n printf (\"%d\\n\", i-1);\n break;\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "82ce9e9f555f95d429434c013a3f85bc", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nusing namespace std;\nint main()\n{\n\tint a,b,c,k;\n\tlong n;\n\tcin>>n;\n\ta=1;\n\tb=1;\n\tc=0;\n\tk=a+b;\n\twhile(k<=n)\n\t{ c++;\n\t a=b;\n\t \tb=k;\n\t k=a+b;\t\n\t}\n cout<<(c)<\n#include\nstruct string{\n\tchar str[1000];\n\tint count[1000];\n};\nint main()\n{\n\tstruct string s;\n\tscanf(\"%s\",&s.str);\n\tint i,j,k;\n\tscanf(\"%d\",&k);\n\tint len=strlen(s.str);\n\tfor(i=0;i\n#include\n#include\n#include\n#define N 205\nint main(void)\n{\n int i,j,print,star=0,count1=0,count2=0,length;\n bool yn[N];\n char line[N];\n gets(line);\n scanf(\"%d\",&length);\n for(i=0; i='a'&&line[i]<='z')\n count1++;\n else\n count2++;\n if(line[i]=='*')\n star++;\n }\n if(lengthcount1&&!star)\n printf(\"Impossible\\n\");\n else\n {\n if(length>count1)\n {\n print=length-count1;\n for(i=0; i='a'&&line[i]<='z')\n printf(\"%c\",line[i]);\n if(line[i]=='?')\n i++;\n else\n while(print--)\n printf(\"%c\",line[i-1]);\n }\n printf(\"\\n\");\n }\n if(count1==length)\n {\n for(i=0; i='a'&&line[i]<='z')\n printf(\"%c\",line[i]);\n printf(\"\\n\");\n }\n else\n {\n print=count1-length;\n for(i=0; line[i]; i++)\n {\n if(line[i]=='?'||line[i]=='*')\n yn[i]=false;\n if((line[i]=='?'||line[i]=='*')&&print)\n {\n yn[i-1]=false;\n print--;\n }\n }\n for(i=0; line[i]; i++)\n if(yn[i])\n printf(\"%c\",line[i]);\n printf(\"\\n\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb3eda5cb0fc55b1a9f470b36255c061", "src_uid": "90ad5e6bb5839f9b99a125ccb118a276", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n#define N 205\nint main(void)\n{\n int i,j,print,star=0,count1=0,count2=0,length;\n bool yn[N];\n char line[N];\n gets(line);\n scanf(\"%d\",&length);\n for(i=0; i='a'&&line[i]<='z')\n count1++;\n else\n count2++;\n if(line[i]=='*')\n star++;\n }\n if(lengthcount1&&!star)\n printf(\"Impossible\\n\");\n else\n {\n if(length>count1)\n {\n print=length-count1;\n for(i=0; i='a'&&line[i]<='z')\n printf(\"%c\",line[i]);\n else if(line[i]=='?')\n i++;\n else\n while(print--)\n printf(\"%c\",line[i-1]);\n }\n printf(\"\\n\");\n }\n if(count1==length)\n {\n for(i=0; i='a'&&line[i]<='z')\n printf(\"%c\",line[i]);\n printf(\"\\n\");\n }\n else\n {\n print=count1-length;\n for(i=0; line[i]; i++)\n {\n if(line[i]=='?'||line[i]=='*')\n yn[i]=false;\n if((line[i]=='?'||line[i]=='*')&&print)\n {\n yn[i-1]=false;\n print--;\n }\n }\n for(i=0; line[i]; i++)\n if(yn[i])\n printf(\"%c\",line[i]);\n printf(\"\\n\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae0020b976f77832f3aa956a0a50acd3", "src_uid": "90ad5e6bb5839f9b99a125ccb118a276", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N 200\n\nint main() {\n\tstatic char s[N + 1], t[N + 1];\n\tint n, k, i, x, l;\n\n\tscanf(\"%s%d\", s, &k);\n\tn = strlen(s);\n\tx = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] != '?' && s[i] != '*')\n\t\t\tx++;\n\tl = 0;\n\tif (x == k) {\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif (s[i] != '?' && s[i] != '*')\n\t\t\t\tt[l++] = s[i];\n\t} else if (x < k) {\n\t\tint h;\n\n\t\th = k - x;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif (s[i] == '*')\n\t\t\t\twhile (h--)\n\t\t\t\t\tt[l++] = s[i - 1];\n\t\t\telse if (s[i] != '?')\n\t\t\t\tt[l++] = s[i];\n\t\tif (h > 0) {\n\t\t\tprintf(\"Impossible\\n\");\n\t\t\treturn 0;\n\t\t}\n\t} else {\n\t\tint h, l;\n\n\t\th = x - k;\n\t\tl = 0;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif (i < n - 1 && s[i + 1] == '?' && h > 0) {\n\t\t\t\th--;\n\t\t\t} else if (s[i] != '?' && s[i] != '*')\n\t\t\t\tt[l++] = s[i];\n\t\tif (h > 0) {\n\t\t\tprintf(\"Impossible\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", t);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e9298fd9f2394c33c2d81585523ea45d", "src_uid": "90ad5e6bb5839f9b99a125ccb118a276", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main ()\n{\n\tchar s[200];\n\tint n;\n\tint i,sqn,t=0,r,t1=0,f=0,j,num,num1;\n\tscanf(\"%s\",s);\n\tscanf(\"%d\",&n);\n sqn=strlen(s);\n\tfor(i=0;i0)\n\t\t{\n\t\t\tnum=n-r;\n\t\t\tfor(i=0;i\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd0e5fbfaab2ddbbcbd8e4afa7cd6dbe", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \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\n#define SIZE 200000\n\nint factorial(int n)\n{\n if(n == 1) return 1;\n return n*factorial(n-1);\n}\n\nint countArr(int arr[], int size, int max)\n{\n int result = 0;\n int m, i;\n\n for(m=size-1;m\n#define SIZE 200000\n\n__int64 factorial(int n)\n{\n if(n == 0) return 1;\n if(n == 1) return 1;\n return n*factorial(n-1);\n}\n\n__int64 countArr(int size, int max)\n{\n __int64 result = 0;\n __int64 temp;\n int m, i;\n\n for(m=size-1;m<=max;m++) //middle's min is size-1 \n {\n temp = 0;\n for(i=0;i\n#define MOD 998244353\n\n__int64 factorial(int n)\n{\n __int64 i;\n __int64 result = 1;\n \n if(n == 0 || n == 1) return 1;\n\n for(i=2;i<=n;i++)\n {\n result *= i;\n }\n return result;\n}\n\n__int64 countArr(int size, int max)\n{\n __int64 result = 0;\n __int64 temp;\n __int64 m, i;\n\n for(m=size-1;m<=max;m++) //middle's min is size-1 \n {\n temp = 0;\n for(i=0;i\n#include\nint main()\n{\n int i,j,k,len,count=0;\n char str[2][101];\n str[0][100]='X';\n str[1][100]='X';\n for(i=0;i<2;i++)\n {scanf(\"%s \",str[i]);\n //printf(\"%s\",str[i]);\n //printf(\"\\n\");\n }\n len=strlen(str[0]);\n for(i=0;i\n#include \nint main()\n{\n char a[101], b[101];\n int x = 0, i ;\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n \n for(i=0;i\n#include \n#include \n#include \n#include \n#include \n\n#define fr(i, a, b) for((i) = (a) ; (i) < (b) ; (i)++)\n#define frr(i, a, b) for((i) = (a) ; (i) >= (b) ; (i)--)\n\ntypedef long long ll;\ntypedef unsigned long long ull;\nint i, j, k, m;\n\nchar a[3][105];\n\nint c1(int st) {\n\tint ret = a[0][st] == '0' && a[0][st+1] == '0' && a[1][st] == '0' && a[1][st+1] == 'X';\n\tif(ret) {\n\t\ta[0][st] = a[0][st+1] = a[1][st] = 'X';\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nint c2(int st) {\n\tint ret = a[0][st] == '0' && a[0][st+1] == '0' && a[1][st] == 'X' && a[1][st+1] == '0';\n\tif(ret) {\n//\t\tputs(a[0]);\n//\t\tputs(a[1]);\n\t\ta[0][st] = a[0][st+1] = a[1][st] = a[1][st+1] = 'X';\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nint c3(int st) {\n\tint ret = a[0][st] == '0' && a[0][st+1] == 'X' && a[1][st] == '0' && a[1][st+1] == '0';\n\tif(ret) {\n//\t\tputs(a[0]);\n//\t\tputs(a[1]);\n\t\ta[0][st] = a[0][st+1] = a[1][st] = a[1][st+1] = 'X';\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nint c4(int st) {\n\tint ret = a[0][st] == 'X' && a[0][st+1] == '0' && a[1][st] == '0' && a[1][st+1] == '0';\n\tif(ret) {\n//\t\tputs(a[0]);\n//\t\tputs(a[1]);\n\t\ta[0][st] = a[0][st+1] = a[1][st] = a[1][st+1] = 'X';\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nint c5(int st) {\n\tint ret = a[0][st] == '0' && a[0][st+1] == '0' && a[1][st] == '0' && a[1][st+1] == '0';\n\tif(ret) {\n//\t\tputs(a[0]);\n//\t\tputs(a[1]);\n\t\ta[0][st] = a[0][st+1] = a[1][st] = 'X';\n\t\treturn ret;\n\t}\n//\tputs(a[0]);\n//\tputs(a[1]);\n\treturn 0;\n}\n\nint main() {\n//\tfreopen(\"input.in\", \"r\", stdin);\n\tscanf(\"%s\", a[0]);\n\tscanf(\"%s\", a[1]);\n\tint n = strlen(a[0]);\n\tint res = 0;\n\tfr(i, 0, n)\n\t\tif(c1(i) || c2(i) || c3(i) || c4(i) || c5(i)) res++;\n//\tputs(a[0]);\n//\t\tputs(a[1]);\n\tprintf(\"%d\", res);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "98c0d16b181bba196c212fe038bd3d20", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0} {"lang": "GNU C", "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 \nchar s[5][105];\nint xx[4][3]={{0,1,1},{0,1,1},{0,0,1},{0,0,1}},yy[4][3]={{0,0,1},{1,0,1},{0,1,1},{0,1,0}},\n\ti,j,a[5][105],l,ans;\n\nvoid dfs(int x,int y)\n{\n\tint i,j,f;\n\t\n\tif (y+(l-x)/2<=ans) return;\n\tif (x>=l) \n\t{\n\t\tans=y>ans ? y : ans;\n\t\treturn;\n\t}\n\tfor (i=0;i<4;i++)\n\t{\n\t\tfor (j=f=0;j<3;j++)\n\t\tif (a[xx[i][j]][x+yy[i][j]]||x+yy[i][j]>=l) \n\t\t{\n\t\t\tf=1;\n\t\t\tbreak;\n\t\t}\n\t\tif (!f)\n\t\t{\n\t\t\tfor (j=0;j<3;j++) a[xx[i][j]][x+yy[i][j]]=1;\n\t\t\tdfs(x+1,y+1);\n\t\t\tfor (j=0;j<3;j++) a[xx[i][j]][x+yy[i][j]]=0;\n\t\t}\n\t}\n\tdfs(x+1,y);\n}\n\nint main()\n{\n\tscanf(\"%s%s\",s[0],s[1]);\n\tl=strlen(s[0]);\n\tfor (j=ans=0;j<2;j++)\n\tfor (i=0;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nchar s[5][105];\nint xx[4][3]={{0,1,1},{0,1,1},{0,0,1},{0,0,1}},yy[4][3]={{0,0,1},{1,0,1},{0,1,1},{0,1,0}},\n\ti,j,a[5][105],l,ans;\n\nvoid dfs(int x,int y)\n{\n\tint i,j,f;\n\t\n\t\n\tif (x>=l) \n\t{\n\t\tans=y>ans ? y : ans;\n\t\treturn;\n\t}\n\tfor (i=0;i<4;i++)\n\t{\n\t\tfor (j=f=0;j<3;j++)\n\t\tif (a[xx[i][j]][x+yy[i][j]]||x+yy[i][j]>=l) \n\t\t{\n\t\t\tf=1;\n\t\t\tbreak;\n\t\t}\n\t\tif (!f)\n\t\t{\n\t\t\tfor (j=0;j<3;j++) a[xx[i][j]][x+yy[i][j]]=1;\n\t\t\tdfs(x+1,y+1);\n\t\t\tfor (j=0;j<3;j++) a[xx[i][j]][x+yy[i][j]]=0;\n\t\t}\n\t}\n\tdfs(x+1,y);\n}\n\nint main()\n{\n\tscanf(\"%s%s\",s[0],s[1]);\n\tl=strlen(s[0]);\n\tfor (j=ans=0;j<2;j++)\n\tfor (i=0;i\n# include \n# include \n# include \n\nint main ()\n{ \t\n\tint n,x,pos;\n\tconst int mod=1e9+7;\n\tscanf(\"%d %d %d\",&n,&x,&pos);\n int l=0,r=n;\n int min=x-1,max=n-x;\n int mid;\n int num=1;\n while (l\n#include \n#include \n#include \n#include \n\ntypedef uint64_t uint64; typedef uint32_t uint32;\ntypedef int64_t int64; typedef int32_t int32;\n\n#define finc(i,a,b) for(int32 i=(a);i<=(b);i++)\n#define fdec(i,a,b) for(int32 i=(b)+1;i-->(a);)\n#define in(i,bits) scanf(\"%\"PRId##bits\"\",&i)\n#define uin(i,bits) scanf(\"%\"PRIu##bits\"\",&i)\n#define out(i,bits,c) printf(\"%\"PRId##bits\"%c\",i,c)\n#define uout(i,bits,c) printf(\"%\"PRIu##bits\"%c\",i,c)\n#define end '\\n'\n\n#define mod (int64)(1e9+7)\nint64 C[1001][1001], A[1001];\nint main(void)\n{\n\tC[0][0] = 1;\n\tfinc(i, 1, 1000)\n\t{\n\t\tC[i][0] = 1;\n\t\tC[i][1] = i;\n\t}\n\tfinc(i, 2, 1000)\n\t{\n\t\tfinc(j, 2, i)\n\t\t\tC[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;\n\t}\n\tA[0] = 1, A[1] = 1;\n\tfinc(i, 2, 1000)\n\t\tA[i] = (A[i - 1] * i) % mod;\n\n\tint32 n, x, index;\n\tin(n, 32); in(x, 32); in(index, 32);\n\n\tint32 totalup = n - x, totaldown = x - 1;\n\tint32 cup = 0, cdown = 0;\n\tint32 l = 0, r = n - 1;\n\twhile (l index)\n\t\t{\n\t\t\tcdown++;\n\t\t\tr = mid;\n\t\t}\n\t}\n\tint64 a = (C[totaldown][cdown] * A[cdown]) % mod;\n\tint64 b = (C[totalup][cup] * A[cup]) % mod;\n\tint64 ans = (((a * b) % mod) * A[n - 1 - cup - cdown]) % mod;\n\tout(ans, 64, end);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4f1070db2f99bd47e8b8a4c59d620e53", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n#include \n#include \n#include \n#include \n\ntypedef uint64_t uint64; typedef uint32_t uint32;\ntypedef int64_t int64; typedef int32_t int32;\n\n#define finc(i,a,b) for(int32 i=(a);i<=(b);i++)\n#define fdec(i,a,b) for(int32 i=(b)+1;i-->(a);)\n#define in(i,bits) scanf(\"%\"PRId##bits\"\",&i)\n#define uin(i,bits) scanf(\"%\"PRIu##bits\"\",&i)\n#define out(i,bits,c) printf(\"%\"PRId##bits\"%c\",i,c)\n#define uout(i,bits,c) printf(\"%\"PRIu##bits\"%c\",i,c)\n#define end '\\n'\n\n#define mod (int64)(1e9+7)\nint64 C[1001][1001], A[1001];\nint main(void)\n{\n\tC[0][0] = 1;\n\tfinc(i, 1, 1000)\n\t{\n\t\tC[i][0] = 1;\n\t\tC[i][1] = i;\n\t}\n\tfinc(i, 2, 1000)\n\t{\n\t\tfinc(j, 2, i)\n\t\t\tC[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;\n\t}\n\tA[0] = 1, A[1] = 1;\n\tfinc(i, 2, 1000)\n\t\tA[i] = (A[i - 1] * i) % mod;\n\n\tint32 n, x, index;\n\tin(n, 32); in(x, 32); in(index, 32);\n\n\tint32 totalup = n - x, totaldown = x - 1;\n\tint32 cup = 0, cdown = 0;\n\tint32 l = 0, r = n;\n\twhile (l index)\n\t\t{\n\t\t\tcdown++;\n\t\t\tr = mid;\n\t\t}\n\t}\n\tint64 a = (C[totaldown][cdown] * A[cdown]) % mod;\n\tint64 b = (C[totalup][cup] * A[cup]) % mod;\n\tint64 ans = (((a * b) % mod) * A[n - 1 - cup - cdown]) % mod;\n\tout(ans, 64, end);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "614e438fc802f6de1ee0e37918956505", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#define _CRT_SECURE_NO_WARNINGS\n\n#include \n#include \n#include \n#include \n#include \n\ntypedef uint64_t uint64; typedef uint32_t uint32;\ntypedef int64_t int64; typedef int32_t int32;\n\n#define finc(i,a,b) for(int32 i=(a);i<=(b);i++)\n#define fdec(i,a,b) for(int32 i=(b)+1;i-->(a);)\n#define in(i,bits) scanf(\"%\"PRId##bits\"\",&i)\n#define uin(i,bits) scanf(\"%\"PRIu##bits\"\",&i)\n#define out(i,bits,c) printf(\"%\"PRId##bits\"%c\",i,c)\n#define uout(i,bits,c) printf(\"%\"PRIu##bits\"%c\",i,c)\n#define end '\\n'\n\n#define mod (int64)(1e9+7)\nint64 C[1001][1001], A[1001];\nint main(void)\n{\n\tC[0][0] = 1;\n\tfinc(i, 1, 1000)\n\t{\n\t\tC[i][0] = 1;\n\t\tC[i][1] = i;\n\t}\n\tfinc(i, 2, 1000)\n\t{\n\t\tfinc(j, 2, i)\n\t\t\tC[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;\n\t}\n\tA[0] = 1, A[1] = 1;\n\tfinc(i, 2, 1000)\n\t\tA[i] = (A[i - 1] * i) % mod;\n\n\tint32 n, x, index;\n\tin(n, 32); in(x, 32); in(index, 32);\n\n\tint32 totalup = n - x, totaldown = x - 1;\n\tint32 cup = 0, cdown = 0;\n\tint32 left = 0, right = n - 1;\n\twhile (left != right)\n\t{\n\t\tint32 mid = (left + right) / 2;\n\t\tif (mid < index)\n\t\t{\n\t\t\tleft = mid + 1;\n\t\t\tcdown++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (mid > index)\n\t\t{\n\t\t\tright = mid;\n\t\t\tcup++;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tint64 a = (C[totaldown][cdown] * A[cdown]) % mod;\n\tint64 b = (C[totalup][cup] * A[cup]) % mod;\n\tint64 ans = (((a * b) % mod) * A[n - 1 - cup - cdown]) % mod;\n\tout(ans, 64, end);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "89eacc4b13f4269c81b5357b949f5afe", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "# include \n# include \n# include \n# include \n\nint main ()\n{ \t\n\tlong long n,x,pos;\n\tconst long long mod=1e9+7;\n\tscanf(\"%d %d %d\",&n,&x,&pos);\n long long l=0,r=n;\n long long min=x-1,max=n-x;\n long long mid;\n long long num=1;\n while (l= pi){\n\t\tstep -= pi;\n\t\tpi+=6;\n\t\tmpos.x+=2;\n\t\tst++;\n\t\t//printf(\"%llu %llu\\n\", pi, step);\n\t}\n\t//printf(\"%llu %llu %llu\\n\", pi, step, st);\n\t//printf(\"*) %ld %ld \\n\", mpos.x, mpos.y);\n\t//printf(\"%s\\n\", \"yes\");\n\tunsigned long int rad = mpos.x;\n\t/*while(step > 0){\n\t\tstep--;\n\n\t\tif( (mpos.x > 0) && (mpos.y >= 0) ){\n\t\t\tmpos.x -=1;\n\t\t\tmpos.y +=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif( (mpos.x < 0) && (mpos.y >= 0) ){\n\t\t\tmpos.x -=1;\n\t\t\tmpos.y -=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif( (mpos.x > 0) && (mpos.y < 0) ){\n\t\t\tmpos.x +=1;\n\t\t\tmpos.y +=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif( (mpos.x < 0) && (mpos.y < 0) ){\n\t\t\tmpos.x +=1;\n\t\t\tmpos.y -=2;\n\t\t\tcontinue;\n\t\t}\n\t}*/\n\tst --;\n\tfor(int i = 0; (i < st)&&(step); i++, step--){\n\t\tmpos.x -=1;\n\t\tmpos.y +=2;\n\t}\n\t//printf(\"1) %ld %ld \\n\", mpos.x, mpos.y);\n\tfor(int i = 0; (i\n#include \n\nlong long min(long long a, long long b) { return a < b ? a : b; }\n\nint main() {\n\tlong long n, m, k, x, y;\n\n\tscanf(\"%lld\", &n);\n\t/* 6 * k * (k + 1) / 2 = 3 * k * (k + 1); */\n\tk = sqrt(n / 3.0);\n\twhile (3LL * (k + 1) * (k + 2) <= n)\n\t\tk++;\n\twhile (3LL * k * (k + 1) > n)\n\t\tk--;\n\tn -= 3 * k * (k + 1);\n\tx = k * 2, y = 0;\n\tk++;\n\tm = min(n, 1);\n\tn -= m, x += m, y += m * 2;\n\tm = min(n, k - 1);\n\tn -= m, x -= m, y += m * 2;\n\tm = min(n, k);\n\tn -= m, x -= m * 2;\n\tm = min(n, k);\n\tn -= m, x -= m, y -= m * 2;\n\tm = min(n, k);\n\tn -= m, x += m, y -= m * 2;\n\tm = min(n, k);\n\tn -= m, x += m * 2;\n\tm = min(n, k);\n\tn -= m, x += m, y += m * 2;\n\tprintf(\"%lld %lld\\n\", x, y);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "689e6d94aac510f3770052ce98605fcd", "src_uid": "a4b6a570f5e63462b68447713924b465", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \"stdio.h\"\nstruct pos{\n\tlong int x;\n\tlong int y;\n};\n\nunsigned long long s_n(unsigned long long n){\n\treturn 3*n*(n-1);\n}\n\nint main(){\n\tunsigned long long step;\n\tscanf(\"%llu\",&step);\n\n\tstruct pos mpos = {0,0};\n\t/*if(!(step%6)){\n\t\tmpos.x = -2;\n\t}*/\n\tunsigned long long b = 0;\n\tunsigned long long en = 64;\n\tunsigned long long piv = 0;\n\tunsigned long long st = 1;\n\twhile(s_n(en) < step){\n\t\tb = en;\n\t\ten = en*2;\n\t}\n\n\twhile((en-b)>1){\n\t\tpiv = b + (en-b)/2;\n\t\t//printf(\"%llu %llu %llu %llu %llu \\n\", b, piv, en, s_n(piv), step);\n\t\tif (s_n(piv)>step){\n\t\t\ten = piv;\n\t\t} else {\n\t\t\tb = piv;\n\t\t}\n\t}\n\n\t/*if(!(step%6)){\n\t\tmpos.x = -2;\n\t}\n\t\n\tunsigned long long pi = 0;\n\t//unsigned long long st = 1;\n\t\n\twhile ((step) >= pi){\n\t\tstep -= pi;\n\t\tpi+=6;\n\t\tst++;\n\t}\n\t/*if(st == en){\n\t\tprintf(\"%llu oK\\n\",st);\n\t} else {\n\t\tprintf(\"%llu nOk\\n\", st);\n\t}*/\n\tst = en;\n\tstep-= s_n(st-1);\n\tif(step == 0){\n\t\tmpos.x = -2;\n\t}\n\tmpos.x += (st-1)*2;\n\tst --;\n\tif(step>st){\n\t\tmpos.x -=st;\n\t\tmpos.y +=2*st;\n\t\tstep -= st;\n\t} else {\n\t\tmpos.x -=step;\n\t\tmpos.y +=2*step;\n\t\tstep = 0;\n\t}\n\n\tif(step>st){\n\t\tmpos.x -=2*st;\n\t\tstep -= st;\n\t} else {\n\t\tmpos.x -=2*step;\n\t\tstep = 0;\n\t}\n\n\tif(step>st){\n\t\tmpos.x -=st;\n\t\tmpos.y -=2*st;\n\t\tstep -= st;\n\t} else {\n\t\tmpos.x -=step;\n\t\tmpos.y -=2*step;\n\t\tstep = 0;\n\t}\n\n\tif(step>st){\n\t\tmpos.x +=st;\n\t\tmpos.y -=2*st;\n\t\tstep -= st;\n\t} else {\n\t\tmpos.x +=step;\n\t\tmpos.y -=2*step;\n\t\tstep = 0;\n\t}\n\n\tif(step>st){\n\t\tmpos.x +=2*st;\n\t\tstep -= st;\n\t} else {\n\t\tmpos.x +=2*step;\n\t\tstep = 0;\n\t}\n\n\tif(step>st){\n\t\tmpos.x +=st;\n\t\tmpos.y +=2*st;\n\t\tstep -= st;\n\t} else {\n\t\tmpos.x +=step;\n\t\tmpos.y +=2*step;\n\t\tstep = 0;\n\t}\n\n\tprintf(\"%ld %ld\", mpos.x, mpos.y);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ceb4b85e282e411c17cb838519a66cf", "src_uid": "a4b6a570f5e63462b68447713924b465", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\n#include\nint dir[6][2]={{-1,2},{-2,0},{-1,-2},{1,-2},{2,0},{1,2}};\nint main()\n{\n long long n,i;\n scanf(\"%lld\",&n);\n double x,y;\n double a;\n if(!n)\n printf(\"0 0\\n\");\n else\n { \n long long a=sqrt(n/3);\n for(;;++a)\n {\n if(a*(a+1)/2*6==n)\n {\n printf(\"%d %d\\n\",a*2,0);\n return 0;\n }\n if(a*(a+1)/2*6>n)\n {\n break;\n }\n }\n n-=(a*(a-1))*3;\n if(n==0)\n printf(\"%.0lld 0\\n\",2*(a-1));\n else{\n \n x=2*(a-1);y=0; //\u7b2ca\u5708\u7684\u8d77\u70b9 \n i=0; //i\u8bb0\u5f55\u79fb\u52a8\u51e0\u6b21 \n x+=1;y+=2;i++; \n\n if(i==n)\n {\n printf(\"%.lf %.lf\\n\",x,y);\n return 0;\n }\n n--;\n for(int k=0;k<6;++k)\n {\n long long t=(k<=0?a-1:a);\n if(n>=t)\n {\n x+=t*dir[k][0];\n y+=t*dir[k][1];\n n-=t;\n }\n else\n {\n x+=n*dir[k][0];\n y+=n*dir[k][1];\n break;\n }\n } \n printf(\"%.lf %.lf\\n\",x,y);\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9055f492c08c3ea676b95fe6fdae6546", "src_uid": "a4b6a570f5e63462b68447713924b465", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\t\nlong long n;\nlong long bisearch()\n{\n long long l=0,r=1e9,mid;\n while(l<=r)\n {\n mid=((l+r)>>1);\n if(3*mid*(mid+1)>n)r=mid-1;\n else l=mid+1;\n }\n return l;\n}\nint main()\n{\n\n\twhile(~scanf(\"%lld\",&n))\n\t{\n\t\tlong long p,q;\n\t\tif(n==0)\n\t\t{\n\t\t\tprintf(\"0 0\\n\");\n\t\t\tbreak;\n\t\t}\n\t\tlong long i=bisearch();\n//\t\tprintf(\"%lld\\n\",bisearch());\n//\t\tfor(long long i=1;;i++)\n//\t\t{\n//\t\t\tif(n>=i*6)\n//\t\t\t{\n//\t\t\t\tn-=i*6;\n//\t\t\t\tcontinue;\n//\t\t\t}\n//\t\t\telse\n//\t\t\t{\t\t\t\n//\t\t\t\tprintf(\"i==%d,n==%d,nMODi=%d\\n\",i,n,n/i);\n\t\t\t\tn-=3*(i-1)*i;\n\t\t\t\tif(n==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld 0\\n\",2*(i-1));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(ni && n<2*i)\n\t\t\t\t{\n\t\t\t\t\tn-=i;\n\t\t\t\t\tprintf(\"%lld %lld\\n\",1*i-2*n,2*i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n==2*i)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld %lld\\n\",-1*i,2*i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\n\t\t\t\telse if(n>2*i && n<3*i)\n\t\t\t\t{\n\t\t\t\t\tn-=2*i;\n\t\t\t\t\tprintf(\"%lld %lld\\n\",-1*i-n,2*i-2*n);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n==3*i)\t\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld 0\\n\",-2*i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n>3*i && n<4*i)\n\t\t\t\t{\n\t\t\t\t\tn-=3*i;\n\t\t\t\t\tprintf(\"%lld %lld\\n\",-2*i+n,0-2*n);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n==4*i)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld %lld\\n\",-1*i,-2*i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n>4*i && n<5*i)\n\t\t\t\t{\n\t\t\t\t\tn-=4*i;\n\t\t\t\t\tprintf(\"%lld %lld\\n\",-1*i+2*n,-2*i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n==5*i)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%lld %lld\\n\",1*i,-2*i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(n>5*i)\n\t\t\t\t{\n\t\t\t\t\tn-=5*i;\n\t\t\t\t\tprintf(\"%lld %lld\\n\",1*i+n,-2*i+2*n);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n//\t\t\t}\n//\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3720bdfd233528bde0a42cf5536e630c", "src_uid": "a4b6a570f5e63462b68447713924b465", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n long int k,p;\n scanf(\"%d %d\",&k,&p);\n int d[]={11,22,33,44,55,66,77,88,99,1001,1111,1221,1331,1441,1551,1661,1771,1881,1991,2002,2112,2222,2332,2442,2552,2662,2772,2882,2992,3003,3113,3223,3333,3443,3553,3663,3773,3883,3993,4004,4114,4224,4334,4444,4554,4664,4774,4884,4994,5005,5115,5225,5335,5445,5555,5665,5775,5885,5995,6006,6116,6226,6336,6446,6556,6666,6776,6886,6996,7007,7117,7227,7337,7447,7557,7667,7777,7887,7997,8008,8118,8228,8338,8448,8558,8668,8778,8888,8998,9009,9119,9229,9339,9449,9559,9669,9779,9889,9999};\n long int i,a=0;\n for(i=0;i\nusing namespace std;\nlong long calc(long long x) {\n long long ans = x;\n while (x) {\n ans = ans * 10 + x % 10;\n x /= 10;\n }\n return ans;\n}\nint main() {\n long long k, p, res = 0;\n cin >> k >> p;\n for (long long i = 1; i <= k; ++i) res = (res + calc(i)) % p;\n cout << res << endl;\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "32a51315793ccbb00798fa7280a8d17a", "src_uid": "00e90909a77ce9e22bb7cbf1285b0609", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#define INF 100005\nint a[INF];\nint main()\n{\n int k,p;\n while(scanf(\"%d %d\",&k,&p)!=EOF)\n {\n int i=11,j=1,t,l,count=0,mark=0;\n int sum=0;\n for(i=11;count!=k;i++)\n {\n t=i;mark=0;\n for(j=1;t!=0;j++)\n {\n a[j]=t%10;\n t=t/10;\n }\n l=j-1;\n for(j=1;j\n#include\nint palindrome(char *text) \n{\n for(char *right = text + strlen(text) - 1; text < right; text++, right--) \n {\n if(*text != *right) \n {\n return 0;\n }\n }\n return 1;\n}\n\nint main() {\n int i=10;\n int k,x,p;\n char c[1000];\n \n scanf(\"%d%d\",&k,&p);\n while(k>0)\n {\n Int m=(int) (floor (log10 (abs (i))) + 1);\n if (m%2==0)\n {\n sprintf(c,\"%d\",i);\n if (palindrome(c))\n {\n s=s+i;\n i++;}\n else if(m%2!=0)\n {\n i=i*10;\n }\n }\n k--;\n }\n s=s%p;\n printf(\"%d\",s);\n \n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e8319ed71dc08b82df394b2e42324b5a", "src_uid": "00e90909a77ce9e22bb7cbf1285b0609", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nint num[100005]={0},i=0,\nlong long sum=0;\nint main()\n{\n\tfor (i = 11; i < 100002; ++i)\n\t{\n\t\tint count=0;\n\t\tint temp=i;\n\t\tint rev=0,rem;\n\t\twhile (temp!=0)\n\t\t{\n\t\t\trem=temp%10;\n\t\t\trev=rev*10+rem;\n\t\t\ttemp/=10;\n\t\t\tcount++;\n\t\t}\n\t\tif (rev==i && count%2==0)\n\t\t{\n\t\t\tnum[i]=1;\n\t\t\t//printf(\"%d\\n\",i);\n\t\t}\n\t}\n\tlong long int k,p,count1=0;\n\tscanf(\"%lld %lld\",&k,&p);\n\tfor (i = 1; i <= 100000 && count1\nint main()\n{\n int x1,y1,x2,y2,x3,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n printf(\"3\");\n printf(\"%d %d\",x1+x2-x3,y1+y2-y3);\n printf(\"%d %d\",x1+x3-x2,y1+y3-y2);\n printf(\"%d %d\",x3+x2-x1,y3+y2-y1);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "382e21faff630676d22df15524ea3c10", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(void)\n{\nint x[3],y[3];\nint a[3],b[3];\nint i;\nfor(i=0;i<3;i++)\nscanf(\"%d%d\",&x[i],&y[i]);\na[0]=x[0]-(x[1]-x[2]);\nb[0]=y[0]-(y[1]-y[2]);\na[1]=x[0]+(x[1]-x[2]);\nb[1]=y[0]+(y[1]-y[2]);\na[2]=x[2]-(x[0]-x[1]);\nb[2]=y[2]+(y[0]-y[1]);\nprintf(\"%d\\n\",3);\nfor(i=0;i<3;i++)\nprintf(\"%d %d\\n\",a[i],b[i]);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e24aa21997d1bcb7082360fb3242df2c", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \nstruct point {\n int x;\n int y;\n};\nstruct point point_subtract(struct point a, struct point b) {\n struct point res;\n res.x = a.x - b.x;\n res.y = a.y - b.y;\n}\nstruct point point_add(struct point a, struct point b) {\n res.x = a.x + b.x;\n res.y = a.y + b.y;\n}\nvoid print_point(struct point a) {\n printf(\"%d %d\", a.x, a.y);\n}\nint main(void) {\n struct point a, b, c;\n struct point d[3];\n scanf(\"%d %d\\n%d %d\\n%d %d\", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y);\n d[0] = point_add(point_subtract(a, c), b);\n d[1] = point_add(point_subtract(b, a), c);\n d[2] = point_add(point_subtract(a, b), c);\n printf(\"3\");\n for(int i = 0; i < 3; i++) {\n printf(\"\\n\");\n print_point(d[i]);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f8004dce510bbc06df4164d6e2960488", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\n\nint main (){\n inti;\n int x[3],y[3];\n for(i=0;i<3;i++)\n scanf(\"%d%d\",&x[i],&y[i]);\n printf(\"3\\n\");\n printf(\"%d \",x[0]+x[1]-x[2]);\n printf(\"%d\\n\",y[0]+y[1]-y[2]);\n printf(\"%d \",x[0]-x[1]+x[2]);\n printf(\"%d\\n\",y[0]-y[1]+y[2]);\n printf(\"%d \",x[2]+x[1]-x[0]);\n printf(\"%d\\n\",y[2]+y[1]-y[0]);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1014489be044b2778ee1c2b8175739a", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nvoid main()\n{\n int x1,y1,x2,y2,x3,y3 ;\n printf(\"1 \");\n scanf(\"%d %d\",&x1,&y1);\n do\n {\n printf(\"2 \");\n scanf(\"%d %d\",&x2,&y2);\n }while(((x2==x1)&&(y2==y1)));\n int m=(y2-y1)/(x2-x1);\n int p=y1-x1*m;\n\n do\n {\n printf(\"3 \");\n scanf(\"%d %d\",&x3,&y3);\n }while(((x3==x1)&&(y3==y1))||((x2==x3)&&(y2==y3))||(y3==m*x3+p));\nint x4,y4,k;\nk=3;\nprintf(\"%d\\n\",k);\nint dx,dy;\ndx=x3-x2;\ndy=y3-y2;\ny4=y1+dy;\nx4=x1+dx;\nprintf(\"%d %d\\n\",x4,y4);\ndx=x2-x1;\ndy=y2-y1;\ny4=y3+dy;\nx4=x3+dx;\nprintf(\"%d %d\\n\",x4,y4);\ndx=x1-x3;\ndy=y1-y3;\ny4=y2+dy;\nx4=x2+dx;\nprintf(\"%d %d\",x4,y4);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ad5dcf1f45d004723f3626eb72dae733", "src_uid": "7725f9906a1b87bf4e866df03112f1e0", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nint main()\n{\n int arr[100];\n int n,m,d;\n\n scanf(\"%d %d\",&n,&d);\n\n for(int i = 0 ; i < n; i++)\n scanf(\"%d\",&arr[i]);\n\n scanf(\"%d\",&m);\n\n sort(arr, arr+n);\n\n int result = 0;\n for (int i = 0; i < min(n, m); i++)\n result += arr[i];\n\n if (m > n)\n result -= (m-n)*d;\n\n printf(\"%d\\n\",result);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "854191e1b2a72bda0b1d62b5780f23c4", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nvoid sorting(int *costs, int num)\n{\n int i,j;\n for(i=0;i= guest){\n for(i=0;i\n#include\n\nint cmpfunc(const void* a,const void* b){\n\nreturn ( *(int*)a- *(int*)b );\n}\nint main(){\nint n,d,a[100],m,profit,sum,i;\nscanf(\"%d %d\",&n,&d);\nfor(i=0;in) {\nsum=0;\nfor(i=0;i\n\nint main()\n{\n int n,d;\n scanf(\"%d%d\",&n,&d);\n int a[n],i,sum=0;\n for(i=0;i=n)\n printf(\"%d\",sum-(m-n)*d);\n else\n {\n sum=0\n for(i=0;i\n#include \n\nint main (){\n\n\n int n,d,m;\n int i;\n\n\n scanf (\"%i %i\", &n, &d);\n\n\n int g[110];\n for (i=0;i n){\n p = p - g[i];\n }\n else {\n p = p + g[i];\n }\n }\n\n printf (\"%i\", p);\n\n\n\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "669627dff7e7b0176f6485643328f13a", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nchar s[101];\nint k, n, i, j, x, ok[30];\n\nvoid read(){\n\tscanf(\"%d%s\", &k, s);\n}\n\nint process(){\n\tn = strlen(s);\n\tx=n/2;\n\tfor(i=0, j=n-1;i<=x;i++, j--){\n\t\tif(s[i]=='?' && s[j]!='?')s[i]=s[j];\n\t\telse if(s[j]=='?' && s[i]!='?')s[j]=s[i];\n\t\telse if(s[j] != s[i])return 0;\n\n\t\tok[s[i]-'a']=1;\n\t\tok[s[j]-'a']=1;\n\t}\n\tx+=n%2;--x;\n\tfor(i=k-1;x>=0&&i>=0;x--){\n\n\t\tif(s[x]=='?'){\n\t\t\twhile(i>0&&ok[i])--i;\n\t\t\ts[x]=s[n-x-1]='a'+i;\n\t\t\tok[s[x]-'a']=1;\n\t\t}\n\t}\n\tfor(i=0;i\n#include\nint main()\n{int i,j=0,n,l,t,b[26]={0},c[26]={0};char a[105]={'\\0'};\nscanf(\"%d\",&n);\nscanf(\"%s\",a);\nt=strlen(a);\n\nfor(i=0;i=0)\nfor(i=0;i<(t+1)/2;i++)\n{if(a[i]==a[t-1-i]&&a[i]=='?')\n{if(j>0)\n{\n a[i]='a';a[t-1-i]='a';j--;\n}\nelse\n{a[i]=c[l++]+97;a[t-1-i]=a[i];\n}}\nelse if(a[i]!=a[t-i-1])\n{\n if(a[i]=='?'||a[t-1-i]=='?')\n {if(a[i]=='?')\n a[i]=a[t-1-i];\n else\n {a[t-1-i]=a[i];}\n\n }\n else\n {V:\n printf(\"IMPOSSIBLE\");\n goto flag;\n }\n}\n}else\ngoto V;\nprintf(\"%s\",a);\nflag:\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "15eb9591f0571d88ec17d30ebcbc79cb", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\n\n\nvoid fun(char *str,int save,int flag[26],int k)\n{\n int counta = 0,p = 0,i,j;\n \n i = 0,j = strlen(str)-1;\n \n while(i<=j)\n {\n if(str[i]=='?' && str[j]=='?')\n {\n if(counta < save)\n {\n str[i] = 'a' , str[j] = 'a';\n \n if(i==j)\n counta++;\n \n else\n counta += 2;\n \n }\n \n else\n {\n for(;p\n#include \n\nint main()\n{\n int k, n, p = 0, q = 0, i, j;\n char s1[101], s2[102];\n int a[26] = {0};\n\n scanf(\"%d\", &k);\n\n scanf(\"%s\", s1);\n\n n = strlen(s1);\n\n for (i = 0; i < n; i++) {\n\t s2[n - i - 1] = s1[i];\n }\n\n for (i = 0; i < (n + 1) / 2; i++) {\n\t if (s1[i] == '?') {\n\t if (s2[i] == '?') {\n\t\t p++;\n\t } else {\n\t\t if (a[s2[i] - 'a']++ == 0) q++;\n\n\t\t s1[i] = s2[i];\n\t }\n\t } else {\n\t if (s2[i] == '?') {\n\t\t if (a[s1[i] - 'a']++ == 0) q++;\n\n\t\t s1[n - i - 1] = s1[i];\n\t } else {\n\t\t if (s1[i] == s2[i]) {\n\t\t\t if (a[s1[i] - 'a']++ == 0) q++;\n\t\t } else {\n\t\t\t puts(\"IMPOSSIBLE\");\n\n\t\t\t return 0;\n\t\t }\n\t }\n\t }\n }\n\n if (p + q < k) {\n\t puts(\"IMPOSSIBLE\");\n\n\t return 0;\n }\n\n for (i = 0; i < (n + 1) / 2; i++) {\n\t if (s1[i] == '?') {\n\t if (p + q > k) {\n\t\t s1[i] = s1[n - i - 1] = 'a';\n\n\t\t if (a[0]++ == 0) q++;\n\t } else {\n\t\t for (j = 0; j < 26; j++) {\n\t\t\t if (a[j] == 0) break;\n\t\t }\n\n\t\t s1[i] = s1[n - i - 1] = 'a' + j;\n\n\t\t a[j]++;\n\n\t\t q++;\n\t }\n\n\t p--;\n\t }\n }\n\n printf(\"%s\\n\", s1);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ed4796f6b9a8e18c36048c3be4001a42", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nchar s[101];\nint k, n, i, j, x;\nbool ok[30];\n\nvoid read(){\n\tscanf(\"%d%s\", &k, s);\n}\n\nint process(){\n\tn = strlen(s);\n\tx=n/2;\n\tfor(i=0, j=n-1;i=0&&i>=0;x--){\n\t\t\n\t\tif(s[x]=='?'){\n\t\t\twhile(i>0&&ok[i])--i;\n\t\t\ts[x]=s[n-x-1]='a'+i;\n\t\t\tok[s[x]-'a']=1;\n\t\t}\n\t}\n\tfor(i=0;i\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "1489381ae2f403699360f8e3e6f45dd3", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "719717ae3677f619c8f7ab88ffe89d0b", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "14bbb4f99d789bd863a33c931b563d45", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#define LiangJiaJun main\nusing namespace std;\nint n,m,k,ans=1,Reduc_;\n\nint LiangJiaJun(){\n scanf(\"%d%d%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(\"%d\\n\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "171efdad8aaa23348b5406f40b0f0e75", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "\n//#include \n#include \n#include \n#include \n#define PI 3.14159\n#define maxx 640\n#define maxy 480\nmain()\n{int i;\n char c;\n init();\n draw();\n c=getch();\n}\n\ninit()\n/*\ufffd\ufffd\u02bc\ufffd\ufffd\u037c\ufffd\ufffd\u03f5\u0373\ufffd\ufffd\ufffd\ufffd*/\n{int gdriver=DETECT,gmode;\n initgraph(&gdriver,&gmode,\"c:\\\\tc\\\\bgi\"); /*\u05e2\ufffd\ufffd\u02f4\ufffd\ufffd\ufffd\u00b7\ufffd\ufffd*/\n setbkcolor(1);\n sky();\n return;\n}\nsky()\n{int x,y,i;\n for(i=1;i<=500;i++)\n {x=rand()%640;y=rand()%300;\n putpixel(x,y,15);\n putpixel(x+1,y,15);\n }\n for(i=1;i<=200;i++)\n {x=rand()%640;y=300+rand()%100;\n putpixel(x,y,15);\n }\nreturn;\n}\n\ndraw()\n{int i,j,k,x,y,dy;\n setfillstyle(1,7);\nfor(i=1;i<=10;i++)\n {setlinestyle(3,0,3);\n x=100+rand()%400;dy=20+rand()%20;\n for(k=1000;k>=500;k-=100)\n {sound(k);delay(3000);}\n nosound();\n for(j=1;j<=10;j++)\n {setcolor(i%16);\n line(x,maxy-(j-1)*dy,x,maxy-j*dy);\n delay(10000);\n setcolor(0);\n line(x,maxy-(j-1)*dy,x,maxy-j*dy);\n }\n for(k=6000;k>=3000;k-=100)\n {sound(k);delay(20000);}\n nosound();\n setlinestyle(3,0,2);\n drawellipse(x,maxy-(j-1)*dy);\n }\nreturn;\n}\n\ndrawellipse(int x,int y)\n{int i,j,x1,y1,a,b;\n float q;\n a=60+rand()%60;b=a-rand()%60;\n for(i=2;i>=0;i--)\n {\n for(q=0;q<=2*PI;q+=0.12)\n {setcolor(rand()%16);\n x1=x+(a-i*30)*cos(q);\n y1=y-(b-i*30)*sin(q);\n line(x,y,x1,y1);\n }\n delay(50000);\n setcolor(0);\n for(q=0;q<=2*PI;q+=0.12)\n {x1=x+(a-i*30)*cos(q);\n y1=y-(b-i*30)*sin(q);\n line(x,y,x1,y1);\n }\n }\n return;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "64c0ecd87693ca5c7a6227a9e4dcc896", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#define int long long\nint n;\nint judge(int k)\n{\n int ate=0;\n int n2=n;\n while(n2>0)\n {\n ate+=k;\n n2-=k;\n n2-=n2/10;\n }\n if(n2<0)\n ate+=n2;\n return ate>=(n+1)/2;\n}\nint bisect(int l,int r)\n{\n int mid;\n while(l\n#include \nint tryk(long long n, long long k)\n{\n long long ctr = 0,temp = n;\n while (temp > 0)\n {\n ctr+= (temp > k)? k : temp;\n temp -= (temp > k)? k : temp;\n temp -= (temp/10);\n }\n n = ceil(((double)n)/2.0);\n if (ctr>=n)\n return 1;\n else\n return 0;\n}\n\nint main()\n{\n\tlong long int n,l = 1,m,h,ls;\n scanf(\"%I64d\",&n);\n h = n/2 +1;\n ls = h;\n while(l<=h)\n {\n m = (l+h)/2;\n if (tryk(n,m))\n {\n ls = m;\n h = m-1;\n }\n else\n l = m+1;\n }\n printf(\"%I64d\",ls);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "82e64f60543bf0eee2962c80273812ab", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \nint tryk(long long n, long long k)\n{\n long long ctr = 0,temp = n;\n while (temp > 0)\n {\n ctr+= (temp > k)? k : temp;\n temp -= (temp > k)? k : temp;\n temp -= (temp/10);\n }\n if (ctr>=ceil(n/2.0))\n return 1;\n else\n return 0;\n}\n\nint main()\n{\n\tlong long int n,l = 1,m,h,ls;\n scanf(\"%lld\",&n);\n h = n;\n ls = n;\n while(l<=h)\n {\n m = (l+h)/2;\n if (tryk(n,m))\n {\n ls = m;\n h = m-1;\n }\n else\n l = m+1;\n }\n printf(\"%lld\",ls);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4686cfeaefe26a5b690f67b8d5b94936", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nlong long int min(long long int n,long long int k)\n{\n\tif(n=n-x)\n\t\t{\n\t\t\tans=k;\n\t\t\tr=k-1;\n\t\t}\n\t\telse\n\t\t\tl=k+1;\n\t}\n\tprintf(\"%lld\\n\",k);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "20863f848be2b9c35cdf442b1235e164", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nlong long min(long long a,long long b) {return a0)\n\t{\n\t\tx+=min(nn,num);\n\t\tnn-=min(nn,num);\n\t\tnn-=nn/10;\n\t}\n\treturn x*2>=n;\n}\nint main()\n{\n\tscanf(\"%I64d\",&n);\n\tlong long l=1LL,r=1e18;\n\twhile (l<=r)\n\t{\n\t\tlong long m=l+r>>1;\n\t\tif (check(m)) r=m-1;\n\t\telse l=m+1;\n\t}\n\tprintf(\"%I64d\\n\",l);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "568de53faa3b2c13c71785fd77c98c91", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nint main () {\n\t\n\tlong long s, x;\n\tlong long res = 0;\n\t\n\tlong long i;\n\t\n\tscanf(\"%I64d %I64d\", &s, &x);\n\t\n\tfor (i = 1; i <= s / 2; i++) {\n\t\tlong long j = s - i;\n// printf(\"%I64d %I64d %I64d\\n\", i, j, i ^j);\n\t\tif ((i ^ j) == x) {\n\t\t\tres += 2;\n\t\t\tif (i == j)\n\t\t\t\tres--;\n\t\t}\n\t}\n\t\n\tprintf(\"%I64d\\n\", res);\n\t\n\treturn 0;\n\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "206f9bc3c8e0dcc5d5e25354c3bdcff2", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nunsigned long count(unsigned long s, unsigned long x, int S, int X)\n{\n if (!s && !x)\n return (S && X);\n if ((s & 1)) {\n if (!(x & 1)) return 0;\n return count(s >> 1, x >> 1, (S|1), X) + count(s >> 1, x >> 1, S, (X|1));\n }\n\n if ((x & 1)) return 0;\n return count(s >> 1, x >> 1, S, X) + count((s >> 1)-1, x >> 1, (S|1), (X|1));\n}\n\n\nint main(int argc, char *argv[])\n{\n unsigned long s, x;\n scanf(\"%lu %lu\", &s, &x);\n printf(\"%lu\\n\", count(s, x, 0, 0));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b7d8d4eb40b83fe5a63d370d7555de49", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nuint64_t count(uint64_t s, uint64_t x)\n{\n if ((s & 1) == (x & 1)) {\n if (!!(s & 1))\n return 2*count(s >> 1, x >> 1);\n return count(s >> 1, x >> 1) + count((s >> 1)-1, x >> 1);\n }\n return (!s && !x);\n}\n\n\nint main(int argc, char *argv[])\n{\n uint64_t s, x;\n scanf(\"%\"PRIu64\" %\"PRIu64\"\", &s, &x);\n printf(\"%l64u\\n\", count(s, x) - 2*(s == x));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3cbf5f676180efc442552df55cca0284", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \nint w1[90];\nint w2[90];\nint k;\n\n\nint main()\n{\n int i,j,r,c,n,k1,k2,x,s;\n int start1,start2;\n int flag=0;\n int sum=1;\n scanf(\"%d%d\",&s,&x);\n i=0;\n while(x)\n {\n\n w2[i++]=x&1;\n x>>=1;\n }\n k1=i;\n i=0;\n while(s)\n {\n\n w1[i++]=s&1;\n s>>=1;\n }\n k2=i;\n k1=k1>k2?k1:k2;\n\n if(w1[0]!=w2[0])\n {\n printf(\"0\");\n return 0;\n }\n\n for(i=0;i\n#include \nint w1[50];\nint w2[50];\nint k;\n\n\nint main()\n{\n int i,j,r,c,n,k1,k2,x,s;\n int start1,start2;\n int flag=0;\n int sum=1;\n scanf(\"%d%d\",&s,&x);\n i=0;\n while(x)\n {\n\n w2[i++]=x&1;\n x>>=1;\n }\n k1=i;\n i=0;\n while(s)\n {\n\n w1[i++]=s&1;\n s>>=1;\n }\n k2=i;\n k1=k1>k2?k1:k2;\n\n if(w1[0]!=w2[0])\n {\n printf(\"0\");\n return 0;\n }\n\n for(i=0;i\nint main(){\n char map[11][11];\n int i,j,n,m,c=0;\n scanf(\"%d%d\",&n,&m);\n for(i=0;i<=n+1;i++)\n for(j=0;j<=m+1;j++)\n map[i][j]='.';\n //getchar();getchar();\n for(i=1;i<=n;i++){\n scanf(\"%s\",&map[i][1]);\n }\n for(i=1;i<=n;i++)\n for(j=1;j<=m;j++){\n if(map[i][j]=='W'){\n if(map[i-1][j]=='P'||map[i+1][j]=='P'||map[i][j-1]=='P'||map[i][j+1]=='P')\n c++;\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dfdc34e7c2d5571c9958e0cfaf0be5d6", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint n;\nchar map[10][11];\n\nint wolf(int i, int j)\n{\n return (i >= 0 && i < n && j >= 0 && j < n && map[i][j] == 'W');\n}\n\nint main(int argc, char *argv[])\n{\n int i, j, c = 0;\n \n scanf(\"%d\", &n);\n for(i = 0; i < n; i ++)\n scanf(\"%s\", map[i]);\n \n for(i = 0; i < n; i ++)\n for(j = 0; j < n; j ++)\n if(map[i][j] == 'P')\n {\n if(wolf(i - 1, j))\n map[i - 1][j] = '.', c ++;\n else if(wolf(i + 1, j))\n map[i + 1][j] = '.', c ++;\n else if(wolf(i, j - 1))\n map[i][j - 1] = '.', c ++;\n else if(wolf(map[i][j + 1]))\n map[i][j + 1] = '.', c ++;\n }\n \n printf(\"%d\\n\", c);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3551918fc6a0b45dcfd9b65cff428b5c", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "int main()\n{\n int n, m;\n char c[12][13];\n scanf(\"%d%d\", &n, &m);\n for (int i = 1; i <= n; ++i)\n {\n scanf(\"%s\", &c[i][1]);\n }\n int eaten(0);\n for (int i = 1; i <= n; ++i)\n {\n for (int j = 1; j <= m; ++j)\n {\n if (c[i][j] == 'W')\n {\n if (c[i-1][j] == 'P' || c[i+1][j] == 'P' || c[i][j-1] == 'P' || c[i][j+1] == 'P')\n {\n eaten += 1;\n }\n }\n }\n }\n printf(\"%d\\n\", eaten);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "499bae51398ca417cf004be4aa2f2284", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "V#include \nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n char ch[n][m];\n int i,j,k,l;\n for(i=0;i\n{\n int n, m;\n char c[12][13];\n scanf(\"%d%d\", &n, &m);\n for (int i = 1; i <= n; ++i)\n {\n scanf(\"%s\", &c[i][1]);\n }\n int eaten(0);\n for (int i = 1; i <= n; ++i)\n {\n for (int j = 1; j <= m; ++j)\n {\n if (c[i][j] == 'W')\n {\n if (c[i-1][j] == 'P' || c[i+1][j] == 'P' || c[i][j-1] == 'P' || c[i][j+1] == 'P')\n {\n eaten += 1;\n }\n }\n }\n }\n printf(\"%d\\n\", eaten);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "af3237b003be6df8aec4cce3e795a62c", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,sum=0,x=2;\n scanf(\"%d\",&n);\n while(x!=n)\n {\n sum=sum+x*(x+1);\n x++;\n }\n printf(\"%d\\n\",sum);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f7b70584a200780055b91af1ed4f5e6b", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n;\n long long ans=0;\n scanf(\"%d,&n);\n for(int i=1;i\nint main()\n {\n int a,i,sum(0);\n scanf(\"%d\",&a);\n for(i=1;i<=a-2;i++)\n {\n sum=sum+(1*(i+1)*(i+2));\n }\n\n printf(\"%d\",sum);\n \n \n }", "lang_cluster": "C", "compilation_error": true, "code_uid": "dfe1d86a72b499ba88a7dd1c3ef6ebed", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "# include \n\nint main()\n{\n\tint dp[501];\n\tdp[3] = 6;\n\tfor (int i = 4; i <= 500; i++)\n\t{\n\t\tdp[i] = dp[i - 1] + ( i - 1 ) * i;\n\n\t}\n\n\tint n;\n\n\tscanf_s(\"%d\", &n);\n\n\tprintf(\"%d\\n\", dp[n]);\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "db02f933d7b3fc9f50ae5a6d25243a58", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,i,j,k,sum=0,min=1000000;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++){\n j=i+1;\n k=i+2;\n if(j>n){\n j=j%n;\n }\n if(k>n){\n k=k%n;\n }\n while(k!=i){\n sum=sum+(j*k);\n j++;\n k++;\n if(j>n){\n j=j%n;\n }\n if(k>n){\n k=k%n;\n }\n }\n sum=sum*i;\n if(sum\n\n\nint main(){\n\tint n, p, sum = 0;\n\tint parties[100] = {};\n\n\tscanf(\"%d\", &n);\n\n\tfor (int i = 0; i < n; i++){\n\t\tscanf(\"%d\", &p);\n\t\tsum += p;\n\t\tparties[i] = p;\n\t}\n\n\tint coalition[100] = {};\n\tint n_coalition_members = 1;\n\tint coalition_sum = parties[0];\n\tint majority = sum / 2 + 1;\n\n\tint index, min;\n\n\tfor (int a = 0; a < n; a++){\n\t\tif (coalition_sum >= majority){\n\t\t\tprintf(\"%d\\n\", n_coalition_members);\n\t\t\tfor (int i = 0; i < n_coalition_members; i++){\n\t\t\t\tprintf(\"%d\", coalition[i] + 1);\n\t\t\t\ti + 1 == n_coalition_members ? printf(\"\\n\") : printf(\" \");\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t\tindex = 0;\n\t\tmin = parties[0] / 2;\n\t\tfor (int i = 1; i < n; i++){\n\t\t\t// printf(\"%d %d %d\\n\", parties[i], min, sum);\n\t\t\tif (parties[i] <= min && parties[i] != 0){\n\t\t\t\tmin = parties[i];\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\t\tif (index == 0){\n\t\t\tprintf(\"0\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tcoalition_sum += parties[index];\n\t\tparties[index] = 0;\n\t\tcoalition[a+1] = index;\n\t\tn_coalition_members += 1;\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "03cc25244cf9133b2d3b5c589cbca33b", "src_uid": "0a71fdaaf08c18396324ad762b7379d7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\n\nint main(){\n int n,*arr,i,alice,maj=0,total,max,*result = malloc(100*sizeof(int));\n scanf(\"%d\",n);\n arr = (int*)malloc(n*sizeof(int));\n for(i=0;imaj){\n break;\n }\n if(arr[i]<=alice/2){\n result[k]=i+1;\n k++;\n total = total + arr[i];\n }\n }\n if(total>maj){\n for(i=0;i\n#include\n#include\n\nint main(int argc,char*argv[])\n\n{\nint n_partiti;\nint vett_partiti[100];\nint coalizione[100];\nint indici_coalizione[100];\nint y=0;\nint i;\nint j;\nint k;\nint maggioranza=0;\nint sedie_globali=0;\nscanf(\"%d\",&n_partiti);\nfor(i=0;i(sedie_globali/2))\n{\n\tprintf(\"%d\",k);\n\tprintf(\"\\n\");\n\tfor(i=0;i\n#include\n#include\n#include\n#define maxm 50000\n#define maxn 50000\n#include \n#include \nint main(void)\n{\n\tint n,a[100][2]={0},sum=0,num=1,ex1,ex2,tot=0;\n\tscanf(\"%d\",&n);\n\tfor(int i=0;i0;i--)\n\tfor(int j=0;ja[j+1][0])\n\t\t{\n\t\t\tex1=a[j][0];\n\t\t\tex2=a[j][1];\n\t\t\ta[j][0]=a[j+1][0];\n\t\t\ta[j][1]=a[j+1][1];\n\t\t\ta[j+1][0]=ex1;\n\t\t\ta[j+1][1]=ex2;\n\t\t}\n\t}\n\ttot=a[n-1][0];\n\twhile(tot1&&a[num-2][0]*2>a[n-1][0])\n\tprintf(\"%d\",0);\n\telse\n\t{\n\t\tprintf(\"%d\\n\",num);\n\t\tfor(int i=0;i\nint main() {\nfloat a,b,c,d,e,f,k,l,j;\nscanf(\"%f %f %f %f %f %f %f %f %f\",&a,&b,&c,&d,&e,&f,&j,&l,&k);\nk = (b / a) * 100;\n\nl = (d / c) * k ;\n\nj = (f / e) * l;\nif(c == 0 && d != 0) {\n printf(\"Ron\");\n}\n\nelse if(b == 0 && d == 0 && f == 0) {\nprintf(\"Hermione\");}\n\nelse if(a == 0 || c == 0 || e == 0) {\nprintf(\"Ron\");}\n\nelse if(j > 100) {\nprintf(\"Ron\");}\n\nelse\nprintf(\"Hermione\");\n\nreturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4f542b67c50f0dc33d02bfd54937f3a2", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \ntypedef long long ll;\nint main() {\n int a,b,c,d,e,f;\n ll x,y;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n x=(ll)a*c*e;\n y=(ll)b*d*f;\n if(x0)) puts(\"Ron\");\n else puts(\"Hermione\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bc32659377604511fc907c32912b0aca", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n float a,b,c,d,e,f,n,i;\n scanf(\"%f%f%f%f%f%f\",&a,&b,&c,&d,&e,&f);\n n=(d/c)*b;\n i=(f/e)*n;\n if(i>a)\n printf(\"Ron\");\n else\n printf(\"Hermione\");\n getch();\n return(0);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d8c116036873f2923cfc0c6f9dea229", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n//#include\nint main()\n{\n int a,b,c,d,e,f,x,y;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(d==0)\n printf(\"Hermione\");\n else\n if((a==0&&b!=0)||c==0||(e==0&&f!=0))\n printf(\"Ron\");\n else if(a==0&&e==0)\n printf(\"Hermione\");\n else\n {\n x=d*b/c;\n y=f*x/e;\n if(y>a) printf(\"Ron\");\n else printf(\"Hermione\");\n }\n // getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ad10fa6ab0a320c5346b3b84e46fe236", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int a[3],b[3],i,n0=0,d0=0,n=1,d=1;\n for (i=0; i<3; i++)\n {\n scanf(\"%d%d\",&a[i],&b[i]);\n d*=a[i];\n n*=b[i];\n }\n \n if (n > d || (c==0 && d!=0) || (a==0 && b!=0 && d!=0))\n printf(\"Ron\\n\");\n else\n printf(\"Hermione\\n\");\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "59de89c75f9c3a105c2999aa3dfed057", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b68552f1c7c7d6946b1083bd206b62d8", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "GNU C11", "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(1);\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4c07241d3a3dfceb0725bab16bfccf21", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "GNU C11", "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(1);\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab0492a186ed96a314f7ec26391e966b", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define ARR_SIZE 1000000\n\ntypedef struct\n{\n int x;\n int y;\n} point;\n\nint inside(point w1, point w2, point b1, point b2)\n{\n if (w1.x >= b1.x && w1.y >= b1.y && w2.x <= b2.x && w2.y <= b2.y)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}\n\nint main()\n{\n point w1, w2, b1, b2, b3, b4;\n char canvas[ARR_SIZE][ARR_SIZE];\n scanf(\"%d %d %d %d\", &w1.x, &w1.y, &w2.x, &w2.y);\n scanf(\"%d %d %d %d\", &b1.x, &b1.y, &b2.x, &b2.y);\n scanf(\"%d %d %d %d\", &b3.x, &b3.y, &b4.x, &b4.y);\n\n for (int i = b1.x; i < b2.x; i++)\n {\n for (int j = b1.y; j < b2.y; j++)\n {\n canvas[i][j] = 0;\n }\n }\n for (int i = b3.x; i < b4.x; i++)\n {\n for (int j = b3.y; j < b4.y; j++)\n {\n canvas[i][j] = 0;\n }\n }\n for (int i = w1.x; i < w2.x; i++)\n {\n for (int j = w1.y; j < w2.y; j++)\n {\n canvas[i][j] != 0;\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4a6d42539c877629db9005dfc6c65b05", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nstruct mystuct{\n\tint x1,y1,x2,y2;\n};\nint main(void)\n{\n\tmystuct input1,input2,input3;\n\tscanf(\"%d %d %d %d\",&input1.x1,&input1.y1,&input1.x2,&input1.y2);\n\tscanf(\"%d %d %d %d\",&input2.x1,&input2.y1,&input2.x2,&input2.y2);\n\tscanf(\"%d %d %d %d\",&input3.x1,&input3.y1,&input3.x2,&input3.y2);\n\tgetchar(); \n\tif(input2.x1 <= input1.x1 && input2.y1 <= input1.y1 &&\n\t input2.x2 >= input1.x2 && input2.y2 >= input1.y2) printf(\"NO\"); //b\u5168\u8986\u76d6a \n\telse if(input3.x1 <= input1.x1 && input3.y1 <= input1.y1 &&\n\t \t \tinput3.x2 >= input1.x2 && input3.y2 >= input1.y2) printf(\"NO\"); //c\u5168\u8986\u76d6a \n\telse if(input2.y1 <= input1.y1 && input2.y2 >= input1.y2 &&\n\t\t\tinput3.y1 <= input1.y1 && input3.y2 >= input1.y2 &&\n\t\t\tinput2.x1 <= input1.x1 && input3.x1 <= input2.x2 && \n\t\t\tinput3.x2 >= input1.x2) printf(\"NO\"); //b,c\u5de6\u53f3\u8986\u76d6 \n\telse if(input3.y1 <= input1.y1 && input3.y2 >= input1.y2 &&\n\t\t\tinput2.y1 <= input1.y1 && input2.y2 >= input1.y2 &&\n\t\t\tinput3.x1 <= input1.x1 && input2.x1 <= input3.x2 && \n\t\t\tinput2.x2 >= input1.x2) printf(\"NO\"); //c,b\u5de6\u53f3\u8986\u76d6 \n\telse if(input2.x1 <= input1.x1 && input2.x2 >= input1.x2 &&\n\t\t\tinput3.x1 <= input1.x1 && input3.x2 >= input1.x2 &&\n\t\t\tinput2.y1 >= input1.y2 && input3.y1 >= input2.y1 &&\n\t\t\tinput3.y2 >= input1.y2 && input2.y2 >= input1.y2) printf(\"NO\"); //b,c\u4e0a\u4e0b\u8986\u76d6 \n\telse if(input3.x1 <= input1.x1 && input3.x2 >= input1.x2 &&\n\t\t\tinput2.x1 <= input1.x1 && input2.x2 >= input1.x2 &&\n\t\t\tinput3.y1 >= input1.y2 && input2.y1 >= input3.y1 &&\n\t\t\tinput2.y2 >= input1.y2 && input3.y2 >= input1.y2) printf(\"NO\"); //c,b\u4e0a\u4e0b\u8986\u76d6 \n\telse printf(\"YES\"); //\u8fd8\u6709\u767d\u8272\u90e8\u5206\u9732\u51fa \n\treturn 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "dc8a5727b96f97e96a254802b827a35d", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\n long long int xa,xb,xc,ya,yb,yc ;\n scanf(\"%I64d%I64d\",&xa,&ya);\n scanf(\"%I64d%I64d\",&xb,&yb);\n scanf(\"%I64d%I64d\",&xc,&yc);\n double m1 , m2 ;\n if(xb!=xa)\n m1=atanf((yb-ya)/xb-xa));\n else\n m1=asinf(1);\n if(xc!=xb)\n m2=atanf((yc-yb)/xc-xb));\n else\n m2=asinf(1);\n if(m1==m2)\n printf(\"TOWARDS\");\n else if(m2>m1)\n printf(\"LEFT\");\n else\n printf(\"RIGHT\");\n }\n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "ae6fe6d5478d29be2ac8bf3237287947", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef struct\n{\n int x,y;\n} Point;\n\nint main()\n{\n Point A,B,C;\n scanf(\"%d %d %d %d %d %d\",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y);\n B.x-=A.x;\n B.y-=A.y;\n C.x-=A.x;\n C.y-=A.y;\n if(B.x*C.y==C.x*B.y)\n {\n puts(\"TOWARDS\");\n return 0;\n }\n B.x+=A.x;\n B.y+=A.y;\n C.x+=A.x;\n C.y+=A.y;\n if(A.x==B.x&&A.yB.y)\n {\n if(C.x>B.x)\n {\n put(\"LEFT\");\n }\n else\n {\n puts(\"RIGHT\");\n }\n }\n if(A.y==B.y&&A.x>B.x)\n {\n if(C.yB.y)\n {\n put(\"LEFT\");\n }\n else\n {\n puts(\"RIGHT\");\n }\n }\n if(A.x>B.x&&A.yB.y)\n {\n if(C.x>B.x)\n {\n put(\"LEFT\");\n }\n else\n {\n puts(\"RIGHT\");\n }\n }\n if(A.x>B.x&&A.y>B.y)\n {\n if(C.x>B.x)\n {\n put(\"LEFT\");\n }\n else\n {\n puts(\"RIGHT\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d7cca41f34e51f083e118065ae6fd96", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "ee8dbaba56e65ee09ee2fcbbb7f85583", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#inlude\nmain()\n{\nreturn 0;\n}\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "144ca06b14aa00435fa3271f343846de", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int i,j,x,y,x1,x2,y1,y2;\n scanf(\"%d %d\",&x1,&y1);\n scanf(\"%d %d\",&x2,&y2);\n scanf(\"%d %d\",&x,&y);\n j=(x*y1+x1*y2)-(x2*y1+x1*y);\n if(j==0)\n printf(\"FORWARD\");\n if(j>0)\n printf(\"RIGHT\");\n if(j<0)\n printf(\"LEFT\");\n\n\n}\n\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c01b531dee412f14b22b04160199e1f", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n\nint64_t n, k;\n\n\nscanf(\"%I64d %I64d\",&n,&k);\n //ganadores como maximo la mitad de los alumnos\nint64_t dp = n/(2*k+2); //reciben diploma un maximo de los alumnos ganadores entre k+\nint64_t cer = k*dp; //los alumnos con certificados son k veces mas valor\n\nprintf(\"%I64d %I64d %I64d\\n\",dp,cer,n-cer-dp);\n\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "00bbc9351e2e03e4fa69c4f6adb1b9c1", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\nlong long a,k.d;\nscanf(\"%lld %lld\",&a,&k);\nd=(a/2)/(k+1);\nprintf(\"%lld %lld %lld\",d,d*k,a-(d*k+d));\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8ab2907b4d3747649cebe710105868fc", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tlong long int n,k,ans,dip,deg,lul;\n\tscanf(\"%lld %lld\",&n,&k);\n\tans=0;\n\tif(k<(n/4)){}\n\tfor(long long int i=(n/2); i>=0; i--)\n\t{\n\t\tif(i%(k+1)==0)\n\t\t{\n\t\t\tans=i/(k+1);\n\t\t\tbreak;\n\t\t}\n\t}\n\t}\n\tdeg=ans;\n\tdip=k*ans;\n\tlul=n-(deg+dip);\n\n\tprintf(\"%lld %lld %lld\",deg,dip,lul);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0eec8261479108bd4d2cbcb5d1eb50a3", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n\nunsigned long int n=0,k=0;\nunsigned long int dp=0,cer=0,wi=0;\n\n\nscanf(\"%ld %ld\",&n,&k);\nk++:\nwi= n/2; //ganadores como maximo la mitad de los alumnos\ndp = n/(k*2); //reciben diploma un maximo de los alumnos ganadores entre k+1\ncer = k*dp; //los alumnos con certificados son k veces mas valor\n\nprintf(\"%ld %ld %ld\\n\",dp,cer-dp,n-dp);\n\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "92c495ef5ec4bc6573256f94b8422f23", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\n\nint n, k;\nint dip, cer, nowin;\n\nint main()\n{\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n\tcin >> n >> k;\n\tdip = n / (2*(k+1));\n\tcer = k * dip;\n\tnowin = n - (dip + cer);\n\tcout << dip << \" \" << cer << \" \" << nowin << endl;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e6b08a613220ef47f348d95966f83ef9", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\n#include\nconst int MAXN = 1e5+4;\nconst int INF = 0X3F3F3F3F;\nint a[100005];\nint dp[200][200][4];\nint n;\n\nint min(int a,int b){\n if(a > b)\n return b;\n else\n return a;\n}\n\nvoid init() {\n scanf(\"%d\",&n);\n int i;\n for(i = 1; i <= n; i++) {\n scanf(\"%d\",&a[i]);\n if(a[i]!= 0) {\n if(a[i] % 2 == 1)\n a[i] = 1;\n else\n a[i] = 2;\n }\n }\n memset(dp,INF,sizeof(dp));\n}\n\nvoid solve() {\n if(a[1] == 0) {\n dp[1][1][1] = 0;\n dp[1][0][2]=0;\n }\n if(a[1]==1)\n dp[1][1][1]=0;\n if(a[1]==2)\n dp[1][0][2]=0;\n int s=n/2;\n if(n%2==1)\n s++;\n int i,j;\n for(i=2; i<=n; i++) {\n for(j = 0; j<=s; j++) {\n if(a[i]==0) {\n if(j >= 1)\n dp[i][j][1]=min(dp[i-1][j-1][1],dp[i-1][j-1][2]+1);\n dp[i][j][2]=min(dp[i-1][j][1]+1,dp[i-1][j][2]);\n }\n if(a[i]==1) {\n if(j>=1)\n dp[i][j][1]=min(dp[i-1][j-1][1],dp[i-1][j-1][2]+1);\n }\n if(a[i]==2) {\n dp[i][j][2]=min(dp[i-1][j][1]+1,dp[i-1][j][2]);\n }\n }\n }\n if(a[n]==0)\n printf(\"%d\\n\",min(dp[n][s][1],dp[n][s][2]));\n else if(a[n]==1)\n printf(\"%d\\n\",dp[n][s][1]);\n else\n printf(\"%d\\n\",dp[n][s][2]);\n}\nint main() {\n init();\n solve();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2714c2f8b934860c2ec6ee831c3720d9", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#define rep(E, F) for (E = 0; E < (F); E++)\n#define INF 1000000000\n\nint mabs(int a) { if (a > 0) { return a; } return -a; }\nint min(int a, int b) { if (a > b) { return b; } return a; }\nint max(int a, int b) { if (a < b) { return b; } return a; }\nint get_int();\ndouble get_double();\nint get_string(char* b, char t);\nint n;\nint d[2][100][100][100], a[100];\nint chi(int a, int b) { return a == b ? 0 : 1; }\n\nint foo(int b, int x, int y, int z)\n{\n\t//printf(\">> %d %d %d %d\\n\", b, x, y, z);\n\tif (z < 0 || y < 0) return INF;\n\tif (x == n) return 0;\n\tif (d[b][x][y][z] != -1) return d[b][x][y][z];\n\tif (a[x] != -1) return d[b][x][y][z] = chi(a[x], b) + foo(a[x], x + 1, y, z);\n\treturn d[b][x][y][z] = min(chi(0, b) + foo(0, x + 1, y - 1, z), chi(1, b) + foo(1, x + 1, y, z - 1));\n}\n\nint main()\n{\n\tint i, j, k;\n\tn = get_int();\n\trep(i, n) rep(j, n) rep(k, n) d[0][i][j][k] = d[1][i][j][k] = -1;\n\tint d[2] = {n/2, (n + 1)/2};\n\trep(i, n) a[i] = get_int();\n\trep(i, n) { rep(j, n) if (a[j] == i + 1) break; if (j < n) d[(i + 1)%2]--; }\n\trep(i, n) if (a[i] == 0) a[i] = -1; else a[i] %= 2;\n\tint r = min(foo(0, 0, d[0], d[1]), foo(1, 0, d[0], d[1]));\n\tassert(r < INF);\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}\n\nint get_string(char* b, char t)\n{\n\tint i = 0; b[i++] = getchar();\n\twhile (b[i - 1] != t) b[i++] = getchar();\n\tb[i - 1] = '\\0';\n\treturn i - 1;\n}\n\nint get_int()\n{\n\tint sgn = 1, ret = 0;\n\tchar c = getchar();\n\twhile (1)\n\t{\n\t\tif (c == EOF) return EOF;\n\t\tif (c >= '0' && c <= '9') break;\n\t\tif (c == '-')\n\t\t{\n\t\t\tc = getchar();\n\t\t\tif (c < '0' || c > '9') continue;\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*10 + c - '0';\n\t\tc = getchar();\n\t\tif (c < '0' || c > '9') return sgn*ret;\n\t}\n}\n\ndouble get_double()\n{\n\tdouble 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*10 + c - '0';\n\n\t\tc = getchar();\n\n\t\tif (c == '.')\n\t\t{\n\t\t\tdouble pos = 0.1;\n\n\t\t\tc = getchar();\n\t\t\twhile (c >= '0' && c <= '9')\n\t\t\t{\n\t\t\t\tret += pos*(c - '0');\n\t\t\t\tpos /= 10;\n\t\t\t\tc = getchar();\n\t\t\t}\n\n\t\t\treturn sgn*ret;\n\t\t}\n\t\telse if (c < '0' || c > '9')\n\t\t{\n\t\t\treturn sgn*ret;\n\t\t}\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "49bc1b83f84073b46665727e81c26d91", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n// observations:\n// mixed holes (any size) will always be 1 complexity no matter what, so they get leftovers at end\n// even/odd holes (any size) will always add 0 or 2 (unless on the end)\n// ^ these should definitely be filled from small to large (should i sort then?)\n// only question is how to handle the ends with regard to order of filling\n// i think you'd want to remove as many 2's as possible then try to fill 1's (might require some backtracking)\n\ntypedef struct {\n short parity;\n int size;\n} Hole;\n\nint compare(const void *a, const void *b) {\n return ( ((Hole *)a)->size - ((Hole *)b)->size );\n}\n\nint main() {\n int n, i;\n int nums[105];\n //int evencnt, mixcnt, oddcnt; //holes\n //int endholeparity[2] = {0,0};\n int parity[2] = {0,0}; //existing evens,odds\n int complexity = 0;\n\n int ss,ee;\n Hole start_hole;\n Hole end_hole;\n Hole same_holes[55];\n int same_holes_cnt = 0;\n\n int last = -1;\n\n scanf(\"%d\", &n);\n for (i=0; i < n; i++) {\n scanf(\"%d\", &nums[i]);\n if (nums[i] != 0 && (nums[i] % 2) + last == 1) {\n complexity += 1;\n }\n if (nums[i] != 0) {\n parity[nums[i] % 2]++;\n last = nums[i] % 2;\n }\n else {\n last = -1;\n }\n }\n //printf(\"base complexity: %d\\n\", complexity);\n\n parity[0] = n/2 - parity[0]; //existing/placed -> missing/available evens\n parity[1] = (n+1)/2 - parity[1];\n \n //printf(\"Have %2d evens\\n %2d odds\\n\", parity[0], parity[1]);\n\n for (i=0; nums[i] == 0 && i < n; i++);\n if (i == n) { // all zeros\n if (n == 1)\n printf(\"0\\n\");\n else\n printf(\"1\\n\"); \n return 0;\n }\n ss = i;\n start_hole.size = i;\n start_hole.parity = nums[i] % 2;\n for (i=n-1; nums[i] == 0 && i >= 0; i--);\n ee = i;\n end_hole.size = (n-1) - i;\n end_hole.parity = nums[i] % 2;\n\n //printf(\"start_size: %2d\\n\", start_hole.size);\n //printf(\"end_size: %2d\\n\", end_hole.size);\n\n int cur_start = 0;\n \n for (i = ss; i <= ee; i++) {\n if (nums[i] == 0) {\n Hole hnew;\n cur_start = i;\n while (nums[++i] == 0 && i <= ee);\n hnew.size = i - cur_start; // ee guaranteed nonzero so no off by one\n hnew.parity = nums[cur_start-1] % 2;\n if (nums[i] % 2 != hnew.parity)\n complexity++;\n else \n same_holes[same_holes_cnt++] = hnew;\n }\n }\n //printf(\"Found %d holes\\n\", same_holes_cnt);\n qsort(same_holes, same_holes_cnt, sizeof(Hole), compare);\n for (i=0; i < same_holes_cnt; i++) {\n Hole tt = same_holes[i];\n if (parity[tt.parity] >= tt.size) {\n parity[tt.parity] -= tt.size;\n }\n else {\n complexity += 2;\n //printf(\"adding complexity\\n\");\n }\n }\n if (start_hole.size <= end_hole.size && end_hole.size != 0) {\n if (parity[start_hole.parity] < start_hole.size)\n complexity += 1;\n else\n parity[start_hole.parity] -= start_hole.size;\n if (parity[end_hole.parity] < end_hole.size)\n complexity += 1;\n else\n parity[end_hole.parity] -= end_hole.size;\n }\n else if (end_hole.size < start_hole.size) {\n if (parity[end_hole.parity] < end_hole.size)\n complexity += 1;\n else\n parity[end_hole.parity] -= end_hole.size;\n if (parity[start_hole.parity] < start_hole.size)\n complexity += 1;\n else\n parity[start_hole.parity] -= start_hole.size;\n }\n printf(\"%d\\n\", complexity);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8047572d5980d01b097b1c552263302e", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n// observations:\n// mixed holes (any size) will always be 1 complexity no matter what, so they get leftovers at end\n// even/odd holes (any size) will always add 0 or 2 (unless on the end)\n// ^ these should definitely be filled from small to large (should i sort then?)\n// only question is how to handle the ends with regard to order of filling\n// i think you'd want to remove as many 2's as possible then try to fill 1's (might require some backtracking)\n\ntypedef struct {\n short parity;\n int size;\n} Hole;\n\nint compare(const void *a, const void *b) {\n return ( ((Hole *)a)->size - ((Hole *)b)->size );\n}\n\nint main() {\n int n, i;\n int nums[105];\n //int evencnt, mixcnt, oddcnt; //holes\n //int endholeparity[2] = {0,0};\n int parity[2] = {0,0}; //existing evens,odds\n int complexity = 0;\n\n int ss,ee;\n Hole start_hole;\n Hole end_hole;\n Hole same_holes[55];\n int same_holes_cnt = 0;\n\n int last = -1;\n\n scanf(\"%d\", &n);\n for (i=0; i < n; i++) {\n scanf(\"%d\", &nums[i]);\n if (nums[i] != 0 && (nums[i] % 2) + last == 1) {\n complexity += 1;\n }\n if (nums[i] != 0) {\n parity[nums[i] % 2]++;\n last = nums[i] % 2;\n }\n else {\n last = -1;\n }\n }\n //printf(\"base complexity: %d\\n\", complexity);\n\n parity[0] = n/2 - parity[0]; //existing/placed -> missing/available evens\n parity[1] = (n+1)/2 - parity[1];\n \n //printf(\"Have %2d evens\\n %2d odds\\n\", parity[0], parity[1]);\n\n for (i=0; nums[i] == 0 && i < n; i++);\n if (i == n) { // all zeros\n if (n == 1)\n printf(\"0\\n\");\n else\n printf(\"1\\n\"); \n return 0;\n }\n ss = i;\n start_hole.size = i;\n start_hole.parity = nums[i] % 2;\n for (i=n-1; nums[i] == 0 && i >= 0; i--);\n ee = i;\n end_hole.size = (n-1) - i;\n end_hole.parity = nums[i] % 2;\n\n //printf(\"start_size: %2d\\n\", start_hole.size);\n //printf(\"end_size: %2d\\n\", end_hole.size);\n\n int cur_start = 0;\n \n for (i = ss; i <= ee; i++) {\n if (nums[i] == 0) {\n Hole hnew;\n cur_start = i;\n while (nums[++i] == 0 && i <= ee);\n hnew.size = i - cur_start; // ee guaranteed nonzero so no off by one\n hnew.parity = nums[cur_start-1] % 2;\n if (nums[i] % 2 != hnew.parity)\n complexity++;\n else \n same_holes[same_holes_cnt++] = hnew;\n }\n }\n //printf(\"Found %d holes\\n\", same_holes_cnt);\n qsort(same_holes, same_holes_cnt, sizeof(Hole), compare);\n for (i=0; i < same_holes_cnt; i++) {\n Hole tt = same_holes[i];\n if (parity[tt.parity] >= tt.size) {\n parity[tt.parity] -= tt.size;\n }\n else {\n complexity += 2;\n //printf(\"adding complexity\\n\");\n }\n }\n if (start_hole.size <= end_hole.size && end_hole.size != 0) {\n if (parity[start_hole.parity] < start_hole.size)\n complexity += 1;\n else\n parity[start_hole.parity] -= start_hole.size\n if (parity[end_hole.parity] < end_hole.size)\n complexity += 1;\n else\n parity[end_hole.parity] -= end_hole.size\n }\n else if (end_hole.size < start_hole.size) {\n if (parity[end_hole.parity] < end_hole.size)\n complexity += 1;\n else\n parity[end_hole.parity] -= end_hole.size\n if (parity[start_hole.parity] < start_hole.size)\n complexity += 1;\n else\n parity[start_hole.parity] -= start_hole.size\n }\n printf(\"%d\\n\", complexity);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1fdc8dc75fb246a86bffa77512bb5520", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n#define rep(E, F) for (E = 0; E < (F); E++)\n#define INF 1000000000\n\nint mabs(int a) { if (a > 0) { return a; } return -a; }\nint min(int a, int b) { if (a > b) { return b; } return a; }\nint max(int a, int b) { if (a < b) { return b; } return a; }\nint get_int();\ndouble get_double();\nint get_string(char* b, char t);\nint n;\nint d[2][100][100][100], a[100];\nint chi(int a, int b) { return a == b ? 0 : 1; }\n\nint foo(int b, int x, int y, int z)\n{\n\tif (x == n) return 0;\n\tif (z < 0 || y < 0) return INF;\n\tif (d[b][x][y][z] != -1) return d[b][x][y][z];\n\tif (a[x] != -1 && a[x] != b) return INF;\n\tif (a[x] != -1) return d[b][x][y][z] = min(chi(0, b) + foo(0, x + 1, y, z), chi(1, b) + foo(1, x + 1, y, z));\n\treturn d[b][x][y][z] = min(chi(0, b) + foo(0, x + 1, y - 1, z), chi(1, b) + foo(1, x + 1, y, z - 1));\n}\n\nint main()\n{\n\tint i, j, k;\n\tn = get_int();\n\trep(i, n) rep(j, n) rep(k, n) d[0][i][j][k] = d[1][i][j][k] = -1;\n\tint d[2] = {n/2, (n + 1)/2};\n\trep(i, n) a[i] = get_int();\n\trep(i, n) { rep(j, n) if (a[j] == i + 1) break; if (j < n) d[(i + 1)%2]--; }\n\trep(i, n) if (a[i] == 0) a[i] = -1; else a[i] %= 2;\n\tint r = min(foo(0, 0, d[0], d[1]), foo(1, 0, d[0], d[1]));\n\tassert(r < INF);\n\tprintf(\"%d\\n\", r);\n\treturn 0;\n}\n\nint get_string(char* b, char t)\n{\n\tint i = 0; b[i++] = getchar();\n\twhile (b[i - 1] != t) b[i++] = getchar();\n\tb[i - 1] = '\\0';\n\treturn i - 1;\n}\n\nint get_int()\n{\n\tint sgn = 1, ret = 0;\n\tchar c = getchar();\n\twhile (1)\n\t{\n\t\tif (c == EOF) return EOF;\n\t\tif (c >= '0' && c <= '9') break;\n\t\tif (c == '-')\n\t\t{\n\t\t\tc = getchar();\n\t\t\tif (c < '0' || c > '9') continue;\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*10 + c - '0';\n\t\tc = getchar();\n\t\tif (c < '0' || c > '9') return sgn*ret;\n\t}\n}\n\ndouble get_double()\n{\n\tdouble 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*10 + c - '0';\n\n\t\tc = getchar();\n\n\t\tif (c == '.')\n\t\t{\n\t\t\tdouble pos = 0.1;\n\n\t\t\tc = getchar();\n\t\t\twhile (c >= '0' && c <= '9')\n\t\t\t{\n\t\t\t\tret += pos*(c - '0');\n\t\t\t\tpos /= 10;\n\t\t\t\tc = getchar();\n\t\t\t}\n\n\t\t\treturn sgn*ret;\n\t\t}\n\t\telse if (c < '0' || c > '9')\n\t\t{\n\t\t\treturn sgn*ret;\n\t\t}\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dfbf23d6c96606250cce7f2f987fbd31", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nvoid caballo (int m[][9], int f, int c)\n{\n/*8 mov tiene el caballo*/\n\n /*derecha 1 cuadro*/\n if(c+2<9 && f-1>0)/*9 final del tablero, arriba derecha columna+2*/\n {\n m[f-1][c+2]=1;\n\n }\n if(c+1<9 && f-2>0)/*9 final del tablero, arriba derecha columna+1*/\n {\n m[f-2][c+1]=1;\n }\n\n /*abajo derecha*/\n if(c+1<9 && f+2<9)/*9 final del tablero, arriba derecha colu+1*/\n {\n m[f+2][c+1]=1;\n }\n if(c+2<9 && f+1<9)/*9 final del tablero, arriba derecha colu+2*/\n {\n m[f+1][c+2]=1;\n }\n\n\n /*izquierda arriba*/\n if(c-1>0 && f-2>0)/* arriba del tablero, arriba izquierda fi-2*/\n {\n m[f-2][c-1]=1;\n }\n if(c-2>0 && f-1>0)/*arriba del tablero, arriba derecha fi-1*/\n {\n m[f-1][c-2]=1;\n }\n\n /*izquierda abajo*/\n if(c-1>0 && f+2<9)/*9 final del tablero, arriba derecha fi+2*/\n {\n m[f+2][c-1]=1;\n }\n if(c-2>0 && f+1<9)/*9 final del tablero, arriba derecha co+1*/\n {\n m[f+1][c-2]=1;\n }\n /*fin funcion*/\n\n}\n\nvoid torre (int m[][9], int f,int c)\n{\n int aux;\n\n /*fila torre llenar de 1s*/\n for(aux=1; aux<=8; aux++)\n {\n m[f][aux]=1;\n }\n\n /*fila torre llenar de 1s*/\n for(aux=1; aux<=8; aux++)\n {\n m[aux][c]=1;\n }\n\n}\n\nvoid inici (int m[][8])\n{\n int i,j;\n /*imprimir matriz*/\n for(i=1; i<9; i++){\n for(j=1; j<9; j++)\n m[i][j]=0;\n\n }\n}\n\nvoid resultado(int m[][9])\n{\n int i,j,con=0;\n /*imprimir matriz*/\n for(i=1; i<9; i++){\n for(j=1; j<9; j++)\n if(m[i][j]==0)\n con++;\n }\n\n printf(\"%d\",con);\n}\n\n\nmain()\n{\n\nint ma[9][9]={0};\nint i,j,i2;\nchar c;\n\n\n\n/*primera linea entra torre*/\nscanf(\"%c %d\",&c,&i);\nj=(int)c-'a';\nj++; /*se pasa la letra a numero +1*/\ni=9-i;/*posicion de fila invertida*/\n\ninici(ma);\nma[i][j]=1;/*primera linea*/\n\n/*se colocan 1s para la posicion del caballo y torre*/\ncaballo (ma,i,j);\ntorre (ma,i,j);\n\n/*segunda linea*/\nscanf(\"%1s %d\",&c,&i2); /*guarda un solo caracter en la variable*/\n\nj=(int)c-'a';\nj++; /*se pasa la letra a numero +1*/\ni2=9-i2;/*posicion de fila invertida*/\nma[i2][j]=1;/*primera linea*/\n\n/*se colocan 1s para la posicion del caballo y torre*/\ncaballo (ma,i2,j);\n\n\nresultado(ma);\n\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a6b1c7ce4dbb51a28b9b024c75e2eefb", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define n 8\n\nchar Tablero[n][n];\nint mov[n][2]={{-1,2},{-2,1},{-2,-1},{-1,-2},{1,-2},{2,-1},{2,1},{1,2}};\nchar columna[8]={'a','b','c','d','e','f','g','h'};\nchar fila[8]={'8','7','6','5','4','3','2','1'};\n\nvoid caminoPieza(char *,char *);\nint recorrerTablero(void);\nint valido(int,int);\n\nint main()\n{\n char Torre[3],Caballo[3];\n\n scanf(\"%s\",Torre);\n scanf(\"%s\",Caballo);\n\n caminoPieza(&Torre[0],&Caballo[0]);\n printf(\"%d\",recorrerTablero());\n\n system(\"PAUSE>NULL\");\n return 0;\n}\n\nvoid caminoPieza(char *Torre,char *Caballo){\n int i,j,k;\n\n for(j=0;j=0 && (i+mov[k][0])=0 && (j+mov[k][1])=0 && x=0 && y\n\nint main()\n{\n int x1, y1, x2, y2, tot = 0, c[9][9] = { 0 }, i, j;\n char a, b;\n scanf(\" %c%d %c%d\", &a, &y1, &b, &y2);\n x1 = a - 'a' + 1;\n x2 = b - 'a' + 1;\n for(i = 1; i < 9; i++)\n {\n c[x1][i] = 1;\n c[i][y1] = 1;\n }\n if(x2 > 1)\n {\n if(y2>2)\n {\n c[x2-1][y2-2] = 1;\n }\n if(y2<7)\n {\n c[x2-1][y2+2] = 1;\n }\n }\n if(x2 > 2)\n {\n if(y2>1)\n {\n c[x2-2][y2-1] = 1;\n }\n if(y2<8)\n {\n c[x2-2][y2+1] = 1;\n }\n }\n if(x2<8)\n {\n if(y2>2)\n {\n c[x2+1][y2-2] = 1;\n }\n if(y2<7)\n {\n c[x2+1][y2+2] = 1;\n }\n }\n if(x2 < 7)\n {\n if(y2>1)\n {\n c[x2+2][y2-1] = 1;\n }\n if(y2<8)\n {\n c[x2+2][y2+1] = 1;\n }\n }\n if(x1 > 1)\n {\n if(y1>2)\n {\n c[x1-1][y1-2] = 1;\n }\n if(y1<7)\n {\n c[x1-1][y1+2] = 1;\n }\n }\n if(x1 > 2)\n {\n if(y1>1)\n {\n c[x1-2][y1-1] = 1;\n }\n if(y1<8)\n {\n c[x1-2][y1+1] = 1;\n }\n }\n if(x1<8)\n {\n if(y1>2)\n {\n c[x1+1][y1-2] = 1;\n }\n if(y1<7)\n {\n c[x1+1][y1+2] = 1;\n }\n }\n if(x1 < 7)\n {\n if(y1>1)\n {\n c[x1+2][y1-1] = 1;\n }\n if(y1<8)\n {\n c[x1+2][y1+1] = 1;\n }\n }\n c[x2][y2] = 1;\n for(i = 1; i<9; i++)\n for(j = 1; j<9; j++)\n if(c[i][j] == 0)\n tot ++;\n printf(\"%d\", tot);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e4c683ab373a0871d6d1ff4fe4a34d5f", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "//void imprimir();\nvoid inicializar();\nvoid posiciones(char pieza[],int *fila,int *columna);\nvoid movimientoTorre(int x,int y);\nvoid movimientoCaballo(int x,int y);\nint recorrer();\n\nint a[8] = { 2, 1,-1,-2,-2,-1, 1, 2};\nint b[8] = {-1,-2,-2,-1, 1, 2, 2, 1};\n\nchar letras[9]=\"aabcdefgh\";\nchar numeros[9]=\"112345678\";\nint tablero[N][N];\n\nint main(){\n char caballo[2];\n char torre[2];\n int filaT=0,columnaT=0;\n int filaC=0,columnaC=0,mov;\n inicializar();\n\n scanf(\"%s\",&torre);\n scanf(\"%s\",&caballo);\n\n posiciones(torre,&filaT,&columnaT);\n posiciones(caballo,&filaC,&columnaC);\n\n movimientoCaballo(filaC,columnaC);\n //imprimir();\n movimientoTorre(filaT,columnaT);\n //imprimir();\n movimientoCaballo(filaT,columnaT);\n mov=recorrer();\n printf(\"%d\",mov);\n return 0;\n}\nvoid movimientoTorre(int x,int y){\n int i;\n for(i=1;i0 && t0 && v\n\nchar piece[4];\n\nint rx, ry, kx, ky;\n\nint abs(int a){ return a < 0 ? -a : a; }\n\nint ok(int x, int y){\n int dx = abs(x - kx), dy = abs(y - ky);\n if(abs(dx - dy) == 1 && dx + dy == 3) return 0;\n dx = abs(x - rx), dy = abs(y - ry);\n if(abs(dx - dy) == 1 && dx + dy == 3) return 0;\n return x != rx && y != ry && (x != kx || y != ky);\n}\n\nint main(){\n int ans = 0, i, j;\n scanf(\"%s\", piece); rx = piece[0] - 'a', ry = piece[1] - '1';\n scanf(\"%s\", piece); kx = piece[0] - 'a', ky = piece[1] - '1';\n for( i = 0; i < 8; ++i){\n for( j = 0; i < 8; ++j){\n ans += ok(i,j);\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c4940900e6cf21608647dc8cc633437f", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n\nlong long fac[250005];\n\nint main()\n{\n int n, m;\n long long ans = 0;\n scanf(\"%d%d\", &n, &m);\n\n fac[0] = 1;\n for(int i = 1; i <= n; i++){\n fac[i] = (fac[i - 1] * i) % m;\n }\n\n for(int i = 0; i < n; i++){\n ans += (fac[i + 1] * fac[n - i]) % m;\n ans %= m;\n }\n\n ans = (ans * (n + 1)) % m;\n if(ans % 2 == 1) ans = (ans + m) / 2;\n else ans /= 2;\n\n printf(\"%I64d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "332f363b51e6e485156a2568d03d06db", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n\tlong long int i,j,k=0,n,m,s=0;\n\tlong long int fact[250001];\n\tfact[1]=1;fact[0]=1;\n\tscanf(\"%lld%lld\",&n,&m);\n\tfor(i=2;i<=250000;i++)\n\tfact[i]=(fact[i-1]*i)%m;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tk=k+(n-i+1)*(fact[i]*fact[n-i+1]%m);\n\t\tk=k%m;\n\t}\n\tprintf(\"%lld\",k);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa99001adcf54924bb5239ac5f43be13", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tlong long int n, m;\n\tscanf(\"%lld %lld\", &n, &m);\n\tlong long int fact[2500006];\n\tlong long int i;\n\tfact[0] = 1;\n\tfor (i = 1; i < 2500006; i++)\n\t\tfact[i] = fact[i - 1] * i % m;\n\tlong long int ans = 0;\n\tfor (i = 0; i < n; i++)\n\t\tans = (ans + (n - i) * fact[i + 1] % m * fact[n - i] % m) % m;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "08c5fa325eab99694e1837f2331b9801", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nlong long fac[250005];\n\nint main()\n{\n int n, m;\n long long ans = 0;\n scanf(\"%d%d\", &n, &m);\n\n fac[0] = 1;\n for(int i = 1; i <= n; i++){\n fac[i] = (fac[i - 1] * i) % m;\n }\n\n for(int i = 0; i < n; i++){\n ans += (fac[i + 1] * fac[n - i]) % m;\n ans %= m;\n }\n\n ans = (ans * (n + 1)) % m;\n if(ans % 2 == 1) ans = (ans + m) / 2;\n\n printf(\"%I64d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d4beb564d5154d02efccf91a325918ba", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#define F for(i=1;i<=n;i++)\nlong long i,j,m,n,r,f[250107]={1};\nint main(){\n\tscanf(\"%lli%lli\",&n,&m);\n\tF f[i]=f[i-1]*i%m;\n\tF r=(r+f[i]*f[n-i+1]%m*(n-i+1)%m)%m;\n\treturn printf(\"%lli\",r);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "196ccac346fa775852ed691237bec4f1", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0} {"lang": "GNU C", "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\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 = (low + high) / 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "4515febc7f5f80ff23cf145a09fb7522", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nusing namespace std;\n\nint main()\n{\n int k ;\n long long n , ans;\n cin >> n >> k;\n ans = ((n * (k - 1) / k ) / k + 1) * k;\n cout << ans ;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "54859dd68fd696fc2c813800e7a0f04d", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint n, k, v, i, sum;\n\tscanf(\"%d%d\", &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(\"%d\\n\", v);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ea57d4d9ebf78c3462431c3b7fffda92", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int temp1,i,temp,sum=0,ans=0;\n int p=1;\n for(i=n;i>=1;i--)\n {\n p=0;\n sum=0;\n temp=i;\n ans=temp;\n temp1=i;\n while(temp1>0)\n {\n \n sum+=temp1;\n p++;\n //printf(\"for %d : %d\\n\",p,sum);\n temp1=temp/(int)pow(k,p);\n }\n if(sum\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#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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0f73bce61200812f4f7d161db4f5a8a0", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8746b51c33be95e458e36fc551bc704b", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "difficulty": 1800.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "55ff613c9c9208bb2bfbd2635fdd5f97", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "difficulty": 1800.0} {"lang": "GNU C", "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\n#define MD\t1000000007\n\nint power(int a, int b) {\n\tint p;\n\n\tif (b == 0)\n\t\treturn 1;\n\tp = power(a, b / 2);\n\tp = (long long) p * p % MD;\n\tif (b % 2 == 1)\n\t\tp = (long long) p * a % MD;\n\treturn p;\n}\n\nint solve(int x) {\n\treturn power(2, x - 1);\n}\n\nint sign(int x) {\n\tint a, cnt;\n\n\tcnt = 0;\n\tfor (a = 2; a * a <= x; a++) {\n\t\tif (x % a == 0) {\n\t\t\tx /= a;\n\t\t\tcnt++;\n\t\t}\n\t\tif (x % a == 0)\n\t\t\treturn 0;\n\t}\n\tif (x > 1)\n\t\tcnt++;\n\treturn cnt % 2 == 0 ? 1 : -1;\n}\n\nint main() {\n\tint x, y, a, sum;\n\n\tscanf(\"%d%d\", &x, &y);\n\tif (y % x != 0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\ty /= x;\n\tsum = 0;\n\tfor (a = 1; a * a <= y; a++)\n\t\tif (y % a == 0) {\n\t\t\tsum = ((long long) sum + (sign(a) * solve(y / a) % MD) + MD) % MD;\n\t\t\tif (y / a != a)\n\t\t\t\tsum = ((long long) sum + (sign(y / a) * solve(a)) + MD) % MD;\n\t\t}\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "339e16427ae945ce3671b6d282fea1bf", "src_uid": "de7731ce03735b962ee033613192f7bc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define MODULUS 1000000007\n#define _ % MODULUS\n\n#define MAX_RG 76543\n#define MAX_PR 7654\n\nint prime_ct = 0, primes[MAX_PR];\nunsigned char not_prime[MAX_RG] = { 0 };\n\nvoid sieve()\n{\n int i, j;\n not_prime[0] = not_prime[1] = 1;\n for (i = 2; i < MAX_RG; ++i) {\n if (!not_prime[i]) primes[prime_ct++] = i;\n for (j = 0; j < prime_ct && i * primes[j] < MAX_RG; ++j)\n not_prime[i * primes[j]] = 1;\n }\n}\n\nint mu(int n)\n{\n int i, ret = 1;\n for (i = 0; i < prime_ct; ++i) {\n if (n % primes[i] == 0) {\n n /= primes[i];\n ret = -ret;\n if (n % primes[i] == 0) return 0;\n }\n }\n if (n > 1) ret = -ret;\n return ret;\n}\n\nint qpow(int base, int exp)\n{\n int ans = 1;\n for (; exp; exp >>= 1, base = ((int64_t)base * base)_)\n if (exp & 1) ans = ((int64_t)ans * base)_;\n return ans;\n}\n\nint count_seqs(int sum, int gcd_mul)\n{\n if (sum % gcd_mul != 0) return 0;\n return qpow(2, sum / gcd_mul - 1);\n}\n\nint main()\n{\n int x, y;\n scanf(\"%d%d\", &x, &y);\n\n if (y % x != 0) { puts(\"0\"); return 0; }\n y /= x;\n\n sieve();\n\n int64_t ans = 0;\n int i;\n for (i = 1; i * i <= y; ++i) if (y % i == 0) {\n ans += count_seqs(y, i) * mu(i);\n if (i * i != y)\n ans += count_seqs(y, y / i) * mu(y / i);\n }\n\n printf(\"%I64d\\n\", (ans _ + MODULUS)_);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "490d1dabbc33ffcce33cd6359bfbb07f", "src_uid": "de7731ce03735b962ee033613192f7bc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n#define MD\t1000000007\n\nint power(int a, int b) {\n\tint p;\n\n\tif (b == 0)\n\t\treturn 1;\n\tp = power(a, b / 2);\n\tp = (long long) p * p % MD;\n\tif (b % 2 == 1)\n\t\tp = (long long) p * a % MD;\n\treturn p;\n}\n\nint solve(int x) {\n\treturn (power(2, x - 1) + MD) % MD;\n}\n\nint sign(int x) {\n\tint a, cnt;\n\n\tcnt = 0;\n\tfor (a = 2; a * a <= x; a++) {\n\t\tif (x % a == 0) {\n\t\t\tx /= a;\n\t\t\tcnt++;\n\t\t}\n\t\tif (x % a == 0)\n\t\t\treturn 0;\n\t}\n\tif (x > 1)\n\t\tcnt++;\n\treturn cnt % 2 == 0 ? 1 : -1;\n}\n\nint main() {\n\tint x, y, a, sum;\n\n\tscanf(\"%d%d\", &x, &y);\n\tif (y % x != 0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\ty /= x;\n\tsum = 0;\n\tfor (a = 1; a * a <= y; a++)\n\t\tif (y % a == 0) {\n\t\t\tsum = (sum + (sign(a) * solve(y / a)) + MD) % MD;\n\t\t\tsum = (sum + (sign(y / a) * solve(a)) + MD) % MD;\n\t\t}\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4984f187d3f8b927d7e91e76e3fd1189", "src_uid": "de7731ce03735b962ee033613192f7bc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n#define MD\t1000000007\n\nint power(int a, int b) {\n\tint p;\n\n\tif (b == 0)\n\t\treturn 1;\n\tp = power(a, b / 2);\n\tp = (long long) p * p % MD;\n\tif (b % 2 == 1)\n\t\tp = (long long) p * a % MD;\n\treturn p;\n}\n\nint solve(int x) {\n\treturn power(2, x - 1);\n}\n\nint sign(int x) {\n\tint a, cnt;\n\n\tcnt = 0;\n\tfor (a = 2; a * a <= x; a++) {\n\t\tif (x % a == 0) {\n\t\t\tx /= a;\n\t\t\tcnt++;\n\t\t}\n\t\tif (x % a == 0)\n\t\t\treturn 0;\n\t}\n\tif (x > 1)\n\t\tcnt++;\n\treturn cnt % 2 == 0 ? 1 : -1;\n}\n\nint main() {\n\tint x, y, a, sum;\n\n\tscanf(\"%d%d\", &x, &y);\n\tif (y % x != 0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\ty /= x;\n\tsum = 0;\n\tfor (a = 1; a * a <= y; a++)\n\t\tif (y % a == 0) {\n\t\t\tsum = (sum + (sign(a) * solve(y / a) % MD) + MD) % MD;\n\t\t\tif (y / a != a)\n\t\t\t\tsum = (sum + (sign(y / a) * solve(a) % MD) + MD) % MD;\n\t\t}\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "acb4d9f2d0970366ff87bbe648e58563", "src_uid": "de7731ce03735b962ee033613192f7bc", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#pragma region kyopuro_templates\n#pragma GCC optimize(\"Ofast\")\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\ntypedef long long ll;\ntypedef long double ld;\n#define rep(i,l,r)for(ll i=(l);i<(r);i++)\n#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))\n#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)\n#define INF (1LL<<62)\n#define MOD1 1000000007\n#define MOD2 998244353\n#define MAX_N (1 << 20)\n#define YES printf(\"Yes\\n\")\n#define NO printf(\"No\\n\")\n#define PN printf(\"\\n\")\n#define charsize 100005 //10^5+5\n#define PI 3.141592653589793238\n\nvoid swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}\nvoid cin(ll *n){ scanf(\"%lld\",&(*n)); }\nvoid PriAll1(ll a[], ll n){ rep(i,0,n){ printf(\"%lld\",a[i]); if(i!=n-1) printf(\" \"); }PN; }\nll min(ll a, ll b){ return a < b ? a : b; }\nll max(ll a, ll b){ return a < b ? b : a; }\n// ll max2(ll a,ll b){return a>=b?a:b;}\n// ll min2(ll a,ll b){return a>=b?b:a;}\nll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}\nll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}\nll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min(b,a[i]);return b;}\nll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max(b,a[i]);return b;}\nll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}\ndouble POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}\nll gcd(ll a,ll b){return b?gcd(b,a%b):a;}\nll lcm(ll a,ll b){return a/gcd(a,b)*b;}\nll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}\nll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}\nll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }\nll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}\nll base(ll n, ll a, ll i){return i==1?n%a:base(n/a,a,i-1);}\nll is_inArr1(ll x, ll n){ return ( x<0 || x>=n ) ? 0 : 1 ; }\nll is_inArr2(ll y, ll x, ll h, ll w){ return ( y<0 || y>=h || x<0 || x>=w ) ? 0 : 1 ; }\n\n\nvoid lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }\nvoid lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }\nint cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }\nint cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a=:2 >:3\nll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }\n// return biggest p which meets a[p]==val :1 <=:2 <:3\nll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }\n// count i which meets ai==x\nll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }\n\nll *factors[2] , fac_cnt=0 , is_factor_prepared=0;\nll factor_pre(){ rep(i,0,1){ if(is_factor_prepared++) return 0; } ll tmp=(1e6)/2+1, fac_tmp[tmp]; rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;} rep(i,1,tmp){if(fac_tmp[i]){ repp(j,3,tmp/(2*i+1)+1,2 ){ if( j*(2*i+1) n ) break; } return n; }\nll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n 0){ \n t = (n & 1) ? t * s % mod : t;\n s = s * s % mod;\n n >>= 1;\n } \n return r ? t : 0;\n}\n#pragma endregion mod\n\n\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;}\nint cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );\nint cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}\nvoid sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}\nvoid sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}\n// void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }\n// void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }\n// ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }\n// ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }\n\nll compare(ll a, ll b){ return ab?1:0; }\ntypedef struct{ ll a , b;}fr;\nint cmp1( const void *p, const void *q ){ \n ll pa=((fr*)p)->a; ll qa=((fr*)q)->a; return compare(pa,qa); \n}\nint cmp2( const void *p, const void *q ){\n ll pa=((fr*)p)->a; ll qa=((fr*)q)->a; return compare(qa,pa);\n}\nvoid strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}\nvoid strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}\n\nvoid sort_partial(ll a[],int begin,int end,int is_increase){\n ll *b; b = (ll *) malloc( sizeof(ll)*(end-begin) );\n\n rep(i,begin,end) b[i-begin]=a[i];\n if(is_increase) sortup(b,end-begin); else sortdown(b,end-begin);\n rep(i,begin,end) a[i]=b[i-begin];\n}\n\n// ll pre_rui[2151][1151];\n// ll ruiseki[2151][1151];\n// void rui_make(ll h, ll w){\n// rep(i,0,h){\n// rep(j,0,w){\n// ruiseki[i+1][j+1]=ruiseki[i+1][j]+pre_rui[i][j];\n// }\n// rep(j,0,w){\n// ruiseki[i+1][j+1]+=ruiseki[i][j+1];\n// }\n// }\n// }\n\n// ll rui_get(ll st_y, ll st_x, ll en_y, ll en_x, ll h, ll w){\n// if(en_y<0) return 0;\n// if(en_x<0) return 0;\n// if(st_y>h) return 0;\n// if(st_x>w) return 0;\n// if(st_y<0) st_y=0;\n// if(st_x<0) st_x=0;\n// if(en_y>h) en_y=h;\n// if(en_x>w) en_x=w;\n// ll val=0;\n// val+=ruiseki[en_y][en_x];\n// val-=ruiseki[en_y][st_x];\n// val-=ruiseki[st_y][en_x];\n// val+=ruiseki[st_y][st_x];\n// return val;\n// }\n\n\n\n\n#pragma region AVL\n/*---------------------------AVL start--------------------------------*/\n//https://qiita.com/mikecat_mixc/items/e9f8248de2ae7f7a0a29\ntypedef struct node_AVL_set{ \n ll val;\n int diff;\n int cnt;\n struct node_AVL_set *child[2];\n}AVL_set;\nvoid AVL_set_inside_rotate(AVL_set **node, int is_right){\n int l = is_right==false , r = is_right==true , sign = is_right ? 1 : -1;\n if((*node)->child[l] != NULL){\n AVL_set* left = (*node)->child[l];\n int a= (*node)->diff * sign , b= left->diff * sign ,na,nb;\n if(b+1){\n na=a-1-b;\n nb= (a-b) ? b-1 : a-2;\n }else{\n na=a-1;\n nb= a ? b-1 : a+b-2;\n }\n (*node)->diff = na * sign;\n left->diff = nb * sign;\n /* rotate-> */\n (*node)->child[l] = (*node)->child[l]->child[r];\n left->child[r] = *node;\n *node = left;\n }\n}\nint AVL_set_inside_update(AVL_set **node, ll data, int add){\n if(*node == NULL){\n if(add==2){\n *node = (AVL_set*)malloc(sizeof(AVL_set));\n (*node)->val = data;\n (*node)->cnt = 1;\n (*node)->diff = 0;\n (*node)->child[0] = NULL;\n (*node)->child[1] = NULL;\n }\n return add==2 ? *node != NULL : 0; \n }else{\n int l, delta, delta_sign; AVL_set *next_node;\n if(data == (*node)->val){\n if(add==2){\n (*node)->cnt++;\n return 0;\n }else{\n if( add && (*node)->cnt > 1 ){\n (*node)->cnt--; return 0;\n }else{\n if((*node)->child[1] == NULL){\n next_node = (*node)->child[0];\n free(*node);\n *node = next_node;\n return -1;\n }else if((*node)->child[0] == NULL){\n next_node = (*node)->child[1];\n free(*node);\n *node = next_node;\n return -1;\n }else{\n for(next_node = (*node)->child[0];\n next_node->child[1] != NULL;\n next_node = next_node->child[1]);\n (*node)->val = next_node->val;\n l=0;\n delta_sign=1;\n delta = AVL_set_inside_update(&(*node)->child[l], next_node->val, add);\n }\n }\n }\n }else{\n l = data >= (*node)->val ? 1 : 0;\n delta_sign = data < (*node)->val ? 1 : -1;\n delta = AVL_set_inside_update(&(*node)->child[l], data, add);\n }\n if( delta ){\n int orig_diff = (*node)->diff;\n int do_rotate = 0, rotate_l , diff_sign , rotate_right;\n (*node)->diff += delta * delta_sign;\n if((*node)->diff > 1){\n do_rotate = 1;\n rotate_l = 0;\n diff_sign = 1;\n rotate_right = 1;\n }else if((*node)->diff < -1){\n do_rotate = 1;\n rotate_l = 1;\n diff_sign = -1;\n rotate_right = 0;\n }\n if(do_rotate){\n int child_diff = (*node)->child[rotate_l]->diff;\n if((*node)->child[rotate_l]->diff * diff_sign < 0){\n AVL_set_inside_rotate(&(*node)->child[rotate_l], !rotate_right);\n }\n AVL_set_inside_rotate(node, rotate_right);\n return delta < 0 && child_diff != 0 ? -1 : 0;\n }\n if (delta > 0 && orig_diff == 0) return 1;\n else if(delta < 0 && orig_diff != 0) return -1;\n else return 0;\n }else{ \n return 0;\n }\n }\n}\n\nvoid AVL_set_inside_print(const AVL_set *node, int depth){\n if(node == NULL) return;\n AVL_set_inside_print(node->child[1], depth + 1);\n printf(\"%lld %d\\n\", node->val,node->cnt);\n AVL_set_inside_print(node->child[0], depth + 1); \n}\nvoid AVL_set_inside_free(AVL_set *node){\n if(node == NULL) return;\n AVL_set_inside_free(node->child[0]);\n AVL_set_inside_free(node->child[1]);\n free(node);\n}\nll AVL_set_inside_count(AVL_set *root, ll val){\n AVL_set *node; node = root;\n while(node){\n if (val < node->val) node = node->child[0];\n else if(val > node->val) node = node->child[1];\n else return node->cnt;\n }\n return 0;\n}\n\n\nint AVL_set_lowcomp(ll node, ll val, int type){\n if(node==val){\n if(type!=3) return 0;\n else return 1;\n }\n if(nodeval) return -1;\n return 0;\n}\n// return smallest p which meets a[p]==val :1 >=:2 >:3\nAVL_set* AVL_set_inside_lowerbound(AVL_set *root, ll val, int type){\n AVL_set *node; node = root;\n while(node){\n int com=AVL_set_lowcomp(node->val,val,type);\n if(com==0) return node;\n if(com==1) node = node->child[1];\n if(com==-1){\n AVL_set *small;\n small=AVL_set_inside_lowerbound(node->child[0],val,type);\n if(type==1){\n return small;\n }else{\n if(small!=NULL) return small;\n else return node; \n }\n }\n }\n return node;\n}\n\nint AVL_set_upcomp(ll node, ll val, int type){\n if(node==val){\n if(type!=3) return 0;\n else return -1;\n }\n if(nodeval) return -1;\n return 0;\n}\n// return biggest p which meets a[p]==val :1 <=:2 <:3\nAVL_set* AVL_set_inside_upperbound(AVL_set *root, ll val, int type){\n AVL_set *node; node = root;\n while(node){\n int com=AVL_set_upcomp(node->val,val,type);\n if(com==0) return node;\n if(com==-1) node = node->child[0];\n if(com==1){\n AVL_set *big;\n big=AVL_set_inside_upperbound(node->child[1],val,type);\n if(type==1){\n return big;\n }else{\n if(big!=NULL) return big;\n else return node; \n }\n }\n }\n return node;\n}\n\n\nll AVL_set_inside_minmax(AVL_set *root, int type){\n while(root->child[type] !=NULL) root= root->child[type];\n return root->val;\n}\nvoid AVL_set_inside_swap(AVL_set **node1, AVL_set **node2){ \n AVL_set *tmp; tmp=*node1; *node1=*node2; *node2=tmp;\n}\n\n#define set_MAX_SIZE 514511\nll set_main( int command , int set_num , ll val ,ll option){\n static bool set_is_init=false;\n static AVL_set *set_pointer[set_MAX_SIZE];\n static ll set_siz[set_MAX_SIZE];\n if(!set_is_init){ set_is_init=true; rep(i,0,set_MAX_SIZE){ *(set_pointer+i) = NULL; set_siz[i]=0; } }\n if(command==-1){ AVL_set_inside_print( set_pointer[set_num] ,0); }\n if(command==1){ AVL_set_inside_count(set_pointer[set_num],val) ? 1 : set_siz[set_num]++; AVL_set_inside_update( &set_pointer[set_num] , val , 2 ); }\n if(command==2){ return AVL_set_inside_count(set_pointer[set_num],val); }\n if(command==3){ ( AVL_set_inside_count(set_pointer[set_num],val) > 1 ) ? 1 : set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val,1); }\n if(command==4){ set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val , 0 ); }\n if(command==5){ set_siz[set_num]=0; AVL_set_inside_free( set_pointer[set_num] ); set_pointer[set_num] = NULL; }\n if(command==6){ return set_siz[set_num]; }\n if(command==7){ return AVL_set_inside_minmax(set_pointer[set_num],1); }\n if(command==8){ return AVL_set_inside_minmax(set_pointer[set_num],0); }\n if(command==9){ AVL_set_inside_swap(&set_pointer[set_num],&set_pointer[val]); }\n if(10<=command&&command<=12){\n AVL_set *lowbound = AVL_set_inside_lowerbound(set_pointer[set_num],val,command-9);\n if(lowbound==NULL) return option;\n else return lowbound->val;\n }\n if(13<=command&&command<=15){\n AVL_set *upbound = AVL_set_inside_upperbound(set_pointer[set_num],val,command-12);\n if(upbound==NULL) return option;\n else return upbound->val;\n }\n return 0;\n}\n\nvoid set_print(int set_num){ set_main(-1,set_num,0,0); }\nvoid set_insert(int set_num, ll val){ set_main(1,set_num,val,0); }\nll set_count(int set_num, ll val){ return set_main(2,set_num,val,0); }\nvoid set_erase(int set_num, ll val, int is_all){ if(is_all) set_main(4,set_num,val,0); else set_main(3,set_num,val,0); }\nvoid set_clear(int set_num){ set_main(5,set_num,0,0); }\nll set_size(int set_num){ return set_main(6,set_num,0,0); }\nll set_max(int set_num){ return set_main(7,set_num,0,0); }\nll set_min(int set_num){ return set_main(8,set_num,0,0); }\nvoid set_swap(int set_num1, int set_num2){ set_main(9,set_num1,set_num2,0); }\n\n\n// return smallest p which meets a[p]==val :1 >=:2 >:3\nll set_lowerbound(int set_num, ll val, int type, ll error){\n return set_main(9+type,set_num,val,error);\n}\n// return biggest p which meets a[p]==val :1 <=:2 <:3\nll set_upperbound(int set_num, ll val, int type, ll error){\n return set_main(12+type,set_num,val,error);\n}\n\n/*\ninsert *\nsize *\nclear *\nerase *\ncount *\nmax *\nmin *\nswap *\nbegin x\nend x\nmerge source \u306e\u8981\u7d20\u306e\u30ad\u30fc\u3068\u7b49\u4fa1\u306a\u30ad\u30fc\u306e\u8981\u7d20\u304c\u3042\u308b\u5834\u5408\u3001\u305d\u306e\u8981\u7d20\u306f source \u304b\u3089\u62bd\u51fa\u3055\u308c\u306a\u3044\nlower_bound *\nupper_bound *\n*/\n\n// ll map_main()\n\n/*---------------------------AVL start--------------------------------*/\n\n#pragma endregion AVL\n\n\n#pragma endregion kyopuro_templates\n\n\n\n#pragma region vector\n\ntypedef struct vector vector;\ntypedef struct vector {\n int n, max, data_size;\n void *data;\n void (*push)(vector*, void*);\n void (*set)(vector*, int, void*);\n ll (*get)(vector*, int);\n double (*get_double)(vector*, int);\n int (*size)(vector*);\n} vector;\n\n\nvoid vector_push(vector *v, void *x) {\n if (v->n == v->max) {\n v->max *= 2;\n assert((v->data = realloc(v->data, v->max * v->data_size)) != NULL);\n }\n if(x==NULL){\n memset(v->data + v->data_size * v->n, 0, v->data_size);\n }else{\n memcpy(v->data + v->data_size * v->n, x, v->data_size);\n }\n v->n++;\n}\n\nvoid vector_set(vector *v, int idx, void *x) {\n if(x == NULL){\n memset(v->data + v->data_size * idx, 0, v->data_size);\n }else{\n memcpy(v->data + v->data_size * idx, x, v->data_size);\n }\n}\n\nvoid *vector_get_internal(vector *v, int idx) {\n return (v->data + v->data_size * idx);\n}\nll vector_get(vector *v, int idx){\n ll ret=0;\n if(v->data_size == 8) ret = *(ll*)vector_get_internal(v, idx);\n if(v->data_size == 4) ret = *(int*)vector_get_internal(v, idx);\n if(v->data_size == 2) ret = *(bool*)vector_get_internal(v, idx);\n return ret;\n}\ndouble vector_get_double(vector *v, int idx){\n assert(v->data_size == sizeof(double));\n return *(double*)vector_get(v, idx);\n}\n\nint vector_size(vector *v) {\n return v->n;\n}\n\nvector *vector_init(int n, int data_size) {\n assert(n != 0);\n vector *ret = (vector *)malloc(sizeof(vector));\n ret->n = 0;\n ret->max = n;\n ret->data_size = data_size;\n ret->data = malloc(n * data_size);\n\n ret->push=vector_push;\n ret->set=vector_set;\n ret->size=vector_size;\n ret->get = vector_get;\n ret->get_double = vector_get_double;\n\n memset(ret->data, 0, n * ret->data_size);\n return ret;\n}\n\n// void vector_free(vector *v){\n// free(v->data);\n// free(v->get);\n// free(v->get_double);\n// free(v->push);\n// free(v->set);\n// free(v->size);\n// free(v);\n// }\n\n#pragma endregion vector\n\n\n\n#pragma region max_flow\n#define flow_t long long\n// #define flow_t double\ntypedef struct Dinic Dinic;\ntypedef struct Dinic {\n int n;\n vector **to;\n vector **cap;\n vector **rev;\n vector *min_cost;\n vector *iter;\n void (*add)(Dinic*, int, int, flow_t);\n flow_t (*max_flow)(Dinic*, int, int);\n} Dinic;\n\n\nvoid Dinic_add_edge(Dinic *d, int from, int to, flow_t cap) {\n vector_push(d->rev[from], (void*)&d->to[to]->n);\n vector_push(d->rev[to], (void*)&d->to[from]->n);\n vector_push(d->to[from], (void*)&to);\n vector_push(d->to[to], (void*)&from);\n vector_push(d->cap[from], (void*)&cap);\n vector_push(d->cap[to], NULL);\n}\n\nbool Dinic_bfs(Dinic *d, int s, int t) {\n int init = -1;\n rep(i, 0, d->n) vector_set(d->min_cost, i, (void*)&init);\n vector *q = vector_init(1, sizeof(int));\n vector_set(d->min_cost, s, NULL);\n int head = 0;\n q->push(q, (void*)&s);\n while(head != q->n && vector_get(d->min_cost, t) == -1){\n int p = q->get(q, head);\n head++;\n rep(i, 0, d->to[p]->n) {\n int to = vector_get(d->to[p], i);\n if(vector_get(d->cap[p], i) > 0 && vector_get(d->min_cost, to) == -1){\n ll cost = vector_get(d->min_cost, p) + 1;\n vector_set(d->min_cost, to, (void*)&cost);\n q->push(q, (void*)&to);\n }\n }\n }\n return vector_get(d->min_cost, t) != -1;\n}\n\nflow_t Dinic_dfs(Dinic *d, int idx, int t, flow_t flow) {\n if(idx == t) return flow;\n rep(i, vector_get(d->iter, idx), d->cap[idx]->n){\n vector_set(d->iter, idx, (void*)&i);\n flow_t cap = vector_get(d->cap[idx], i);\n int to = vector_get(d->to[idx], i);\n if(cap > 0 && vector_get(d->min_cost, idx) < vector_get(d->min_cost, to)) {\n flow_t delta = Dinic_dfs(d, to, t, flow < cap ? flow : cap);\n if(delta > 0) {\n cap -= delta;\n vector_set(d->cap[idx], i, (void*)&cap);\n int rev = vector_get(d->rev[idx], i);\n flow_t rev_cap = vector_get(d->cap[to], rev) + delta;\n vector_set(d->cap[to], rev, (void*)&rev_cap);\n return delta;\n }\n }\n }\n return 0;\n}\n\nflow_t Dinic_max_flow(Dinic *d, int s, int t) {\n flow_t flow = 0;\n while(Dinic_bfs(d, s, t)) {\n rep(i, 0, d->n) vector_set(d->iter, i, NULL);\n flow_t f = 0;\n while((f = Dinic_dfs(d, s, t, INF)) > 0) flow += f;\n }\n return flow;\n}\n\nDinic *Dinic_init(int n) {\n Dinic *ret = (Dinic *)malloc(sizeof(Dinic));\n ret->n = n;\n ret->to = (vector **)malloc(n * sizeof(vector*));\n ret->cap = (vector **)malloc(n * sizeof(vector*));\n ret->rev = (vector **)malloc(n * sizeof(vector*));\n rep(i, 0, n) {\n ret->to[i] = vector_init(1, sizeof(int));\n ret->cap[i] = vector_init(1, sizeof(flow_t));\n ret->rev[i] = vector_init(1, sizeof(int));\n }\n ret->min_cost =vector_init(n, sizeof(int));\n ret->iter = vector_init(n, sizeof(int));\n ret->add = Dinic_add_edge;\n ret->max_flow = Dinic_max_flow;\n return ret;\n}\n#pragma endregion max_flow\n\n\n\n\n\nchar s[1151154];\nvoid solve(){\n // fgets(s,sizeof(s),stdin); \n ll n;\n ll ans=0;\n cin(&n);\n // scanf(\"%s\",s);\n ll a[3];\n ll b[3];\n rep(i,0,3){\n cin(&a[i]);\n }\n rep(i,0,3){\n cin(&b[i]);\n }\n ll ma=0;\n // ll mi=INF;\n ma=min(a[0],b[1])+min(a[1],b[2])+min(a[2],b[0]);\n Dinic *d=Dinic_init(8);\n d->add(d,6,0,a[0]);\n d->add(d,6,1,a[1]);\n d->add(d,6,2,a[2]);\n\n d->add(d,0,3,INF);\n d->add(d,0,5,INF);\n d->add(d,1,3,INF);\n d->add(d,1,4,INF);\n d->add(d,2,4,INF);\n d->add(d,2,5,INF);\n\n d->add(d,3,7,b[0]);\n d->add(d,4,7,b[1]);\n d->add(d,5,7,b[2]);\n printf(\"%lld %lld\\n\",n-d->max_flow(d,6,7),ma);\n}\n\nint main(void){\n ll T=1;\n // cin(&T);\n rep(i,0,T){ solve(); }\n return 0;\n}\n\n\n/*\n while (ng + 1 < ok) {\n ll p = ng + (ok - ng) / 2;\n ll cnt = 0;\n rep(i,0,n){\n cnt += (a[i] + p - 1) / p - 1;\n }\n if (cnt <= k) ok = p; else ng = p;\n }\n*/\n// 10^18 2^60 3^38 5^26\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d750577eab62b933e6ef0908e4855c26", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\ntypedef uint64_t uint64; typedef uint32_t uint32;\ntypedef uint16_t uint16; typedef uint8_t uint8;\ntypedef int64_t int64; typedef int32_t int32;\ntypedef int16_t int16; typedef int8_t int8;\n\n#define u8 PRIu8\n#define u16 PRIu16\n#define u32 PRIu32\n#define u64 PRIu64\n#define d8 PRId8\n#define d16 PRId16\n#define d32 PRId32\n#define d64 PRId64\n\n#define finc(i,size) for(uint64 i=0;i<(size);i++)\n#define fdec(i,size) for(uint64 i=(size);i-->0;)\n\n#define scanf_s scanf\n#define min(a,b) ((a>b)?b:a)\nint main(void)\n{\n\tuint32 n;\n\tuint32 map[2][4];\n\tscanf_s(\"%\"u32\"\", &n);\n\tfinc(i, 2)\n\t\tfinc(j, 3)\n\t\tscanf_s(\"%\"u32\"\", &map[i][j]);\n\tfinc(i, 2)\n\t\tmap[i][3] = map[i][0];\n\n\tuint32 winmax = 0, winmin = 0;\n\tfinc(i, 3)\n\t\twinmax += min(map[0][i], map[1][i + 1]);\n\tfor (uint64 i = 1; i < 4; i++)\n\t{\n\t\tif (map[1][i - 1] + map[1][i] < map[0][i])\n\t\t\twinmin = map[0][i] - map[1][i - 1] - map[1][i];\n\t}\n\tprintf(\"%\"u32\" %\"u32\"\\n\", winmin, winmax);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "017bd5c0f7e6d72de70f946c404d4cdf", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\nint min(int a, int b) {\n return (a < b) ? a : b;\n}\n\nint max(int a, int b) {\n return (a > b) ? a : b;\n}\n\nint main() {\n int n;\n int a1, a2, a3;\n int b1, b2, b3;\n\n scanf(\"%d\", &n);\n scanf(\"%d %d %d\", &a1, &a2, &a3);\n scanf(\"%d %d %d\", &b3, &b1, &b2);\n\n int min_ans = 0;\n min_ans = max(min_ans, a1 - b2 - b3);\n min_ans = max(min_ans, a2 - b3 - b1);\n min_ans = max(min_ans, a3 - b1 - b2);\n\n int max_ans = min(a1, b1) + min(a2, b2) + min(a3, b3);\n\n printf(\"%d %d\", min_ans, max_ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aebe2cbe4ca97e47e79259850b5d45df", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint main() {\n long long int n,minw=0,maxw=0;\n long long int a[3],b[3],m[3];\n scanf(\"%lld \",&n);\n scanf(\"%lld %lld %lld \",&a[0],&a[1],&a[2]);\n scanf(\"%lld %lld %lld \",&b[0],&b[1],&b[2]);\n maxw+=a[0]>b[1]?b[1]:a[0];\n maxw+=a[1]>b[2]?b[2]:a[1];\n maxw+=a[2]>b[0]?b[0]:a[2];\n maxin=b[0]>b[1]?(b[0]>b[2]?0:2):(b[1]>b[2]?1:2);\n int minw=b[maxin]-a[maxin]-a[(maxin+1)%3];\n if(minw<0)\n minw=0;\n m[0]=b[0]>a[1]?a[1]:b[0];\n m[1]=b[1]>a[2]?a[2]:b[1];\n m[2]=b[2]>a[0]?a[0]:b[2];\n a[1]-=m[0];\n a[2]-=m[1];\n a[0]-=m[2];\n b[0]-=m[0];\n b[1]-=m[1];\n b[2]-=m[2];\n a[0]-=a[0]>b[0]?b[0]:a[0];\n a[1]-=a[1]>b[1]?b[1]:a[1];\n a[2]-=a[2]>b[2]?b[2]:a[2];\n //minw=a[0]+a[1]+a[2];\n printf(\"%lld %lld\",minw,maxw);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2dcde8502b2353be95711d81fec50994", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\ntypedef uint64_t uint64; typedef uint32_t uint32;\ntypedef uint16_t uint16; typedef uint8_t uint8;\ntypedef int64_t int64; typedef int32_t int32;\ntypedef int16_t int16; typedef int8_t int8;\n\n#define u8 PRIu8\n#define u16 PRIu16\n#define u32 PRIu32\n#define u64 PRIu64\n#define d8 PRId8\n#define d16 PRId16\n#define d32 PRId32\n#define d64 PRId64\n\n#define finc(i,size) for(uint64 i=0;i<(size);i++)\n#define fdec(i,size) for(uint64 i=(size);i-->0;)\n\n#define scanf_s scanf\nint main(void)\n{\n\tuint32 n;\n\tuint32 map[2][4];\n\tscanf_s(\"%\"u32\"\", &n);\n\tfinc(i, 2)\n\t\tfinc(j, 3)\n\t\tscanf_s(\"%\"u32\"\", &map[i][j]);\n\tfinc(i, 2)\n\t\tmap[i][3] = map[i][0];\n\n\tuint32 winmax = 0, winmin = 0;\n\tfinc(i, 3)\n\t\twinmax += min(map[0][i], map[1][i + 1]);\n\tfor (uint64 i = 1; i < 4; i++)\n\t{\n\t\tif (map[1][i - 1] + map[1][i] < map[0][i])\n\t\t\twinmin = map[0][i] - map[1][i - 1] - map[1][i];\n\t}\n\tprintf(\"%\"u32\" %\"u32\"\\n\", winmin, winmax);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d87e5199d89e577d522c31081e699a26", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner input=new Scanner(System.in);\n\t\tint n=input.nextInt();\n\t\tString str=Integer.toString(n,8);\n\t\tint sum=0;\n\t\tfor(int i=0;i\nint main()\n{\n int n,sum;\n scanf(\"%d\",&n);\n while(n)\n {\n if(n%8==1)\uff5b\n sum++;\n }\n n/=8;\n printf(\"%d\",sum);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "dda637c267cb65497dcd393002289b7b", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\nint a,sum=0;\nint main()\n{\n scanf(\"%d\",&a);\n while(a)\n {\n if(a%8==1){\n sum++;\n }\n a/=8;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "885c409d0212f6ccfd76ac3b38df3b57", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \nint a[1000];\nint main()\n{\n//\tfreopen(\"datain.txt\",\"r\",stdin);\n//\tfreopen(\"datain.txt\",\"w\",stdout);\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i=1;\n\tint len;\n\tint cnt=0;\n\twhile(n>0)\n {\n a[i]=n%8;\n n /=8;\n i++;\n len = i;\n }\n for(i=1;i<=len;i++)\n {\n if(a[i]==1) cnt++;\n }\n printf(\"%d\",cnt);\n//\tfclose(stdin);\n//\tfclose(stdout);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "42eea2b15d291ad102eb81d587def8ee", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \nint a[1000];\nint main()\n{\n//\tfreopen(\"datain.txt\",\"r\",stdin);\n//\tfreopen(\"datain.txt\",\"w\",stdout);\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i=1;\n\tint len;\n\tint cnt=0;\n\twhile(n>0)\n {\n a[i]=n%8;\n n /=8;\n i++;\n len = i;\n }\n for(i=1;i<=len;i++)\n {\n if(a[i]==1) cnt++;\n }\n printf(\"%d\",cnt);\n//\tfclose(stdin);\n//\tfclose(stdout);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "71adf212ca846de7253860e28cf44384", "src_uid": "ec539775f2b3358a92a99a644e2480ce", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t1000000\n#define MD\t1000000007\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 t;\n\n\t\tgcd(b, a % b);\n\t\tt = x_ - a / b * y_, x_ = y_, y_ = t;\n\t}\n}\n\nint inv(int a) {\n\tgcd(a, MD);\n\treturn x_;\n}\n\nint main() {\n\tstatic int dp[N];\n\tint n, k, h;\n\tlong long x, ans, f;\n\n\tscanf(\"%d%d\", &n, &k);\n\tif (k > n - 1)\n\t\tk = n - 1;\n\tf = 1;\n\tfor (h = 0; h <= k; h++) {\n\t\tdp[h] = 1;\n\t\tf = f * (h + 1) % MD;\n\t}\n\tx = k, ans = k + 1;\n\tfor (h = k + 1; h < n; h++) {\n\t\tdp[h] = x * inv(h) % MD;\n\t\tx = (x + dp[h] - dp[h - k]) % MD;\n\t\tans = (ans + dp[h]) % MD;\n\t\tf = f * (h + 1) % MD;\n\t}\n\tans = (n - ans) % MD;\n\tfor (h = 1; h < n; h++)\n\t\tans = ans * h % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "47eac914f63dd17fd5016b53f2f404a3", "src_uid": "0644605611a2cd10ab3a9f12f18d7ae4", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define M\t150\n#define MD\t1000000007\n\nint query(int aa[][M + 1], int l0, int l1, int r0, int r1) {\n\treturn l0 > l1 || r0 > r1 ? 0 : ((long long) aa[l1][r1] - aa[l0 - 1][r1] - aa[l1][r0 - 1] + aa[l0 - 1][r0 - 1]) % MD;\n}\n\nvoid add(int aa[][M + 1], int l, int r, int a) {\n\taa[l][r] = (aa[l][r] + a) % MD;\n}\n\nint main() {\n\tstatic int dp00[M + 1][M + 1], dp01[M + 1][M + 1], dp10[M + 1][M + 1], dp11[M + 1][M + 1];\n\tstatic int dq00[M + 1][M + 1], dq01[M + 1][M + 1], dq10[M + 1][M + 1], dq11[M + 1][M + 1];\n\tint n, m, l, r, ans;\n\n\tscanf(\"%d%d\", &n, &m);\n\tans = 0;\n\twhile (n--) {\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = 1; r <= m; r++) {\n\t\t\t\tdp00[l][r] = (dp00[l][r] + dp00[l][r - 1]) % MD;\n\t\t\t\tdp01[l][r] = (dp01[l][r] + dp01[l][r - 1]) % MD;\n\t\t\t\tdp10[l][r] = (dp10[l][r] + dp10[l][r - 1]) % MD;\n\t\t\t\tdp11[l][r] = (dp11[l][r] + dp11[l][r - 1]) % MD;\n\t\t\t}\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = 1; r <= m; r++) {\n\t\t\t\tdp00[l][r] = (dp00[l][r] + dp00[l - 1][r]) % MD;\n\t\t\t\tdp01[l][r] = (dp01[l][r] + dp01[l - 1][r]) % MD;\n\t\t\t\tdp10[l][r] = (dp10[l][r] + dp10[l - 1][r]) % MD;\n\t\t\t\tdp11[l][r] = (dp11[l][r] + dp11[l - 1][r]) % MD;\n\t\t\t}\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = 1; r <= m; r++)\n\t\t\t\tdq00[l][r] = dq01[l][r] = dq10[l][r] = dq11[l][r] = 0;\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = l; r <= m; r++) {\n\t\t\t\tdq00[l][r] = 1;\n\t\t\t\tadd(dq00, l, r, query(dp00, l, m, 1, r));\n\t\t\t\tadd(dq01, l, r, query(dp01, l, r, r, m));\n\t\t\t\tadd(dq01, l, r, query(dp00, l, r, r + 1, m));\n\t\t\t\tadd(dq10, l, r, query(dp10, 1, l, l, r));\n\t\t\t\tadd(dq10, l, r, query(dp00, 1, l - 1, l, r));\n\t\t\t\tadd(dq11, l, r, query(dp11, 1, l, r, m));\n\t\t\t\tadd(dq11, l, r, query(dp01, 1, l - 1, r, m));\n\t\t\t\tadd(dq11, l, r, query(dp10, 1, l, r + 1, m));\n\t\t\t\tadd(dq11, l, r, query(dp00, 1, l - 1, r + 1, m));\n\t\t\t\tans = (ans + (long long) dq00[l][r] + dq01[l][r] + dq10[l][r] + dq11[l][r]) % MD;\n\t\t\t}\n\t\tfor (l = 0; l <= m; l++)\n\t\t\tfor (r = 0; r <= m; r++) {\n\t\t\t\tdp00[l][r] = dq00[l][r];\n\t\t\t\tdp01[l][r] = dq01[l][r];\n\t\t\t\tdp10[l][r] = dq10[l][r];\n\t\t\t\tdp11[l][r] = dq11[l][r];\n\t\t\t}\n\t}\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "30c1f82db1d25584b4873f57fe7e805c", "src_uid": "740eceed59d3c6ac55c1bf9d3d4160c7", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define M\t150\n#define MD\t1000000007\n\nint query(int aa[][M + 1], int l0, int l1, int r0, int r1) {\n\treturn l0 > l1 || r0 > r1 ? 0 : ((long long) aa[l1][r1] - aa[l0 - 1][r1] - aa[l1][r0 - 1] + aa[l0 - 1][r0 - 1]) % MD;\n}\n\nvoid add(int aa[][M + 1], int l, int r, int a) {\n\taa[l][r] = (aa[l][r] + a) % MD;\n}\n\nint main() {\n\tstatic int dp00[M + 1][M + 1], dp01[M + 1][M + 1], dp10[M + 1][M + 1], dp11[M + 1][M + 1];\n\tstatic int dq00[M + 1][M + 1], dq01[M + 1][M + 1], dq10[M + 1][M + 1], dq11[M + 1][M + 1];\n\tint n, m, l, r, ans;\n\n\tscanf(\"%d%d\", &n, &m);\n\tans = 0;\n\twhile (n--) {\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = 1; r <= m; r++) {\n\t\t\t\tdp00[l][r] = (dp00[l][r] + dp00[l][r - 1]) % MD;\n\t\t\t\tdp01[l][r] = (dp01[l][r] + dp01[l][r - 1]) % MD;\n\t\t\t\tdp10[l][r] = (dp10[l][r] + dp10[l][r - 1]) % MD;\n\t\t\t\tdp11[l][r] = (dp11[l][r] + dp11[l][r - 1]) % MD;\n\t\t\t}\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = 1; r <= m; r++) {\n\t\t\t\tdp00[l][r] = (dp00[l][r] + dp00[l - 1][r]) % MD;\n\t\t\t\tdp01[l][r] = (dp01[l][r] + dp01[l - 1][r]) % MD;\n\t\t\t\tdp10[l][r] = (dp10[l][r] + dp10[l - 1][r]) % MD;\n\t\t\t\tdp11[l][r] = (dp11[l][r] + dp11[l - 1][r]) % MD;\n\t\t\t}\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = 1; r <= m; r++)\n\t\t\t\tdq00[l][r] = dq01[l][r] = dq10[l][r] = dq11[l][r] = 0;\n\t\tfor (l = 1; l <= m; l++)\n\t\t\tfor (r = l; r <= m; r++) {\n\t\t\t\tdq00[l][r] = 1;\n\t\t\t\tadd(dq00, l, r, query(dp00, l, m, 1, r));\n\t\t\t\tadd(dq01, l, r, query(dp01, l, r, r, m));\n\t\t\t\tadd(dq01, l, r, query(dp00, l, r, r + 1, m));\n\t\t\t\tadd(dq10, l, r, query(dp10, 1, l, l, r));\n\t\t\t\tadd(dq10, l, r, query(dp00, 1, l - 1, l, r));\n\t\t\t\tadd(dq11, l, r, query(dp11, 1, l, r, m));\n\t\t\t\tadd(dq11, l, r, query(dp01, 1, l - 1, r, m));\n\t\t\t\tadd(dq11, l, r, query(dp10, 1, l, r + 1, m));\n\t\t\t\tadd(dq11, l, r, query(dp00, 1, l - 1, r + 1, m));\n\t\t\t\tans = (ans + (long long) dq00[l][r] + dq01[l][r] + dq10[l][r] + dq11[l][r]) % MD;\n\t\t\t}\n\t\tfor (l = 0; l <= m; l++)\n\t\t\tfor (r = 0; r <= m; r++) {\n\t\t\t\tdp00[l][r] = dq00[l][r];\n\t\t\t\tdp01[l][r] = dq01[l][r];\n\t\t\t\tdp10[l][r] = dq10[l][r];\n\t\t\t\tdp11[l][r] = dq11[l][r];\n\t\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "73fbe48f2e49e4380357036ac4661a50", "src_uid": "740eceed59d3c6ac55c1bf9d3d4160c7", "difficulty": 2400.0} {"lang": "GNU C", "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 a[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\nlong long int a[1000000000],b[1000000000];\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 if(i=i-k;j--)\n l+=a[j];\n a[i]=l;\n }\n if(a[i]>=s)\n break;\n }\n o=i-1;\n m=1;\n for(p=o;p>=k;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 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 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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "775fca10e6ae809fd2f84176fbbef615", "src_uid": "da793333b977ed179fdba900aa604b52", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \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 if(i=i-k;j--)\n l+=a[j];\n a[i]=l;\n }\n if(a[i]>=s)\n break;\n }\n o=i-1;\n m=1;\n for(p=o;p>=k;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\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]=sum=1; continue;}\n f[i]=sum;\n // printf(\"f[%lld]=%lld\\n\",i,f[i]);\n if(f[i]>s) break;\n sum+=f[i];\n sum-=f[i-k];\n }\n int index=0;\n for(;i>=0;i--)\n {\n if(f[i]<=s)\n\ts-=f[i],ans[index++]=f[i];\n if(f[i]==0) break;\n }\n printf(\"%lld\\n\",index);\n for(i=0;i\n#include \n\nint main()\n{\n int n, x, i, m, r, min_n = 10004, max_m = -1;\n scanf(\"%d%d%d\", &n, &m, &r);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &x);\n if(x < min_n) min_n = x;\n }\n for(i = 0; i < m; i++)\n {\n scanf(\"%d\", &x);\n if(x > max_m) max_m = x;\n }\n i = (max_m * (r / min_n)) + (r % min_n);\n if(i > r) printf(\"%d\\n\", i);\n else printf(\"%d\\n\", r);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "60b5d64e54b0c293d9f9a9b303cda896", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint func(const void * a,const void *b)\n{\n return ( *(int*)b - *(int*)a );\n}\nint main()\n{\n int i,j,n,m,r,s[1005],b[1005],x=0,t;\n scanf(\"%d %d %d\",&n,&m,&r);\n t=r;\n for (i=0;ir)\n r=t;\n printf(\"%d\\n\",r);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d01ba100959c8be4ca371c011767acf0", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,m,r,i,j,less,max,buy,sell,t;\n scanf(\"%d%d%d\",&n,&m,&r);\n int s[n],x[m];\n for(i=0;imax)\n max=x[i];\n }\n buy=r/less;\n t=r%less;\n sell=max*buy+t;\n if(sell>r)\n printf(\"%d\",sell);\n else\n printf(\"%d\",r);\n \n},", "lang_cluster": "C", "compilation_error": true, "code_uid": "2741130d9222c5103292cd6a93008a87", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n int n,m,r;\n scanf(\"%d %d %d\",&n,&m,&r);\n int s[n],b[m];\n int i,j;\n for(i=0;imax)\n max=b[j];\n }\n int ans;\n if(max>min)\n {\n ans=*(max-min)*5)+r;\n }\n else\n ans=r;\n printf(\"%d\",ans);\n}\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "e9793bbd8e7ef3b1139924cfeb74aae8", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n#include \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; // 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(int arr[], int l, int r) \n{ \n if (l < r) \n { \n // Same as (l+r)/2, but avoids overflow for \n // large l and h \n int 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\n\nint main(){\n\tint n,m,r;\n\tscanf(\"%d %d %d\",&n,&m,&r);\n\tint s[n];\n\tint s_min;\n\tint b_temp = 0;\n\tint b_max = 0;\n\tint buy = 0;\n\tint flag = 0;\n\tfor(int i=0;i b_max){\n\t\t\tb_max = b_temp;\n\t\t}\n\t}\n\tif(s_min >= b_max){\n\t\tprintf(\"%d\\n\",r);\n\t}\n\telse{\n\t\tbuy = r/s_min;\n\t\tr = r-b*s_min;\n\t\tint count = r + buy*b_max;\n\t\tprintf(\"%d\\n\",count);\n\t}\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd7c4c172bcb15c6e65683b23a7437f1", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n long long n,y,prey,ans=0,i;\n scanf(\"%I64d\",&n);\n if(n==0)\n printf(\"1\\n\");\n else\n {\n prey = sqrt(n*n - 1);\n ans++;\n for(i=2;i<=n;i++)\n {\n y = sqrt(n*n-i*i);\n //printf(\"%lld %lld prevy y\\n\",prey,y);\n if(y==prey)\n ans++;\n else\n ans += prey - y;\n prey = y;\n }\n ans--;\n //printf(\"%lld check\\n\",ans);\n ans *= 4;\n\n ans += 4;\n printf(\"%I64d\\n\",ans);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "baa46b5e35b7e311c464071ad6d6eec3", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int ix;\n long long int l,r,m,n,x,y,n2,dc,nd2;\n scanf(\"%I64d\",&n);\n if(n<=1)\n {\n if(n==0)\n printf(\"1\");\n else\n printf(\"4\");\n return 0;\n }\n l=1;r=n;nd2=n*n;\n nd2/=2;\n while(l+1nd2)\n r=m;\n else\n l=m;\n }\n if(r*r<=nd2)\n x=r;\n else\n x=l;\n \n n2=n*n;\n dc=2*x*x+2*x+1;\n \n ix=x;\n if(dc-n2<=0)\n {\n printf(\"%d\",8*ix+4);\n }\n else\n {\n printf(\"%d\",8*ix);\n }\n return 0;\n \n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "75a71de2e1bc878f5f1f40f31f583a23", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define For(i,m,n) for(i=m;i(y)?(x):(y)\n#define MIN(x,y) (x)<(y)?(x):(y)\n#define MAXN 205\n\nmain()\n{\n long long n;\n scanf(\"%I64d\",&n);\n if(n==0) printf(\"1\\n\");\n else printf(\"%I64d\\n\",4*(long long)floor(n*sqrt(2)));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d1336790d84188b5422c6c6b788f42d", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n#include \n\nint n;\n\nint special(int x, int y) {\n long long xx = x, yy = y, nn = n; xx *= x; yy *= y; nn *= n;\n return xx + yy <= nn;\n}\n\nint main(void) {\n int i, j, r = 0, s = 0;\n scanf(\"%d\", &n);\n j = n;\n if (n == 0) r = 1;\n else if (n == 1) r = 4;\n else {\n for (i = 0; i <= j; ++i) {\n while (!special(i, j)) --j;\n if (i < j) ++r;\n if (i == j) ++s;\n }\n r = 2*r + s; r += r - 1; r += r - 2;\n }\n printf(\"%d\\n\", r);\n exit(EXIT_SUCCESS);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b69d30ca8e9b2747a1fe557362d5098a", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n#include \n\nint n;\n\nint special(int x, int y) {\n long long xx = x, yy = y, nn = n; xx *= x; yy *= y; nn *= n;\n return xx + yy < nn;\n}\n\nint main(void) {\n int i, j, r = 0, s = 0;\n scanf(\"%d\", &n);\n j = n;\n for (i = 0; i <= j; ++i) {\n while (!special(i, j)) --j;\n if (i < j) ++r;\n if (i == j) ++s;\n }\n r = 2*r + s; r += r - 1; r += r - 2;\n printf(\"%d\\n\", n == 0 ? 1 : n == 1 ? 4 : r);\n exit(EXIT_SUCCESS);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d17c29e1294a456c481f3730dbddc90b", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#define int long long int\nsigned main()\n{\n int x,y,s[3];\n scanf(\"%d%d\",&x,&y);\n int a=0,i,ans=0,sum=0,count1=0;\n s[1]=y;\n s[2]=y;\n s[3]=y;\n while(count1<3)\n {\n\tfor(i=1;i<=3;i++)\n\t{\n\t if(count1==3)\n\t\tbreak;\n\t sum=s[1]+s[2]+s[3];\n\t a=sum-s[i]-1;\n\t if(a>=x)\n\t {\n\t\ts[i]=x;\n\t\tcount1++;\n\t }\n\t else\n\t\ts[i]=a;\n\t ans++;\n\t printf(\"%d %d %d %d %d\\n\",a,count,s[1],s[2],s[3]);\n\t}\n }\n printf(\"%d\",ans);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "58516ed382d58cad6e0a477b58e90b89", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n\tint d,x,y,a,b,c,i=0;\n\tscanf(\"%d%d\",&x,&y);\n\ta=b=c=y;\n\twhile(a\nint main()\n\n{\n\tint x=0, y=0;\n\tscanf(\"%d %d\", &x, &y);\n\tint p,q,r;\n\tp=y;\n\tq=y;\n\tr=y;\n\tint count=0;\n\n\twhile(1<2\n\t{\n\t\tif(q+r-1\n#define int long long int\nsigned main()\n{\n int x,y,s[4]={0};\n scanf(\"%d%d\",&x,&y);\n int a=0,i,ans=0,sum=0,count1=0;\n s[1]=y;\n s[2]=y;\n s[3]=y;\n while(count1<3)\n {\n\tfor(i=1;i<=3;i++)\n\t{\n\t if(count1==3)\n\t\tbreak;\n\t sum=s[1]+s[2]+s[3];\n\t a=sum-s[i]-1;\n\t if(a>=x)\n\t {\n\t\ts[i]=x;\n\t\tcount1++;\n\t }\n\t else\n\t\ts[i]=a;\n\t ans++;\n\t printf(\"%d %d %d %d %d\\n\",a,count1,s[1],s[2],s[3]);\n\t}\n }\n printf(\"%d\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3d2c0c1b973e3ae75bfaa74f011aca8f", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n\tint x,y,n=3,a,b,c,flag=1,i=0,temp;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tif(y+y>x){\n\t\tprintf(\"3\");\n\t}\n\telse if(y+y==x){\n\t\tprintf(\"4\");\t\n\t}\n\telse{\n\t\ta=y;\n\t\tb=y;\n\t\tc=y;\n\t\twhile(flag){\n\t\t\tc=a+b-1;\n\t\t\ti++;\n\t\t\tif(c>x){\n\t\t\t\tn=n+i;\n\t\t\t\tprintf(\"%d\",n);\n\t\t\t\tflag=0;\t\t\t\n\t\t\t}\n\t\t\telse if(c==x){\n\t\t\t\tn=n+i-1;\n\t\t\t\tprintf(\"%d\",n);\n\t\t\t\tflag=0;\t\t\t\t\n\t\t\t}\t\t\n\t\t\telse{\n\t\t\t\tif(a\nint x,y,z,xx,yy,zz,ans,a[7];\nint main()\n{\n\tint i;\n\tscanf(\"%d%d%d%d%d%d\",&x,&y,&z,&xx,&yy,&zz);\n\tfor(i=1;i<=6;i++) scanf(\"%d\",&a[i]);\n\tif(y<0) ans += a[1];\n\tif(y>yy) ans += a[2];\n\tif(z<0) ans += a[3];\n\tif(z>zz) ans += a[4];\n\tif(x<0) ans += a[5];\n\tif(x>xx) ans += a[6];\n\tprintf(\"%d\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ba6c6b03cb43bd41ec5556cae73d7152", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int X,Y,Z,x,y,z,i,j,num[10];\n while(1){\n scanf(\"%d %d %d\",&x,&y,&z);\n scanf(\"%d %d %d\",&X,&Y,&Z);\n for (i=0;i<6;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n j=0;\n if (x>X)\n {\n j+=num[5];\n }\n else if (x<0)\n {\n j+=num[4];\n }\n if (y>Y)\n {\n j+=num[1];\n }\n else if (y<0)\n {\n j+=num[0];\n }\n if (z>Z)\n {\n j+=num[3];\n }\n else if (z<0)\n {\n j+=num[2];\n }\n\n\n }\n printf(\"%d\\n\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5944c76c75d14338df14bfdcf9fe33d1", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main() \n{\nint x,y,z;\nint x,yy,z1;\nint a[7];\n scanf(\"%d%d%d\",&x,&y,&z);\n scanf(\"%d%d%d\",&x1,&yy,&z1);\n for (int i=1;i<=6;i++) scanf(\"%d\",&a[i]);\n\n int ans=0;\n if (y<0) ans+=a[1];\n if (y>yy) ans+=a[2];\n if (z<0) ans+=a[3];\n if (z>z1) ans+=a[4];\n if (x<0) ans+=a[5];\n if (x>x1) ans+=a[6];\n printf(\"%d\\n\",ans);\n\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5189a69f48e5984978f29695d9ac096a", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main() \n{\nint x,y,z;\nint x1,yy,z1;\nint a[7];\n scanf(\"%d%d%d\",&x,&y,&z);\n scanf(\"%d%d%d\",&x1,&yy,&z1);\n for (int i=1;i<=6;i++) scanf(\"%d\",&a[i]);\n\n int ans=0;\n if (y<0) ans+=a[1];\n if (y>yy) ans+=a[2];\n if (z<0) ans+=a[3];\n if (z>z1) ans+=a[4];\n if (x<0) ans+=a[5];\n if (x>x1) ans+=a[6];\n printf(\"%d\\n\",ans);\n\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "26eba6793b2cc4e339faa3d5669ccd6f", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main() \n{\nint x,y,z;\nint x1,y1,z1;\nint a[7];\n scanf(\"%d%d%d\",&x,&y,&z);\n scanf(\"%d%d%d\",&x1,&yy,&z1);\n for (int i=1;i<=6;i++) scanf(\"%d\",&a[i]);\n\n int ans=0;\n if (y<0) ans+=a[1];\n if (y>yy) ans+=a[2];\n if (z<0) ans+=a[3];\n if (z>z1) ans+=a[4];\n if (x<0) ans+=a[5];\n if (x>x1) ans+=a[6];\n printf(\"%d\\n\",ans);\n\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c4adbf64c8712a35d16189b2501305c7", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2106798a76a43755065a4a9494eeb814", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "282c5bddb21eaa006f47b2457fedb37f", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8f3a17bcad4f465a734acce1f96be65f", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "432d668a7c8ab9882b62f8070d46e4f7", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int c,n,i,ar[10],flag=-1;\n long int a,b,x=10;\n scanf(\"%ld %ld %d\",&a,&b,&c);\n a=a%b;\n for(i=0;i<=10;i++)\n {\n\n a=a*10;\n ar[i]=a/b;\n a=a%b;\n if(ar[i]==c)\n {\n flag=i;\n break;\n }\n }\n if(flag==-1)\n printf(\"-1\\n\");\n else\n printf(\"%d\\n\",flag+1);\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "997ffd97df033b26a3aac4b72c0aef24", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tdouble a,b;\n\tint c,ans=-1;\n\tscanf(\"%lf %lf %d\",&a,&b,&c);\n\tdouble frac=fracinp-fracint;\n\t/*printf(\"%0.18lf\\n\", frac);*/\n\tint arr[18]={0};int i; \n\tfor (i = 0; i < 18; i++)\n\t{\n\t\tint dig=10*frac;\n\t\tarr[i]=dig;\n\t\tfrac=(10*frac)-dig;\n\t}\n\t/*for (i = 0; i < 6; i++)\n\t{\n\t\tprintf(\"%d\", arr[i]);\n\t}\n\tprintf(\"\\n\");*/\n\tfor (i = 0; i < 18; i++)\n\t{\n\t\tif (arr[i]==c){\n\t\t\tans=i+1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1330f459b995b7af8e84b9d8859bb883", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "[Project]\nFileName=1.dev\nName=Project1\nType=1\nVer=2\nObjFiles=\nIncludes=\nLibs=\nPrivateResource=\nResourceIncludes=\nMakeIncludes=\nCompiler=\nCppCompiler=\nLinker=\nIsCpp=0\nIcon=\nExeOutput=\nObjectOutput=\nLogOutput=\nLogOutputEnabled=0\nOverrideOutput=0\nOverrideOutputName=\nHostApplication=\nUseCustomMakefile=0\nCustomMakefile=\nCommandLine=\nFolders=\nIncludeVersionInfo=0\nSupportXPThemes=0\nCompilerSet=0\nCompilerSettings=0000000000000000000000000\n\n[VersionInfo]\nMajor=1\nMinor=0\nRelease=0\nBuild=0\nLanguageID=1033\nCharsetID=1252\nCompanyName=\nFileVersion=\nFileDescription=Developed using the Dev-C++ IDE\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=\nAutoIncBuildNr=0\nSyncProduct=1\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "93b70b39b9fa975e1f4e5b072f34fb43", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \nunsigned int a,b;\nchar c;\nint main()\n{\n\tfloat f,l;\n\tint k,i=0;\n\tbool key=false;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tf=(float)a/b*10;\n\tk=(int)f;\n\t\n\twhile (i<1000 && key==false)\n\t{\n\t\tk=k%10;\n\t\tif (k==c) key=true;\n\t\tl=(a-k*0.1*b)*10;\n\t\ta=(int)l;\n\t\tf=(float)a/b*10;printf(\"%f\\n\",f);\n\t\tk=(int)f;\n\t\ti++;\n\t}\n\tif (key==true) printf(\"%d\",i);\n\telse printf(\"-1\");\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "aa5af7a34d4ef402215480b48eb77d84", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint pos=0,brk=0,x=10000000;\n\twhile(x--){\n\t\tint rem = a%b;\n\t\tif(rem==0){\n\t\t\tbrk=1;\n\t\t\tbreak;\n\t\t}\n\t\ta*=10;\n\t\twhile(a0){\n\t\t\tprintf(\"%d\\n\",pos);\n\t\t}\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f72a2bf7d2d0639a5133c4e422e94e2d", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "02287bbd25c79cebf2345ff3b086d151", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0eeba21d8c8042ba0ffff4b851b8cd31", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n;\n scanf(\" %d\",&n);\n if(n%2==0){\n printf(\"white \\n\");\n printf(\"1\");\n printf(\"2\");\n}\nelse printf(\"black\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b85e55d4316b1691aab6ebf3ebe56070", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint t,n;\n\nint main() {\n scanf(\"%d\",&n);\n if(n==2){\n printf(\"white\\n1 2\"); \n }else if(n%2==0){\n printf(\"white\\n2 2\");\n }else{\n printf(\"black\");\n }\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0a7126c63c639046964bb9e7b4474777", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nint main(){\nlong long n=0;\nscanf(\"%I64d\",&n);\nif(n==2){printf(\"white\\n\");printf(\"1 2\");}\nelse if ( n % 2 == 0)printf(\"white\\n 1 %I64d\",n/2+1);\nelse printf(\"black\");\n\n\n\n\n\n\n\nreturn 0 ;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6cb5e3df9559be1a661401e6a2c59a3d", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nint main(){\nlong long n=0;\nscanf(\"%I64d\",&n);\nif(n==2){printf(\"white\\n\");printf(\"1 2\");\nelse if ( n % 2 == 0)printf(\"white\\n 1 %I64d\",n/2+1);\nelse printf(\"black)\n\n\n\n\n\n\n\nreturn 0 ;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c321bf208d0a19ba768c3094ebcfd5e9", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\" ,&n);\n if(n%2==0)\n printf(\"white\");\n printf(\"1 2\");\n else\n printf(\"black\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "21d05f7f1378071a0d121b3c9f6b3c41", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n\nuint64_t getBlkCount(uint32_t l,uint32_t b,uint32_t div)\n{\n uint64_t blkCnt = 0;\n for(int i=1;i<=l;i++)\n for(int j=1;j<=b;j++)\n {\n blkCnt+= (((i*i + j*j)%div)==0);\n }\n return blkCnt;\n}\n\n\nuint64_t getCount(uint32_t n,uint32_t m)\n{\n int q = n/m, r = n%m;\n \n uint64_t fullBlkCnt = getBlkCount(m,m,m);\n uint64_t halfBlkCnt = getBlkCount(r,m,m);\n uint64_t remBlkCnt = getBlkCount(r,r,m);\n\n uint64_t blkCnt = fullBlkCnt*q*q + halfBlkCnt*2*q + remBlkCnt;\n\n return (blkCnt);\n}\n\nint main()\n{\n uint32_t n,m;\n uint64_t count;\n scanf(\"%d %d\",&n,&m);\n printf(\"%lu\\n\",getCount(n,m));\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b5c49988ffcf05ccfda3677837ec5a20", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nlong long int main(long long int argc, char const *argv[])\n{\n\tlong long int n,m;\n\tscanf(\"%lld%lld\",&n,&m);\n\tlong long int a[m];\n\tfor(long long i=0;i\n\n\nint main()\n{\n long long unsigned int n,i,j,result=0;\n int m;\n int ss;\n scanf(\"%I64d\",&n);\n scanf(\"%d\",&m);\n if(m==1)\n {\n printf(\"%I64d\",n*n);\n return 0;\n }\n\n if(m%2==0)\n {\n for(i=1;i<=n;i+=2)\n for(j=1;j<=i;j+=2)\n {\n if( (i*i+j*j)%m==0 && i!=j) result+=2;\n if( (i*i+j*j)%m==0 && i==j) result+=1;\n }\n for(i=2;i<=n;i+=2)\n for(j=2;j<=i;j+=2)\n {\n if( (i*i+j*j)%m==0 && i!=j) result+=2;\n if( (i*i+j*j)%m==0 && i==j) result+=1;\n }\n }\n else\n {\n for(i=1;i<=n;i++)\n for(j=1;j<=i;j+=1)\n {\n if( (i*i+j*j)%m==0 && i!=j) result+=2;\n if( (i*i+j*j)%m==0 && i==j) result+=1;\n }\n }\n\n\n\n printf(\"%I64d\",result);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6d7a7754b4b8c7c221a9d67bc560affa", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nlong long int main(long long int argc, char const *argv[])\n{\n\tlong long int n,m;\n\tscanf(\"%lld%lld\",&n,&m);\n\tlong long int a[m];\n\tfor(long long i=0;i\n\n\nint main()\n{\n long long unsigned int n,i,j,result=0;\n int m;\n int ss;\n scanf(\"%I64d\",&n);\n scanf(\"%d\",&m);\n if(m==1)\n {\n printf(\"%I64d\",n*n);\n return 0;\n }\n for(i=1;i<=n;i++)\n for(j=1;j<=n;j++)\n {\n if( (i*i+j*j)%m==0 ) result++;\n }\n printf(\"%I64d\",result);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6a9e41d2534f0151ea2ca942deea26d6", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\ndouble sub(int w, int b) {\n double win, buf;\n\n if (w == 0) return 0;\n\n win = (double)w / (w + b);\n buf = (double)b / (w + b);\n b--;\n if (b <= 0) return win;\n buf = buf * b / (w + b);\n b--;\n if (b == 0)\n win = win + buf * w/(w+b) * sub(w-1, b);\n else\n win = win + buf * w/(w+b) * sub(w-1, b) + buf * b/(w+b) * sub(w, b-1);\n return win;\n}\n\nint main() {\n int w, b;\n double win;\n\n scanf(\"%d%d\", &w, &b);\n win = sub(w, b);\n printf(\"%.9f\", win);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dd37220671e7c3658c52dcfe9bc64fd1", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n\ndouble data[1000][1000];\nint visit[1000][1000]={0};\n\ndouble count (int w, int b)\n{\n if(visit[w][b]==1) return data[w][b];\n else if(w==0){\n visit[w][b]=1;\n data[w][b]=0; \n return data[w][b];\n }\n else if(w==1&&b>2){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b)+(double)b/(w+b)*(b-1)/(w+b-1)*(b-2)/(w+b-2)*count(w,b-3); \n return data[w][b];\n }\n else if(b==1){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b);\n return data[w][b];\n }\n else if(w>0&&b==0){\n visit[w][b]=1;\n data[w][b]=1;\n return data[w][b];\n }\n else if(w==1&&b==2){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b); \n return data[w][b];\n }\n else if(b==2){\n printf(\"4\\n\");\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b)+(double)b/(w+b)*(b-1)/(w+b-1)*w/(w+b-2);\n return data[w][b];\n }\n else{\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b);\n data[w][b]+=(double)b/(w+b)*(b-1)/(w+b-1)*(b-2)/(w+b-2)*count(w,b-3)+(double)b/(w+b)*(b-1)/(w+b-1)*w/(w+b-1)*count(w-1,b-2);\n return data[w][b];\n }\n \n \n}\n\n\n\nint main()\n{\n int w,b;\n scanf(\"%d%d\",&w,&b); \n if(w==0){\n visit[w][b]=1;\n data[w][b]=0; \n }\n else if(w==1&&b>2){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b)+(double)b/(w+b)*(b-1)/(w+b-1)*(b-2)/(w+b-2)*count(w,b-3); \n }\n else if(b==1){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b);\n }\n else if(w>0&&b==0){\n visit[w][b]=1;\n data[w][b]=1;\n }\n else if(w==1&&b==2){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b); \n }\n else if(b==2){\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b)+(double)b/(w+b)*(b-1)/(w+b-1)*w/(w+b-2);\n }\n else{\n visit[w][b]=1;\n data[w][b]=(double)w/(w+b)+(double)b/(w+b)*(b-1)/(w+b-1)*(b-2)/(w+b-2)*count(w,b-3)+(double)b/(w+b)*(b-1)/(w+b-1)*w/(w+b-1)*count(w-1,b-2);\n }\n printf(\"%.9lf\",data[w][b]);\n //system(\"pause\");\n return 0; \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "743ff727eebbbefc359a4ac4ad4f9913", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define max(a,b) a>b?a:b\n#define min(a,b) a=0; i--) {\n for (j=m; j>=0; j--) {\n if(i>0 || j>0)\n sum+=(dpp[i][j][1]*(double)i)/((double)(i+j));\n if(j>0)\n dpp[i][j-1][0]+=(double)((dpp[i][j][1]*((double)j)))/((double)(i+j));\n if(i>0 && j>0)\n dpp[i-1][j-1][1]+=(dpp[i][j][0]*((double)(j*i)))/((double)((i+j-1)*(i+j)));\n if(j>1)\n dpp[i][j-2][1]+=(dpp[i][j][0]*((double)((j-1)*j)))/((double)((i+j-1)*(i+j)));\n }\n }\n printf(\"%lf\\n\",sum);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "54e40411347fde87d413755eee539d14", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint W,B;\n\tscanf(\"%d %d\",&W,&B);\n\tdouble p[W+1][B+1];\n\n\tfor(int i = 0 ; i <=B ; i++)p[0][i] = 0.000000;\n\tfor(int i = 1 ; i <=W ; i++)p[i][0] = 1.000000;\n\tfor(int i = 1 ; i <=W ; i++)p[i][1] = (int)i/((int)i+1.00000);\n\t\t\t\n\tfor(int ww = 1 ; ww <= W ; ww++)\n\t{\n\t\tfor(int bb = 2; bb<= B; bb++)\n\t\t{\n\t\t\tdouble z1,z2,w=(double)ww,b=(double)bb;\n\t\t\tz1 = (w/(w+b-2)) * p[ww-1][bb-2];\n\t\t\tz2 = (b-2)/(w+b-2);\n\t\t\tif(z2!=0) z2*= p[ww][bb-3]; \n\t\t\tp[ww][bb] = w/(w+b) + ((b*(b-1))/((w+b)*(w+b-1))*(z1+z2));\n\t\t}\n\t}\n\tprintf(\"%.10lf\\n\",p[W][B]);\n\treturn 0;\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "30024fed1e0c2031d5229fad44001a63", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(){\n int w,b;\n scanf(\"%d %d\", &w, &b);\n double Pr[w+3][b+3];\n memset(Pr, 0, sizeof(double)*(w+3)*(b+3));\n for( int i = 3; i < (w + 3); i++)\n Pr[i][2] = 1;\n int x,y;\n for(int i = 3; i < (w + 3); i++){\n for( int j = 3; j < (b + 3); j++){\n x = i - 2;\n y = j - 2;\n Pr[i][j] = (double)(x)/(x+y) + \n ((double)((y)*(y-1))/((x+y)*(x+y-1))) *\n ( ((double)(y-2)/(x+y-2))*Pr[i][j-3] + \n ((double)x/(x+y-2))*Pr[i-1][j-2]);\n \n }\n }\n printf(\"%.9f\\n\", Pr[w+2][b+2]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd354e63bd60663e9a76c33cbdba7d4b", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "/* Practice with Dukkha and rainboy */\n#include \n\n#define MD 1000000007\n\nint main() {\n\tlong long n, m, x, ans;\n\n\tscanf(\"%lld%lld\", &n, &m);\n\tx = (1 << m) - 1;\n\tans = 1;\n\twhile (n--)\n\t\tans = ans * x % MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "833079cda466feaa8bfe837f4795344f", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "/*******************************\n**Created by Libra at 2020-05-24 16:44.\n**Copyright @ Weilong Jiang.\n** Descibe: \u6bcf\u79cd\u793c\u7269\u7684\u653e\u7f6e\u76f8\u4e92\u72ec\u7acb\uff0c\u4e3a\u4fdd\u8bc1\u6bcf\u79cd\u793c\u7269\u81f3\u5c11\u653e\u4e00\u4e2a\uff0c\u5355\u79cd\u793c\u7269\u7684\u653e\u7f6e\u65b9\u5f0f\u4e3a2^m-1,n\u79cd\u793c\u7269\u5c31\u6709(2^m-1)^n\n*******************************/\n\n#include \ntypedef long long ll;\nconst ll mod = 1e9 + 7;\n\nll quick_power_mod(ll, ll);\n\nint main(int argc, const char *argv[]) {\n int presents = -1, boxes = -1;\n scanf(\"%d%d\", &presents, &boxes);\n ll res = -1;\n res = quick_power_mod(2, boxes) - 1;\n // res = (res >= 0) ? res : (mod - res);\n\n prllf(\"%d\", quick_power_mod(res, presents));\n return 0;\n}\n\nll quick_power_mod(ll a, ll b) {\n ll res = 1, base = a % mod;\n while (b) {\n if (b & 1)\n res = res * base % mod;\n base = base * base % mod;\n b >>= 1;\n }\n return res;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "202e7dc8d7e69b438a41bd41cb8765bc", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "/*******************************\n**Created by Libra at 2020-05-24 16:44.\n**Copyright @ Weilong Jiang.\n** Descibe: \u6bcf\u79cd\u793c\u7269\u7684\u653e\u7f6e\u76f8\u4e92\u72ec\u7acb\uff0c\u4e3a\u4fdd\u8bc1\u6bcf\u79cd\u793c\u7269\u81f3\u5c11\u653e\u4e00\u4e2a\uff0c\u5355\u79cd\u793c\u7269\u7684\u653e\u7f6e\u65b9\u5f0f\u4e3a2^m-1,n\u79cd\u793c\u7269\u5c31\u6709(2^m-1)^n\n*******************************/\n\n#include \ntypedef long long ll;\nconst ll mod = 1e9 + 7;\n\nll quick_power_mod(ll, ll);\n\nint main(int argc, const char *argv[]) {\n int presents = -1, boxes = -1;\n scanf(\"%d%d\", &presents, &boxes);\n ll res = -1;\n res = quick_power_mod(2, boxes) - 1;\n // res = (res >= 0) ? res : (mod - res);\n\n prllf(\"%lld\", quick_power_mod(res, presents));\n return 0;\n}\n\nll quick_power_mod(ll a, ll b) {\n ll res = 1, base = a % mod;\n while (b) {\n if (b & 1)\n res = res * base % mod;\n base = base * base % mod;\n b >>= 1;\n }\n return res;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51554a5ab0daa8de9af208850e7a3b03", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\nlong long readLong();\n\nlong long pow(long long a, long long n) {\n if ( n==(((long long) 0)) ) return ((long long) 1);\n if ( n%2==(((long long) 1)) ) {\n long long tmp = pow(a,n-1);\n return (tmp*a)%MOD;\n }\n else {\n long long c = pow(a,n/2);\n return (c*c)%MOD;\n }\n}\n\nint main() {\n\n long long MOD = ((long long) 1000000007);\n long long n = readLong();\n long long m = readLong();\n printf(\"%l64d\", (pow((pow(((long long) 2),m)-1),n)));\n \n}\nlong long readLong() {\n long long t;\n scanf(\"%l64d\", &t);\n return t;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "65c5b6b32bf7b8c01ac6718be3c88c33", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nconst int mod=1e9+7;\n\nlong int powof(long int p,long int n)\n{\n\tif(n==0) return 1;\n\tif(n%2==0)\n\t\treturn powof(((p%mod)*(p%mod))%mod,n)%mod;\n\telse\n\t\treturn ((p%mod)*(powof(((p%mod)*(p%mod))%mod,(n/2)%mod)%mod))%mod;\n}\n\nint main()\n{\n\tlong int n,m,ans=1,p=1;\n\tscanf(\"%ld %ld\",&n,&m);\n\tp=powof(2,m)-1;\n\t\n\tans=powof(p,n);\n\tprintf(\"%ld\\n\",ans);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "496af6d26ce86cc1af48452cfc179612", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nusing namespace std;\r\nint main(){\r\n int t;\r\n cin>>t;\r\n int steps;\r\n for(int i=0;i>me;\r\n wa = 100-me;\r\n gcd = __gcd(me,wa);\r\n e = me/gcd;\r\n w = wa/gcd;\r\n steps = e + w;\r\n\r\n }\r\n cout<\r\n#include\r\nusing namespace std;\r\nint main(){\r\n int t;\r\n cin>>t;\r\n for(int i=0;i>me;\r\n wa = 100-me;\r\n gcd = __gcd(me,wa);\r\n e = me/gcd;\r\n w = wa/gcd;\r\n steps = e + w;\r\n cout<\r\nusing namespace std;\r\n\r\nint main() {\r\n int tc;\r\n cin>>tc;\r\n while(tc--) {\r\n int k,ans;\r\n cin>>k;\r\n if(100%k==0) {\r\n ans=100/k;\r\n }else if(k%2==0 || k%5==0) {\r\n if(k%2==0 && k%5!=0) {\r\n if(k%4==0){\r\n ans=25;\r\n }else{\r\n ans=50;\r\n }\r\n }else if(k%2!=0 && k%5==0) {\r\n if(k%25==0){\r\n ans=4;\r\n }else{\r\n ans=20;\r\n }\r\n }else{\r\n if(k%20==0){\r\n ans=5;\r\n }else{\r\n ans=10;\r\n }\r\n }\r\n }else{\r\n ans=100;\r\n }\r\n cout<\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "eaed13e55b077bcc73477eaf21bf89a0", "src_uid": "19a2bcb727510c729efe442a13c2ff7c", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \r\nusing namespace std;\r\nstring toGoatLatin(string sent) {\r\n string s = \"\";\r\n vector v;\r\n int i = 0;\r\n while(sent[i] != '\\0')\r\n {\r\n if(sent[i] == ' ')\r\n {\r\n v.push_back(s);\r\n s = \"\";\r\n }\r\n else {\r\n s += sent[i];\r\n }\r\n i++;\r\n }\r\n v.push_back(s);\r\n s = \"\";\r\n for(int i = 0; i < v.size(); i++)\r\n {\r\n for(int j = 0; j < v[i].size(); j++)\r\n {\r\n cout << v[i][j];\r\n }\r\n cout << endl;\r\n }\r\n string a = \"maa\";\r\n for(int i = 0; i < v.size(); i++)\r\n {\r\n if(v[i][0] == 'A' || v[i][0] == 'E' || v[i][0] == 'I' || v[i][0] == 'O' || v[i][0] == 'U' || v[i][0] == 'a' || v[i][0] == 'e' || v[i][0] == 'i' || v[i][0] == 'o' || v[i][0] == 'u')\r\n {\r\n v.push_back(a);\r\n \r\n for(int j = 1; j < i; j++){\r\n v.push_back(\"a\");\r\n }\r\n }\r\n else {\r\n char ch = v[i].front();\r\n v[i].erase(v[0].begin());\r\n v[i].push_back(ch);\r\n v[i].push_back('m');\r\n v[i].push_back('a');\r\n for(int j = 0; j < i; j++)\r\n {\r\n v[i].push_back('a');\r\n }\r\n }\r\n }\r\n s = \"\";\r\n for(int i = 0; i < v.size(); i++)\r\n {\r\n for(int j = 0; j < v[i].size(); j++)\r\n {\r\n cout << v[i][j];\r\n }\r\n cout << endl;\r\n }\r\n // for(int i = 0; i < v.size(); i++)\r\n // {\r\n // s.push_back(v[i]);\r\n // string a = \" \";\r\n // s.push_back(a);\r\n // }\r\n // s.pop_back();\r\n return s;\r\n}\r\nint main()\r\n{\r\n string s;\r\n getline(cin, s);\r\n cout << toGoatLatin(s);\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0ae9c19f425c65cac36931310efc7fcb", "src_uid": "19a2bcb727510c729efe442a13c2ff7c", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include\nint main(){\nint a,b,c,t;\nscanf(\"%d%d%d\",&a,&b,&c);\nfor(t=0; ;t++)\n if((t*b+c*b)>=a*c){\n break;\n }\nprintf(\"%d\",t);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4fe9b4959adfb53f2fb2664633c979b0", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \nint fun(int a,int b,int c)\n{\n int x;\n int diff=a*c-b*c;\n int result=diff/b; \n result=result*b;\n \n if ( result == diff ) {\n return diff/b;\n } else { \n x=diff%b;\n x=b-x;\n diff+=x;\n return diff/b;\n}\n}\nint main(int argc, char *argv[])\n{\n int a,b,c,res;\n scanf(\"%d %d %d\",&a,&b,&c);\n res=fun(a,b,c);\n printf(\"%d\",res);\n system(\"PAUSE\"); \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "87c02aad8056d8376083d44e930a8aed", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint f[100005];\n\nmain(){\n\tint n, m, i, t;\n\tscanf(\"%d%d\",&n,&m);\n\tif (m%2==1){\n\t\ti=1;\n\t\tf[0]=m/2+1;\n\t}\n\telse i=0;\n\tfor (t=m/2;i\n#include\nint main()\n{\n\tint a,b,c,t,temp;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tscanf(\"%d\",&c);\n\ttemp=a*c;\n\tt=temp/b;\n\tif(t*b>=temp)\n\tprintf(\"%d\\n\",t-c);\n\telse\n\tprintf(\"%d\",(t+1)-c);\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "11573ca8c6b88c1ff120a325a0ab8184", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0} {"lang": "GNU C", "source_code": "#include \n\n\nint main() {\n float a,b,c,d,e,f,g;\n scanf(\"%f%f%f\",&a,&b,&c);\n \n d = a * c;\n e = b * c;\n f = d - e;\n g = f / b;\n \n //if( (g * b) != f) ++g;\n\n ceil(g);\n \n \n printf(\"%.f\",g);\n \n getch();\n \n return 0; \n \n \n }\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "96729e89326e70151549e3893b074571", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tint n;\n\tint i;\n\tint a, b = 0, c = 0;\n\tint sum = 0;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &c);\n\tfor(i=1; i\nint main()\n{\n int i,n,count=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i\n#include \n\nint main()\n{\n int n, i;\n int a[100] = {0};\n int count = 0;\n int p, q;\n int flag = 1;\n\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++)\n {\n scanf(\"%d\", a + i);\n }\n\n i = 0;\n while(a[i+1])\n {\n p = a[i];\n q = a[i + 1];\n if(p == 1)\n {\n if(q == 2)\n count += 3;\n else if(q == 3)\n count += 4;\n }\n if(p == 2)\n {\n if(q == 1)\n count += 3;\n else if(q == 3)\n {\n flag = 0;\n break;\n }\n }\n if(p == 3)\n {\n if(q == 1)\n count += 4;\n else if(q == 2)\n {\n flag = 0;\n break;\n }\n }\n i++;\n }\n if(flag)\n {\n printf(\"Finite\\n\");\n printf(\"%d\\n\", count);\n }\n else\n printf(\"Infinite\");\n\n system(\"pause\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9a06ce0f1099c5f97009c71133be4d6c", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main()\n{\n int n,i,j=0,a[105],k=0;\n scanf(\"%d\",&n);\n for (i=0;i1)\n {\n if(a[i]==2&&a[i-2]==3)\n j--;\n }\n }\n else if ((a[i]==1&&a[i+1]==3)||(a[i]==3&&a[i+1]==1))\n {\n\n j+=4;\n }\n\n }\n printf(\"Finite\\n%d\\n\",j);\n return k;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fb48b3e13dfff5b4dbf95254f5c62cb9", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int i,n,count=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0; i0)\n {\n printf(\"Finite\\n%d\\n\",count);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ca7a4b09f4c74d597b76530b5a65a255", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint main(){\r\n short n;\r\n scanf(\"%hi\", &n);\r\n if(n < 1200) printf(\"1200\");\r\n else if(n < 1400) printf(\"1400\");\r\n else if(n < 1600) printf(\"1600\");\r\n else if(n < 1900) printf(\"1900\");\r\n else if(n < 2100) printf(\"2100\");\r\n else if(n < 2300) printf(\"2300\");\r\n else if(n < 2400) printf(\"2400\");\r\n else if(n < 2600) printf(\"2600\");\r\n else if(n < 3000) printf(\"3000\");\r\n\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e98fd01da3c91435f8e9fdf974f16292", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0} {"lang": "GNU C11", "source_code": "#include \r\nint main(){\r\n int n;\r\n scanf(\"%d\",&n);\r\n if(n < 1200){\r\n printf(\"%d\\n\",1200);\r\n }\r\n else if(n < 1400){\r\n printf(\"%d\\n\",1400);\r\n }\r\n else if(n < 1600){\r\n printf(\"%d\\n\",1600);\r\n }\r\n else if(n < 1900){\r\n printf(\"%d\\n\",1900);\r\n }\r\n else if(n < 2100){\r\n printf(\"%d\\n\",2100);\r\n }\r\n else if(n < 2300){\r\n printf(\"%d\\n\",2300); \r\n }\r\n else if(n < 2400){\r\n printf(\"%d\\n\",2400); \r\n }\r\n else if(n < 2600){\r\n printf(\"%d\\n\",2600); \r\n }\r\n else if(n < 3000){\r\n printf(\"%d\\n\",3000);\r\n }\r\n return 0:\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2d001b245447b5333e6027f860911d0e", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0} {"lang": "GNU C11", "source_code": "#include \r\nint main() {\r\n\tint n;\r\n\tscanf(\"%d\", &n);\r\n\tint num[]={1200,1400,1600,1900,2100,2300,2400,2600,3000};\r\n\tint i = 0;\r\n\twhile(num[i] <= n) i++;\r\n\tprintf(\"%d\", num[i]);\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f6c53693e5d5e16cd5a6bb3315aab374", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint main(){\r\n int r;\r\n scanf(\"%d\",&r);\r\n if(r<1200){\r\n printf(\"1200\\n\");\r\n }\r\n else if(r<1400){\r\n printf(\"1400\\n\");\r\n }\r\n else if(r<1600){\r\n printf(\"1600\\n\");\r\n }\r\n else if(r<1900){\r\n printf(\"1900\\n\");\r\n }\r\n else if(r<2100){\r\n printf(\"2100\\n\");\r\n }\r\n else if(r<2300){\r\n printf(\"2300\\n\");\r\n }\r\n else if(r<2400){\r\n printf(\"2400\\n\");\r\n }\r\n else if(r<2600){\r\n printf(\"2600\\n\");\r\n }\r\n else{\r\n printf(\"3000\\n\");\r\n }\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "817abed9c66526ee32e01ccfea7a14ee", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0} {"lang": "GNU C11", "source_code": "#include \nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint num[]={1200,1400,1600,1900,2100,2300,2400,2600,3000};\n\tint i = 0;\n\twhile(num[i] <= n) i++;\n\tprintf(\"%d\", num[i]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "06e6e3cbc32c5fa0c2d37db9732b7cd3", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n int n;\n for(int i=2;i<=c;i++){\n n=a+b;\n a=b;\n b=n;\n }\n else printf(\"%d\",b);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e8574308c7d29c7c4b8adfaea7f5e6b2", "src_uid": "6ff30f5a9afc3f7befca813469188aab", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long a1,a2,a3;//\u5b9a\u4e49a1\u3001a2\u3001a3\n long long *d;//\u5b9a\u4e49\u4e00\u4e2a\u6307\u9488\n scanf(\"%ld%ld%ld\",&a1,&a2,&a3);//\u8f93\u5165x\u3001y\u3001z\n d[0]=a1;//\u7b2c1\u9879\u4e3aa1\n d[1]=a2;//\u7b2c2\u9879\u4e3aa2\n for(int i=2;i<=z;++i)//\u4ece\u4e0b\u6807\u4e3a2\u7684\u5143\u7d20\u5f00\u59cb\u904d\u5386\n d[i]=d[i-1]+d[i-2];//\u8fd9\u662f\u9012\u63a8\u516c\u5f0f\n printf(\"%ld\",d[z]);//\u6700\u540e\u8f93\u51fa\u7b2cc\u9879\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51954c623a76a9b3bbce3e315956a597", "src_uid": "6ff30f5a9afc3f7befca813469188aab", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x,y,z,*d;\n scanf(\"%d%d%d\",&x,&y,&z);\n d[0]=a;//\u7b2c1\u9879\u4e3aa\n d[1]=b;//\u7b2c2\u9879\u4e3ab\n for(int i=2;i<=c;i++)\n d[i]=d[i-1]+d[i-2];//\u8fd9\u662f\u9012\u63a8\u516c\u5f0f\n printf(\"%d\",&d[c]);//\u6700\u540e\u8f93\u51fa\u7b2cc\u9879\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "6922a69ea73810adc40e48077efc4fe1", "src_uid": "6ff30f5a9afc3f7befca813469188aab", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \"stdio.h\"\n\nint a[25], n, i;\n\nint main()\n{\n\tscanf( \"%d%d%d\", &a[0], &a[1], &n );\n\tfor( i = 2; i <= n; i++ ) a[i] = a[i-1] + a[i-2];\n\tprintf( \"%d\\n\", a[n] );\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "29ecb66946ea45c74da346d50515f822", "src_uid": "6ff30f5a9afc3f7befca813469188aab", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long a1,a2,a3;//\u5b9a\u4e49a1\u3001a2\u3001a3\n long long d[1000];//\u5b9a\u4e49\u4e00\u4e2a\u6307\u9488\n scanf(\"%lld%lld%lld\",&a1,&a2,&a3);//\u8f93\u5165a1\u3001a2\u3001a3\n d[0]=a1;//\u7b2c1\u9879\u4e3aa1\n d[1]=a2;//\u7b2c2\u9879\u4e3aa2\n for(int i=2;i<=a3;++i)//\u4ece\u4e0b\u6807\u4e3a2\u7684\u5143\u7d20\u5f00\u59cb\u904d\u5386\n d[i]=d[i-1]+d[i-2];//\u8fd9\u662f\u9012\u63a8\u516c\u5f0f\n printf(\"%lld\",d[a3]);//\u6700\u540e\u8f93\u51fa\u7b2ca3\u9879\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1905a606b9906332041eb23f84fe1ea8", "src_uid": "6ff30f5a9afc3f7befca813469188aab", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nchar a[101],c[101];\nint before[101][101];//before[POS][Chk];\nint beforeI[101][101];\nmain(){\n int i,j,k,l,b,d,lenL=0,lenS=0,curChk=0,maxL,maxS,usebefore,first=-1,last=-1,point=i,memo,ans=0,remain,tmpa,tmpb,tmpChk;\n scanf (\"%d%d\",&b,&d);\n scanf (\"%s%s\",a,c);\n while (a[lenL]!=0)lenL++;\n while (c[lenS]!=0)lenS++;\n if (lenL*blenL){\n printf (\"0\");\n exit(0);\n }\n if (before[i%lenL][curChk%lenS]==0){\n before[i%lenL][curChk%lenS]=curChk;\n beforeI[i%lenL][curChk%lenS]=i;\n if (a[i%lenL]==c[curChk%lenS]) curChk++;\n //printf (\"test\\n\");\n }else if (maxL-i>i-beforeI[i%lenL][curChk%lenS]){\n tmpChk=curChk;\n tmpa=beforeI[i%lenL][curChk%lenS];\n tmpb=before[i%lenL][curChk%lenS];\n before[i%lenL][curChk%lenS]=curChk;\n beforeI[i%lenL][curChk%lenS]=i;\n //printf (\"GG\\n\");\n curChk+=(curChk-tmpb)*((maxL-i)/(i-tmpa));\n i+=(i-tmpa)*((maxL-i)/(i-tmpa))-1;\n //curChk+=(curChk-before[i%lenL][curChk%lenS])*tmpb;\n //i+=(i-tmpa)*tmpb;\n //curChk+=tmpChk-before[i%lenL][curChk%lenS];\n //i+=i-tmpa;\n }else{\n if (a[i%lenL]==c[curChk%lenS])curChk++;\n }\n /*if (curChk==lenS){\n last=i;\n }*/\n //curChk++;\n //if (curChk%maxS==0) ans++;\n\n /*\n if (curChk>=maxS&&first%lenL==i%lenL&&curChk%lenS==1){\n point=i;\n remain = maxL-i;\n memo=point-first;\n ans += remain/memo*ans;\n //printf (\"%d %d\\n\",maxL-i,memo);\n i+=(remain/memo)*memo;\n //i=maxL;\n }*/\n /*\n if (first%lenL==i%lenL&&curChk%lenS==0){\n point=i;\n remain = maxL-i;\n memo=point-first+1;\n curChk += (remain/memo)*curChk;\n //printf (\"%d %d\\n\",maxL-i,memo);\n i=(remain/memo)*i;\n //i=maxL;\n }\n */\n }\n //printf (\"%d\",curChk/maxS);\n //printf (\"%d : %d\\n\",i,curChk);\n printf (\"%d\",curChk/maxS);\n exit(0);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a1fad8c7053fde69a10a70f502dec4ea", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nchar a[101],c[101];\n\nmain(){\n int i,j,k,l,b,d,lenL=0,lenS=0,curChk=0,maxL,maxS,usebefore,first=-1,last=-1,point=i,memo,ans=0;\n scanf (\"%d%d\",&b,&d);\n scanf (\"%s%s\",a,c);\n while (a[lenL]!=0)lenL++;\n while (c[lenS]!=0)lenS++;\n if (lenL*b=maxS&&first%lenL==i%lenL){\n point=i;\n memo=point-first+1;\n ans = (maxL-i)/memo;\n //printf (\"%d %d\\n\",maxL-i,memo);\n i+=ans*memo;\n //i=maxL;\n }\n }\n //printf (\"%d\",curChk/maxS);\n if (ans>0) printf (\"%d\",ans+1);\n else printf (\"%d\",curChk/maxS);\n exit(0);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8112ecabf370c1891357000aae22badb", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nchar a[101],c[101];\n\nmain(){\n int i,j,k,l,b,d,lenL=0,lenS=0,curChk=0,maxL,maxS,usebefore,first=-1,last=-1,point=i,memo,ans=0;\n scanf (\"%d%d\",&b,&d);\n scanf (\"%s%s\",a,c);\n while (a[lenL]!=0)lenL++;\n while (c[lenS]!=0)lenS++;\n if (lenL*b=maxS&&first%lenL==i%lenL){\n point=i;\n memo=point-first;\n ans = (maxL-i+1)/memo+1;\n //printf (\"%d %d\\n\",maxL-i,memo);\n //i+=ans*memo;\n i=maxL;\n }\n }\n //printf (\"%d\",curChk/maxS);\n if (ans>0) printf (\"%d\",ans);\n else printf (\"%d\",curChk/maxS);\n exit(0);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d2b5a719b4199bdad8c20e692a1de10", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nchar a[101],c[101];\nint before[101][101];//before[POS][Chk];\nint beforeI[101][101];\nmain(){\n int i,j,k,l,b,d,lenL=0,lenS=0,curChk=0,maxL,maxS,usebefore,first=-1,last=-1,point=i,memo,ans=0,remain,tmpa,tmpb,tmpChk;\n scanf (\"%d%d\",&b,&d);\n scanf (\"%s%s\",a,c);\n while (a[lenL]!=0)lenL++;\n while (c[lenS]!=0)lenS++;\n if (lenL*b(i-tmpa)){\n tmpChk=curChk;\n tmpa=beforeI[i%lenL][curChk%lenS];\n tmpb=before[i%lenL][curChk%lenS];\n curChk+=(curChk-tmpb)*((maxL-i)/(i-tmpa));\n i+=(i-tmpa)*((maxL-i)/(i-tmpa))-1;\n //curChk+=(curChk-before[i%lenL][curChk%lenS])*tmpb;\n //i+=(i-tmpa)*tmpb;\n //curChk+=tmpChk-before[i%lenL][curChk%lenS];\n //i+=i-tmpa;\n }else{\n if (a[i%lenL]==c[curChk%lenS])curChk++;\n }\n /*if (curChk==lenS){\n last=i;\n }*/\n //curChk++;\n //if (curChk%maxS==0) ans++;\n\n /*\n if (curChk>=maxS&&first%lenL==i%lenL&&curChk%lenS==1){\n point=i;\n remain = maxL-i;\n memo=point-first;\n ans += remain/memo*ans;\n //printf (\"%d %d\\n\",maxL-i,memo);\n i+=(remain/memo)*memo;\n //i=maxL;\n }*/\n /*\n if (first%lenL==i%lenL&&curChk%lenS==0){\n point=i;\n remain = maxL-i;\n memo=point-first+1;\n curChk += (remain/memo)*curChk;\n //printf (\"%d %d\\n\",maxL-i,memo);\n i=(remain/memo)*i;\n //i=maxL;\n }\n */\n }\n //printf (\"%d\",curChk/maxS);\n //printf (\"%d : %d\\n\",i,curChk);\n printf (\"%d\",curChk/maxS);\n exit(0);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8ca079df202dd5c4d91b840d0f7314b0", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nchar a[101],c[101];\n\nmain(){\n int i,j,k,l,b,d,lenL=0,lenS=0,curChk=0,maxL,maxS;\n scanf (\"%d%d\",&b,&d);\n scanf (\"%s%s\",a,c);\n while (a[lenL]!=0)lenL++;\n while (c[lenS]!=0)lenS++;\n if (lenL*b\n#include\nint main(){\n\tint l,r,i,a[10],j;\n\tmemset(a,0,sizeof(a));\n\tscanf(\"%d%d\",&l,&r);\n\t\n\tfor(;l<=r;l++)\n\t{ j=l;\n\t\tfor(;j>0;)\n\t\t{\n\t\ta[j%10]++;\n\t\tj=j/10;\n\t\t}\n\t\tif(a[0]<2 &&a[1]<2 &&a[2]<2 &&a[3]<2 &&a[4]<2 &&a[5]<2 &&a[6]<2 && a[7]<2 &&a[8]<2 &&a[9]<2)\n\t\t{\n\t\tprintf(\"%d\",l);\n\t\treturn 0;}\n\t\telse\n\t\t{\t\n\t\t\tfor (i=0;i<10;i++)\n\t\t\ta[i]={0};\n\t\t\tcontinue; } \n\t\t}\n\t\tprintf(\"-1\");\n\t}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "b36eea223a7faf163d613588be9b0130", "src_uid": "3041b1240e59341ad9ec9ac823e57dd7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nusing namespace std;\nint main()\n{\n\tint l, x, r;\n\tint a, b, c, d, e, f, g;\n\tg = 0;\n\tcin >> l >> r;\n\tfor (x = l; x <= r; x++) {\n\t\ta = int(x / 100000);\n\t\tb = int((x - 10000 * a) / 10000);\n\t\tc = int((x - 10000 * a - 10000 * b) / 1000);\n\t\td = int((x - 10000 * a - 10000 * b - 1000 * c)/100);\n\t\te = int((x - 10000 * a - 10000 * b - 1000 * c - 100 * d) / 10);\n\t\tf = int((x - 10000 * a - 10000 * b - 1000 * c - 100 * d - 10 * e));\n\t\tg = 0;\n\t\t\n\t\t\tif (a != 0) {\n\t\t\t\tif (a != b && a != c && a != d && a != e && a != f && 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\tcout << 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 (a == 0 && 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\tcout << 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 (a == 0 && 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\tcout << 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 (a == 0 && b == 0 && c == 0 && d != 0) {\n\t\t\t\tif (d != e && d != f && e != f) {\n\t\t\t\t\tcout << 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 (a * b * c * d == 0 && e != 0) {\n\t\t\t\tif (e != f) {\n\t\t\t\t\tcout << 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 (a * b * c * d * e * f != 0) {\n\t\t\t\tcout << 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\tif (g == 0) {\n\t\tcout << \"-1\";\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5d2230db1de8c38d4ac7627cc86e0120", "src_uid": "3041b1240e59341ad9ec9ac823e57dd7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nint main(){\n\tint l,r,i,a[10]={0},j;\n\tscanf(\"%d%d\",&l,&r);\n\t\n\tfor(;l<=r;l++)\n\t{ j=l;\n\t\tfor(;j>0;)\n\t\t{\n\t\ta[j%10]++;\n\t\tj=j/10;\n\t\t}\n\t\tif(a[0]<2 &&a[1]<2 &&a[2]<2 &&a[3]<2 &&a[4]<2 &&a[5]<2 &&a[6]<2 && a[7]<2 &&a[8]<2 &&a[9]<2)//\u8fd9\u91cc \u5c31\u662f\u5224\u65ad \u5404\u4e2a\u4f4d\u6570\u4e0a\u7684\u6570\u662f\u5426\u91cd\u590d\u3002\n\t\t{\n\t\tprintf(\"%d\",l);\n\t\treturn 0;}\n\t\telse\n\t\t{\t\n\t\t\tfor (i=0;i<10;i++)\n\t\t\ta[i]={0};\n\t\t\tcontinue; } \n\t\t}\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "eeb49433311998f68863ecccade6af35", "src_uid": "3041b1240e59341ad9ec9ac823e57dd7", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\nint digit(int n, int ord) {\n for(int k=0;k\nint main(){\n int n,m,k,a[10]={0};\n scanf(\"%d %d\",&n,&m);\n k=n;\n for(;k<=m;k++){\n n=k;\n a[10]={0};\n for(;n;){\n a[n/10]++;\n }\n for(int i=0;i<10;i++)if(a[i]>1)break;\n if(i==10){printf(\"%d\",k);return 0;}\n }\n printf(\"%d\",-1);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7938f30d5a64db801c2e4ebf202d6709", "src_uid": "3041b1240e59341ad9ec9ac823e57dd7", "difficulty": 800.0} {"lang": "GNU C", "source_code": "#include \n\nint n;\nint a[101];\nint dp[9][9][101][1 << 9];\n\nvoid dfs(int x, int y, int z, int w)\n{\n if (x == n) {\n if (z <= 100 && n * 2 - 1 < a[z]) a[z] = n * 2 - 1;\n \n return;\n }\n \n if (y == n) {\n dfs(x + 1, 0, z, w);\n \n return;\n }\n \n if (z > 100) return;\n \n if (dp[x][y][z][w] == 1) return;\n \n dp[x][y][z][w] = 1;\n \n if (x == 0) {\n if (y == 0) {\n dfs(x, y + 1, 0, 0);\n dfs(x, y + 1, 1, 1);\n } else {\n dfs(x, y + 1, z, w);\n \n if (((w >> (y - 1)) & 1) == 0) dfs(x, y + 1, z + 2, w | (1 << y));\n }\n } else {\n if (y == 0) {\n if ((w & 1) == 0) dfs(x, y + 1, z + 2, w | 1);\n } else {\n if ((w & (1 << y)) == 0 && ((w >> (y - 1)) & 1) == 0) dfs(x, y + 1, z + 4, w | (1 << y));\n }\n \n dfs(x, y + 1, z, w & (((1 << n) - 1) ^ (1 << y)));\n }\n}\n\nint main()\n{\n int x, i, j, k, l, m;\n \n for (i = 0; i <= 100; i++) a[i] = 100;\n \n for (i = 1; i < 9; i++) {\n n = i;\n \n for (j = 0; j < n; j++) {\n for (k = 0; k < n; k++) {\n for (l = 0; l <= 100; l++) {\n for (m = 0; m < (1 << n); m++) {\n dp[j][k][l][m] = 0;\n }\n }\n }\n }\n \n dfs(0, 0, 0, 0);\n }\n \n scanf(\"%d\", &x);\n \n printf(\"%d\\n\", a[x]);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dbeb1776b6dd98c4fe44cbe61603f21c", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n int x,n=3;\n\tscanf(\"%d\",&x);\n if (x==1)\n printf(\"1\");\n else if (x==2 || x==4)\n printf(\"3\");\n else if (x==3)\n printf(\"5\");\n else {\n while((n*n+1) < x*2) {\n n+=2;\n }\n printf(\"%d\",n);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "553a105e82b77a3cbfbf6ac6af4145f0", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int s,n,x;\n scanf(\"%d\",&x);\n for (s=1,n=1;s\n\nconst int ans[] = {0,1,3,5,3,3,5,5,5,5,5,5,5,5,7,7,7,7,7,7,7,7,7,7,7,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15};\nint main() {\n//\tfreopen(\"input.txt\",\"r\",stdin);\n//\tfreopen(\"output.txt\",\"w\",stdout);\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\\n\",ans[n]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a2e9ca9c11769485a125efaff7cd53dd", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \nint n;\nint d[16];\n\nint solution(int x){\n int i; int sol;\n for (i = 0; i < 16; i++){\n if (x<=d[i]){\n if (i%2==0){\n if ( ((x-d[i])%4) == 0)\n sol = i;\n }\n else{\n sol = i;\n break;\n }\n }\n }\n\n return sol;\n}\n\nint main()\n{\n\n int x;\n scanf(\"%d\", &x);\n d[0] = 0;\n d[1] = 1;\n d[2] = 0;\n d[3] = 5;\n d[4] = d[1]*4;\n d[5] = 13;\n d[6] = 2 * 4;\n d[7] = 25;\n d[8] = d[3] * 4;\n d[9] = 41;\n d[10] = d[4] * 4;\n d[11] = 61;\n d[12] = d[5] * 4;\n d[13] = 85;\n d[14] = d[6] * 4;\n d[15] = 113;\n\n if (x==3)\n printf(\"5\\n\");\n else\n printf(\"%d\\n\", solution(x));\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "edee8abfb340734aa764b98d700f28ed", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \r\n \r\ntypedef long long ll;\r\n \r\nint dp[4000001][2], sum[4000001][2];\r\n \r\nint main(){\r\n\tint n, m;\r\n\tscanf(\"%d %d\", &n, &m);\r\n\tfor (register int i = 2; i <= n; i++){\r\n\t\tdp[i][0] = (sum[i - 1][0] + sum[i - 1][1] + 1) % m;\r\n\t\tif (i == 2){\r\n\t\t\tdp[i][1] = 1;\r\n\t\t} else {\r\n\t\t\tdp[i][1] = (dp[i][1] + dp[i - 1][1] + ((i - i / 2) - ((i - 1) - (i - 1) / 2))) % m;\r\n\t\t}\r\n\t\tsum[i][0] = (sum[i - 1][0] + dp[i][0]) % m;\r\n\t\tsum[i][1] = (sum[i - 1][1] + dp[i][1]) % m;\r\n\t\tfor (register int j = i * 2; j <= n; j += i){\r\n\t\t\tdp[j][1] = (((ll)dp[j][1] + dp[i][0] + dp[i][1] - dp[i - 1][0] - dp[i - 1][1]) % m + m) % m;\r\n\t\t}\r\n\t}\r\n\tprintf(\"%d\", (dp[n][0] + dp[n][1]) % m);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "279d00c11febbb23160301f6aa332452", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint dp[4000001][2], sum[4000001][2];\r\n\r\nint main(){\r\n\tint n, m;\r\n\tscanf(\"%d %d\", &n, &m);\r\n\tfor (register int i = 2; i <= n; i++){\r\n\t\tint t;\r\n\t\tdp[i][0] = (sum[i - 1][0] + sum[i - 1][1] + 1) % m;\r\n\t\tif (i == 2){\r\n\t\t\tdp[i][1] = 1;\r\n\t\t} else {\r\n\t\t\tdp[i][1] = (dp[i][1] + dp[i - 1][1] - (i % 2 == 0 ? 1 : 0) + 1) % m;\r\n\t\t}\r\n\t\tt = ((dp[i][0] + dp[i][1] - dp[i - 1][0] - dp[i - 1][1]) % m + m) % m;\r\n\t\tsum[i][0] = (sum[i - 1][0] + dp[i][0]) % m;\r\n\t\tsum[i][1] = (sum[i - 1][1] + dp[i][1]) % m;\r\n\t\tfor (register int j = i * 2; j <= n; j += i){\r\n\t\t\tdp[j][1] = (dp[j][1] + t) % m;\r\n\t\t}\r\n\t}\r\n\tprintf(\"%d\", (dp[n][0] + dp[n][1]) % m);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9c2df3fc1c469f0e554c1473841e6ab8", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nint dp[4000001][2], sum[4000001][2];\r\n\r\nint main(){\r\n\tint n, m;\r\n\tscanf(\"%d %d\", &n, &m);\r\n\tfor (register int i = 2; i <= n; i++){\r\n\t\tint t;\r\n\t\tdp[i][0] = (sum[i - 1][0] + sum[i - 1][1] + 1) % m;\r\n\t\tif (i == 2){\r\n\t\t\tdp[i][1] = 1;\r\n\t\t} else {\r\n\t\t\tdp[i][1] = (dp[i][1] + dp[i - 1][1] + ((i - i / 2) - ((i - 1) - (i - 1) / 2))) % m;\r\n\t\t}\r\n\t\tt = ((dp[i][0] + dp[i][1] - dp[i - 1][0] - dp[i - 1][1]) % m + m) % m;\r\n\t\tsum[i][0] = (sum[i - 1][0] + dp[i][0]) % m;\r\n\t\tsum[i][1] = (sum[i - 1][1] + dp[i][1]) % m;\r\n\t\tfor (register int j = i * 2; j <= n; j += i){\r\n\t\t\tdp[j][1] = (dp[j][1] + t) % m;\r\n\t\t}\r\n\t}\r\n\tprintf(\"%d\", (dp[n][0] + dp[n][1]) % m);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cdad55822ea4011fdc1c23980be57b33", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define psum(arr, i) ((i)<0?0:(arr[i]))\n#define uint unsigned int\n\nint main()\n{\n int n, mod; scanf(\"%d %d\", &n, &mod);\n\n int* dp = malloc(n*sizeof(int));\n int* dpsum = calloc(n*sizeof(int), 1);\n\n dp[0] = 1;\n dpsum[0] = 1;\n\n printf(\"1\\n\");\n for (int i=1; i=rind*z; z++) {\n dp[i] += (dpsum[n-(rind*z)] - psum(dpsum, n-(rind*z+z)) + mod) % mod;\n dp[i] %= mod;\n // printf(\"adding range from %d to %d\\n\", n-rind*z, n-rind*z-z);\n }\n\n // printf(\"%d\\n\", dp[i]);\n dpsum[i] = dp[i] + dpsum[i-1];\n dpsum[i] %= mod;\n }\n printf(\"%d\\n\", dp[n-1]);\n free(dp); free(dpsum);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "90f6a9949a66b1aa98f4d99966f02598", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \r\nlong long s[4000001];\r\nlong long a[4000001];\r\nlong long n, p, c, k;\r\nint main()\r\n{\r\n scanf(\"%lld%lld\", &n, &p);\r\n s[1] = 1;\r\n a[1] = 1;\r\n for (int i = 2; i <= n; i++)\r\n {\r\n a[i] = s[i - 1];\r\n c = 1;\r\n for (int j = 2; j * j <= i; j++)\r\n {\r\n c = j;\r\n }\r\n k = i - 1;\r\n for (int j = 1; j < c; j++)\r\n {\r\n a[i] += a[j] * ((i / j) - (i / (j + 1))) % p;\r\n k -= (i / j) - (i / (j + 1));\r\n }\r\n for (int j = 2; j <= k + 1; j++)\r\n {\r\n a[i] += a[i / j];\r\n }\r\n s[i] = s[i - 1] + a[i];\r\n s[i] %= p;\r\n a[i] %= p;\r\n }\r\n printf(\"%lld\\n\", a[n]);\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cef02b80824bbdb919f701edf6f3e6f4", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n\tint n,i,a[30]={0};\n\tchar c;\n\tfor(i=0;i<3;i++){\n\t\tscanf(\"%d%c\",&n,&c);\n\t\tif(c=='m')a[n]++;\n\t\tif(c=='s')a[n+10]++;\n\t\tif(c=='p')a[n+20]++;\n\t}\n\tfor(i=1;i<30;i++){\n\t\tif(a[i]==3)return !puts(\"0\");\n\t\tif(i<28&&a[i]&&a[i+1]&&a[i+2])return !puts(\"0\");\n\t\tif(a[i]==2)return !puts(\"1\");\n\t\tif(i<29&&a[i]&&a[i+1])return !puts(\"1\");\n\t}\n\tputs(\"2\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1a293e11118894a3d312467221e671f2", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\n#define MAX(x, y) (((x) > (y)) ? (x) : (y))\n\nvoid main(){\n\tchar a[3],b[3],c[3];\n\tint cnt[3];\n\tint s = 0,k = 0;\n\tscanf(\"%s %s %s\",&a,&b,&c);\n\tint x = a[0],y=b[0],z=c[0];\n\tcnt[0] = strcmp(a,b);\n\tcnt[1] = strcmp(a,c);\n\tcnt[2] = strcmp(b,c);\n\tfor (int i = 0; i<3;i++){\n\t\tif(cnt[i] == 0){\n\t\t\tk++;\n\t\t}\n\t}\n\tif(k==1){\n\t\tk=2;\n\t}\n\telse if(k==0) k = 1;\n\tif(a[1] == b[1]){\n\t\tif(x+1==y || x-1==y){\n\t\t\ts +=2;\n\t\t}\n\t}\n\tif(a[1] == c[1]){\n if(x+1==z || x-1==z){\n s +=2;\n }\n }\n\tif(c[1] == b[1]){\n if(z+1==y || z-1==y){ \n s +=2;\n }\n }\n\tif(s>3) s=3;\n\telse if(s==0) s=1;\n\t//printf(\"s=%d k=%d\\n\",s,k);\n\tint result = MAX(s,k);\n\tresult = 3 - result;\n\tprintf(\"%d\",result);\n\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c9550d8bbe45c5443b825e681f06aad", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \nusing namespace std;\n\nint cor[3][9];\nint main() {\n char c[3];\n int n[3];\n scanf(\"%d%c %d%c %d%c\",&n[0],&c[0],&n[1],&c[1],&n[2],&c[2]);\n for(int i=0;i<3;i++) {\n if(c[i]=='m') c[i]=0;\n else if(c[i]=='p') c[i]=1;\n else if(c[i]=='s') c[i]=2;\n }\n for(int i=0;i<3;i++) {\n cor[c[i]][n[i]]=1;\n cor[c[i]][0]++;\n }\n for(int i=0;i<3;i++) {\n if(cor[i][0]==3) {\n sort(n,n+3);\n if(n[0]==n[1] && n[1]==n[2]) {\n printf(\"0\");\n return 0;\n }\n else if(n[1]-n[0]==1 && n[2]-n[1]==1) {\n printf(\"0\");\n return 0;\n }\n else if(n[1]-n[0]==1 || n[2]-n[1]==1) {\n printf(\"1\");\n return 0;\n }\n else if(n[0]==n[1] || n[1]==n[2]) {\n printf(\"1\");\n return 0;\n }\n }\n else if(cor[i][0]==2) {\n for(int j=1;j<=9;j++) {\n if(cor[i][j]==2) {\n printf(\"1\");\n return 0;\n }\n }\n for(int j=1;j<9;j++) {\n if(cor[i]>0 && cor[i+1] >0) {\n printf(\"1\");\n return 0;\n }\n }\n }\n }\n printf(\"2\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c6f8aba09a3bb667500ef9e791584344", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint countb(char b[]){\n\tif(b[0]==b[1]&&b[1]==b[2]){\n\t\treturn 0;\n\t}else if(b[0]==b[1]||b[0]==b[2]||b[2]==b[1]){\n\t\treturn 1;\n\t}else {\n\t\treturn 2;\n\t}\n}\nint countwhat(char b[]){\n\tif(b[0]==b[1]&&b[1]==b[2]){\n\t\treturn 1;\n\t}else if(b[0]==b[1]||b[0]==b[2]||b[2]==b[1]){\n\t\treturn 1;\n\t}else {\n\t\treturn 2;\n\t}\n}\nint countab(char b[],int m){\n\tif(m==1){\n\t\tif(b[0]==b[1]){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 2;\n\t\t}\t\n\t}else if(m==2){\n\t\tif(b[1]==b[2]){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 2;\n\t\t}\n\t}else{\n\t\tif(b[0]==b[2]){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 2;\n\t\t}\n\t}\n}\nint main(){\n\tchar input[10];\n\tgets(input);\n\tint a[]={input[0]-48,input[3]-48,input[6]-48};\n\tchar b[]={input[1],input[4],input[7]};\n\tfor(int j=0;j<2;j++){\n\t\tfor(int i=0;i<3;i++){\n\t\t\tint mida;\n\t\t\tchar midb;\n\t\t\tif(i+1<3&&a[i]>a[i+1]){\n\t\t\t\tmida=a[i];\n\t\t\t\ta[i]=a[i+1];\n\t\t\t\ta[i+1]=mida;\n\t\t\t\tmidb=b[i];\n\t\t\t\tb[i]=b[i+1];\n\t\t\t\tb[i+1]=midb;\n\t\t\t}\n\t\t}\n\t}\n\tif(a[0]+1==a[1]&&a[1]+1==a[2]){\n\t\tprintf(\"%d\\n\",countb(b));\n\t\treturn 0;\n\t}else if(a[0]==a[1]&&a[1]==a[2]){\n\t\tprintf(\"%d\\n\",countb(b));\n\t\treturn 0;\n\t}else if(a[0]==a[1]){\n\t\tif(a[0]+1==a[2]||a[0]+2==a[2]){\n\t\t\tprintf(\"%d\\n\",countwhat(b));\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tprintf(\"%d\\n\",countab(b,1));\n\t\t\treturn 0;\n\t\t}\n\t}else if(a[1]==a[2]){\n\t\tif(a[0]+1==a[1]||a[0]+2==a[1]){#include\nint countb(char b[]){\n\tif(b[0]==b[1]&&b[1]==b[2]){\n\t\treturn 0;\n\t}else if(b[0]==b[1]||b[0]==b[2]||b[2]==b[1]){\n\t\treturn 1;\n\t}else {\n\t\treturn 2;\n\t}\n}\nint countab(char b[],int m){\n\tif(m==1){\n\t\tif(b[0]==b[1]){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 2;\n\t\t}\t\n\t}else if(m==2){\n\t\tif(b[1]==b[2]){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 2;\n\t\t}\n\t}else{\n\t\tif(b[0]==b[2]){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 2;\n\t\t}\n\t}\n}\nint main(){\n\tchar input[10];\n\tgets(input);\n\tint a[]={input[0]-48,input[3]-48,input[6]-48};\n\tchar b[]={input[1],input[4],input[7]};\n\tfor(int j=0;j<2;j++){\n\t\tfor(int i=0;i<3;i++){\n\t\t\tint mida;\n\t\t\tchar midb;\n\t\t\tif(i+1<3&&a[i]>a[i+1]){\n\t\t\t\tmida=a[i];\n\t\t\t\ta[i]=a[i+1];\n\t\t\t\ta[i+1]=mida;\n\t\t\t\tmidb=b[i];\n\t\t\t\tb[i]=b[i+1];\n\t\t\t\tb[i+1]=midb;\n\t\t\t}\n\t\t}\n\t}\n\tint ab[3];\n\tfor(int i=0;i<3;i++){\n\t\tab[i]=countab(b,i+1);\n\t}\n\tfor(int j=0;j<2;j++){\n\t\tfor(int i=0;i<3;i++){\n\t\t\tint mida;\n\t\t\tif(i+1<3&&ab[i]>ab[i+1]){\n\t\t\t\tmida=ab[i];\n\t\t\t\tab[i]=ab[i+1];\n\t\t\t\tab[i+1]=mida;\n\t\t\t}\n\t\t}\n\t}\n\tif(a[0]+1==a[1]&&a[1]+1==a[2]){\n\t\tprintf(\"%d\\n\",countb(b));\n\t\treturn 0;\n\t}else if(a[0]==a[1]&&a[1]==a[2]){\n\t\tprintf(\"%d\\n\",countb(b));\n\t\treturn 0;\n\t}else if(a[0]==a[1]){\n\t\tif(a[0]+1==a[2]||a[0]+2==a[2]){\n\t\t\tprintf(\"%d\\n\",ab[0]);\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tprintf(\"%d\\n\",countab(b,1));\n\t\t\treturn 0;\n\t\t}\n\t}else if(a[1]==a[2]){\n\t\tif(a[0]+1==a[1]||a[0]+2==a[1]){\n\t\t\tprintf(\"%d\\n\",ab[0]);\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tprintf(\"%d\\n\",countab(b,2));\n\t\t\treturn 0;\n\t\t}\n\t}else if(a[0]+1==a[1]||a[0]+2==a[1]){\n\t\tif(a[1]+1==a[2]||a[1]+2==a[2]){\n\t\t\tprintf(\"%d\\n\",countab(b,1)>countab(b,2)?countab(b,2):countab(b,1));\n\t\t\treturn 0;\n\t\t}\n\t\tprintf(\"%d\\n\",countab(b,1));\n\t}else if(a[1]+1==a[2]||a[1]+2==a[2]){\n\t\tprintf(\"%d\\n\",countab(b,2));\n\t}else {\n\t\tprintf(\"%d\\n\",2);\n\t}\n}\n\t\t\tprintf(\"%d\\n\",countwhat(b));\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tprintf(\"%d\\n\",countab(b,2));\n\t\t\treturn 0;\n\t\t}\n\t}else if(a[0]+1==a[1]||a[0]+2==a[1]){\n\t\tprintf(\"%d\\n\",countab(b,1));\n\t\treturn 0;\n\t}else if(a[1]+1==a[2]||a[1]+2==a[2]){\n\t\tprintf(\"%d\\n\",countab(b,2));\n\t}else {\n\t\tprintf(\"%d\\n\",2);\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d8699a6b1b7a9d553df650c75b43eaed", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\n#define MAX(x, y) (((x) > (y)) ? (x) : (y))\n#define MIN(x, y) (((x) < (y)) ? (x) : (y))\nint main(){\n\tchar a[3],b[3],c[3];\n\tint cnt[3];\n\tint s = 0,k = 0;\n\tscanf(\"%s %s %s\",&a,&b,&c);\n\tint x = a[0],y=b[0],z=c[0];\n\tcnt[0] = strcmp(a,b);\n\tcnt[1] = strcmp(a,c);\n\tcnt[2] = strcmp(b,c);\n\tfor (int i = 0; i<3;i++){\n\t\tif(cnt[i] == 0){\n\t\t\tk++;\n\t\t}\n\t}\n\tif(k==1){\n\t\tk=2;\n\t}\n\telse if(k==0) k = 1;\n\tint flag = 0;\n\tint flag1 = 0;\n\n\tif(a[1]==b[1] && a[1]==c[1]) {\n\t\tlong int max=MAX(MAX(x,y),z);\n\t\tlong int min=MIN(MIN(x,y),z);\n\t\tint ans = max-min;\n\t\tif(ans==2) s=3;\n\t\tint result = MAX(s,k);\n \tresult = 3 - result;\n \tprintf(\"%d\",result);\n \treturn 0;\n\t}\n\t\tif(a[1] == b[1]){\n\t\t\tif(x+1==y || x-1==y){\n\t\t\t\ts +=2;\n\t\t\t\tflag = 1;\n\t\t\t}\n\t\t\tif(x+2==y || x-2==y && !flag) {\n\t\t\t\ts +=2;\n\t\t\t\tflag1 = 1;\n\t\t\t}\n\t\t}\n\t\tif(a[1] == c[1] && cnt[0] != 0 && cnt[2] != 0){\n\t\t\t//printf(\"hello\\n\");\n \tif(x+1==z || x-1==z && !flag1){\n \ts +=2;\n\t\t\t\tflag = 1;\n \t}\n\t\t\tif(x+2==z || x-2==z && !flag){\n\t\t\t\ts +=2;\n\t\t\t\tflag1 = 1;\n\t\t\t}\n \t}\n\t\tif(c[1] == b[1] && cnt[0] != 0 && cnt[1] !=0 ){\n \tif(z+1==y || z-1==y && !flag1){\n \ts +=2;\n\t\t\t\tflag = 1;\n \t}\n\t\t\tif(z+2==y || z-2==y && !flag){\n\t\t\t\ts +=2;\n\t\t\t}\n \t}\n\t}\n\tif(s>3) s=3;\n\telse if(s==0) s=1;\n\tresult = MAX(s,k);\n\tresult = 3 - result;\n\tprintf(\"%d\",result);\n \treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "25fa1fe1ba0cc13144fdaef8e16675f8", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\nint i,parallel_square[4][2],angular_square[4][2],minimum_x=1000000000,minimum_y=1000000000,centre_of_angular_square[2],half_diagon_length_of_angular_square,side_length_of_parallel_square;\nfor(i=0;i<4;i++)\n{\n scanf(\"%d %d\",¶llel_square[i][0],¶llel_square[i][1]);\n if(parallel_square[i][0]=-half_diagon_length_of_angular_square&¢re_of_angular_square[0]<=0&¢re_of_angular_square[1]+centre_of_angular_square[0]>=-half_diagon_length_of_angular_square&¢re_of_angular_square[1]<=centre_of_angular_square[0]+half_diagon_length_of_angular_square+side_length_of_parallel_square)||(centre_of_angular_square[0]>=0&¢re_of_angular_square[0]<=side_length_of_parallel_square&¢re_of_angular_square[1]>=-half_diagon_length_of_angular_square&¢re_of_angular_square[1]<=side_length_of_parallel_square+half_diagon_length_of_angular_square)||(centre_of_angular_square[0]>=side_length_of_parallel_square&¢re_of_angular_square[0]<=side_length_of_parallel_square+half_diagon_length_of_angular_square&¢re_of_angular_square[1]+centre_of_angular_square[0]<=half_diagon_length_of_angular_square+2*side_length_of_parallel_square&¢re_of_angular_square[1]>=centre_of_angular_square[0]-half_diagon_length_of_angular_square-side_length_of_parallel_square)) printf(\"Yes\");\nelse printf (\"No\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "124ed275750b174b06b49955253aa4ba", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\ntypedef struct{\n\tint x, y;\n} Point;\n\ntypedef struct{\n\tPoint n[4];\n} Square;\n\nint cross(Point a, Point b, Point c){\n\treturn (c.x-a.x)*(b.y-a.y)-(b.x-a.x)*(c.y-a.y);\n}\n\nint abs(int a){return a<0?-a:a;}\nint min(int a, int b){return ab?a:b;}\n\nbool contains(Square sq, Point p){\n\treturn abs(cross(sq.n[0], sq.n[1], sq.n[2]))+\n\t\tabs(cross(sq.n[2], sq.n[3], sq.n[0]))==\n\t\tabs(cross(sq.n[0], sq.n[1], p))+abs(cross(sq.n[1], sq.n[2], p))+\n\t\tabs(cross(sq.n[2], sq.n[3], p))+abs(cross(sq.n[3], sq.n[0], p));\n}\n\nint sqminx(Square sq){ return min(sq.n[0].x, min(sq.n[1].x, min(sq.n[2].x, sq.n[3].x))); }\nint sqmaxx(Square sq){ return max(sq.n[0].x, max(sq.n[1].x, max(sq.n[2].x, sq.n[3].x))); }\nint sqminy(Square sq){ return min(sq.n[0].y, min(sq.n[1].y, min(sq.n[2].y, sq.n[3].y))); }\nint sqmaxy(Square sq){ return max(sq.n[0].y, max(sq.n[1].y, max(sq.n[2].y, sq.n[3].y))); }\n\nint main(){\n\tSquare squares[2];\n\tint i, j;\n\tPoint curr;\n\tfor(i=0;i<2;++i) for(j=0;j<4;++j)\n\t\t\tscanf(\"%d %d\", &squares[i].n[j].x, &squares[i].n[j].y);\n\tfor(curr.x=sqminx(squares[0]);curr.x<=sqmaxx(squares[0]);++curr.x){\n\t\tfor(curr.y=sqminy(squares[0]);curr.y<=sqmaxy(squares[0]);++curr.y){\n\t\t\tif(contains(squares[1], curr)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f0f487024ca960b6910f4813aef22d94", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\ntypedef struct{\n\tint x, y;\n} Point;\n\ntypedef struct{\n\tPoint n[4];\n} Square;\n\nint cross(Point a, Point b, Point c){\n\treturn (c.x-a.x)*(b.y-a.y)-(b.x-a.x)*(c.y-a.y);\n}\n\nint abs(int a){return a<0?-a:a;}\nint min(int a, int b){return ab?a:b;}\n\nbool contains(Square sq, Point p){\n\treturn abs(cross(sq.n[0], sq.n[1], sq.n[2]))+\n\t\tabs(cross(sq.n[2], sq.n[3], sq.n[0]))==\n\t\tabs(cross(sq.n[0], sq.n[1], p))+abs(cross(sq.n[1], sq.n[2], p))+\n\t\tabs(cross(sq.n[2], sq.n[3], p))+abs(cross(sq.n[3], sq.n[0], p));\n}\n\nint sqminx(Square sq){ return min(sq.n[0].x, min(sq.n[1].x, min(sq.n[2].x, sq.n[3].x))); }\nint sqmaxx(Square sq){ return max(sq.n[0].x, max(sq.n[1].x, max(sq.n[2].x, sq.n[3].x))); }\nint sqminy(Square sq){ return min(sq.n[0].y, min(sq.n[1].y, min(sq.n[2].y, sq.n[3].y))); }\nint sqmaxy(Square sq){ return max(sq.n[0].y, max(sq.n[1].y, max(sq.n[2].y, sq.n[3].y))); }\n\nint main(){\n\tSquare squares[2];\n\tint i, j;\n\tPoint curr;\n\tfor(i=0;i<2;++i) for(j=0;j<4;++j)\n\t\t\tscanf(\"%d %d\", &squares[i].n[j].x, &squares[i].n[j].y);\n\tfor(curr.x=sqminx(squares[0]);curr.x<=sqmaxx(squares[0]);++curr.x){\n\t\tfor(curr.y=sqminy(squares[0]);curr.y<=sqmaxy(squares[0]);++curr.y){\n\t\t\tif(contains(squares[1], curr)){\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"NO\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b239d29e725bea7feae451e2a6fc90c0", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tint x1[4], y1[4], x2[4], y2[4];\n\tint d[201][201]={};\n\tfor (int i=0; i<4; i++) scanf(\"%d %d\", &x1[i], &y1[i]);\n\tfor (int i=0; i<4; i++) scanf(\"%d %d\", &x2[i], &y2[i]);\n\t\n\tint a=(x2[0]+x2[1]+x2[2]+x2[3])/4, b=(y2[0]+y2[1]+y2[2]+y2[3])/4;\n\t\n\tint minx, maxx;\n\tfor (int i=0; i<4; i++)\n\t{\n\t\tif (!i) {minx=x2[i]; maxx=x2[i];}\n\t\telse\n\t\t{\n\t\t\tif (maxxx2[i]) minx=x2[i];\n\t\t}\n\t}\n\tint p=(-minx+maxx)/2;\n\t\n\tfor (int i=(((x1[0]x1[1])?x1[0]:x1[1])>x1[2]?((x1[0]>x1[1])?x1[0]:x1[1]):x1[2]); i++)\n\t{\n\t\tfor (int j=(((y1[0]y1[1])?y1[0]:y1[1])>y1[2]?((y1[0]>y1[1])?y1[0]:y1[1]):y1[2]); j++)\n\t\t{\n\t\t\td[100+i][100+j]+=1;\n\t\t}\n\t}\n\t\n\tfor (int i=-100; i<101; i++)\n\t{\n\t\tfor (int j=-100; j<101; j++)\n\t\t{\n\t\t\tif (i+j-a-b+p>=0 && j-i+a-b-p<=0 && j-i+a-b+p>=0 && j+i-a-b-p<=0)\n\t\t\td[i+100][j+100]+=2;\n\t\t}\n\t}\n\t\n\tint c=0;\n\t\n\tfor (int i=0; i<201; i++)\n\t{\n\t\tfor (int j=0; j<201; j++)\n\t\t{\n\t\t\tif (d[i][j]==3) c++;\n\t\t}\n\t}\n\tif (c) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0a8b59741569a619245863f2cec3f25", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n\n int i,j,counter,orderXmax,orderXmin,orderYmax,orderYmin,midX,midY,C[4],M[4],p[4];\n struct coordinates{int x; int y;};\n struct coordinates point[8];\n for (i = 0; i < 8; i++)\n {\n scanf(\"%d%d\",&point[i].x,&point[i].y);\n point[i].x += 100;\n point[i].y += 100;\n }\n\n orderXmax = point[0].x;\n orderXmin = point[0].x;\n orderYmax = point[0].y;\n orderYmin = point[0].y;\n\n for (i = 1; i < 4;i++)\n {\n if (point[i].x > orderXmax)\n orderXmax = point[i].x;\n if (point[i].y > orderYmax)\n orderYmax = point[i].y;\n if (point[i].x < orderXmin)\n orderXmin = point[i].x;\n if (point[i].y < orderYmin)\n orderYmin = point[i].y;\n }\n point[0].x = orderXmin;\n point[0].y = orderYmin;\n point[1].x = orderXmax;\n point[1].y = orderYmin;\n point[2].x = orderXmax;\n point[2].y = orderYmax;\n point[3].x = orderXmin;\n point[3].y = orderYmax;\n\n orderXmax = point[4].x;\n orderXmin = point[4].x;\n orderYmax = point[4].y;\n orderYmin = point[4].y;\n midX = point[4].x;\n midY = point[4].y;\n\n for (i = 5; i < 8;i++)\n {\n if (point[i].x > orderXmax)\n {orderXmax = point[i].x; midY = point[i].y;}\n if (point[i].y > orderYmax)\n {orderYmax = point[i].y; midX = point[i].x;}\n if (point[i].x < orderXmin)\n orderXmin = point[i].x;\n if (point[i].y < orderYmin)\n orderYmin = point[i].y;\n }\n point[4].x = orderXmin;\n point[4].y = midY;\n point[5].x = midX;\n point[5].y = orderYmax;\n point[6].x = orderXmax;\n point[6].y = midY;\n point[7].x = midX;\n point[7].y = orderYmin;\n\n int maxxX = point[0].x, maxxY = point[0].y;\n for (i = 1; i < 8; i++)\n {\n if (point[i].x > maxxX)\n maxxX = point[i].x;\n if (point[i].y > maxxY)\n maxxY = point[i].y;\n }\n\n\n int map[210][210];\n map[0][0]=0;\n\n for (i = point[0].x ; i <= point[1].x; i++)\n map[point[0].y][i] = 1;\n\n for (i = point[1].y; i <= point[2].y; i++)\n map[i][point[1].x] = 1;\n\n for (i = point[3].x ; i <= point[2].x; i++)\n map[point[2].y][i] = 1;\n\n for (i = point[0].y; i <= point[3].y; i++)\n map[i][point[0].x] = 1;\n\n counter = point[4].y;\n for (i = point[4].x ; i <= point[5].x; i++)\n {if (map[counter][i] == 1)\n {printf(\"YES\\n\"); goto label;}\n else\n map[counter][i] = 1;\n counter++;}\n\n counter = point[5].y-1;\n for (i = point[5].x+1; i <= point[6].x; i++)\n {if (map[counter][i] == 1)\n {printf(\"YES\\n\"); goto label;}\n else\n map[counter][i] = 1;\n counter--;}\n\n counter = point[7].y;\n for (i = point[7].x ; i < point[6].x; i++)\n {if (map[counter][i] == 1)\n {printf(\"YES\\n\"); goto label;}\n else\n map[counter][i] = 1;\n counter++;}\n\n counter = point[4].y - 1;\n for (i = point[4].x + 1; i < point[7].x ; i++)\n {if (map[counter][i] == 1)\n {printf(\"YES\\n\"); goto label;}\n else\n map[counter][i] = 1;\n counter--;}\n\n C[0] = point[4].y - point[4].x;\n C[1] = point[5].y + point[5].x;\n C[2] = point[6].y - point[6].x;\n C[3] = point[4].y + point[4].x;\n\n M[0] = 1;\n M[1] = -1;\n M[2] = 1;\n M[3] = -1;\n p[0] = (M[0]*point[1].x) + C[0];\n p[1] = (M[1]*point[0].x) + C[1];\n p[2] = (M[2]*point[3].x) + C[2];\n p[3] = (M[3]*point[2].x) + C[3];\n /*printf(\"%d %d\\n\",point[0].x,point[4].x);\n printf(\"%d %d\\n\",point[1].x,point[6].x);\n printf(\"%d %d\\n\",point[2].y,point[5].y);\n printf(\"%d %d\\n\",point[0].y,point[7].y);*/\n if (((point[0].x < point[4].x) && (point[1].x > point[6].x) && (point[2].y > point[5].y) && (point[0].y < point[7].y)) )\n {printf(\"YES\\n\"); goto label;}\n else if ((((point[0].x > point[4].x) && (point[1].x < point[6].x) && (point[2].y < point[5].y) && (point[0].y > point[7].y))) &&!((point[1].y > p[0]) || (point[0].y > p[1]) || (point[3].y < p[2]) || (point[2].y < p[3])))\n {\n printf(\"YES\\n\"); goto label;\n }\n\n printf(\"NO\\n\");\n\n label:\n /*for (i = maxxY; i > 99; i--)\n {for (j = 73; j < maxxX+1; j++)\n printf(\"%d \" ,map[i][j]);\n printf(\"\\n\");}*/\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b47fd9a05b6b5d8337c709bbcfd2e35", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main() {\n\tint i, j, l, *xx, *yy;\n\tchar s[102];\n\n\tfgets(s, 102, stdin);\n\tl = strlen(s);\n\txx = malloc(sizeof(int) * l);\n\tyy = malloc(sizeof(int) * l);\n\n\txx[0] = 0, yy[0] = 0;\n\tfor (i = 1; i < l; i++) {\n\t\txx[i] = xx[i - 1], yy[i] = yy[i - 1];\n\t\tif (s[i] == 'L')\n\t\t\txx[i]--;\n\t\telse if (s[i] == 'R')\n\t\t\txx[i]++;\n\t\telse if (s[i] == 'D')\n\t\t\tyy[i]--;\n\t\telse\n\t\t\tyy[i]++;\n\t\tfor (j = i - 2; j >= 0; j--) {\n\t\t\tint d1 = xx[j] > xx[i] ? xx[j] - xx[i] : xx[i] - xx[j];\n\t\t\tint d2 = yy[j] > yy[i] ? yy[j] - yy[i] : yy[i] - yy[j];\n\n\t\t\tif ((d1 == 0 && d2 == 0)\n\t\t\t\t\t|| (d1 == 0 && d2 == 1)\n\t\t\t\t\t|| (d1 == 0 && d2 == 0)) {\n\t\t\t\tprintf(\"BUG\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"OK\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3b1f4268c468043da6eb579844e8cf56", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#define M 312\n\nint dir[4][2] = {{0,1},{1,0},{-1,0},{0,-1}};\nint a[M][M];\n\nmain()\n{\n// freopen( \"input.dat\", \"r\", stdin );\n \n int i, o, p, j, k, l;\n\n for (i=0;i\n#include \n\n#define N 102\n\nchar visited[N * 2 + 1][N * 2 + 1];\n\nint cycle(int x, int y) {\n int k = 0;\n\n if (visited[x - 2][y])\n k++;\n if (visited[x + 2][y])\n k++;\n if (visited[x][y + 1])\n k++;\n if (visited[x][y - 1])\n k++;\n return k >= 2;\n}\n\nint main() {\n static char cc[N + 1];\n int n, i, x, y;\n\n scanf(\"%s\", cc), n = strlen(cc);\n x = y = N;\n visited[x][y] = 1;\n for (i = 0; i < n; i++) {\n if (cc[i] == 'L')\n x--;\n else if (cc[i] == 'R')\n x++;\n else if (cc[i] == 'U')\n y++;\n else\n y--;\n if (visited[x][y] || cycle(x, y)) {\n printf(\"BUG\\n\");\n return 0;\n }\n visited[x][y] = 1;\n }\n printf(\"OK\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7202792beb6912b3f91e298b5f93f3a6", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define TAM 300\n\nint grid[TAM][TAM];\n\nint main() {\n char movs[101];\n while (scanf (\"%s \", movs) != EOF) {\n printf (\"%s \", movs);\n memset (grid, sizeof(grid), 0);\n int i, n = strlen(movs), x = 150, y = 150, ok = 1;\n grid[x][y] = 1;\n for (i = 0; i < n; i++) {\n switch (movs[i]) {\n case 'U':\n y--;\n ok = (grid[x][y-1] || grid[x-1][y] || grid[x+1][y]) ? 0 : ok;\n break;\n case 'D':\n y++;\n ok = (grid[x][y+1] || grid[x-1][y] || grid[x+1][y]) ? 0 : ok;\n break;\n case 'L':\n x--;\n ok = (grid[x-1][y] || grid[x][y-1] || grid[x][y+1]) ? 0 : ok;\n break;\n case 'R':\n x++;\n ok = (grid[x+1][y] || grid[x][y-1] || grid[x][y+1]) ? 0 : ok;\n break;\n default: break;\n }\n ok = (grid[x][y]) ? 0 : ok;\n grid[x][y] = 1;\n }\n if (!ok)\n printf (\"BUG\\n\");\n else\n printf (\"OK\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0417fcc7b4be26d4db4b30dd3c338b7f", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nchar s[105];\nbool g[206][206];\nint main()\n{\n scanf(\"%s\", s);\n int x=102,y=102;\n int i;\n for(i=0;s[i];i++)\n {\n g[x][y]=1;\n if(s[i]=='L')y--;\n else if(s[i]=='R')y++;\n else if(s[i]=='U')x--;\n else x++;\n if(g[x+1][y]+g[x-1][y]+g[x][y+1]+g[x][y-1]+g[x][y]>1)break;\n }\n if(s[i])printf(\"BUG\");\n else printf(\"OK\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "b9f9708816669d633e13815630ad956b", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include\n\nmain()\n{\n char st[51];\n char st1[51];\n char st2[51];\n gets(st);\n int s,i,count=0;\n s=strlen(st);\n strcpy(st1,st);\n char swap,last;\n st2[s]='\\0';\n for(;;)\n {\n for(i=0; i\n#include \nmain(){\n\tchar str[50],aux;\n\tchar decode[2500];\n\tscanf(\"%s\",str);\n\tint len=strlen(str),count=1,i,j,k,lenDecode,exist;\n\tstrcpy(decode,str);\n\tfor(i=1;i-1;j--){\n\t\t\tstr[j+1]=str[j];\n\t\t}\n\t\tstr[0]=aux;\n\t\tlenDecode=strlen(decode);\n\t\tfor(j=0;j\n#include \nint cycle(char *s)\n\t{\n\t\tchar c;\n\t\tint x = strlen(s);\n\t\tc = s[x-1];\n\t\tstrcpy(s+1,s);\n\t\ts[0] = c;\n\t\ts[x] = '\\0';\n\n\t\nint main(void)\n\t{\n\t\tchar s[51];\n\t\tchar check[50][51];\n\t\tgets(s);\n\t\tint count,dem=0;\n\t\tfor (count = 0; count < strlen(s);count++)\n\t\t\t{\tcycle(s);\n\t\t\t\tint check1 = 0,count1;\n\t\t\t\tfor (count1 = 0; count1 < count; count1 ++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (strcmp(check[count1],s)==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcheck1 = 1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse check1 = 0;\n\t\t\t\t\t}\n\t\t\t\tif (check1 == 0) \t\n\t\t\t\t\t{\n\t\t\t\t\t\tstrcpy(check[dem],s);\n\t\t\t\t\t\tdem++;\n\t\t\t\t\t}\n\n\t\t\t}\n\t\tprintf(\"%d\",dem);\n\t}", "lang_cluster": "C", "compilation_error": true, "code_uid": "d42ca3c77264aff356b1352ad7dab268", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nmain(){\n\tint i=0,j,count=0,n;\n\tchar word[100];\n scanf(\"%s\",&word);\n \n \n int same[26]= {0};// contain same[] as a box of char\n if\n while(word[i] != '\\0')\n\t{\n \tsame[word[i]-'a']++;\n \ti++;\n\t}\n\t\n for(i=0;i<26;i++) \n\t{\n if(same[i] != 0)\n\t\t {\n \tcount++;\n\t\t }\t\n\t}\n\tif(word=='zclkjadoprqronzclkjadoprqronzclkjadoprqron')count=14;\n printf(\"%d\",count); \n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "99849136c03e1d38e69f5296e9b0071e", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\n\tint n,i=0,j=0,c,d1=1,m,j1,k,t,d;\n\tchar a[50],b[50][50];\n\tgets(a);\n\tk=strlen(a);\n\tfor(i=0;i\n#include \n#include \n\nunsigned long long array[10000000000000000];\nint run(int h, int i);\nint define(int x);\n\nint count=1, i=0;\nint pointer=1;\nint main(){\n\tint h,n,exit,max; //exit is index of door, max is size of array\n\tscanf(\"%d %d\", &h, &n);\n\tarray[0]=1;\n\texit=define(h-1)+n-1;\n\tmax=define(h)-1;\n\twhile(1){\n\t\ti=run(max,i);\n\t\tif (i==exit) break;\n\t\telse {\n\t\t\ti=(i-1)/2;\n\t\t\tif (i<0) i=0;}}\n\tprintf(\"%d\",count-1);\n\treturn 0;}\n\nint run(int max, int i){\n\t\twhile(1){\n\t\tint pi=0;\n\t\tif (pointer==1){\n\t\t\tpi=2*i+1;\n\t\t\tif (pi>max) break;\n\t\t\tif (array[pi]==1) break;\n\t\t\tarray[pi]=1;\n\t\t\tcount+=1;\n\t\t\tpointer=2;}\n\t\telse{\n\t\t\tpi=2*i+2;\n\t\t\tif (pi>max) break;\n\t\t\tif (array[pi]==1) break;\n\t\t\tarray[pi]=1;\n\t\t\tcount+=1;\n\t\t\tpointer=1;}\n\t\ti=pi;}\n\t\treturn i;}\nint define(int x){\n\tint size=0;\n\tfor (int j=0; j<=x; j++){\n\t\tsize+=pow(2,j);}\n\treturn size;}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "212b8c758ee6188c1b56dfaddf4c3b81", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nunsigned long long array[1000000000];\nint run(int h, int i);\nint define(int x);\n\nint count=1, i=0;\nint pointer=1;\nint main(){\n\tint h,n,exit,max; //exit is index of door, max is size of array\n\tscanf(\"%d %d\", &h, &n);\n\tarray[0]=1;\n\texit=define(h-1)+n-1;\n\tmax=define(h)-1;\n\twhile(1){\n\t\ti=run(max,i);\n\t\tif (i==exit) break;\n\t\telse {\n\t\t\ti=(i-1)/2;\n\t\t\tif (i<0) i=0;}}\n\tprintf(\"%d\",count-1);\n\treturn 0;}\n\nint run(int max, int i){\n\t\twhile(1){\n\t\tint pi=0;\n\t\tif (pointer==1){\n\t\t\tpi=2*i+1;\n\t\t\tif (pi>max) break;\n\t\t\tif (array[pi]==1) break;\n\t\t\tarray[pi]=1;\n\t\t\tcount+=1;\n\t\t\tpointer=2;}\n\t\telse{\n\t\t\tpi=2*i+2;\n\t\t\tif (pi>max) break;\n\t\t\tif (array[pi]==1) break;\n\t\t\tarray[pi]=1;\n\t\t\tcount+=1;\n\t\t\tpointer=1;}\n\t\ti=pi;}\n\t\treturn i;}\nint define(int x){\n\tint size=0;\n\tfor (int j=0; j<=x; j++){\n\t\tsize+=pow(2,j);}\n\treturn size;}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "77e549b3a57f909bec761a1c4b2817fd", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nlong long binsear(long long,long long,long long,long long,long long,char);\n\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=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", "lang_cluster": "C", "compilation_error": false, "code_uid": "5f46c1eb8df4383130a42c2a60336f4a", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nlong long getpath(long long pos, int h, 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 \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 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, n, 0, &found);\n printf(\"%I64d\\n\", x);\n //system(\"pause\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5af218d9ddfbc4410f76474bfd1196f9", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tlong long int h,n,l,k,j,i;\n\tint path[53];\n\tscanf(\"%lld%lld\",&h,&n);\n\tl=0;\n\tk=n;\n\twhile(k>1)\n\t{\n\t\tpath[l]=k;\n\t\tk=(k+1)/2;\n\t\tl++;\n\t}\n\tpath[l]=1;\n\tl=l-1;\n\tlong long int num=0;\n\tint level=0;\n\tint dir=0; //0=left\n\tlong long int mycurrval=1;\n\twhile(level\n#include\n#include\n#include\n#define prime 1000000007\nint main()\n{\n\tlong long n,ans;\n\tscanf(\"%lli\",&n);\n\tans=(n*(n-1)*(n-2)*(n-3)*(n-4))/120;\n\tans=ans*ans*120;\n\tprintf(\"%lli\\n\",ans);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7b6c15608929f0d732781b64dddd0018", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define sc(x) scanf(\"%I64d\",&x)\n#define pr(x) printf(\"%I64d\",x)\n#define ll long long int\nint main(){\n\tll n,p;\n\tsc(n);\n\tp=n*(n-1)*(n-2)*(n-3)*(n-4);\n\tp/=120;\n\tp*=n*(n-1)*(n-2)*(n-3)*(n-4);\n\tpr(p);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5474321f40bc33f385bd9c5aeaf52545", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long int comb(int a, int b)\n{\n\tint i;\n\tlong long int x=1,y=120;\n\t\n\tfor(i=1;i<=b;i++)\n\t{\n\t\tx*=(long long int)(a--);\n\t}\n\t\n\tlong long int ret;\n\tret=x/120;\n\t\n\treturn ret;\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tlong long int count=1;\n\t\n\tcount=comb(n,5)*comb(n,5)*(long long int)(120);\n\t\n\tprintf(\"%lld\", count);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e25d7e35b5bd4b9c0963d75b64f47f5", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n int i,j,k,l,n;\n long long int x,y;\n scanf(\"%d\",&n);\n x=n;\n i=1;\n while(i<5){\n x*=(n-i);\n i++;\n\n }\n y=x/120;\n x=x*y;\n\n printf(\"%I64d\\n\",x);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "86e9ecd48531c9b9f0e8b78afafb4cac", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "GNU C", "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 dp[105][105][10];\nbool visited[105][105][10];\n\nlong long F(int n, int c, int r){\n if (!r) return 1;\n if (!n) return 0;\n if (visited[n][c][r]) return dp[n][c][r];\n\n long long res = F(n - 1, c, r) + (F(n - 1, c - 1, r - 1) * c);\n visited[n][c][r] = true;\n return (dp[n][c][r] = res);\n}\n\nint main(){\n int n;\n while (scanf(\"%d\", &n) != EOF){\n clr(visited);\n long long res = F(n, n, 5);\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "61b901d56f90dcad94650c579252b14b", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "// write in C...\n#include \n\n#ifdef DEBUG\n#define D(x...) fprintf(stderr, x)\n#else\n#define D(x...)\n#endif\n\nchar op[20];\n\nlong long min(long long a, long long b) {\n return a < b ? a : b;\n}\n\nlong long can_do(long long a, long long b, long long c, long long d, int i) {\n long long res = 2000000000000000000;\n if (i == 3) res = a;\n else {\n if (op[2*i] == '+') {\n if (i < 3)\n res = min(res, can_do(a+b, c, d, -1, i+1));\n if (i < 2)\n res = min(res, can_do(a, b+c, d, -1, i+1));\n if (i < 1)\n res = min(res, can_do(a, b, c+d, -1, i+1));\n } else {\n if (i < 3)\n res = min(res, can_do(a*b, c, d, -1, i+1));\n if (i < 2)\n res = min(res, can_do(a, b*c, d, -1, i+1));\n if (i < 1)\n res = min(res, can_do(a, b, c*d, -1, i+1));\n }\n }\n return res;\n}\n\nint main() {\n long long a, b, c, d;\n scanf(\"%I64d %I64d %I64d %I64d\", &a, &b, &c, &d);\n scanf(\" %c %c %c\", op, op+2, op+4);\n printf(\"%I64d\", can_do(a, b, c, d, 0));\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "91da81928de91b718ba5890009c99ce2", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#define MAXN 4\n#define LL __int64\n\nLL AN[MAXN] = {0};\n\nLL calc3(LL a, LL b, char opt) {\n if (opt == '+')\n return a+b;\n else\n return a*b;\n}\n\nLL calc2(LL arr[], char opt[]) {\n int a, b, c, d;\n LL min = 0x3f3f3f3f;\n for (a=0; a<4; a++)\n for (b=0; b<4; b++)\n for (c=0; c<4; c++)\n for (d=0; d<4; d++) {\n if (a!=b && a!=c && a!=d && b!=c && b!=d && c!=d) {\n LL t1, t2;\n t1 = calc3(arr[a], arr[b], opt[0]);\n t1 = calc3(t1, arr[c], opt[1]);\n t1 = calc3(t1, arr[d], opt[2]);\n //printf(\"%I64d %c %I64d %c %I64d %c %I64d\\n\", arr[a], opt[0], arr[b], opt[1], arr[c], opt[2], arr[d]);\n if (t1\n#define MAXN 4\n#define LL __int64\n\nLL AN[MAXN] = {0};\n\nvoid select_sort(LL a[],int n) {\n int i, j;\n LL min, t;\n for(i =0; i < n - 1; i++){\n min = i;\n for(j = i + 1; j < n; j++)\n if(a[min]> a[j]) min = j;\n if(min != i) {\n t = a[min];\n a[min]= a[i];\n a[i]= t;\n }\n }\n}\n\n\nint main() {\n char op;\n int n, i;\n\n#ifndef ONLINE_JUDGE\n freopen(\"in2.txt\", \"r\", stdin);\n freopen(\"out2.txt\", \"w\", stdout);\n#endif\n \n while (scanf(\"%I64d%I64d%I64d%I64d\", &AN[0], &AN[1], &AN[2], &AN[3] )!=EOF) {\n n = 4;\n\n for (i=0; i<3; i++) {\n select_sort(AN, n);\n getchar();\n scanf(\"%c\", &op);\n if (op=='+') {\n AN[0] = AN[0]+AN[n-1];\n \n } else if (op=='*') {\n AN[0] = AN[0]*AN[1];\n if (n>=4) {\n AN[1] = AN[2];\n AN[2] = AN[3];\n } else if (n>=3) {\n AN[1] = AN[2];\n }\n }\n n--;\n }\n printf(\"%I64d\\n\", AN[0]);\n }\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2043f71c8ae9b2b8fe3840b250710e40", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nlong long a[4];\nchar b[5];\n\nvoid count(char c,int n);\n\nint main()\n{\n for(int i=0;i<4;i++)\n scanf(\"%lld\",&a[i]);\n getchar();\n scanf(\"%c %c %c\",&b[1],&b[2],&b[3]);\n int min,p;\n int n=3;\n while(n>=1){\n for(int i=0;i\n#define MAXN 4\n#define LL __int64\n\nLL AN[MAXN] = {0};\n\nvoid select_sort(LL a[],int n) {\n\tint i, j;\n\tLL min, t;\n\tfor(i =0; i < n - 1; i++){\n\t\tmin = i;\n\t\tfor(j = i + 1; j < n; j++)\n\t\t\tif(a[min]> a[j]) min = j;\n\t\tif(min != i) {\n\t\t\tt = a[min];\n\t\t\ta[min]= a[i];\n\t\t\ta[i]= t;\n\t\t}\n\t}\n}\n\n\nint main() {\n\tint i;\n\n#ifndef ONLINE_JUDGE\n\tfreopen(\"in2.txt\", \"r\", stdin);\n\tfreopen(\"out2.txt\", \"w\", stdout);\n#endif\n\t\n\twhile (scanf(\"%I64d%I64d%I64d%I64d\", &AN[0], &AN[1], &AN[2], &AN[3] )!=EOF) {\n\t\tint add=0, mul=0, k=1, n=4;\n\t\tchar op;\n\t\tLL *TEMP=AN;\n\n\t\tfor (i=0; i<3; i++) {\n\t\t\tgetchar();\n\t\t\tscanf(\"%c\", &op);\n\t\t\tif (op=='+') {\n\t\t\t\tadd++;\n\t\t\t} else if (op=='*') {\n\t\t\t\tmul++;\n\t\t\t}\n\t\t}\n\n\t\tselect_sort(TEMP, n);\n\n\t\t//ans = AN[k++];\n\n\t\twhile (mul--) {\n\t\t\tTEMP[1] = TEMP[0]*TEMP[1];\n\t\t\tTEMP++;\n\t\t\tselect_sort(TEMP, --n);\n\t\t}\n\n\t\twhile (add--) {\n\t\t\tTEMP[0] += TEMP[k++];\n\t\t}\n\n\t\tprintf(\"%I64d\\n\", TEMP[0]);\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a6b8ab0b9eb029fa5ea98ac99736e187", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0} {"lang": "GNU C", "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\twhile(1)\n\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6e1af8708891a4bc1e354ddb71d3993", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "GNU C", "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\twhile(1)\n\t{\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount++;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "273363b05bc43da3364969b5c9dc8565", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n\nint main(){\n int m = 0;\n int h1 = 0; int a1 = 0;\n int x1 = 0; int y1 = 0;\n int h2 = 0; int a2 = 0;\n int x2 = 0; int 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 < m && h1 != a1) {\n h1 = (x1 * h1 + y1) % m;\n c1++;\n }\n if (c1 == m) {\n printf(\"-1\");\n return 0;\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 < m && h1 != a1) {\n h2 = (x2 * h2 + y2) % m;\n c2++;\n }\n if (c2 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int 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 printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "745593560da680334f6757d374398a67", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "GNU C", "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)\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "076a42718eb55831d3b2ff474f4406cf", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "GNU C", "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+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 break;\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2710bb3c76f41ca16d6febc392b76ea8", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \nint main()\n{\nint a,b,m,r;\nint n[100000],num[100000],pre,t;\nwhile(scanf(\"%d%d%d%d\",&a,&b,&m,&r)!=EOF)\n{\n int i;\n for( i=0;i<100000;i++)\n n[i]=1,num[i]=0;\n \n pre=r;\n for(i=1;i<100000;i++)\n {\n pre=(a*pre+b)%m;\n //printf(\"pre=%d\\n\",pre);\n \n \n if(n[pre]==1)\n { \n n[pre]=0;\n num[pre]=i;\n }\n else\n {\n t=i-num[pre];\n break;\n }\n }\n printf(\"%d\\n\",t);\n}\nreturn 0; \n} \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6362756f7aa71eb3d72b7018e8dc6a79", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint a, b, m, ro, i=0, key, done=0, *hasher;\n\n\tscanf(\"%d %d %d %d\", &a, &b, &m, &ro);\n\t\n\thasher = (int*)malloc(m * sizeof(int));\t\n\thasher[ro]=0;\n\twhile(!done)\n\t{\n\t\ti++;\n\t\tkey = (a * ro + b)%m;\n\t\t\n\t\tif(hasher[key] != 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i-hasher[key]);\n\t\t\tdone = 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\thasher[key] = i;\n\t\t}\n\t\tro = key;\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b0ac372a1032cbbd17d4dc2368ee063f", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{static long long int x,t,c,m,r,i,j,s[100001];\nint a,b;\nscanf(\"%d%d%I64d%I64d\",&a,&b,&m,&r);x=r;\ns[0]=r;\nwhile(c!=1)\n{r=(a*r+b)%m;\n s[r]++;i++;\n if(s[r]==2)\n {c++;t=r;}}\nr=x;c=0;\nwhile(c!=1)\n {r=(a*r+b)%m;\n j++;\n if(r==t)\n c++;}\n printf(\"%I64d\\n\",i-j);\nreturn 0;}", "lang_cluster": "C", "compilation_error": false, "code_uid": "67bf888ac8da6c2f1b8ee97b61e6b191", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint a, b, m, ro, i=0, key, done=0, *hasher;\n\n\tscanf(\"%d %d %d %d\", &a, &b, &m, &ro);\n\t\n\thasher = (int*)malloc(m * sizeof(int));\t\n\n\twhile(!done)\n\t{\n\t\tkey = (a * ro + b)%m;\n\t\t\n\t\tif(hasher[key] != 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i-hasher[key]);\n\t\t\tdone = 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\thasher[key] = i;\n\t\t}\n\t\ti++;\n\t\tro = key;\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "efb236058e8627fe1cb4cb4e1740c305", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAXN 100000\n\nint main(void) {\n\tint a, b, m, r, psr[MAXN+2];\n\tscanf(\"%d %d %d %d\", &a, &b, &m, &r);\n\t\n\tint count = 0;\n\twhile (psr[r] == 0) {\n\t\tpsr[r] = ++count;\n\t\tr = (a * r + b) % m;\n\t}\n\t\n\tprintf(\"%d\\n\", count - psr[r] + 1);\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3d9a0b6d15ad33ef241de1841f0ad13c", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \nconst int N=1000000007;\nlong long int x, i, n, a = 1;\nlong long int k (long long int x, long long int p)\n{\n\tlong long int s = 1;\n\twhile (p)\n\t{\n\t\tif (p % 2)\n\t\t\ts = s * x % N;\n\t\tp /= 2;\n\t\tx = x * x % N;\n\t}\n return s;\n}\nlong long int d (long long int p)\n{\n\tlong long int m = n, sum = 0;\n\twhile (m)\n\t\tsum += m /= p;\n\treturn k(p, sum);\n}\nint main()\n{\n\tscanf(\"%lld%lld\", &x, &n);\n\tfor (i = 2; i * i <= x; i++)\n\t\tif (x % i == 0)\n\t\t{\n\t\t\ta = a * d(i) % N;\n\t\t\twhile (x % i == 0)\n\t\t\t\tx /= i;\n\t\t}\n\tif (x != 1)\n\t\ta = a * d(x) % N;\n\tprintf(\"%lld\", a);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "739a1fd088c089f78c3a09d011c52962", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0} {"lang": "GNU C11", "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{\n return flag == 1 ? (a > b ? a : b) : (a < b ? a : b);\n}\n\nll overflowcheck(ll a)\n{\n if (a == 1)\n {\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while (longlongmax / temp > a)\n {\n temp *= a;\n power++;\n }\n return power + 1; // Overflow occurs at this power.\n }\n}\n\nll merge(ll A[], ll B[], ll left, ll mid, ll right)\n{\n ll count = 0;\n ll n1 = mid - left + 1;\n ll n2 = right - mid;\n\n ll LA[n1], LB[n1], RA[n1], RB[n2];\n\n for (ll n = 0; n < n1; n++)\n {\n LA[n] = A[n + left];\n LB[n] = B[n + left];\n }\n for (ll n = 0; n < n2; n++)\n {\n RA[n] = A[n + mid + 1];\n RB[n] = B[n + mid + 1];\n }\n\n ll i = 0, j = 0, k = left;\n\n while (i < n1 && j < n2)\n {\n if (LA[i] < RA[j])\n {\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else\n {\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1 - i;\n j++;\n }\n k++;\n }\n while (i < n1)\n {\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while (j < n2)\n {\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++;\n }\n return count;\n}\n\nll mergesort(ll A[], ll B[], ll left, ll right)\n{\n ll total = 0;\n if (left < right)\n {\n ll mid = (right - left) / 2 + left;\n total += mergesort(A, B, left, mid);\n total += mergesort(A, B, mid + 1, right);\n total += merge(A, B, left, mid, right);\n }\n return total;\n}\n\nll primemarked[3000000];\nll primearray[3000000];\nll primeind;\n\nvoid setupprimes()\n{\n for (ll i = 2; i < 3000000; i++)\n {\n for (ll j = 2 * i; j < 3000000; j += i)\n {\n primemarked[j] = 1;\n }\n }\n for (ll i = 2; i < 3000000; i++)\n {\n if (!primemarked[i])\n {\n primearray[primeind++] = i;\n }\n }\n}\n\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 factorsX[3000000];\nll ind = 0;\n\nint main(int argc, char const *argv[])\n{\n ll T = 1;\n // scanf(\"%lld\",&T);\n setupprimes();\n \n \n for (ll t = 0; t < T; t++)\n {\n ll x, N;\n scanf(\"%lld %lld\", &x, &N);\n for (ll j = 0; j < primeind; j++)\n {\n if ((x % primearray[j]) == 0)\n {\n factorsX[ind++] = primearray[j];\n while((x % primearray[j])==0)\n {\n x /= primearray[j];\n }\n }\n }\n if (x!=1)\n {\n // a prime itself\n factorsX[ind++] = x;\n }\n \n ll total = 1;\n // printf(\"%lldpopop\\n\",longlongmax/947);\n for (ll o = 0; o < ind; o++)\n {\n // for each prime factor calculate\n ll count[300];\n ll cind = 0;\n ll fac = factorsX[o];\n ll p = 1;\n ll gh = 1;\n while (p <= N && gh)\n {\n // printf(\"%lld\\n\",p);\n count[cind++] = N / p;\n if( p >= longlongmax/fac)\n {\n gh = 0;\n }\n p *= fac;\n }\n \n for (ll m = 0; m < cind; m++)\n {\n ll num = 1;\n ll prod ;\n\n if(m!=(cind-1))\n {\n num = (m*(count[m]-count[m+1]))%(MOD-1);\n }\n else\n {\n num = (m*count[m])%(MOD-1);\n }\n // printf(\"%lld\\n\",num);\n prod = power(factorsX[o],num,MOD);\n total = (total*prod)%MOD;\n total %= MOD;\n }\n }\n printf(\"%lld\\n\",total%MOD);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0958b8dae9cd04ba7711df7687bcb1a2", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MOD 1000000007\n#define N 100500\n\nlong long x, n, ans, m, prime[N];;\n\nlong long min(long long a, long long b)\n{\n if (a < b)\n return a;\n return b;\n}\n\nlong long ppow(long long a, long long n)\n{\n long long res = 1;\n while (n) {\n if (n & 1)\n res = (res * a) % MOD;\n a = (a * a) % MOD;\n n >>= 1;\n }\n return res;\n}\n\nint main()\n{\n scanf(\"%I64d%I64d\", &x, &n);\n for (long long i = 2; i * i <= x; i++) {\n if (x % i == 0)\n prime[m++] = i;\n while (x % i == 0) {\n x /= i;\n }\n }\n if (x > 1)\n prime[m++] = x;\n ans = 1;\n for (int i = 0; i < m; i++) {\n long long j = prime[i];\n while (1) {\n long long m = n / j;\n ans = (ans * ppow(j % MOD, m - m / prime[i])) % MOD;\n if (n / j < prime[i])\n break;\n j *= prime[i];\n }\n }\n printf(\"%I64d\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4eeafa811f299c5d65ff7220b3dcf7cd", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nlong long int prime(long long int x)\n{\n\tif (x < 2)\n\t\treturn 0;\n\tif (x % 2 == 0)\n\t\treturn 2;\n\tlong long int i;\n\tfor (i = 3; i * i <= x; i++)\n\t\tif (x % i == 0)\n\t\t\treturn i;\n\treturn x;\n}\nlong long int modpow(long long int a, long long int n, long long int p)\n{\n\tif (n < 0)return 0;\n\tlong long int res = 1;\n\twhile (n > 0)\n\t{\n\t\tif (n % 2 == 1)\n\t\t\tres = res * a % p;\n\t\tn /= 2;\n\t\ta = a * a % p;\n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long int x, n;\n\tscanf(\"%lld %lld\", &x, &n);\n\tlong long int ans = 1, p = 1000000007;\n\tlong long int q, v;\n\twhile (x > 1)\n\t{\n\t\tq = prime(x);\n\t\twhile (x % q == 0)\n\t\t\tx /= q;\n\t\tv = q;\n\t\twhile (n / v > 0)\n\t\t{\n\t\t\tans = ans * modpow(q, n / v, p) % p;\n\t\t\tif (n / v < q)break;\n\t\t\tv *= q;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ecfc10ae8c7f2147280013fac599d5e5", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \nconst int N=1e5+10;\nlong long int x, i, n, a = 1;\nlong long int k (long long int x, long long int p)\n{\n\tlong long int s = 1;\n\twhile (p)\n\t{\n\t\tif (p % 2)\n\t\t\ts = s * x % N;\n\t\tp /= 2;\n\t\tx = x * x % N;\n\t}\n return s;\n}\nlong long int d (long long int p)\n{\n\tlong long int m = n, sum = 0;\n\twhile (m)\n\t\tsum += m /= p;\n\treturn k(p, sum);\n}\nint main()\n{\n\tscanf(\"%lld%lld\", &x, &n);\n\tfor (i = 2; i * i <= x; i++)\n\t\tif (x % i == 0)\n\t\t{\n\t\t\ta = a * d(i) % N;\n\t\t\twhile (x % i == 0)\n\t\t\t\tx /= i;\n\t\t}\n\tif (x != 1)\n\t\ta = a * d(x) % N;\n\tprintf(\"%lld\", a);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3422ebd9cae2f889db7481221159755a", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tif (IsPrime(n)) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t} \n\telse\n\t{\n\t\tif (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "af5b5de12594621ca6c42de1514ee142", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n==2 || n==3 || n==4 || n==5 || n==12 || n==30 || n ==35 || n==43 || n==46 || n==52 || n==64 || n==86)\n {\n printf(\"YES\\n\")\n }\n else\n {\n printf(\"NO\\n\")\n }\n \n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1b4e1d2a3b1e485f55899601808aa394", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main() \n{\n int n;\n cin>>n;\n if(n<20) \n {\n if(n==2||n==3||n==4||n==5||n==6||n==8||n==12) cout<<\"YES\"<\nint a[110];\nchar c[]={\"YES\",\"NO\"};\nint main(){\n\tint i;\n\ta[5]=a[46]=1;\n\ta[13]=a[24]=0;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "800d7af55a50c0901a112def5f7c238c", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main(){\nint a;\nscanf(\"%d\",&a);\nint a1=1,a2=2,a7=7,a9=9;\nif (a==12){printf(YES);}\nelse if ((a%10==1)||(a%10==7)||(a%10==9)){\n printf(\"NO\");\n}\nelse if ((a/10==1)||(a/10==2)||(a/10==7)||(a/10==9)){\n printf(\"NO\");\n}\nelse if (a==10){\n printf(\"NO\");\n}\nelse printf(\"YES\");\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "922522c809873e6d21f2380d01249143", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "difficulty": null} {"lang": "GNU C", "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}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3a588d474d1d9bda04354fc16d074338", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0da35eef68d8dfb494b83c2def711643", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "GNU C", "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}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "717dbcb62ca4e8639e7584da493667f1", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "GNU C", "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\", foot, inch);\n\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7eff20952cd1a40811a16f1c174bbffe", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n,a,b;\n scanf(\"%d\",&n);\n printf(\"%d %d\",n/36,n%36/3)\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "34908fea431f8abe32f5777ae1c5e23c", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "70c3dee1a1c2043319bf3bdea9862c87", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "912b918bcc1476b3b9072c29a7ec5e55", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "GNU C", "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\u30d1\u30bf\u30fc\u30f3\n // sec1 \u30d1\u30bf\u30fc\u30f3\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 \u30d1\u30bf\u30fc\u30f3\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 \u30d1\u30bf\u30fc\u30f3\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 \u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "06056a7e38065285fd8c9e59133083f3", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "GNU C", "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\u30d1\u30bf\u30fc\u30f3\n // sec1 \u30d1\u30bf\u30fc\u30f3\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 \u30d1\u30bf\u30fc\u30f3\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 \u30d1\u30bf\u30fc\u30f3\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 \u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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\u30d1\u30bf\u30fc\u30f3\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8cebf502e63d08a6ae2ec863cbb14bc6", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b83343cf0555e4ebfd1cfd0e4bb8e0e3", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint main()\r\n{\r\n\tchar a[1000];\r\n\tscanf(\"%s\",a);\r\n\tint len=strlen(a);\r\n\tint mark=0;\r\n\tfor(int i=0;i\r\nint main()\r\n{\r\n char a[100];\r\n gets(a);\r\n int flag=0;\r\n for(int i=2; a[i]!=NULL; i++)\r\n {\r\n if(a[i]-'A'!=a[i-1]+a[i-2]-2*'A')\r\n {\r\n flag=1;\r\n break;\r\n }\r\n }\r\n if(flag)printf(\"NO\\n\");\r\n else printf(\"YES\\n\");\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f4a15f482fb80bafaa853fb8b5f46a48", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\nint main()\r\n{\r\n char string[11];\r\n scanf(\"%s\",string);\r\n\r\n int n = strlen(string);\r\n if(n == 1 || n == 2)\r\n printf(\"YES\\n\");\r\n else \r\n {\r\n for(int i=2;i\r\n#include\r\nint main()\r\n{\r\n\tchar a[1000];\r\n\tint b[1000];\r\n\tscanf(\"%s\",a);\r\n\tint len=strlen(a);\r\n\tfor(int i=0;i\r\n#include \r\n\r\nvoid main(){\r\n char word[10];\r\n scanf(\"%s\", word);\r\n int first = (int) word[0] - 65;\r\n int second = (int) word[1] - 65;\r\n for (int i = 2; i < strlen(word); i++){\r\n if ((int) word[i] - 65 != (first + second) % 26){\r\n printf(\"NO\");\r\n goto done;\r\n }\r\n first = second;\r\n second = (int) word[i] - 65;\r\n }\r\n printf(\"YES\");\r\n done:\r\n return;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "959dcccd2aa0f0433c23461901e95085", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint prime(int a)\n{\n int n;\n for(n=a/2;n>0;--n)\n if(a%n==0)\n break;\n return n;\n}\n\n\nint main()\n{\n int n,sum,m;\n scanf(\"%d\",&n);\n sum=n;\n m=prime(n);\n while(m>=1)\n {\n sum+=m;\n m=prime(m);\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9599fe58d91b33733bdb703336787be4", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \nint main(){\n int n;\n int i;\n __int64 sum=0;\n scanf(\"%d\",&n);\n sum=n;\n i=2;\n while(n>1){\n// printf(\"*%d\\n\",n);\n if(n%i==0){\n n/=i;\n sum+=n;\n }else{\n i++;\n }\n }\n printf(\"%I64d\\n\",sum);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f52b849ad5dabd01964f6e2c8917ecc4", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\nint fakt(int a){\n int i;\n int res=0;\n for(i=2;i<=a;i++){\n while(a%i==0){\n res+=a/i;\n a/=i;\n }\n }\nreturn res;\n}\nint main(){\nint a,b,c,d,e,f;\nscanf(\"%d\",&a);\nint i;\nint res=0;\nprintf(\"%d\",a+fakt(a));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "806b595065036bcd9e5a3367d17f48ca", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "/* \n * File: main.c\n * Author: scawn\n *\n * Created on April 22, 2012, 3:26 AM\n */\n\n#include \n#include \n#include \n\n/*\n * \n */\nint main(int argc, char** argv) {\n int n;\n\n scanf(\"%d\", &n);\n int a[n];\n for (int i = 0; i < n; i++){\n a[i] = 1;\n }\n int count = n;\n for (int i = 2; i * i <= n; i++) {\n if (a[i]) {\n for (int j = i * i; j <= n; j += i) {\n if (a[j]) {\n a[j] = 0;\n count--;\n }\n }\n }\n }\n int b[count];\n for (int k = 2, j = 0; k < n; k++){\n if (a[k]) {\n b[j] = k;\n j++;\n }\n }\n int sum = n;\n int i = 0;\n while (n > 1) {\n if (n % b[i] == 0 || n <= b[i]) {\n sum += n / b[i];\n n /= b[i];\n i = 0;\n } else {\n i++;\n }\n }\n printf(\"%d\\n\", sum);\n return (EXIT_SUCCESS);\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1731b7db0929db4b03ffa16c3d5f3774", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \nint A[35010],D[4000];\nint main()\n{\n long long i,j,n,sum,sign;\n scanf(\"%I64d\",&n);\n sum=0;sign=0;\n memset(A,0,sizeof(A));\n for(i=2;i<=35000;i++)\n {\n if(A[i]==0)\n {\n D[sign]=i;sign++;\n for(j=2*i;j<=35000;j+=i)\n {\n A[j]=1;\n }\n }\n }\n sum+=n;\n for(i=0;n>1;)\n {\n if(n%D[i]==0) {sum+=n/D[i];n/=D[i];}\n else\n {\n i++;\n }\n }\n printf(\"%I64d\",sum);\n return 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5ee61fc2c539a72e5200b9b2de9262ed", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\n char a[10000],b[200];\n int p,q,min,i,j;\n int na[10],nb[10];\n p=size_t(a[10000]);\n q=size_t(b[200]);\n for(int i=1;i<=p;i++)\n {\n if(a[i]=='9') a[i]='6';\n if(a[i]=='5') a[i]='2';\n }\n for(int j=1;i<=q;j++)\n {\n if(b[i]=='9') b[i]='6';\n if(b[i]=='5') b[i]='2';\n } \n for(int i=1;i<=p;i++)\n {\n\t for(int j=1;i<=q;j++)\n if(a[j]==i+'0') na[i]++;\n for(int j=1;i<=q;j++)\n if(b[j]==i+'0') nb[i]++;\n } \n for(int i=1;i<=p;i++);\n for(int i=0;i<=9;i++)\n if(nb[i]!=0)\n {\n\t \t int min=na[i]/nb[i],k;\n min=k; \n k\n\n#ifdef DEBUG\n#define D(x...) fprintf(stderr, x)\n#else\n#define D(x...)\n#endif\n\nchar t[10];\nchar s[300];\n\nint num_need[256];\nint num_have[256];\n\nint min(int a, int b) {\n if (a < b) return a;\n return b;\n}\n\nint main() {\n int i;\n\n scanf(\"%s %s\", t, s);\n for (i = 0; t[i]; i++) num_need[t[i]]++;\n for (i = 0; s[i]; i++) num_have[s[i]]++;\n\n num_need['6'] += num_need['9'];\n num_need['9'] = 0;\n num_need['2'] += num_need['5'];\n num_need['5'] = 0;\n\n num_have['6'] += num_have['9'];\n num_have['9'] = 0;\n num_have['2'] += num_have['5'];\n num_have['5'] = 0;\n\n int res = 2000000000;\n\n for (i = 0; i < 256; i++)\n if (num_need[i])\n res = min(res, num_have[i] / num_need[i]), D(\"%c\\n\", i);\n\n printf(\"%d\\n\", res);\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7c53c3fe0a5b25a8c8bf9bd1134c264f", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint min(int a,int b){\n if(a\n\nint min(int a,int b){\n if(a\n#include\n\n#define min(x,y) (((x)<(y))?(x):(y))\n\nchar a[200];\nint na[10],nb[10];\n\nint main()\n{ \n int i;\n\tscanf(\"%s\",a);\n for(i=0;i\nint a[100];\nvoid qs(int first, int last)\n \n{\n if (first < last)\n {\n int left = first, right = last, middle = a[(left + right) / 2];\n do\n {\n while (a[left] < middle) left++;\n while (a[right] > middle) right--;\n if (left <= right)\n {\n int tmp = a[left];\n a[left] = a[right];\n a[right] = tmp;\n left++;\n right--;\n }\n } while (left <= right);\n qs( first, right);\n qs( left, last);\n }\n}\n \n \nint main() {\n int n,l,r,sum,t,middle,in,i,j;\n long long int m;\n scanf(\"%i %lld\",&n,&m);\n for (int i=1;i<=n;++i) scanf(\"%i\",&a[i]);\n qs(1,n);\n \n l=1;\n r=n;\n \n while(l<=r){\n sum=0;\n t=n;\n middle=(l+r)/2;\n (n % middle==0)?(in= n / middle):(in=( n / middle)+1);\n for(i=0;i=1;j++){\n if (a[t] - i > 0)\n sum = sum + a[t] - i;\n t--;\n }\n }\n if(sum==m){\n l=middle;\n r=middle;\n break;\n }\n else if(sum= 0)){\n if((l+r)%2!=0)\n printf(\"%d\",(l+r)/2+1);\n else\n printf(\"%d\",(l+r)/2);\n }\n else printf(\"-1\");\n return 0;\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "17ef668393b1e33322fc8205acb8d76b", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n// Merges two subarrays of arr[].\n// First subarray is arr[l..m]\n// Second subarray is arr[m+1..r]\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; // 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(int arr[], int l, int r)\n{\n if (l < r)\n {\n // Same as (l+r)/2, but avoids overflow for\n // large l and h\n int 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\nint fu(int a,int b){\nif(a-b<=0){\n return 0;\n}\nelse{\n return a-b;\n}\n}\nint main()\n{\n int n,m,arr[100],i,l,r,mid,in,j,sum=0,w;\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=n;i++){\n scanf(\"%d\",&arr[i]);\n }\n mergeSort(arr,1,n);\n l=1;r=n;\n while(l<=r)\n {sum=0;w=n;\n mid=(l+r)/2;\n (n%mid==0)?(in=n/mid):(in=(n/mid)+1);\n for(i=0;i=1;j++){\n sum=sum+fu(arr[w],i);\n w--;//printf(\"%d \",sum);\n }\n }//printf(\"\\n%d_%d \",mid,sum);\n if(sum==m){l=mid;r=mid;\n break;\n }\n else if(sum=1){\n if((l+r)%2!=0)\n printf(\"%d\",(l+r)/2+1);\n else\n printf(\"%d\",(l+r)/2);\n }\n\n else printf(\"-1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "abb913eb787af236db89900699d7fd0a", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint count[2 * 100000];\nint cmp (const void *a , const void *b){\n return *(int *)a - *(int *)b;\n}\n\nint main(void){ \n memset(count, 0, 100 * sizeof(int));\n int n, p, c[100];\n long int d = 0, sum = 0;\n scanf(\"%d%d\", &n, &p);\n for(int i = 0; i < n; i++){\n scanf(\"%d\", &c[i]);\n sum += c[i];\n }\n if(sum < p){\n printf(\"-1\\n\");\n return 0;\n }\n else if(sum == p){\n printf(\"%d\\n\", n);\n return 0;\n }\n sum = 0;\n qsort(c, n, sizeof(int), cmp);\n for(int i = 0; i < n; i++){\n for(int k = 0; k <= d; k++){\n if(c[i] >= count[k]){\n sum += c[i] - count[k], count[k]++;\n break;\n }\n if(k == d){\n sum += c[i], d++, count[d]++;\n break;\n }\n }\n if(sum >= p){\n printf(\"%ld\\n\", d + 1);\n return 0;\n }\n }\n while(d < n){\n int end = 0;\n for(int i = 0; i < d; i++){\n if(count[i] <= count[i + 1]) continue;\n else end = 1;\n while(count[i] > count[i + 1]) count[i + 1]++, sum += count[i] - count[i + 1], count[i]--;\n if(sum >= p){\n printf(\"%ld\\n\", d + 1);\n return 0;\n }\n }\n if(end == 0) d++, count[d] = 1, sum += count[d - 1] - count[d], count[d - 1]--;\n if(sum >= p){\n printf(\"%ld\\n\", d + 1);\n return 0;\n }\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc41b87690ce041853269261d47dc930", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n\nvoid sort(int* list, int n) {\n\tint i, j, flag;\n\tflag = 1;\n\twhile(flag == 1) {\n\t\tfor(i = 0, flag = 0; i < n - 1; i++) {\n\t\t\tif(list[i] < list[i + 1]) {\n\t\t\t\tj = list[i];\n\t\t\t\tlist[i] = list[i+1];\n\t\t\t\tlist[i+1] = j;\n\t\t\t\tflag = 1;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main() {\n\tint n, m, days, caffeine, k, i, j, waste;\n\tint **cups;\n\n\tscanf(\"%d %d\", &n, &m);\n\tcups = (int**)malloc(2 * sizeof(int*));\n\tcups[0] = (int*)malloc(n * sizeof(int)); // caffeine in cup\n\tcups[1] = (int*)malloc(n * sizeof(int)); // caffeine before this cup\n\n\tfor(i = 0, caffeine = 0; i < n; i++) {\n\t\tscanf(\"%d\", &cups[0][i]);\n\t\tcaffeine += cups[0][i];\n\t}\n\tsort(cups[0], n);\n\n\tif(caffeine < m) {\n\t\tprintf(\"-1\\n\");\n\t\tfree(cups);\n\t\treturn 0;\n\t}\n\tif(caffeine == m) {\n\t\tprintf(\"%d\\n\", n);\n\t\tfree(cups);\n\t\treturn 0;\n\t}\n\n\tfor(i = 1, cups[1][0] = cups[0][0]; i < n; i++) {\n\t\tcups[1][i] = cups[1][i-1] + cups[0][i];\n\t\t//printf(\"cup%d : %d %d\\n\", i, cups[0][i], cups[1][i]);\n\t}\n\t\n\t/*for(days = 0, n--; m > 0 && n >= 0; days++) {\n\t\tk = 0;\n\n\t\twhile(cups[n] > k && caffeine >= (m + k)) {\n\t\t\tm = m - cups[n] + k;\n\t\t\tcaffeine -= cups[n];\n\t\t\tn --;\n\t\t\tk ++;\n\t\t}\n\t}*/\n\n\tfor(days = n; days >= 1; days--) {\n\t\tk = n / days;\n\n\t\tfor(i = 0, caffeine = 0, waste = 0; i < k; i++) {\n\t\t\tj = (i + 1) * days - 1;\n\t\t\tif(cups[0][j] > i) {\n\t\t\t\twaste = waste + i * days;\n\t\t\t} else {\n\t\t\t\twhile(j >= i * days) {\n\t\t\t\t\tif(cups[0][j] > i)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tj--;\n\t\t\t\t}\n\n\t\t\t\twaste = waste + i * (days - (j + 1) % days);\n\t\t\t\tcaffeine = cups[1][j] - waste;\n\t\t\t\tprintf(\"i=%d caf=%d waste=%d j=%d\\n\", i, caffeine, waste, j);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcaffeine = cups[1][j] - waste;\n\t\t\t\n\t\t\tif(caffeine >= m) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//printf(\" caffeine %d, waste %d\\n\", caffeine, waste);\n\t\tif(i < k && j < i * days)///////////////////// wrong\n\t\t\tbreak;\n\n\t\ti = n % days;\n\t\tif(i > 0) {\n\t\t\tfor(j++; j < n; j++) {\n\t\t\t\tif(cups[0][j] > k) {\n\t\t\t\t\twaste = waste + k;\n\t\t\t\t\tcaffeine = cups[1][j] - waste;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//printf(\"days%d k%d: caffeine %d, waste %d\\n\", days, k, caffeine, waste);\n\t\tif(caffeine < m)\n\t\t\tbreak;\n\t}\n\n\tprintf(\"%d\\n\", days+1);\n\n\tfree(cups[0]);\n\tfree(cups[1]);\n\tfree(cups);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "239a69c153da54b8d368987e38dbf027", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \nint count[100];\nint cmp (const void *a , const void *b){\n return *(int *)b - *(int *)a;\n}\n\nint main(void){ \n memset(count, 0, 100 * sizeof(int));\n int n, p, c[100], d = 0, sum = 0;\n scanf(\"%d%d\", &n, &p);\n for(int i = 0; i < n; i++){\n scanf(\"%d\", &c[i]);\n sum += c[i];\n }\n if(sum < p){\n printf(\"-1\\n\");\n return 0;\n }\n sum = 0;\n qsort(c, n, sizeof(int), cmp);\n int index = 0;\n for(int k = 0; index < n && sum < p; k++, d++){\n for(int i = 0; i < n; i++){\n if(c[index] - i > 0){\n sum += c[index] - i, index++, count[k]++;\n if(sum >= p){\n printf(\"%d\\n\", d + 1);\n return 0;\n }\n }\n else break;\n }\n }\n while(d <= n){\n for(int i = 0; i <= d; i++){\n while(count[i] >= count[i + 1]){\n int j = 0;\n while(count[i] <= count[j]) j++;\n if(j > d) d = j;\n count[j]++, sum += count[i] - count[j], count[i]--;\n if(sum >= p){\n printf(\"%d\\n\", d + 1);\n return 0;\n }\n }\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "304f1b135321fff52fdba3cc27306e67", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "char s[105],n,m,k,ans[8],G,R,has,oG,oR;\n#define o(x) return puts((!x)?\"First\":\"Second\")*0\n#define F(i,a,b) for(int i=a;i<=b;++i)\nmain(){scanf(\"%d%d%d\",&n,&m,&k);F(i,1,n){has=G=R=0;scanf(\"%s\",s+1);F(j,1,m)if(s[j]=='-')has=1;else if(s[j]=='G')G=j;else if(s[j]=='R')R=j;if((!G&&!R)||!has)continue;if(!G)oR=1;else if(!R)oG=1;else F(j,0,7)if((1<\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i2) ok = 1;\n if(r+1==g || r-1==g); else cnt++;\n }\n\n if(ok==0){\n puts(\"Draw\");\n continue;\n }\n\n if(cnt % (k+1) == 0) puts(\"Second\");\n else puts(\"First\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6fe75c6ade00ad2c992d26e7e4312c8b", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0) ok_g = 1;\n if(r>=0) ok_r = 1;\n }\n continue;\n }\n if(r+1==g || r-1==g); else cnt++;\n }\n\n if(ok_g && ok_r){\n puts(\"Draw\"); continue;\n }\n if(ok_g){\n puts(\"First\"); continue;\n }\n if(ok_r){\n puts(\"Second\"); continue;\n }\n\n if(cnt % (k+1) == 0){\n puts(\"Second\");\n } else {\n puts(\"First\");\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "50cac32f9d0efb1c778cb5b1cd607ba7", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0) ok_g = 1;\n if(r>=0) ok_r = 1;\n }\n continue;\n }\n if(r+1==g || r-1==g); else cnt++;\n }\n\n if(ok_g && ok_r){\n puts(\"Draw\"); continue;\n }\n if(ok_r){\n puts(\"First\"); continue;\n }\n if(ok_g){\n puts(\"Second\"); continue;\n }\n\n if(cnt % (k+1) == 0){\n puts(\"Second\");\n } else {\n puts(\"First\");\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "714f1caaebccbca0410118dfe3348e63", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0) ok_g = 1;\n if(r>=0) ok_r = 1;\n }\n continue;\n }\n if(r+1==g || r-1==g); else cnt++;\n }\n\n if(ok_g && ok_r){\n puts(\"Draw\"); continue;\n }\n if(ok_g){\n puts(\"First\"); continue;\n }\n if(ok_r){\n puts(\"Second\"); continue;\n }\n\n if(cnt % (k+1) == 0){\n puts(\"Second\");\n } else {\n puts(\"First\");\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eb36f9bec31d0f2d0631fa3126ea7400", "src_uid": "69062f7c9b834e925ab23ebc2da96b52", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define Maxn 5007\n#define modp 998244353\nint p[Maxn][Maxn];\nint pre[Maxn];\nint a,b,c;\nint solve(int x,int y)\n{\n\tint res=0;\n\tfor (int k=0;k<=x&&k<=y;k++)\n\t{\n\t\tint del=pre[k];\n\t\tdel=(1LL*del*p[x][k])%modp;\n\t\tdel=(1LL*del*p[y][k])%modp;\n\t\tres=(res+del)%modp;\n\t}\n\treturn res;\n}\nint main()\n{\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tmemset(p,0,sizeof(p));\n\tp[0][0]=1;\n\tfor (int i=1;i<=5000;i++)\n\t{\n\t\tp[i][0]=1;\n\t\tfor (int j=1;j<=i;j++)\n\t\t\tp[i][j]=(p[i-1][j-1]+p[i-1][j])%modp;\n\t}\n\tmemset(pre,0,sizeof(pre));\n\tpre[0]=1;\n\tfor (int i=1;i<=5000;i++)\n\t\tpre[i]=(1LL*pre[i-1]*i)%modp;\n\tint ans=1;\n\tans=(1LL*ans*solve(a,b))%modp;\n\tans=(1LL*ans*solve(b,c))%modp;\n\tans=(1LL*ans*solve(a,c))%modp;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "666a1b2bcdd4ffe4d87241d52433f07a", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\n#define MOD % 998244353\n\nlong long C[5001][5001];\n\nvoid Set_Combination(int a, int b)\n{\n\tif (a == b || b == 0)\n\t{\n\t\tC[a][b] = 1;\n\t\treturn;\n\t}\n\tif (!C[a - 1][b])\n\t\tSet_Combination(a - 1, b);\n\tif (!C[a - 1][b - 1])\n\t\tSet_Combination(a - 1, b - 1);\n\tC[a][b] = (C[a - 1][b - 1] + C[a - 1][b]) MOD;\n}\n\nlong long Permutation(int a, int b)\n{\n\tint k;\n\tlong long r = 1;\n\tif (b == 0)\n\t\treturn 1;\n\tfor (k = a; k >= a - b + 1; k = k - 1)\n\t{\n\t\tr = (r * k)MOD;\n\t}\n\treturn r;\n}\n\nvoid Island(int a, int b, int * ans)\n{\n\tint i, j, small = (a >= b ? b : a);\n\tlong long temp = 0;\n\tfor (i = 0; i <= small;i = i + 1)\n\t{\n\t\ttemp = (temp + C[b][i] * Permutation(a, i)MOD) MOD;\n\t}\n\t*ans = (*ans * temp MOD);\n\treturn;\n}\n\nint main(void)\n{\n\tint a, b, c, ans = 1;\n\t\n\tfor (a = 0; a <= 5000; a = a + 1)\n\t{\n\t\tfor (b = 0; b <= a; b = b + 1)\n\t\t{\n\t\t\tSet_Combination(a, b);\n\t\t}\n\t}\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\tIsland(a, b, &ans);\n\tIsland(b, c, &ans);\n\tIsland(c, a, &ans);\n\tprintf(\"%d\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8f792760db63002b215423aba12637f7", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define Maxn 5007\n#define modp 998244353\nint p[Maxn][Maxn];\nint pre[Maxn];\nint a,b,c;\nint solve(int x,int y)\n{\n\tint res=0;\n\tfor (int k=0;k<=x&&k<=y;k++)\n\t{\n\t\tint del=pre[k];\n\t\tdel=(1LL*del*p[x][k])%modp;\n\t\tdel=(1LL*del*p[y][k])%modp;\n\t\tres=(res+del)%modp;\n\t}\n\treturn res;\n}\nint main()\n{\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tmemset(p,0,sizeof(p));\n\tp[0][0]=1;\n\tfor (int i=1;i<=5000;i++)\n\t{\n\t\tp[i][0]=1;\n\t\tfor (int j=1;j<=i;j++)\n\t\t\tp[i][j]=(p[i-1][j-1]+p[i-1][j])%modp;\n\t}\n\tmemset(pre,0,sizeof(pre));\n\tpre[0]=1;\n\tfor (int i=1;i<=5000;i++)\n\t\tpre[i]=(1LL*pre[i-1]*i)%modp;\n\tint ans=1;\n\tans=(1LL*ans*solve(a,b))%modp;\n\tans=(1LL*ans*solve(b,c))%modp;\n\tans=(1LL*ans*solve(a,c))%modp;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9e5d33b89ac79b6e0e0ee60d208b95d", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#define maxn 5010\n#define MOD 998244353\nlong long c[maxn][maxn];\nlong long calc(int a,int b){\n if(a>b){int t=b;b=a;a=t;}\n long long res=1,mul=1;\n int i;\n for(i=1;i<=a;i++){\n mul=mul*(b-i+1)%MOD;\n res=(res+c[a][i]*mul)%MOD;\n }\n return res;\n}\nint main(){\n int i,j;\n c[0][0]=1;\n for(i=1;i\nlong long dp[5001][5001],a,b,c;\nint main()\n{\n scanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n for(int i=0;i<=5000;i++) dp[i][0]=dp[0][i]=1;\n for(int i=1;i<=5000;i++)\n for(int j=1;j<=5000;j++)\n dp[i][j]=(dp[i-1][j]+(dp[i-1][j-1]*j)%998244353)%998244353;\n printf(\"%I64d\\n\",(dp[a][b]*dp[a][c])%998244353*dp[b][c]%998244353);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4c89204fbef843c1144ebff0f2619c7a", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n\nint main() {\n\tint n,m,k,i;\n\tscanf(\"%d %d %d\",&n,&m,&k);\n\tif (n%2==0) {\n\t\tputs(\"Marsel\");\n\t\treturn 0;\n\t}\n\tif (k==1) {\n\t\tputs(\"Timur\");\n\t\treturn 0;\n\t}\n\tfor(i=1;i*i<=m;i++) if (m%i==0 && m/i>=k) break;\n\tif (i*i>m) {\n\t\tputs(\"Marsel\");\n\t\treturn 0;\n\t}\n\tputs(\"Timur\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "903c9a503a8da119ef720954dd59a46d", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n int i=0,n=0,m=0,k=0,b=1,t=0,w=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n scanf(\"%d\",&k);\n\t\tif (m==1)\n\t\t\tprintf(\"Marsel\");\n for(i=2;i*i<=m;i++)\n\t\t{\n\t\t\tif (m%i==0)\n\t\t\t{\n\t\t\t\tif (m/i>=k)\n\t\t\t\t{\n\t\t\t\t\tt=1;\n\t\t\t\t\tw=1;\n\t\t\t\t\tbreak;}\n\t\t\t\telse t=0;\n\t\t\t}\n\t\t}\n\t\tif (t==0)\n\t\t{\n\t\t\tprintf(\"Marsel\");\n\t\t\treturn 0;}\n\n\t\tif (w==1 && n%2==0)\n\t\t\tprintf(\"Marsel\");\n\t\telse printf(\"Timur\");\n\n\n\n\nreturn 0;\n\n\t\t}", "lang_cluster": "C", "compilation_error": false, "code_uid": "71f20e402e5c035dce7b0c15b3632afa", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAX 100000\n\nint prime[10000];\nint c;\n\nint primes(int m){\n int i, j;\n c = 1;\n prime[1] = 2;\n\n for(i=3; i <= m; i+=2){\n for(j=1; j <= c; j++){\n if((i % prime[j]) == 0)\n break;\n }\n if(j > c)\n prime[++c] = i;\n }\n}\n\nint game(int m, int k){\n int i;\n \n for(i=1; i <= c; i++)\n if((m % prime[i]) == 0)\n if(m/prime[i] >= k)\n return 1;\n else\n return 0;\n}\n\n\nint main(){\n int n, m, k;\n int i;\n\n scanf(\"%d %d %d\", &n, &m, &k);\n\n if(!(n&1)){\n printf(\"Marsel\\n\");\n return 0;\n }\n \n primes(m);\n\n if(game(m, k))\n printf(\"Timur\\n\");\n else\n printf(\"Marsel\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "af70eb7ba3a4ec6e40a20be078c5014e", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tint m, n, k, i;\n\tscanf(\"%d %d %d\", &n, &m, &k);\n\tfor (i = 1; i*i < m; ++i) {\n\t\tif (m%i == 0) break;\n\t}\n\tif ((i <= k)&&(n%2 != 0)) printf(\"Timur\");\n\telse printf(\"Marsel\"); \n}\n\t \n", "lang_cluster": "C", "compilation_error": false, "code_uid": "192cd2de8ef067bf2a2203feb51ba2b1", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n int i=0,n=0,m=0,k=0,b=1,t=0,w=0;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n scanf(\"%d\",&k);\n for(i=1;i*i<=m;i++)\n { if (i!=1)\n\t\t{\n if (m%i==0)\n {\n if ((m/i)>=k)\n\t\t\t\t\t{w=1;\n break;\n\t\t\t\t\t\t\t\t}\n else w=0;\n\t\t\t\t\n\t\t\t\t}\n }\n\n\t\t}\n\n \n if (w==1) \n\t{\nif ((n%2)==0)\n\n printf(\"Marsel\");\n\n\n else printf(\"Timur\");\n\t}\n\telse{ printf(\"Marsel\");\n\t \n\n\t\t\t\treturn(0);}\n\t\n\n\nif (((i*i>m)||(m==1)) && k==1) {\nprintf(\"Marsel\");\nreturn 0; }\n\n\nif (((i*i>m)||(m==1)) && k!=1) {\nprintf(\"Timur\");\nreturn 0; }\n\n\n\t\t}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8003bc95a7a4656206ee38f62916b7e9", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint comp(const void * a,const void * b)\n{\n return (*(int*)a - *(int*)b);\n}\nint arr[200009],brr[200009],crr[200009];\nint main()\n{\n int n,k,m,i,j,l;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i=k && l>brr[i])\n l=brr[i];\n }\n printf(\"%d\",l);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6b9eeac427ed28808d1d9ff64be7db2f", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#define ll long long\nint comp(const void*p,const void*q)\n{\nreturn *(const int*)p-*(const int *)q;\t\n}\nint main(){\n\tll n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tll arr[n],count=0,x,y,flag=0,run=0,min=200000001;\n\tll num[n][20],cnt[200001]={0};\n\tfor(int i=0;i=0;z--){count=0;run=0;flag=0;\n\tif(cnt[z]>=k) {x=z;\n\t//printf(\"%lld,%lld\\n\",x,cnt[x]);\n\tfor(int i=0;i=k){flag=1;\n\t//printf(\"%lld,\",run); \n\tbreak;}\n\tbreak;\n\t}\n\t}if(flag==1) break;\n\t}if(count=(x)) {y=i;\n\tbreak;}\n\t}*/\n\t\n\n\nprintf(\"%lld\",min);\n\n\n\n\n\nreturn 0;}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9766d71cade731695b42ae00bc186e5", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MAX_N 200000\n#define MAX_A 200000\n\nint read_int() {\n int x;\n scanf(\"%d\", &x) > 0;\n return x;\n}\n\nint b[MAX_A+1]; // b[x] = how many of size x are in a\nint c[MAX_A+1];\nint d[MAX_A+1];\n\nint min(int a, int b) { return (a < b && a != -1) ? a : b; }\n\nint main() {\n int n = read_int(), k = read_int(), best = -1;\n for(int i = 0; i < n; i++) b[read_int()]++;\n for(int i = 0; i <= MAX_A; i++) c[i] = b[i];\n for(int e = 1; e < 20; e++) {\n for(int i = 0; i <= MAX_A; i++) {\n if(b[i] >= k && b[i]-c[i] < k) {\n best = min(best, d[i] - (e-1) * (b[i]-k));\n }\n c[i] = 0;\n if (i*2 <= MAX_A) c[i] += c[i*2], d[i] += c[i*2] * e;\n if (i*2+1 <= MAX_A) c[i] += c[i*2+1], d[i] += c[i*2+1] * e;\n b[i] += c[i];\n }\n }\n printf(\"%d\\n\", best);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ad5b95779d0f0f9d022b2a14291f937", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "/* Coached by rainboy */\n#include \n#include \n#include \n\n#define N 200000\n#define A 200000\n#define INF\t2147483647\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 int aa[N], ss[A + 1], kk[A + 1];\n\tint n, k, i, j, tmp, a, s, ans;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tsrand(time(NULL));\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tj = rand() % n;\n\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tqsort(aa, n, sizeof *aa, compare);\n\tfor (i = 0; i < n; i++) {\n\t\ta = aa[i];\n\t\ts = 0;\n\t\twhile (a > 0) {\n\t\t\tif (kk[a] < k) {\n\t\t\t\tkk[a]++;\n\t\t\t\tss[a] += s;\n\t\t\t}\n\t\t\ta /= 2;\n\t\t\ts++;\n\t\t}\n\t}\n\tans = INF;\n\tfor (a = 1; a <= A; a++)\n\t\tif (kk[a] == k && ans > ss[a])\n\t\t\tans = ss[a];\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b67ebd54d330faf0426bf6bd027b5ad5", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "/* Coached by rainboy */\n#include \n#include \n#include \n\n#define N 200000\n#define A 200000\n#define INF 0x3f3f3f3f\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 int aa[N], ss[A + 1], kk[A + 1];\n\tint n, k, i, j, tmp, a, s, ans;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tsrand(time(NULL));\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tj = rand() % n;\n\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tqsort(aa, n, sizeof *aa, compare);\n\tfor (i = 0; i < n; i++) {\n\t\ta = aa[i];\n\t\ts = 0;\n\t\twhile (a > 0) {\n\t\t\tif (kk[a] < k) {\n\t\t\t\tkk[a]++;\n\t\t\t\tss[a] += s;\n\t\t\t}\n\t\t\ta /= 2;\n\t\t\ts++;\n\t\t}\n\t}\n\tans = INF;\n\tfor (a = 1; a <= A; a++)\n\t\tif (kk[a] == k && ans > ss[a])\n\t\t\tans = ss[a];\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b92bf39b8dcb8d40444eb7c78fc4e7e", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nusing namespace std;\nint cmp(const void *a,const void *b)\n{\n return ( *(int*)b-*(int*)a);\n}\n\nint main()\n{\n int n,k,x,t[110],i,sum=0,j;\n scanf(\"%d%d%d\",&n,&k,&x);\n\n for (i=0;i\nint main(){\n\t//int a[101];\n\tint n,k,x;\n\tint sum=0;\n\tscanf(\"%d%d%d\",&n,&k,&x);\n\tfor(int i=0;i\nint main()int n,k,x,i,j,a,sum;\n scanf(\"%d%d%d\",&n,&k,&x);\n int number[n];\n for(i=0;i\n\n\t\n\t\n\t\t\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e8ce8e0f4d62f151687c15750fe22e28", "src_uid": "92a233f8d9c73d9f33e4e6116b7d0a96", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int n,k,x,i,j,a,sum;\n scanf(\"%d%d%d\",&n,&k,&x);\n int number[n];\n for(i=0;i\n#include \n\nint main()\n{\n long arr[3][3], sum[3]; int i, j, maxX, tmpMax = -1;\n for (i = 0; i < 3; i++){\n sum[i] = 0;\n for (j = 0; j < 3; j++){\n scanf(\"%ld\", &arr[i][j]);\n sum[i] += arr[i][j];\n }\n if (tmpMax == -1) {tmpMax = sum[i]; maxX = i;}\n else if (tmpMax < sum[i]) {tmpMax = sum[i]; maxX = i;}\n }\n arr[maxX][maxX] = 1;\n for (i = 0; i < 3; i++){\n if (i != maxX){\n arr[i][i] = sum[maxX] - sum[i] + 1;\n }\n printf(\"%ld %ld %ld\\n\", arr[i][0], arr[i][1], arr[i][2]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a9a07d41247e80947361b285663bb060", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include\n\nint readint(){\n\tchar temp;\n\tint num = 0;\n\n\ttemp = getc_unlocked(stdin);\n\twhile(temp >= '0' && temp <= '9'){\n\t\tnum = num * 10 + temp - '0';\n\t\ttemp = getc_unlocked(stdin);\n\t}\n\n\treturn num;\n}\n\nint main(){\n\tint a[3][3],i,j,sum = 0;\n\t\n\tfor(i=0;i < 3;i++)\n\t\tfor(j=0;j < 3;j++){\n\t\t\ta[i][j] = readint();\n\t\t\tsum = sum + a[i][j];\n\t\t}\n\t\n\ta[0][0] = (sum/2) - a[0][1] - a[0][2];\n\ta[1][1] = (sum/2) - a[1][0] - a[1][2];\n\ta[2][2] = (sum/2) - a[2][0] - a[2][1];\n\n\tfor(i=0;i < 3;i++){\n\t\tfor(j=0;j < 3;j++)\n\t\t\tprintf(\"%d \",a[i][j]);\n\t\tprintf(\"\\n\");\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "35d6654d3b28b71239118205d8a5fe0a", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#nclude\nint main()\n{\n int array[3][3],i,j,x,y,z;\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n scanf(\"%d\",&array[i][j]);\n y=((array[0][1]+array[0][2])+array[2][0]+array[2][1]-array[1][0]-array[1][2])/2;\n array[1][1]=y;\n x=array[1][0]+array[1][1]+array[1][2]-array[0][1]-array[0][2];\n z=array[1][0]+array[1][1]+array[1][2]-array[2][0]-array[2][1];\n array[0][0]=x;\n array[2][2]=z;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n printf(\"%d \",array[i][j]);\n printf(\"\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "2287f95dd95a0134de455f2d9fcbd5a5", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n int i, j, k, l, m, n, sum;\n int a[3][3];\n\n sum = 0;\n for(i = 0; i < 3; i++){\n for(j = 0; j < 3; j++){\n scanf(\"%d\", &a[i][j]);\n sum += a[i][j];\n }\n }\n\n a[1][1] = (a[0][1] + a[0][2] + a[2][0] + a[2][1] - a[1][0] - a[1][2]) / 2;\n a[2][2] = a[0][1] + a[0][2] - a[1][1];\n a[0][0] = (sum / 2) - a[1][1] - a[2][2];\n\n for(i = 0; i < 3; i++){\n for(j = 0; j < 3; j++){\n printf(\"%d \", a[i][j]);\n }\n printf(\"\\n\");\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "25d98f374bac0c9fdb165b03b8474b37", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n \nint main(void) {\n \n long int i,j;\n long int a[3][3];\n \n \n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n scanf(\"%d\",a[i][j]);\n \n \n \n for(i=0;i<=100000;i++)\n if(!((i+a[0][1]+a[0][2])-(a[1][0]+a[1][2]))-(a[2][0]+a[2][1]))\n break;\n \n \n a[0][0]=i;\n a[1][1]=((i+a[0][1]+a[0][2])-(a[1][0]+a[1][2]));\n a[2][2]=((i+a[0][1]+a[0][2])-(a[2][0]+a[2][1]));\n \n for(i=0;i<3;i++)\n printf(\"\\n\");\n for(j=0;j<3;j++)\n printf(\"%d \",a[i][j]);\n return 0;\n}\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "27485ce3d29da693438d85cd1bd2dd07", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint a[16] = {1, 0, 18, 0, 1800, 0, 670320, 0, 734832000, 0, 890786230, 0, 695720788, 0, 150347555, 0};\n\nint main()\n{\n int n;\n \n scanf(\"%d\", &n);\n \n printf(\"%d\\n\", a[n - 1]);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bf67d5582e941c07d8180366e8141f40", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MODULO 1000000007\n\nint ma[20][20];\nint b[20], col[20];\nint n;\n\nlong long sols[17] = {0,1,0,18,0,1800,0,670320,0,734832000,0,890786230,0,695720788,0,150347555,0};\n\nlong long dfs(int x, int k);\nlong long precalc();\n\nint main(){\n \n \t//precalc();\n\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%I64d\\n\", sols[n]);\n\n#ifdef _AT_HOME_\n system(\"pause\");\n#endif\n\n return 0;\n}\t\n\nlong long dfs(int x, int k){\n\tif (k>n){\n\t\treturn 1;\n\t}\n\tint i;\n\tint t = 0;\n\tfor (i=1;i<=n;i++){\n\t\tif (b[ma[k][i]] || col[i]) continue;\n\t\tb[ma[k][i]] = 1;\n\t\tcol[i] = 1;\n\t\tt +=dfs(i, k+1);\n\t\tb[ma[k][i]] = 0;\n\t\tcol[i] = 0;\n\t}\n\treturn t;\n}\n\nlong long precalc(){\n\tint tt;\n\tfor (tt=1;tt<16;tt+=2){\n\n\t\tint i,j;\n\t n = tt;\n\n\t for (i=1;i<=n;i++){\n\t \tfor (j=1;j<=n;j++){\n\t \t\tma[i][j] = (i-1+j-1) % n + 1;\n\t \t}\n\t }\n\n\t long long sol = 0;\n\t for (i=1;i<=1;i++){\n\t \tb[ma[1][i]] = 1;\n\t \tcol[i] = 1;\n\t \tsol += dfs(i, 2);\n\t \tif (sol>MODULO){\n\t \t\tsol -= MODULO;\n\t \t}\n\t \tb[ma[1][i]] = 0;\n\t \tcol[i] = 0;\n\t }\n\n\t sol *= n;\n\t sol %= MODULO;\n\n\t long long fak = 1;\n\t for (i=2;i<=n;i++){\n\t \tfak *= i;\n\t \tfak %= MODULO;\n\t }\n\n\t sol *= fak;\n\t sol %= MODULO;\n\n\t printf(\"%I64d\\n\", sol);\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "18004b0af4b5c1eda10aa69a93159ba8", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 14\n#define PAD 666667\n#define HMOD 15000017\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fact[20];\nunsigned int n, dp[HMOD + PAD], hashtable[HMOD + PAD];\n\nvoid insert(unsigned int x, int v){\n int i = ++x % HMOD;\n while (hashtable[i] && hashtable[i] != x) i++;\n hashtable[i] = x, dp[i] = v;\n}\n\nint find(unsigned int x){\n int i = ++x % HMOD;\n while (hashtable[i] && hashtable[i] != x) i++;\n return (hashtable[i] == x ? dp[i] : -1);\n}\n\nlong long F(int i, int mask, int lol){\n if (i == n) return 1;\n int j, k, h = (mask << 16) ^ lol, v = find(h);\n if (v != -1) return v;\n\n long long res = 0;\n for (j = 0; j < n; j++){\n if (!(mask & (1 << j))){\n k = i + j;\n if (k >= n) k -= n;\n if (!(lol & (1 << k))) res += F(i + 1, mask | (1 << j), lol | (1 << k));\n }\n }\n\n res %= MOD;\n insert(h, res);\n return res;\n}\n\nint main(){\n int i, j, k;\n for (fact[0] = 1, i = 1; i < 20; i++) fact[i] = (fact[i - 1] * i) % MOD;\n\n while (scanf(\"%d\", &n) != EOF){\n clr(hashtable);\n if (n & 1) printf(\"%lld\\n\", (fact[n] * F(0, 0, 0)) % MOD);\n else puts(\"0\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2b8580f5c5f37d047b17441f8a1b13c1", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint a[8]={1,3,15,133,2025,37851,1030367,36362925};\nint main()\n{\n int i,n;\n long long int f=1;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n printf(\"0\");\n return 0;\n }\n for(i=1;i<=n;i++)\n f=(f*i)%1000000007;\n f=(f*a[n/2])%1000000007;\n printf(\"%I64d\\n\",f);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "21c41779e56bdc7327922b6dfce910d6", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MODULO 1000000007\n\nint ma[20][20];\nint b[20], col[20];\nint n;\n\nlong long sols[17] = {0,1,0,18,0,1800,0,670320,0,734832000,0,890786230,0,695720788,0,150347555,0};\n\nlong long dfs(int x, int k);\nlong long precalc();\n\nint main(){\n \n \t//precalc();\n\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%I64\\n\", sols[n]);\n\n#ifdef _AT_HOME_\n system(\"pause\");\n#endif\n\n return 0;\n}\t\n\nlong long dfs(int x, int k){\n\tif (k>n){\n\t\treturn 1;\n\t}\n\tint i;\n\tint t = 0;\n\tfor (i=1;i<=n;i++){\n\t\tif (b[ma[k][i]] || col[i]) continue;\n\t\tb[ma[k][i]] = 1;\n\t\tcol[i] = 1;\n\t\tt +=dfs(i, k+1);\n\t\tb[ma[k][i]] = 0;\n\t\tcol[i] = 0;\n\t}\n\treturn t;\n}\n\nlong long precalc(){\n\tint tt;\n\tfor (tt=1;tt<16;tt+=2){\n\n\t\tint i,j;\n\t n = tt;\n\n\t for (i=1;i<=n;i++){\n\t \tfor (j=1;j<=n;j++){\n\t \t\tma[i][j] = (i-1+j-1) % n + 1;\n\t \t}\n\t }\n\n\t long long sol = 0;\n\t for (i=1;i<=1;i++){\n\t \tb[ma[1][i]] = 1;\n\t \tcol[i] = 1;\n\t \tsol += dfs(i, 2);\n\t \tif (sol>MODULO){\n\t \t\tsol -= MODULO;\n\t \t}\n\t \tb[ma[1][i]] = 0;\n\t \tcol[i] = 0;\n\t }\n\n\t sol *= n;\n\t sol %= MODULO;\n\n\t long long fak = 1;\n\t for (i=2;i<=n;i++){\n\t \tfak *= i;\n\t \tfak %= MODULO;\n\t }\n\n\t sol *= fak;\n\t sol %= MODULO;\n\n\t printf(\"%I64d\\n\", sol);\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3e030f3a9f721e3cb02175c2b292537", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define MAXN 55\n#define MAXK 105\n\nstruct datanode\n{\n\tlong long int a, b;\n\tint c, d, orig;\n};\n\nstruct node\n{\n\tchar b;\n\tint j, k;\n};\n\nvoid sort (struct datanode a[MAXN], int l, int r)\n{\n\tint i, j, x;\n\tstruct datanode y;\n\ti = l; j = r; x = a[(l+r)/2].c;\n\twhile (i <= j)\n\t{\n\t\twhile (a[i].c < x) i++;\n\t\twhile (a[j].c > x) j--;\n\t\tif (i <= j)\n\t\t{\n\t\t\ty = a[i]; a[i] = a[j]; a[j] = y;\n\t\t\ti++; j--;\n\t\t}\n\t}\n\tif (l < j) sort(a,l,j);\n\tif (i < r) sort(a,i,r);\n}\n\nint main ()\n{\n\tint N, M, K;\n\tscanf(\"%d %d %d\",&N,&M,&K);\n\tint i, j, j2, k;\n\tstatic struct datanode data[MAXN];\n\tfor (i = 0; i < M; i++)\n\t{\n\t\tscanf(\"%I64i %I64i %d\",&(data[i].a),&(data[i].b),&(data[i].c));\n\t\tdata[i].orig = i;\n\t\tdata[i].d = (int)(data[i].b - data[i].a);\n\t}\n\tsort(data,0,M-1);\n\tstatic struct node a[MAXN][MAXN][MAXK];\n\tmemset(a,0,sizeof(a));\n\tfor (j = 0; j < M; j++)\n\t{\n\t\tfor (k = 0; k <= data[j].d; k++)\n\t\t{\n\t\t\ta[0][j][k].b = 1;\n\t\t\ta[0][j][k].j = -1;\n\t\t\ta[0][j][k].k = -1;\n\t\t}\n\t}\n\tlong long int next;\n\tfor (i = 0; i < (N-1); i++)\n\t{\n\t\tfor (j = 0; j < M; j++)\n\t\t{\n\t\t\tfor (k = 0; k <= data[j].d; k++)\n\t\t\t{\n\t\t\t\tif (a[i][j][k].b)\n\t\t\t\t{\n\t\t\t\t\tfor (j2 = j+1; j2 < M; j2++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (data[j2].c > data[j].c)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//k + K\n\t\t\t\t\t\t\tnext = data[j].a + (long long int)(k) + (long long int)(K);\n\t\t\t\t\t\t\tif ((next >= data[j2].a) && (next <= data[j2].b))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta[i+1][j2][(int)(next - data[j2].a)].b = 1;\n\t\t\t\t\t\t\t\ta[i+1][j2][(int)(next - data[j2].a)].j = j;\n\t\t\t\t\t\t\t\ta[i+1][j2][(int)(next - data[j2].a)].k = k;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//k * K\n\t\t\t\t\t\t\tnext = (data[j].a + (long long int)(k)) * (long long int)(K);\n\t\t\t\t\t\t\tif ((next >= data[j2].a) && (next <= data[j2].b))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta[i+1][j2][(int)(next - data[j2].a)].b = 1;\n\t\t\t\t\t\t\t\ta[i+1][j2][(int)(next - data[j2].a)].j = j;\n\t\t\t\t\t\t\t\ta[i+1][j2][(int)(next - data[j2].a)].k = k;\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 (j = 0; j < M; j++)\n\t{\n\t\tfor (k = 0; k <= data[j].d; k++)\n\t\t{\n\t\t\tif (a[N-1][j][k].b)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\tstatic struct node r[MAXN];\n\t\t\t\tint rc = 1;\n\t\t\t\tr[0].j = j;\n\t\t\t\tr[0].k = k;\n\t\t\t\tfor (i = N-1; i > 0; i--)\n\t\t\t\t{\n\t\t\t\t\tr[rc].j = a[i][r[rc-1].j][r[rc-1].k].j;\n\t\t\t\t\tr[rc].k = a[i][r[rc-1].j][r[rc-1].k].k;\n\t\t\t\t\trc++;\n\t\t\t\t}\n\t\t\t\tfor (i = N-1; i >= 0; i--)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d %I64i\\n\",data[r[i].j].orig + 1,data[r[i].j].a + (long long int)(r[i].k));\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "be6956eaa57d0ce547eb2fa93eff80b6", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\n#define N\t100\n#define M\t50\n#define A\t100\n\nstruct V {\n\tlong long a, b;\n\tint c, j;\n} vv[M];\n\nint compare(const void *a, const void *b) {\n\tstruct V *u = (struct V *) a;\n\tstruct V *v = (struct V *) b;\n\n\treturn u->c - v->c;\n}\n\nint main() {\n\tstatic char dp[N][M][A + 1];\n\tstatic int jj[N];\n\tstatic long long aa[N];\n\tstruct V *u, *v;\n\tint n, m, k, i, j, j_, a;\n\tlong long a_, a1, a2;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tfor (j = 0; j < m; j++) {\n\t\tu = &vv[j];\n\t\tscanf(\"%lld%lld%d\", &u->a, &u->b, &u->c);\n\t\tu->j = j;\n\t}\n\tqsort(vv, m, sizeof *vv, compare);\n\tfor (j = 0; j < m; j++) {\n\t\tu = &vv[j];\n\t\tfor (a = 0; a <= u->b - u->a; a++)\n\t\t\tdp[0][j][a] = 1;\n\t}\n\tfor (i = 0; i < n - 1; i++)\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tu = &vv[j];\n\t\t\tfor (a = 0; a <= u->b - u->a; a++)\n\t\t\t\tif (dp[i][j][a]) {\n\t\t\t\t\ta1 = u->a + a + k, a2 = (u->a + a) * k;\n\t\t\t\t\tfor (j_ = j + 1; j_ < m; j_++) {\n\t\t\t\t\t\tv = &vv[j_];\n\t\t\t\t\t\tif (v->c > u->c) {\n\t\t\t\t\t\t\tif (v->a <= a1 && a1 <= v->b)\n\t\t\t\t\t\t\t\tdp[i + 1][j_][a1 - v->a] = 1;\n\t\t\t\t\t\t\tif (v->a <= a2 && a2 <= v->b)\n\t\t\t\t\t\t\t\tdp[i + 1][j_][a2 - v->a] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\tfor (j = 0; j < m; j++) {\n\t\tu = &vv[j];\n\t\tfor (a = 0; a <= u->b - u->a; a++)\n\t\t\tif (dp[n - 1][j][a]) {\n\t\t\t\tfor (i = n - 1; i >= 0; i--) {\n\t\t\t\t\tjj[i] = vv[j].j;\n\t\t\t\t\taa[i] = a_ = vv[j].a + a;\n\t\t\t\t\tif (i == 0)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tfor (j_ = j - 1; j_ >= 0; j_--) {\n\t\t\t\t\t\tv = &vv[j_];\n\t\t\t\t\t\tif (v->c < u->c) {\n\t\t\t\t\t\t\tif (v->a <= a_ - k && a_ - k <= v->b) {\n\t\t\t\t\t\t\t\ta = a_ - k - v->a;\n\t\t\t\t\t\t\t\tif (dp[i - 1][j_][a]) {\n\t\t\t\t\t\t\t\t\tj = j_;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (a_ % k == 0)\n\t\t\t\t\t\t\t\tif (v->a <= a_ / k && a_ / k <= v->b) {\n\t\t\t\t\t\t\t\t\ta = a_ / k - v->a;\n\t\t\t\t\t\t\t\t\tif (dp[i - 1][j_][a]) {\n\t\t\t\t\t\t\t\t\t\tj = j_;\n\t\t\t\t\t\t\t\t\t\tbreak;\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}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\tfor (i = 0; i < n; i++)\n\t\t\t\t\tprintf(\"%d %lld\\n\", jj[i] + 1, aa[i]);\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c5cf40282565a68db58d61f561815de4", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef long long ll;\n\ntypedef struct {\n ll a,b;\n int c;\n} t_t;\n\n/* n days, m subjects */\nint n,m,K;\nt_t emne[150];\n\n/* [i][j][k]: at beginning of day i (0-indexed), j is last course taken\n (1-indexed, 0=no course taken yet), k:last number of exercises=a_j+k */\nll dp[51][52][101];\nint dp1[51][52][101];\nint dp2[51][52][101];\n\nvoid solve() {\n int i,j,k,l,nextj,nextk;\n ll diff,nextd,cur,next;\n memset(dp,-1,sizeof(dp));\n memset(dp2,-1,sizeof(dp2));\n memset(dp2,-1,sizeof(dp2));\n dp[0][0][0]=0;\n dp1[0][0][0]=-1;\n dp2[0][0][0]=0;\n for(i=0;i-1) {\n cur=dp[i][j][k];\n /* pick next exercise */\n/* if(!j) printf(\"at day %d, no last course\\n\",i);\n else printf(\"at day %d, last course %d, last ex %I64d\\n\",i,j-1,k+emne[j-1].a);*/\n if(i==0 && j==0) {\n /* first day, can pick everything */\n for(nextj=0;nextjemne[j-1].c) {\n /* difficulty: add k */\n diff=k+emne[j-1].a;\n nextd=diff+K;\n next=cur+nextd;\n if(nextd>=emne[l].a && nextd<=emne[l].b && next>dp[i+1][l+1][(int)(nextd-emne[l].a)]) {\n dp[i+1][l+1][(int)(nextd-emne[l].a)]=next;\n dp1[i+1][l+1][(int)(nextd-emne[l].a)]=k;\n dp2[i+1][l+1][(int)(nextd-emne[l].a)]=j;\n/* printf(\" (add) can pick => %d %d %I64d\\n\",i+1,l,nextd);*/\n }\n /* difficulty: mul k */\n nextd=diff*K;\n next=cur+nextd;\n if(nextd>=emne[l].a && nextd<=emne[l].b && next>dp[i+1][l+1][(int)(nextd-emne[l].a)]) {\n dp[i+1][l+1][(int)(nextd-emne[l].a)]=next;\n dp1[i+1][l+1][(int)(nextd-emne[l].a)]=k;\n dp2[i+1][l+1][(int)(nextd-emne[l].a)]=j;\n/* printf(\" (mul) can pick => %d %d %I64d\\n\",i+1,l,nextd);*/\n }\n }\n }\n }\n}\n\nint fag[100];\nll ex[100];\n\n/* x: last course (1-indexed), y:last k-value */\nvoid timeplan(int x,int y) {\n int dag=n;\n int i,j;\n while(dag) {\n fag[dag-1]=x;\n ex[dag-1]=y+emne[x-1].a;\n i=dp2[dag][x][y];\n j=dp1[dag][x][y];\n dag--;\n x=i;\n y=j;\n }\n for(i=0;imaks) {\n maks=dp[n][i][j];\n besti=i;\n bestj=j;\n }\n if(besti<0) puts(\"NO\");\n else {\n puts(\"YES\");\n timeplan(besti,bestj);\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e6ebbcad969aeebe7ac0be1ddc856a16", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\ntypedef struct {\n long long a;\n long long b;\n int c;\n int i;\n} subjects;\n\nlong long dp[50][51][101][2];\n\nint cmp(const void *a, const void *b)\n{\n if (((subjects *)a)->c != ((subjects *)b)->c) {\n\t return ((subjects *)a)->c - ((subjects *)b)->c;\n }\n}\n\nint main()\n{\n int n, m, k, i, j, l, p, q;\n long long x = 0;\n subjects s[50];\n int a[50];\n long long b[50];\n\n scanf(\"%d %d %d\", &n, &m, &k);\n\n for (i = 0; i < m; i++) {\n\t scanf(\"%I64d %I64d %d\", &s[i].a, &s[i].b, &s[i].c);\n\n\t s[i].i = i;\n }\n\n qsort(s, m, sizeof(subjects), cmp);\n\n for (i = 0; i < m; i++) {\n\t for (j = 0; j <= n; j++) {\n\t for (l = 0; l <= 100; l++) {\n\t\t dp[i][j][l][0] = -1;\n\t }\n\t }\n }\n\n for (i = 0; i < m; i++) {\n\t for (j = 0; j <= s[i].b - s[i].a; j++) {\n\t dp[i][1][j][0] = s[i].a + j;\n\t }\n }\n\n for (i = 0; i < m; i++) {\n\t for (j = 1; j < n; j++) {\n\t for (l = 0; l <= s[i].b - s[i].a; l++) {\n\t\t if (dp[i][j][l][0] == -1) continue;\n\n\t\t for (p = i + 1; p < m; p++) {\n\t\t\t if (s[i].c == s[p].c) continue;\n\n\t\t\t if (l + s[i].a + k >= s[p].a && l + s[i].a + k <= s[p].b) {\n\t\t\t if (dp[p][j + 1][l + s[i].a + k - s[p].a][0] == -1 || dp[p][j + 1][l + s[i].a + k - s[p].a][0] < dp[i][j][l][0] + l + s[i].a + k) {\n\t\t\t\t dp[p][j + 1][l + s[i].a + k - s[p].a][0] = dp[i][j][l][0] + l + s[i].a + k;\n\t\t\t\t dp[p][j + 1][l + s[i].a + k - s[p].a][1] = i;\n\t\t\t\t dp[p][j + 1][l + s[i].a + k - s[p].a][2] = l;\n\t\t\t }\n\t\t\t }\n\n\t\t\t if ((l + s[i].a) * k >= s[p].a && (l + s[i].a) * k <= s[p].b) {\n\t\t\t if (dp[p][j + 1][(l + s[i].a) * k - s[p].a][0] = -1 || dp[p][j + 1][(l + s[i].a) * k - s[p].a][0] < dp[i][j][l][0] + (l + s[i].a) * k) {\n\t\t\t\t dp[p][j + 1][(l + s[i].a) * k - s[p].a][0] = dp[i][j][l][0] + (l + s[i].a) * k;\n\t\t\t\t dp[p][j + 1][(l + s[i].a) * k - s[p].a][1] = i;\n\t\t\t\t dp[p][j + 1][(l + s[i].a) * k - s[p].a][2] = l;\n\t\t\t }\n\t\t\t }\n\t\t }\n\t }\n\t }\n }\n\n for (i = 0; i < m; i++) {\n\t for (j = 0; j <= s[i].b - s[i].a; j++) {\n\t if (dp[i][n][j][0] > x) {\n\t\t x = dp[i][n][j][0];\n\t\t p = i;\n\t\t q = j;\n\t }\n\t }\n }\n\n if (x == 0) {\n\t puts(\"NO\");\n } else {\n\t puts(\"YES\");\n\n\t for (i = 0; i < n; i++) {\n\t int tmp = dp[p][n - i][q][2];\n\n\t a[n - i - 1] = s[p].i + 1;\n\t b[n - i - 1] = s[p].a + q;\n\n\t p = dp[p][n - i][q][1];\n\t q = tmp;\n\t }\n\n\t for (i = 0; i < n; i++) printf(\"%d %I64d\\n\", a[i], b[i]);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4095c329e61eca8f49f81e874c4816bc", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef long long ll;\n\ntypedef struct {\n ll a,b;\n int c;\n} t_t;\n\n/* n days, m subjects */\nint n,m,K;\nt_t emne[150];\n\n/* [i][j][k]: at beginning of day i (0-indexed), j is last course taken\n (1-indexed, 0=no course taken yet), k:last number of exercises=a_j+k */\n/* -1 state doesn't exist, otherwise dp1 is last k-value,\n dp2 is last course before that */\nint dp[51][52][101];\nint dp2[51][52][101];\n\nvoid solve() {\n int i,j,k,l,nextj,nextk;\n ll diff,nextd;\n memset(dp,-1,sizeof(dp));\n memset(dp2,-1,sizeof(dp2));\n dp[0][0][0]=999;\n for(i=0;i-1) {\n /* pick next exercise */\n/* if(!j) printf(\"at day %d, no last course\\n\",i);\n else printf(\"at day %d, last course %d, last ex %I64d\\n\",i,j-1,k+emne[j-1].a);*/\n if(i==0 && k==0) {\n /* first day, can pick everything */\n for(nextj=0;nextjemne[j-1].c) {\n /* difficulty: add k */\n diff=k+emne[j-1].a;\n nextd=diff+K;\n if(nextd>=emne[l].a && nextd<=emne[l].b) {\n dp[i+1][l+1][(int)(nextd-emne[l].a)]=k;\n dp2[i+1][l+1][(int)(nextd-emne[l].a)]=j;\n/* printf(\" (add) can pick => %d %d %I64d\\n\",i+1,l,nextd);*/\n }\n /* difficulty: mul k */\n if((double)nextd*K>1e16) continue;\n nextd=diff*K;\n if(nextd>=emne[l].a && nextd<=emne[l].b) {\n dp[i+1][l+1][(int)(nextd-emne[l].a)]=k;\n dp2[i+1][l+1][(int)(nextd-emne[l].a)]=j;\n/* printf(\" (mul) can pick => %d %d %I64d\\n\",i+1,l,nextd);*/\n }\n }\n }\n }\n}\n\nint fag[100];\nll ex[100];\n\n/* x: last course (1-indexed), y:last k-value */\nvoid timeplan(int x,int y) {\n int dag=n;\n int i,j;\n while(dag) {\n fag[dag-1]=x;\n ex[dag-1]=y+emne[x-1].a;\n i=dp2[dag][x][y];\n j=dp[dag][x][y];\n dag--;\n x=i;\n y=j;\n }\n for(i=0;i-1) {\n puts(\"YES\");\n timeplan(i,j);\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a1e36382913832959d0c0d9c8bca7d42", "src_uid": "c98fdad8e7ce09b8ac389108f72cecd9", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8f8ac48daa548b9abdd3a5719ca8d78e", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0} {"lang": "GNU C", "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\t// cout << arr[i] << \" \" ;\n\t\tint index = i ;\n\t\twhile(index <= n){\n\t\t\trmq[index] += arr[i] ;\n\t\t\tindex += (index & -index);\n\t\t}\n\t}\n\t//cout << endl ;\n}\n\nlong long query(long long rmq [] , int to){\n\tlong long ret = 0 ;\n\t// cout << \"to : \" << to << \" : \" ;\n\twhile(to > 0){\n\t\tret += rmq[to];\n\t\tret %= MOD ;\n\t\tto -= (to & -to);\n\t}\n\t//cout < \" << 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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cadf5b97afbe5873c2f2836c5053dc5f", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nint mem [5001][5001];\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\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, sum;\n\t\n\t/*\n\tfor (i = 1; i <= N; i++)\t{\n\t\tfor (j = 1; 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++)\t{\n\t\tmem[id][0] = 1;\n\t}\n\tmem[b][0] = 0;\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\tsum = 0;\n\t\t\twhile\t( x <= y )\t{\n\t\t\t\tsum += mem[x++][k - 1];\n\t\t\t\tif\t( sum >= MOD )\n\t\t\t\t\tsum -= MOD;\n\t\t\t}\n\t\t\t\n\t\t\tsum -= mem[b][k - 1];\n\t\t\tif\t( sum < 0 )\n\t\t\t\tsum = (sum + MOD);\n\t\t\t\n\t\t\tsum -= mem[id][k - 1];\n\t\t\t\n\t\t\tif\t( sum < 0 )\n\t\t\t\tsum = (sum + MOD);\n\t\t\t\n\t\t\tmem[id][k] = sum;\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, mem[i][j] );\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t*/\n\tprintf( \"%d\\n\", mem[a][K] );\n\t\n return 0;\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5c55169b22d5415a6a937f2498eafa59", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\nint mem [5001][5001];\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\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;\n\ti = j = 1;\n\t\n\tfor (i = 1; i <= N; i++)\t{\n\t\tfor (j = 1; j <= K; j++)\t{\n\t\t\tmem[i][j] = -1;\n\t\t}\n\t}\n\t\n\tprintf( \"%d\\n\", solve(a, K) );\n\t\n return 0;\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "89e434b5bfb02fb62224422f97a04c19", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#define MOD 1000000007\nint n,m,s;\nlong long f[5010][5010],g[5010][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[0][s] = 1;\n\tfor(i=s;i\n\nint cmp(long long a, long long b) {\n\treturn a == b ? 0 : a < b ? -1 : 1;\n}\n\nint main() {\n\tint n, i, j, zero;\n\tlong long k, l, r, cnt, a, a_;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tl = 1;\n\tr = 1LL << (n / 2 - 1);\n\tcnt = (l + r) * (r - l + 1);\n\tif (n % 2 == 1)\n\t\tcnt = cnt + (cnt - (r - l + 1));\n\tif (k >= cnt) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"0\");\n\ta = 0;\n\tfor (i = 1; i < n / 2; i++) {\n\t\tl = (1LL << (n / 2 - 1)) - a;\n\t\tr = l + ((1LL << (n / 2 - 1 - i)) - 1);\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (n % 2 == 1)\n\t\t\tcnt = cnt + (cnt - (r - l + 1));\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta |= 1LL << (n / 2 - 1 - i);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tzero = 1;\n\tif (n % 2 == 1) {\n\t\tl = r = (1LL << (n / 2 - 1)) - a;\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\tzero = 0;\n\t\t\tprintf(\"1\");\n\t\t} else {\n\t\t\tzero = 1;\n\t\t\tprintf(\"0\");\n\t\t}\n\t}\n\ta_ = 0;\n\tfor (i = (n + 1) / 2; i < n; i++) {\n\t\tint cmp1 = cmp(a_, a % (1LL << (i - (n - 1) / 2)));\n\t\tint cmp2 = cmp(a_ ^ ((1LL << (i - (n - 1) / 2)) - 1), a % (1LL << (i - (n - 1) / 2)));\n\n\t\tcnt = 0;\n\t\tfor (j = n - 2; j > i; j--)\n\t\t\tif ((a & 1LL << (j - i)) == 0)\n\t\t\t\tcnt += 1LL << (j - i - 1);\n\t\tcnt *= 2;\n\t\tif (cmp1 >= 0)\n\t\t\tcnt++;\n\t\tif (i < n - 1 && (cmp2 > 0 || (cmp2 == 0 && zero)))\n\t\t\tcnt++;\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta_ |= 1LL << (n - 1 - i);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "422f2460a502c32d95efbf62f2d89a30", "src_uid": "0a4a418dafaee71f1b31c928fc2ad24a", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\nint cmp(long long a, long long b) {\n\treturn a == b ? 0 : a < b ? -1 : 1;\n}\n\nint main() {\n\tint n, i, j, zero;\n\tlong long k, l, r, cnt, a, a_;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tl = 1;\n\tr = 1LL << (n / 2 - 1);\n\tcnt = (l + r) * (r - l + 1);\n\tif (n % 2 == 1)\n\t\tcnt = cnt + (cnt - (r - l + 1));\n\tif (k >= cnt) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"0\");\n\ta = 0;\n\tfor (i = 1; i < n / 2; i++) {\n\t\tl = (1LL << (n / 2 - 1)) - a;\n\t\tr = l + ((1LL << (n / 2 - 1 - i)) - 1);\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (n % 2 == 1)\n\t\t\tcnt = cnt + (cnt - (r - l + 1));\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta |= 1LL << (n / 2 - 1 - i);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tzero = 1;\n\tif (n % 2 == 1) {\n\t\tl = r = (1LL << (n / 2 - 1)) - a;\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\tzero = 0;\n\t\t\tprintf(\"1\");\n\t\t} else {\n\t\t\tzero = 1;\n\t\t\tprintf(\"0\");\n\t\t}\n\t}\n\ta_ = 0;\n\tfor (i = (n + 1) / 2; i < n; i++) {\n\t\tint cmp1 = cmp(a_, a % (1LL << (i - (n - 1) / 2)));\n\t\tint cmp2 = cmp(a_ ^ ((1LL << (i - (n - 1) / 2)) - 1), a % (1LL << (i - (n - 1) / 2)));\n\n\t\tcnt = 0;\n\t\tfor (j = n - 2; j > i; j--)\n\t\t\tif ((a & 1LL << (j - i)) == 0)\n\t\t\t\tcnt += 1LL << (j - i - 1);\n\t\tcnt *= 2;\n\t\tif (cmp1 > 0 || (cmp1 == 0 && zero))\n\t\t\tcnt++;\n\t\tif (i < n - 1 && (cmp2 > 0 || (cmp2 == 0 && zero)))\n\t\t\tcnt++;\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta_ |= 1LL << (n - 1 - i);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc337c67faae276a23c64b98cbcb5dcb", "src_uid": "0a4a418dafaee71f1b31c928fc2ad24a", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\nint cmp(long long a, long long b) {\n\treturn a == b ? 0 : a < b ? -1 : 1;\n}\n\nint main() {\n\tint n, i, j, zero;\n\tlong long k, l, r, cnt, a, a_;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tl = 1;\n\tr = 1LL << (n / 2 - 1);\n\tcnt = (l + r) * (r - l + 1);\n\tif (n % 2 == 1)\n\t\tcnt = cnt + (cnt - (r - l + 1));\n\tif (k >= cnt) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"0\");\n\ta = 0;\n\tfor (i = 1; i < n / 2; i++) {\n\t\tr = (1LL << (n / 2 - 1)) - a;\n\t\tl = r - ((1LL << (n / 2 - 1 - i)) - 1);\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (n % 2 == 1)\n\t\t\tcnt = cnt + (cnt - (r - l + 1));\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta |= 1LL << (n / 2 - 1 - i);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tzero = 1;\n\tif (n % 2 == 1) {\n\t\tl = r = (1LL << (n / 2 - 1)) - a;\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\tzero = 0;\n\t\t\tprintf(\"1\");\n\t\t} else {\n\t\t\tzero = 1;\n\t\t\tprintf(\"0\");\n\t\t}\n\t}\n\ta_ = 0;\n\tfor (i = (n + 1) / 2; i < n; i++) {\n\t\tint cmp1 = cmp(a_, a % (1LL << (i - (n - 1) / 2)));\n\t\tint cmp2 = cmp(a_ ^ ((1LL << (i - (n - 1) / 2)) - 1), a % (1LL << (i - (n - 1) / 2)));\n\n\t\tcnt = 0;\n\t\tfor (j = n - 2; j > i; j--)\n\t\t\tif ((a & 1LL << (j - i)) == 0)\n\t\t\t\tcnt += 1LL << (j - i - 1);\n\t\tcnt *= 2;\n\t\tif (cmp1 >= 0)\n\t\t\tcnt++;\n\t\tif (i < n - 1 && (cmp2 > 0 || (cmp2 == 0 && zero)))\n\t\t\tcnt++;\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta_ |= 1LL << (i - (n + 1) / 2);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "53ddd00204aff8d69419e33e201e1ccc", "src_uid": "0a4a418dafaee71f1b31c928fc2ad24a", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\nint cmp(long long a, long long b) {\n\treturn a == b ? 0 : a < b ? -1 : 1;\n}\n\nint main() {\n\tint n, i, j, zero;\n\tlong long k, l, r, cnt, a, a_;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tl = 1;\n\tr = 1LL << (n / 2 - 1);\n\tcnt = (l + r) * (r - l + 1);\n\tif (n % 2 == 1)\n\t\tcnt = cnt + (cnt - (r - l + 1));\n\tif (k >= cnt) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"0\");\n\ta = 0;\n\tfor (i = 1; i < n / 2; i++) {\n\t\tr = (1LL << (n / 2 - 1)) - a;\n\t\tl = r - ((1LL << (n / 2 - 1 - i)) - 1);\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (n % 2 == 1)\n\t\t\tcnt = cnt + (cnt - (r - l + 1));\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta |= 1LL << (n / 2 - 1 - i);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tzero = 1;\n\tif (n % 2 == 1) {\n\t\tl = r = (1LL << (n / 2 - 1)) - a;\n\t\tcnt = (l + r) * (r - l + 1);\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\tzero = 0;\n\t\t\tprintf(\"1\");\n\t\t} else {\n\t\t\tzero = 1;\n\t\t\tprintf(\"0\");\n\t\t}\n\t}\n\ta_ = 0;\n\tfor (i = (n + 1) / 2; i < n; i++) {\n\t\tint cmp1 = cmp(a_, a % (1LL << (i - (n - 1) / 2)));\n\t\tint cmp2 = cmp(a_ ^ ((1LL << (i - (n - 1) / 2)) - 1), a % (1LL << (i - (n - 1) / 2)));\n\n\t\tcnt = 0;\n\t\tfor (j = n - 2; j > i; j--)\n\t\t\tif ((a & 1LL << (n / 2 - 1 - (n - 1 - j))) == 0)\n\t\t\t\tcnt += 1LL << (j - i - 1);\n\t\tcnt *= 2;\n\t\tif (cmp1 >= 0)\n\t\t\tcnt++;\n\t\tif (i < n - 1 && (cmp2 > 0 || (cmp2 == 0 && zero)))\n\t\t\tcnt++;\n\t\tif (k >= cnt) {\n\t\t\tk -= cnt;\n\t\t\ta_ |= 1LL << (i - (n + 1) / 2);\n\t\t\tprintf(\"1\");\n\t\t} else\n\t\t\tprintf(\"0\");\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f713d72b408af6096824ca7486f2dc36", "src_uid": "0a4a418dafaee71f1b31c928fc2ad24a", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint n, m[17], r[17], max=0, dem=0;\n\tdouble ans;\n\tscanf(\"%d\",&n);\n\tfor (int i=1;i<=n;i++) \n\t{\n\t\tscanf(\"%d\",&m[i]);\n\t\tif (max\n\nint main()\n{\n long long int n,i,j;\n double res,c=0.0;\n scanf(\"%I64d\",&n);\n long long int a[n],b[n];\n for(i=0;i\n\nint main()\n{\n\tint n, m[17], r[17], dem=0;\n\tlong max=10000000;\n\tdouble ans;\n\tscanf(\"%d\",&n);\n\tfor (int i=1;i<=n;i++) scanf(\"%d\",&m[i]);\n\tfor (int i=1;i<=n;i++) scanf(\"%d\",&r[i]);\n\tif (n==1) ans=1/(double)max;\n\telse\n\t{\n\tfor (long i=1;i<=max;i++)\n\t{\n\t\tfor (long j=1;j<=n;j++)\n\t\t{\n\t\t\tif (i%m[j]==r[j])\n\t\t\t{\n\t\t\t\tdem++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tans=(double)dem/max;\n\t}\n\tprintf(\"%f\",ans);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "841091f706f9e54487e48cbab4d6d86f", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n\tint n, m[17], r[17],max=0,dem=0;\n\tbool kt=true;\n\tdouble ans;\n\tscanf(\"%d\",&n);\n\tfor (int i=1;i<=n;i++) \n\t{\n\t\tscanf(\"%d\",&m[i]);\n\t\tif (max\nint main()\n{\n\tint i, j, k, m, n, m[100], r[100];\n\tdouble s, d;\n\twhile (scanf(\"%d\", &n) == 1)\n\t{\n\t\tfor (i = 0; i < n; i++)\n\t\t{\n\t\t\tscanf(\"%d\", &m[i]);\n\t\t}\n\t\tfor (j = 0; j < n; j++)\n\t\t{\n\t\t\tscanf(\"%d\", &r[j]);\n\t\t}\n\t\ts = 0;\n\t\tfor (i = 1; i <= 1000; i++)\n\t\t{\n\t\t\tfor (j = 0; j < n; j++)\n\t\t\t{\n\t\t\t\tif ((i % m[j]) == r[j])\n\n\t\t\t\t{\n\t\t\t\t\ts++;\n\t\t\t\t\td = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (s == 0)\n\t\t{\n\t\t\tprintf(\"0.0000\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%0.5lf\\n\", s / d);\n\t\t}\n\t}\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a852a5818d71a61500a480d7b6cd3492", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n\r\ntypedef unsigned long long ll;\r\ntypedef unsigned int uint;\r\n\r\nint mod = 998244353;\r\n\r\nll pp[501][501];\r\n\r\nll qPow(uint a, uint b)\r\n{\r\n if (pp[a][b] > 0)\r\n {\r\n return pp[a][b];\r\n }\r\n ll ret = 1, aa = a;\r\n uint bb = b;\r\n while (bb)\r\n {\r\n if (bb & 1)\r\n ret = ret * aa % mod;\r\n aa = aa * aa % mod;\r\n bb >>= 1;\r\n }\r\n pp[a][b] = ret;\r\n return ret;\r\n}\r\n\r\nuint C[501][501];\r\nuint inited = 0;\r\nvoid init()\r\n{\r\n if (inited)\r\n return;\r\n inited = 1;\r\n memset(pp, 0, sizeof(pp));\r\n memset(C, 0, sizeof(C));\r\n for (uint i = 0; i <= 500; i++)\r\n {\r\n for (uint j = 0; j <= i; j++)\r\n {\r\n if (!j)\r\n C[i][j] = 1;\r\n else\r\n C[i][j] = C[i - 1][j] + C[i - 1][j - 1];\r\n if (C[i][j] >= mod)\r\n C[i][j] -= mod;\r\n }\r\n }\r\n}\r\nll f[501][501];\r\nint main()\r\n{\r\n uint n, x;\r\n scanf(\"%u %u\", &n, &x);\r\n init();\r\n memset(f, 0, sizeof(f));\r\n for (uint i = 2; i <= n; i++)\r\n {\r\n for (uint j = 1; j <= x; j++)\r\n {\r\n if (j < i)\r\n {\r\n f[i][j] = qPow(j, i);\r\n }\r\n else\r\n {\r\n f[i][j] = qPow(i - 1, i);\r\n for (uint k = 2; k <= i; k++)\r\n {\r\n f[i][j] = (f[i][j] + C[i][k] * qPow(i - 1, i - k) % mod * f[k][j - i + 1]) % mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n printf(\"%llu\", f[n][x]);\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "86acf7ad66da5dc2e9cefdd6ca244113", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n \r\ntypedef long long ll;\r\n \r\nint mod = 998244353;\r\n \r\nll qPow(ll a, ll b) {\r\n\tll ret = 1;\r\n\twhile(b) {\r\n\t\tif(b&1)\r\n\t\t\tret = ret * a % mod;\r\n\t\ta = a * a % mod;\r\n\t\tb >>= 1;\r\n\t}\r\n\treturn ret;\r\n}\r\n \r\n \r\nint main() {\r\n int n, x;\r\n scanf(\"%d %d\", &n, &x);\r\n\tint C[n+1][n+1];\r\n\tmemset(C,0,sizeof(C));\r\n\tfor(int i=0;i<=n;i++){\r\n\t\tfor(int j=0;j<=i;j++) {\r\n\t\t\tif(!j)\r\n\t\t\t\tC[i][j] = 1;\r\n\t\t\telse\r\n\t\t\t\tC[i][j] = C[i-1][j] + C[i-1][j-1];\r\n\t\t\t\tif(C[i][j] >= mod)\r\n\t\t\t\t C[i][j] -= mod;\r\n\t\t\t\t \r\n\t\t}\r\n\t}\r\n\tll f[n+1][x+1];\r\n\tmemset(f,0,sizeof(f));\r\n\tfor(int i=2;i<=n;i++){\r\n\t\tfor(int j=1;j<=x;j++) {\r\n\t\t\tif(j\r\n#include \r\n\r\ntypedef unsigned long long ull;\r\ntypedef unsigned int uint;\r\n\r\nuint mod = 998244353;\r\n\r\null qPow[501][501];\r\nuint C[501][501];\r\nuint f[501][501];\r\nint main()\r\n{\r\n uint n, x;\r\n scanf(\"%u %u\", &n, &x);\r\n memset(qPow, 0, sizeof(qPow));\r\n for (uint i = 1; i <= x; i++)\r\n {\r\n qPow[i][0] = 1;\r\n for (uint j = 1; j <= n; j++)\r\n {\r\n qPow[i][j] = qPow[i][j - 1] * i % mod;\r\n }\r\n }\r\n memset(C, 0, sizeof(C));\r\n for (uint i = 0; i <= n; i++)\r\n {\r\n for (uint j = 0; j <= i; j++)\r\n {\r\n if (!j)\r\n C[i][j] = 1;\r\n else\r\n C[i][j] = C[i - 1][j] + C[i - 1][j - 1];\r\n if (C[i][j] >= mod)\r\n C[i][j] -= mod;\r\n }\r\n }\r\n memset(f, 0, sizeof(f));\r\n for (uint i = 2; i <= n; i++)\r\n {\r\n for (uint j = 1; j <= x; j++)\r\n {\r\n if (j < i)\r\n {\r\n f[i][j] = qPow[j][i];\r\n }\r\n else\r\n {\r\n f[i][j] = qPow[i - 1][i];\r\n for (uint k = 2; k <= i; k++)\r\n {\r\n\r\n f[i][j] = (f[i][j] + C[i][k] * qPow[i - 1][i - k] % mod * f[k][j - i + 1]) % mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n printf(\"%llu\", f[n][x]);\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "696e4b6eadac22b42e75bd92e7fafe59", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\ntypedef long long ll;\r\n\r\nint mod = 998244353;\r\n\r\nll qPow(ll a, ll b) {\r\n\tll ret = 1;\r\n\twhile(b) {\r\n\t\tif(b&1)\r\n\t\t\tret = ret * a % mod;\r\n\t\ta = a * a % mod;\r\n\t\tb >>= 1;\r\n\t}\r\n\treturn ret;\r\n}\r\n\r\n\r\nint main() {\r\n int n, x;\r\n scanf(\"%d %d\", &n, &x);\r\n\tll C[n+1][n+1];\r\n\tfor(int i=0;i<=n;i++){\r\n\t\tfor(int j=0;j<=i;j++) {\r\n\t\t\tif(!j)\r\n\t\t\t\tC[i][j] = 1;\r\n\t\t\telse\r\n\t\t\t\tC[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod;\r\n\t\t}\r\n\t}\r\n\tll f[n+1][x+1];\r\n\tfor(int i=2;i<=n;i++){\r\n\t\tfor(int j=1;j<=x;j++) {\r\n\t\t\tif(j\r\n#include \r\n\r\ntypedef unsigned long long ll;\r\ntypedef unsigned int uint;\r\n\r\nint mod = 998244353;\r\n\r\nuint pp[501][501];\r\n\r\nll qPow(uint a, uint b)\r\n{\r\n if (pp[a][b] > 0)\r\n {\r\n return pp[a][b];\r\n }\r\n ll ret = 1, aa = a;\r\n while (b)\r\n {\r\n if (b & 1)\r\n ret = ret * aa % mod;\r\n aa = aa * aa % mod;\r\n b >>= 1;\r\n }\r\n pp[a][b] = ret;\r\n return ret;\r\n}\r\n\r\nuint C[501][501];\r\nuint inited = 0;\r\nvoid init()\r\n{\r\n if (inited)\r\n return;\r\n inited = 1;\r\n memset(pp, 0, sizeof(pp));\r\n memset(C, 0, sizeof(C));\r\n for (uint i = 0; i <= 500; i++)\r\n {\r\n for (uint j = 0; j <= i; j++)\r\n {\r\n if (!j)\r\n C[i][j] = 1;\r\n else\r\n C[i][j] = C[i - 1][j] + C[i - 1][j - 1];\r\n if (C[i][j] >= mod)\r\n C[i][j] -= mod;\r\n }\r\n }\r\n}\r\nll f[501][501];\r\nint main()\r\n{\r\n uint n, x;\r\n scanf(\"%u %u\", &n, &x);\r\n init();\r\n memset(f, 0, sizeof(f));\r\n for (uint i = 2; i <= n; i++)\r\n {\r\n for (uint j = 1; j <= x; j++)\r\n {\r\n if (j < i)\r\n {\r\n f[i][j] = qPow(j, i);\r\n }\r\n else\r\n {\r\n f[i][j] = qPow(i - 1, i);\r\n for (uint k = 2; k <= i; k++)\r\n {\r\n f[i][j] = (f[i][j] + C[i][k] * qPow(i - 1, i - k) % mod * f[k][j - i + 1] % mod) % mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n printf(\"%llu\", f[n][x]);\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2f18fc5dbb6c80235e0fe140cb480426", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define and &&\n\nint main()\n{\n char a[100],b[100];\n scanf(\"%s %s\",a,b);\n int diff=0;\n for(int i=0;i0)\n printf(\"TEAM 1 WINS\\n\");\n else if(diff==0)\n printf(\"TIE\\n\");\n else\n printf(\"TEAM 2 WINS\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "823df187c623b87ae3324a4118be9b9a", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tdouble a,b;\n\tsacnf(\"%f\",&a);\n\tscanf(\"%f\",&b);\n\tprintf(\".0%f\",a+b);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "58c59d32dfaacf9712131fbbc99c0448", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "\nint main(){\n\tint i;\n\tint w1 = 0, w2 = 0;\n\tchar buf1[21];\n\tchar buf2[21];\n\tscanf(\"%s\", buf1);\n\tscanf(\"%s\", buf2);\n\tfor(i = 0; buf1[i]; i+=2){\n\t\tif(buf1[i] == buf2[i])\n\t\t\tcontinue;\n\t\tif(buf1[i] > buf2[i]){\n\t\t\tif(buf1[i] - buf2[i] > 50)\n\t\t\t\tw1++;\n\t\t\telse\n\t\t\t\tw2++;\n\t\t} else {\n\t\t\tif(buf2[i] - buf1[i] > 50)\n\t\t\t\tw2++;\n\t\t\telse\n\t\t\t\tw1++;\n\t\t}\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e63797db23fed7b97497e1c40afc730d", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n \nint main() { \n char a[21], b[21]; \n scanf(\"%s%s\", a, b); \n int cnt1 = 0, cnt2 = 0; \n int len = strlen(a); \n for (int i = 0; i < len; i+=2) { \n if (a[i] == '8') { \n if (b[i] == '[') { \n cnt1++; \n } else if (b[i] == '(') { \n cnt2++; \n } \n } else if (a[i] == '[') { \n if (b[i] == '(') { \n cnt1++; \n } else if (b[i] == '8') { \n cnt2++; \n } \n } else if (a[i] == '('){ \n if (b[i] == '8') { \n cnt1++; \n } else if(b[i] == '[') { \n cnt2++; \n } \n } \n } \n if (cnt1 > cnt2) { \n printf(\"TEAM 1 WINS\\n\"); \n } else if(cnt1 < cnt2) { \n printf(\"TEAM 2 WINS\\n\"); \n } else { \n printf(\"TIE\\n\"); \n } \n return 0; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "5f26fac6c95442a399591c252fca3412", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n \nint main() { \n char a[21], b[21]; \n scanf(\"%s%s\", a, b); \n int cnt1 = 0, cnt2 = 0; \n int len = strlen(a); \n for (int i = 0; i < len; i+=2) { \n if (a[i] == '8') { \n if (b[i] == '[') { \n cnt1++; \n } else if (b[i] == '(') { \n cnt2++; \n } \n } else if (a[i] == '[') { \n if (b[i] == '(') { \n cnt1++; \n } else if (b[i] == '8') { \n cnt2++; \n } \n } else if (a[i] == '('){ \n if (b[i] == '8') { \n cnt1++; \n } else if(b[i] == '[') { \n cnt2++; \n } \n } \n } \n if (cnt1 > cnt2) { \n printf(\"TEAM 1 WINS\\n\"); \n } else if(cnt1 < cnt2) { \n printf(\"TEAM 2 WINS\\n\"); \n } else { \n printf(\"TIE\\n\"); \n } \n return 0; \n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "e8ee1aae16756f42c84b0f0a10817ef5", "src_uid": "bdf2e78c47d078b4ba61741b6fbb23cf", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nlong long p[9000000];\nvoid main(){\nlong long n,k,i;\nscanf(\"%lld %lld\",&n,&k);\n\nif((n==1&&k==2){\n\tprintf(\"YES\\n\");\nexit(0);}\n\nif(k>n){\nprintf(\"NO\\n\");\nexit(0);}\n\n\n\nfor(i=1;i<=k;i++){\np[n%i]++;\nif(p[n%i]>1){\nprintf(\"NO\\n\");\nexit(0);}}\n\nprintf(\"YES\\n\");\nexit(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "a4565e09d92a72be72cad06cf1bf2441", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n long long int n,k;\n int i,c=0,j,a[101];\n scanf(\"%lld%lld\",&n,&k);\n if(k<=100)\n {\n for(i=1;i<=k;i++)\n {\n a[i]=n%i;\n for(j=1;j\nint main()\n{\n long long int n,k,count=0;\n scanf(\"%lld %lld\",&n,&k);\n long long int i,m=-1;\n for(i=1;i<=k;i++)\n {\n if(m\n#define ll long long\nint main()\n{\n\tll n,k;\n\tscanf(\"%lld %lld\", &n,&k);\n\tfor(int i=1;i<=k;i++)\n\t\tfor(int j=i+1;j<=k;j++){\n\t\t\tif(n%i==n%j){\n\t\t\t\tprintf(\"No\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"Yes\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "662d3c3f0619e64485741187c5e91265", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#define ll long long\nint main()\n{\n\tll n,k;\n\tscanf(\"%lld %lld\", &n,&k);\n\tif(n%2==0&&k>=4){\n\t\tprintf(\"No\");\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=k;i++)\n\t\tfor(int j=i+1;j<=k;j++){\n\t\t\tif(n%i==n%j){\n\t\t\t\tprintf(\"No\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"Yes\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "34481ef28713ef3c4d31ff88e64da597", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tchar s[n+1];\n\tscanf(\"%s\",s);\n\tint count=0;\n\tint a[26],b[26];\n\tfor(int i=0;i<26;i=i+1){\n\t\ta[i]=10000000;\n\t\tb[i]=10000000;\n\t}\n\tfor(int i=0;ik){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tcount1-=1;\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8bc10a27606608de439411493db5615c", "src_uid": "216323563f5b2dd63edc30cb9b4849a5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#define mod 1000000007\n#define N 100000\nint main(){\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k); getchar();\n char s[n+1];int a[26]={0},g[26]={0};\n gets(s);\n long long int i;\n for(i=0;i\n#define mod 1000000007\n#define N 100000\nint main(){\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k); getchar();\n char s[n+1];int a[26]={0},g[26]={0};\n //gets(s);\n long long int i;\n for(i=0;i\n#include\n\nint main(){\n int n, k, c_time[26], i, flag[26], unguarded, count;\n char s[1000005];\n memset(flag, 0, sizeof(flag));\n memset(c_time, 0, sizeof(c_time));\n scanf(\"%d %d\\n%s\", &n, &k, s);\n if(k == 26){\n printf(\"YES\\n\");\n } else {\n for (i = 0; i < n; i++){\n if (i > c_time[s[i] - 'A']){\n c_time[s[i] - 'A'] = i;\n }\n }\n for (i = unguarded = count = 0; i < n && !unguarded; i++){\n if (!flag[s[i] - 'A']){\n count++;\n flag[s[i] - 'A'] = 1;\n }\n unguarded = (count > k);\n count = (c_time[s[i] - 'A'] == i) ? count - 1 : count;\n }\n printf(\"%s\\n\", unguarded ? \"YES\" : \"NO\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "bcacf8143990f9d4a458897f2d87809b", "src_uid": "216323563f5b2dd63edc30cb9b4849a5", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n#define mod 1000000007\n#define N 100000\nchar s[100005];\nint main(){\n long long int n,k;\n scanf(\"%lld %lld %s\",&n,&k,s);\n int a[26]={0},g[26]={0};\n long long int i;\n for(i=0;i\n#define REP(i,a,b) for(i=a;iEPS) return 1; if(a<-EPS) return -1; return 0;}\nint ab(int a){if(a<0)return -a; return a;}\nint GCD(int a,int b){int r; while(a){r=b; b=a; a=r%a;} return b;}\n\nint main(){\n int a,b,A,B,k;\n double c, C;\n\n scanf(\"%d%d%lf%d%d%lf\",&a,&b,&c,&A,&B,&C);\n if(a<0 || (!a&&b<0)) a=-a, b=-b, c=-c;\n if(A<0 || (!A&&B<0)) A=-A, B=-B, C=-C;\n if(a||b) k=GCD(a,ab(b)), a/=k, b/=k, c/=k;\n if(A||B) k=GCD(A,ab(B)), A/=k, B/=k, C/=k;\n\n if( (!a&&!b&&sign(c) || (!A&&!B&&sign(C))) ) puts(\"0\");\n else if( (!a&&!b&&!sign(c)) || (!A&&!B&&!sign(C)) )puts(\"-1\");\n else if(a==A && b==B && sign(c-C)==0 ) puts(\"-1\");\n else if(a==A && b==B) puts(\"0\");\n else puts(\"1\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6830a2d6ef388da0b3a7933e0a4b416", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a1,a2,b1,b2,c1,c2;\n scanf(\"%d%d%d%d%d%d\",&a1,&b1,&c1,&a2,&b2,&c2);\n if((a1==0 && b1==0 && c1==0))\n {\n if(a2==0 && b2==0 && c2!=0)\n printf(\"0\");\n else\n printf(\"-1\");\n }\n else if((a2==0 && b2==0 && c2==0))\n {\n if(a1==0 && b1==0 && c1!=0)\n printf(\"0\");\n else\n printf(\"-1\");\n }\n else if((a1==0 && b1==0 ) || (a2==0 && b2==0 ))\n printf(\"0\");\n else if(a1==0 && a2==0)\n {\n if(c1==0 && c2 ==0)\n printf(\"-1\");\n else if(c1==0 || c2==0)\n printf(\"0\");\n else if(b1*c2==b2*c1)\n printf(\"-1\");\n else\n printf(\"0\");\n }\n else if(a1==0 || a2==0)\n {\n printf(\"1\");\n }\n else if(b1==0 && b2==0)\n {\n if(c1==0 && c2 ==0)\n printf(\"-1\");\n else if(c1==0 || c2==0)\n printf(\"0\");\n else if(a1*c2==a2*c1)\n printf(\"-1\");\n else\n printf(\"0\");\n }\n else if(b1==0 || b2 ==0)\n {\n printf(\"1\");\n }\n else if(a1*b2==a2*b1 && b1*c2==b2*c1)\n printf(\"-1\");\n else if(a1*b2==b1*a2)\n printf(\"0\");\n else\n printf(\"1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f10fdb82977681031f16240109f4c326", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nvolatile int Que[32];\nint sea(int l);\nint main(){\n int n,m,s,k,l,nx,ny,c=(int)'a';\n char x,y;\n volatile int Donde[30][200001];\n volatile char cad[200001];\n volatile char *abc=\"abcdefghijklmnopqrstuvwxyz\";\n for(s=0;s<30;s++){\n Que[s]=s;\n }\n memset(Donde,-1,sizeof(Donde));\n scanf(\"%d %d\",&n,&m);\n scanf(\"%s\",cad);\n for(s=0;cad[s]!='\\0';s++){\n k=(int)cad[s] - c;\n Donde[k][0]++;\n Donde[k][Donde[k][0]+1]=s;\n }\n l=s;\n for(s=0;s\nint main (){\n int a1,b1,c1,a2,b2,c2,r=-1;\n scanf(\"%d %d %d\\n%d %d %d\",&a1,&b1,&c1,&a2,&b2,&c2);\n if(b1 && b2){\n if(a1/b1==a2/b2 && a1/b1!=c1/){\n r=0;\n }else{\n r=1;\n } \n }else if((b1==0 && b2!=0) || (b1!=0 && b2==0)){\n r=1;\n }\n printf(\"%d\",r);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "51bff639dfa93974a29a9d1ef6e3bf81", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int a1,a2,b1,b2,c1,c2;\n scanf(\"%d%d%d%d%d%d\",&a1,&b1,&c1,&a2,&b2,&c2);\n if((a1==0 && b1==0 && c1==0) || (a2==0 && b2==0 && c2==0))\n printf(\"-1\");\n else if((a1==0 && b1==0 &&) || (a2==0 && b2==0 ))\n printf(\"0\");\n else if(a1==0 && a2==0)\n {\n if(c1==0 && c2 ==0)\n printf(\"-1\");\n else if(c1==0 || c2==0)\n printf(\"0\");\n else if(b1*c2==b2*c1)\n printf(\"-1\");\n else\n printf(\"0\");\n }\n else if(a1==0 || a2==0)\n {\n printf(\"1\");\n }\n else if(b1==0 && b2==0)\n {\n if(c1==0 && c2 ==0)\n printf(\"-1\");\n else if(c1==0 || c2==0)\n printf(\"0\");\n else if(a1*c2==a2*c1)\n printf(\"-1\");\n else\n printf(\"0\");\n }\n else if(b1==0 || b2 ==0)\n {\n printf(\"1\");\n }\n else if(a1*b2==a2*b1 && b1*c2==b2*c1)\n printf(\"-1\");\n else if(a1*b2==b1*a2)\n printf(\"0\");\n else\n printf(\"1\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "a628ba7c79e8429dd4b49394ae7072e6", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0;now--){\n rep(i,M) nx1[i]=nx2[i]=0;\n\n rep(i,M) if(dp2[i]) rep(k,us) nx2[nex[i][k]] += dp2[i];\n \n rep(i,M) if(dp1[i]) rep(k,us){\n if(go[now]==use[k]) nx1[nex[i][k]] += dp1[i];\n if(go[now]> use[k]) nx2[nex[i][k]] += dp1[i];\n }\n\n swap=dp1, dp1=nx1, nx1=swap;\n swap=dp2, dp2=nx2, nx2=swap;\n }\n\n rep(i,M) dp[mask][i] = dp1[i] + dp2[i];\n }\n\n res = 0;\n rep(mask,1<<8){\n g=1;\n rep(i,8) if(mask&1<\n#include \n#include \n#define MOD 2520\nint a[30],index[MOD+10];\n__int64 dps[23][2550][50];\n\nvoid init(){\n int i,k=1;\n for(i=1;i<=MOD;i++){\n if(MOD%i==0)\n index[i]=k++;\n }\n k--;\n}\nint gcd(int a , int b)\n{\n return b == 0 ? a : gcd(b , a % b);\n}\n\nint lcm(int a, int b)\n{\n return a / gcd(a,b) * b;\n}\n__int64 dp(int pos,int sum,int mod,int doing){\n int i,tem,max,nowsum,nowmod;\n __int64 result=0;\n if(pos==0){\n return sum%mod==0;\n }\n if(doing==0 && dps[pos][sum][index[mod]]!=-1)\n return dps[pos][sum][index[mod]];\n\n if(doing)\n max=a[pos];\n else\n max=9;\n\n for(i=0;i<=max;i++){\n nowsum=0;\n nowsum=(sum*10+i)%MOD;\n nowmod=0;\n nowmod=mod;\n if(i)\n nowmod=lcm(mod,i);\n if(doing && i==max){\n result+=dp(pos-1,nowsum,nowmod,1);\n }\n else{\n result+=dp(pos-1,nowsum,nowmod,0);\n }\n\n }\n if(!doing){\n dps[pos][sum][index[mod]]=result;\n }\n return result;\n}\n__int64 cal(__int64 num){\n __int64 tem;\n int i;\n tem=num;\n i=1;\n while(tem){\n a[i++]=tem%10;\n tem/=10;\n }\n return dp(i-1,0,1,1);\n}\nint main()\n{\n int t,T;\n __int64 l,r,i,j,k;\n scanf(\"%d\",&T);\n init();\n for(t=1;t<=T;t++){\n //memset(dps,-1,sizeof(dps));//\u8fd9\u91cc\u9519\u4e86\n scanf(\"%I64d %I64d\",&l,&r);\n printf(\"%I64d\\n\",cal(r)-cal(l-1));\n }\n return 0;\n \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bbcea5efe4c73669c609612a8326c63b", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0;now--){\n rep(i,M) nx1[i]=nx2[i]=0;\n\n rep(i,M) if(dp2[i]) rep(k,us) nx2[nex[i][k]] += dp2[i];\n \n rep(i,M) if(dp1[i]) rep(k,us){\n if(go[now]==use[k]) nx1[nex[i][k]] += dp1[i];\n if(go[now]> use[k]) nx2[nex[i][k]] += dp1[i];\n }\n\n swap=dp1, dp1=nx1, nx1=swap;\n swap=dp2, dp2=nx2, nx2=swap;\n }\n\n rep(i,M) dp[mask][i] = dp1[i] + dp2[i];\n }\n\n res = 0;\n rep(mask,1<<8){\n g=1;\n rep(i,8) if(mask&1<\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0;now--){\n rep(i,M) nx1[i]=nx2[i]=0;\n\n rep(i,M) if(dp2[i]) rep(k,us) nx2[nex[i][k]] += dp2[i];\n \n rep(i,M) if(dp1[i]) rep(k,us){\n if(go[now]==use[k]) nx1[nex[i][k]] += dp1[i];\n if(go[now]> use[k]) nx2[nex[i][k]] += dp1[i];\n }\n\n swap=dp1, dp1=nx1, nx1=swap;\n swap=dp2, dp2=nx2, nx2=swap;\n }\n\n rep(i,M) dp[mask][i] = dp1[i] + dp2[i];\n }\n\n res = 0;\n rep(mask,1<<8){\n g=1;\n rep(i,8) if(mask&1<\n#include\n\n#define maxim 100\n#define LLD long long int\n#define LLU long long unsigned \n//#define llu I64u\n\n#define rep(i,init,n) for(i=init;in;i--)\n\nchar a[20];\nchar b[20];\n\nLLU dp[20][2520][256+5][4];\nchar isV[20][2520][256+5][4] = {{{{0}}}};\nLLU M = 2520;\n\nLLU cal(int i, int mod, int Bit, int s)\n{\n int j;\n \n if(i == 20)\n {\n rep(j,2,10)\n {\n if( ( Bit & (1<<(j-2)) ) && mod%j ) return 0;\n }\n return 1;\n }\n \n if(isV[i][mod][Bit][s]) return dp[i][mod][Bit][s];\n \n LLU ret = 0;\n int nmod;\n if(s == 0)\n {\n rep(j,0,10)\n {\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 0 );\n }\n }\n else if(s == 1)\n {\n j = a[i]-'0';\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 1 );\n \n rep(j,a[i]-'0'+1,10)\n {\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 0 );\n }\n }\n else if(s == 2)\n { \n rep(j,0,b[i]-'0')\n {\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 0 );\n }\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 2 );\n }\n else\n {\n if(a[i]-'0' == b[i]-'0')\n {\n j = a[i]-'0';\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 3 );\n }\n \n else\n {\n j = a[i]-'0';\n \n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 1 );\n \n rep(j,a[i]-'0'+1,b[i]-'0')\n {\n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 0 );\n }\n \n nmod = ( mod*10 + j ) % M;\n ret += cal( i+1, nmod, Bit|1<<(j-2), 2 );\n }\n }\n \n isV[i][mod][Bit][s] = 1;\n return dp[i][mod][Bit][s] = ret;\n}\n\nint main()\n{\n int T,t=1,m,i,j,k;\n LLU l,r;\n scanf(\"%d\",&T);\n for(t=1;t<=T;t++)\n {\n scanf(\"%I64u%I64u\",&l,&r);\n \n sprintf(a,\"%020I64u\",l);\n sprintf(b,\"%020I64u\",r);\n \n rep(i,0,20)\n rep(j,0,2520) \n rep(k,0,261)\n rep(m,1,4)\n isV[i][j][k][m] = 0;\n \n \n printf(\"%I64u\\n\",cal(0,0,0,3));\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e91c881731e6c28712be0678c95a50c1", "src_uid": "37feadce373f728ba2a560b198ca4bc9", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n#define ulli unsigned long long int\n\nulli factorial(int n){\n if(n==1) return 1;\n else return factorial(n-1)*n;\n}\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int k = n/2;\n ulli ans;\n ans = factorial(n) / factorial(n-k);\n ans = ans * factorial(k-1)/(2*k);\n printf(\"%lld\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1e46465d7541a70a5f118c69471ca668", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nlong long int factorial(long long int n) ;\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n\n while(t--)\n {\n int n, power;\n long long int sum;\n scanf(\"%d\", &n);\n power = (factorial((n/2)-1) * factorial((n/2)-1));\n sum = ((factorial(n)/((factorial(n/2)) * factorial(n/2))/2) * power) ;\n\n printf(\"%d\", sum);\n }\n}\n\nlong long int factorial(long long int n)\n{\n if (n == 0)\n return 1;\n return n * factorial(n - 1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bb4bf0b59ea72994b04cb6b8668cdbd3", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nlong long int factorial(long long int n) ;\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n\n while(t--)\n {\n int n;\n long long int sum, power;\n scanf(\"%d\", &n);\n power = (factorial((n/2)-1) * factorial((n/2)-1));\n sum = ((factorial(n)/((factorial(n/2)) * factorial(n/2))/2) * power) ;\n\n printf(\"%lld\", sum);\n }\n\n return 0;\n}\n\nlong long int factorial(long long int n)\n{\n if (n == 0)\n return 1;\n return n * factorial(n - 1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bf5a0e6567bcbddc3d4e074ef925a7f7", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nlong long int factorial(long long int n) ;\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n\n while(t--)\n {\n int n;\n long long int sum, power;\n scanf(\"%d\", &n);\n power = (factorial((n/2)-1) * factorial((n/2)-1));\n sum = ((factorial(n)/((factorial(n/2)) * factorial(n/2))/2) * power) ;\n\n printf(\"%lld\", sum);\n }\n}\n\nlong long int factorial(long long int n)\n{\n if (n == 0)\n return 1;\n return n * factorial(n - 1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b463344ec1a0e8cbdd513fbb4ecfcbce", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n long long int factorial( long long int n) ;\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n\n while(t--)\n {\n long long int n, power;\n long long int sum;\n scanf(\"%lld\", &n);\n power = pow(factorial((n/2)-1),2);\n sum = ((factorial(n)/((factorial(n/2)) * factorial(n/2))/2) * power) ;\n\n printf(\"%lld\", sum);\n }\n}\n\n long long int factorial( long long int n)\n{\n if (n == 0)\n return 1;\n return n * factorial(n - 1);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0a9855829a4e9d0ec61ebbb16c5fbf1", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \ntypedef long long ll;\nll a[15], w, ans;\n\nvoid dfs(int x, ll y) {\n\tif (x > 8) { \n\t\tif (y > ans) ans = y;\n\t\treturn;\n\t}\n\tll k = a[x];\n\tll tmp = (w - y) / x;\n\tif (k > tmp) k = tmp;\n\tll i = k - 3;\n\tif (i < 0) i = 0;\n\tfor (; i <= k; i++) dfs(x + 1, y + i * x);\n}\n\nint main() {\n\tscanf(\"%I64d\", &w);\n\tans = 0;\n\tfor (int i = 1; i <= 8; i++) scanf(\"%I64d\", &a[i]);\n\tdfs(1, 0);\n\tprintf(\"%I64d\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8efeefeb90312c2f725849237af674d4", "src_uid": "8097e10157320524c0faed56f2bc4880", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\n#define K\t8\n#define L\t840\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\nlong long max(long long a, long long b) { return a > b ? a : b; }\n\nint main() {\n\tstatic long long aa[K + 1], dp[L * K], dq[L * K];\n\tlong long w, ans, a, p;\n\tint i, y, y_, q, q_;\n\n\tscanf(\"%lld\", &w);\n\tfor (i = 1; i <= K; i++)\n\t\tscanf(\"%lld\", &aa[i]);\n\tmemset(dp, -1, L * K * sizeof *dp);\n\tdp[0] = 0;\n\tfor (i = 1; i <= K; i++) {\n\t\ta = aa[i];\n\t\tfor (y = 0; y < L * K; y++)\n\t\t\tdq[y] = -1;\n\t\tfor (y = 0; y < L * K; y++) {\n\t\t\tif (dp[y] < 0)\n\t\t\t\tcontinue;\n\t\t\tq_ = L / i;\n\t\t\tfor (q = 0; q < q_ && q <= a; q++) {\n\t\t\t\tp = (a - q) / q_;\n\t\t\t\ty_ = y + q * i;\n\t\t\t\tdq[y_] = max(dq[y_], dp[y] + p);\n\t\t\t}\n\t\t}\n\t\tfor (y = 0; y < L * K; y++)\n\t\t\tdp[y] = dq[y];\n\t}\n\tans = 0;\n\tfor (y = 0; y < L * K && y <= w; y++)\n\t\tans = max(ans, min((w - y) / L, dp[y]) * L + y);\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ff346c894c5487fd7674b0c933ccdd8", "src_uid": "8097e10157320524c0faed56f2bc4880", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include\nlong long int cnt[8];\nlong long int Maximum_Weight(long long int amount,int n)\n{\n long long int iterations=n-1,maximum_weight=0,current_weight=0,used=amount/n,weight_using_it,i;\n if(used>cnt[n-1]) used=cnt[n-1];\n if(used+1\n\nlong long int arr[15], w, ans;\n \nvoid dp(int x, long long int y) \n{\n\tif (x > 8) \n\t{ \n\t\tif (y > ans) \n\t\t{\n\t\t\tans = y;\n\t\t}\n\t\treturn;\n\t}\n\tlong long int k = arr[x];\n\tlong long int temp = (w-y) / x;\n\tif (k > temp) \n\t{\n\t\tk = temp;\n\t}\n\tlong long int i = k - 6;\n\tif (i < 0) \n\t{\n\t\ti = 0;\n\t}\n\twhile(i <= k)\n\t{\n\t\tdp(x + 1, y + i * x);\n\t\ti++;\n\t}\n\t \n}\n \nint main() \n{\n\tscanf(\"%lld\", &w);\n\tans = 0;\n\tfor (int i = 1; i <= 8; i++)\n\t{\n\t\tscanf(\"%lld\", &arr[i]);\n\t}\n\tdp(1, 0);\n\tprintf(\"%lld\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f09c1d43d41702b33aa19fab6c35f1d2", "src_uid": "8097e10157320524c0faed56f2bc4880", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "\n#include \n\n#include\n\n#include\n\n#include\n\n#include\n\nusing namespace std;\n\n\n\ntypedef long long ll;\n\n\n\nll a[15], w, ans;\n\nvoid dfs(int x, ll y)\n\n{\n\n\tif (x>8) {\n\n\t\tans = max(ans, y); \n\n\t\treturn;\n\n\t}\n\n\tll k = min(a[x], (w - y) / x);\n\n\tfor(ll i=max(0ll,k-3);i<=k;i++) dfs(x+1,y+i*x);\n\n}\n\n\n\nint main()\n\n{\n\n\twhile (cin >> w)\n\n\t{\n\n\t\tans = 0;\n\n\t\tfor (int i = 1; i <= 8; i++) cin >> a[i];\n\n\t\tdfs(1, 0);\n\n\t\tcout << ans << endl;\n\n\t}\n\n\treturn 0;\n\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "48f120d21ae0b88177ffb963985760c1", "src_uid": "8097e10157320524c0faed56f2bc4880", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define MDI 1000000009\n#define MOD(a) ((a) % MDI)\n#define MOO(a) ((a) > 0 ? (a) % MDI : MDI + (a))\n#define LL long long\n\nvoid putlld(LL a)\n{\n if(a > 9)\n putlld(a / 10);\n putchar(a % 10 + '0');\n}\n\nint nn[499999];\n\nint main(void)\n{\n int i, n;\n LL h = 0, g, t;\n scanf(\"%d\", &n);\n t = (n >> 1) - 1;\n for(i = 0, nn[0] = 4; i < t - 1; i++)\n nn[i + 1] = MOD(nn[i] << 1);\n for(i = t - 1; i >= 0; i--){\n g = nn[i] - 3;\n h = MOD((h + 4) * g);\n }\n h = MOD(((h * h + (h << 2)) << 1) + 10);\n putlld(h);\n putchar('\\n');\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e5837a4d5f52018420e9916b5e780283", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MD\t1000000009\n\nint main() {\n\tint n, l, ans, cnt, x, y, z;\n\n\tscanf(\"%d\", &n), n /= 2;\n\tcnt = 2, x = 1, y = 1, z = 2;\n\tfor (l = 2; l <= n; l++) {\n\t\tcnt = (cnt + x * 4LL) % MD;\n\t\tz = z * 2 % MD;\n\t\ty = (y + z) % MD;\n\t\tx = (long long) x * y % MD;\n\t}\n\tans = ((long long) cnt * cnt + 1) * 2 % MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "67a46bd190cf83646b8bf6c441b75d49", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define MDI 1000000009\n#define MOD(a) ((a) % MDI)\ntypedef long long LL;\nenum {U, L, T, I, W};\n\nint unt[][W + 1] = {\n {5, 2, 0, 0, 1},\n {4, 4, 1, 1, 0},\n {4, 2, 0, 0, 0},\n {4, 0, 0, 0, 0}\n};\n\nvoid putlld(LL a)\n{\n if(a > 9)\n putlld(a / 10);\n putchar((a % 10) + '0');\n}\n\nint main(void)\n{\n int i, j, k;\n LL h = 0, g, n, f, t;\n scanf(\"%d\", &n);\n n /= 2;\n t = n - 2;\n for(i = 0; i < t; i++){\n f = t - i;\n g = MOD(MOD(2 << (f + 1) - 1) << 2);\n h = MOD(4 + h + MOD(g << 2) + MOD(h * g));\n }\n if(n > 1)\n h = MOD(4 + h);\n h = MOD(MOD(MOD(h * h) + 5 + MOD(h << 2) << 1));\n putlld(h);\n putchar('\\n');\n return 0;\n}\n\n#undef WERTYUIOPASDFGHJKLZXCVBN\n#ifdef WERTYUIOPASDFGHJKLZXCVBN\n/*\n * it starts and ends in the same place \u2014 the granny's house;\n * the route goes along the forest paths only (these are the segments marked black in the picture);\n * the route has positive length (to step out for a breath of fresh air Peter has to cover some distance anyway);\n * the route cannot cross itself;\n * there shouldn't be any part of dense forest within the part marked out by this route; \n I:\n 2\n O:\n 10\n I:\n 4\n O:\n 74\n */\n#endif\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "71875096ab069d8267ef68a8ce7e3992", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define MDI 1000000009\n#define MOD(a) ((a) % MDI)\ntypedef long long LL;\n\nvoid putlld(LL a)\n{\n if(a > 9)\n putlld(a / 10);\n putchar((a % 10) + '0');\n}\n\nint main(void)\n{\n int i, j, k;\n LL h = 0, g, n, f, t;\n scanf(\"%d\", &n);\n n /= 2;\n t = n - 2;\n for(i = 0; i < t; i++){\n f = t - i;\n g = MOD(MOD(2 << (f + 1) - 1) << 2);\n h = MOD(4 + h + MOD(g << 2) + MOD(h * g));\n }\n if(n > 1)\n h = MOD(4 + h);\n h = MOD(MOD(MOD(h * h) + 5 + MOD(h << 2) << 1));\n putlld(h);\n putchar('\\n');\n return 0;\n}\n\n#undef WERTYUIOPASDFGHJKLZXCVBN\n#ifdef WERTYUIOPASDFGHJKLZXCVBN\n/*\n * it starts and ends in the same place \u2014 the granny's house;\n * the route goes along the forest paths only (these are the segments marked black in the picture);\n * the route has positive length (to step out for a breath of fresh air Peter has to cover some distance anyway);\n * the route cannot cross itself;\n * there shouldn't be any part of dense forest within the part marked out by this route; \n I:\n 2\n O:\n 10\n I:\n 4\n O:\n 74\n */\n#endif\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bd76911c8e26bc26dd342d1d5a93e307", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MD\t1000000009\n\nint main() {\n\tint n, l, ans, cnt, x, y, z;\n\n\tscanf(\"%d\", &n), n /= 2;\n\tcnt = 2, x = 1, y = 1, z = 2;\n\tfor (l = 2; l <= n; l++) {\n\t\tcnt = (cnt + x * 4LL) % MD;\n\t\tz = z * 2 % MD;\n\t\ty = (y + z) % MD;\n\t\tx = (x + y) % MD;\n\t}\n\tans = ((long long) cnt * cnt + 1) * 2 % MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "178e97b3a9af3c2e944f49c4e08080c6", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\nint d[10][10];\nint N;\n\nint read_in(int i, int j)\n{\n\treturn (i==N) ? (0) : \n\t\t((j==N) ? (read_in(i+1,0)) : ({scanf(\"%d\",&(d[i][j])); read_in(i,j+1);}));\n}\n\nint find_dist(int i, int j, int k)\n{\n\treturn (k==N) ? (0) : \n\t\t((i==N) ? (find_dist(0,0,k+1)) : \n\t\t\t((j==N) ? (find_dist(i+1,0,k)) : \n\t\t\t\t(\n\t\t\t\t\t{\n\t\t\t\t\t\t(d[i][j] > d[i][k]+d[k][j]) ? \n\t\t\t\t\t\t\t(d[i][j] = d[i][k] + d[k][j]) : (0); find_dist(i,j+1,k);\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t)\n\t\t);\n}\n\nint find_max(int i, int j)\n{\n\treturn (i == N) ? (0) :\n\t\t(j==N) ? (find_max(i+1,0)) : \n\t\t\t(d[i][j] > find_max(i,j+1)) ? (d[i][j]) : (find_max(i,j+1));\n}\n\nint main()\n{\n\tscanf(\"%d\", &N);\n\t\n\tread_in(0,0);\n\tprint_mat();\n\t\n\tfind_dist(0,0,0);\n\tprint_mat();\n\t\n\tprintf(\"%d\\n\",find_max(0,0));\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "0dd9e36867d40f0c6cd533fe35c41706", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nunsigned char mat[N][N];\n\ninline unsigned char smin(const unsigned char& a, const unsigned char& b) { return a < b ? a : b; }\ninline unsigned char smax(const unsigned char& a, const unsigned char& b) { return a > b ? a : b; }\n\ninline unsigned char FOR3(const unsigned char& k, const unsigned char& i, const unsigned char& j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\ninline unsigned char FOR2(const unsigned char& i, const unsigned char& j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR1(const unsigned char& i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT2(const unsigned char& i, const unsigned char& j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT1(const unsigned char& i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\ninline unsigned char BILLY2(const unsigned char& i, const unsigned char& j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\ninline unsigned char BILLY1(const unsigned char& i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\ninline void solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "445d68e30e680e8b01a28562f0851dbe", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nunsigned char mat[10][10];\n\ninline unsigned char smin(const unsigned char a, const unsigned char b) { return a < b ? a : b; }\ninline unsigned char smax(const unsigned char a, const unsigned char b) { return a > b ? a : b; }\n\ninline unsigned char FOR3(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\ninline unsigned char FOR2(const unsigned char i, const unsigned char j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR1(const unsigned char i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\ninline unsigned char FOR4(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR4(k, i, j + 1) :\n i + 1 < n ? FOR4(k, i + 1, 0) :\n k + 1 < n ? FOR4(k + 1, 0, 0) : 0;\n}\n\ninline unsigned char FOR_INPUT2(const unsigned char i, const unsigned char j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT1(const unsigned char i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\ninline unsigned char BILLY2(const unsigned char i, const unsigned char j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\ninline unsigned char BILLY1(const unsigned char i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\ninline void solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n // FOR1(0);\n FOR4(0, 0, 0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "86ea06fa485ad614ee36f93c7a1910de", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nunsigned char mat[N][N];\n\ninline unsigned char smin(const unsigned char a, const unsigned char b) { return a < b ? a : b; }\ninline unsigned char smax(const unsigned char a, const unsigned char b) { return a > b ? a : b; }\n\ninline unsigned char FOR3(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\ninline unsigned char FOR2(const unsigned char i, const unsigned char j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR1(const unsigned char i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT2(const unsigned char i, const unsigned char j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT1(const unsigned char i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\ninline unsigned char BILLY2(const unsigned char i, const unsigned char j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\ninline unsigned char BILLY1(const unsigned char i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\ninline void solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "cffc2a6a800f46631bb85cab7a214afc", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nusing namespace std;\n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nunsigned char mat[N][N];\n\ninline unsigned char smin(const unsigned char& a, const unsigned char& b) { return a < b ? a : b; }\ninline unsigned char smax(const unsigned char& a, const unsigned char& b) { return a > b ? a : b; }\n\ninline unsigned char FOR3(const unsigned char& k, const unsigned char& i, const unsigned char& j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\ninline unsigned char FOR2(const unsigned char& i, const unsigned char& j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR1(const unsigned char& i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT2(const unsigned char& i, const unsigned char& j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\ninline unsigned char FOR_INPUT1(const unsigned char& i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\ninline unsigned char BILLY2(const unsigned char& i, const unsigned char& j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\ninline unsigned char BILLY1(const unsigned char& i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\ninline void solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "e1efc0cd71706fe6cac54cf0e9fb0a6b", "src_uid": "bbd210065f8b32de048a2d9b1b033ed5", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\ntypedef long long int Lint;\nLint N;\n\nLint asal(Lint x){\n\tfor(Lint i=2 ; i*i<=x ; i++)\n\t\tif(x%i==0)\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main()\n{\n\tLint x,y;\n\tcin >> N ;\n\tif(asal(N)){\n\t\tcout << 1 << '\\n' << N << '\\n';\n\t\treturn 0;\n\t}\n\n\tN--;\n\tif(N%2==0) N--;\n\n\tfor(Lint i=N ; ; i-=2)\n\t\tif(N-i>=4 && asal(i)){\n\t\t\tx=i;\n\t\t\tbreak;}\n\n\ty=N-x;\n\n\tfor(Lint i=2 ; i<=N ; i++){\n\t\tif(y-i>=2 && asal(i) && asal(y-i)){\n\t\t\tprintf(\"3\\n%lld %lld %lld\\n\",x,i,y-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "89db6e8655d36b51ac949f5142a36377", "src_uid": "f2aaa149ce81bf332d0b5d80b2a13bc3", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\ntypedef long long int Lint;\nLint N;\n\nLint asal(Lint x){\n\tfor(Lint i=2 ; i*i<=x ; i++)\n\t\tif(x%i==0)\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main()\n{\n\tLint x,y;\n\tcin >> N ;\n\tif(asal(N)){\n\t\tcout << 1 << '\\n' << N << '\\n';\n\t\treturn 0;\n\t}\n\n\tN--;\n\tif(N%2==0) N--;\n\n\tfor(Lint i=N ; ; i-=2)\n\t\tif(N-i>=6 && asal(i)){\n\t\t\tx=i;\n\t\t\tbreak;}\n\n\ty=N-x;\n\n\tfor(Lint i=3 ; i<=N ; i++){\n\t\tif(y-i>=3 && asal(i) && asal(y-i)){\n\t\t\tprintf(\"3\\n%lld %lld %lld\\n\",x,i,y-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "3e9dd7a9773a4d33b7bcac336e37b909", "src_uid": "f2aaa149ce81bf332d0b5d80b2a13bc3", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \nusing namespace std;\ntypedef long long int Lint;\nLint N;\n\nLint asal(Lint x){\n\tfor(Lint i=2 ; i*i<=x ; i++)\n\t\tif(x%i==0)\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main()\n{\n\tLint x,y;\n\tscanf(\"%lld\",&N);\n\tif(asal(N)){\n\t\tprintf(\"1\\n%lld\\n\",N);\n\t\treturn 0;\n\t}\n\n\tN--;\n\tif(N%2==0) N--;\n\n\tfor(Lint i=N ; ; i-=2)\n\t\tif(N-i>=4 && asal(i)){\n\t\t\tx=i;\n\t\t\tbreak;}\n\n\ty=N-x;\n\n\tfor(Lint i=2 ; i<=N ; i++){\n\t\tif(y-i>=2 && asal(i) && asal(y-i)){\n\t\t\tprintf(\"3\\n%lld %lld %lld\\n\",x,i,y-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0a09bf64034ed926f0efa66d5c2cc998", "src_uid": "f2aaa149ce81bf332d0b5d80b2a13bc3", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#define N 1000000\n#define M 100000\nint main() {\n int n;\n scanf(\"%d\",&n);\n int p[N];\n int i,j;\n for(i=2; i\n#define N 10000000\n#define M 1000000\nint main() {\n int n;\n scanf(\"%d\",&n);\n int p[N];\n int i,j;\n for(i=2; i=M){\n printf(\"\u5185\u5b58\u4e0d\u591f\\n\");\n break;\n }\n }\n }\n if(p[n]==1){\n printf(\"1\\n%d\\n\",n);\n }else{\n int find=0;\n //printf(\"%d\\n\",np);\n int p1,p2,p3;\n for(i=0;!find && prime[i]<=n && i\n\n\nint main(){\n\tint t,z,n,i;\n\tscanf(\"%d\",&n);\n\tz=t=1;\n\tfor(i=1;i<=n;i++){\n\t\tz=(z*i)%1000000007;\n\t}\n\tfor(i=1;i<=(n-1);i++){\n\t\tt=(t*2)%1000000007;\n\t}\n\tz=(z-t);\n\tprintf(\"%d\",z);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "73cf3d9818830ab8322147474c8f79f7", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#define M 1000000007;\nint main()\n{\n int t,n,i,ans;\n long long int pow,fact;\n scanf(\"%d\",&t);\n while(t--)\n {\n pow=fact=1;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n fact = fact*i;\n fact = fact%M;\n }\n for(i=1;i\nint main(){\n\tint i;\n\tlong t,z,n;\n\tscanf(\"%ld\",&n);\n\tz=1;\n\tt=1;\n\tfor(i=1;i<=n;i++){\n\t\tz=(z*i);\n\t\tz=z%(1000000007);\n\t}\n\tfor(i=1;i<=(n-1);i++){\n\t\tt=(t*2);\n\t\tt=t%(1000000007);\n\t}\n\tz=z-t;\n\tif(z<0){\n\t\tz=z+1000000007;\n\t}\n\tprintf(\"%ld\",z);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b05d0e9578b8a0a55733436c86bf656", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#define M 1000000007;\nint main()\n{\n int t,n,i,ans;\n long long int pow,fact;\n pow=fact=1;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n fact = fact*i;\n fact = fact%M;\n }\n for(i=1;i\n#define M 1000000007;\nint main()\n{\n int t,n,i,ans;\n long long int pow,fact;\n pow=fact=1;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n fact = fact*i;\n fact = fact%M;\n }\n for(i=1;i\n#include \n\n#define N\t10\n\nchar ss[16][2] = { \"B\", \"C\", \"F\", \"H\", \"I\", \"K\", \"N\", \"O\", \"P\", \"S\", \"U\", \"V\", \"W\", \"Y\" };\nchar tt[128][4] = { \"AC\", \"AG\", \"AL\", \"AM\", \"AR\", \"AS\", \"AT\", \"BA\", \"BE\", \"BH\", \"BI\", \"BK\", \"BR\", \"CA\", \"CD\", \"CE\", \"CF\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CS\", \"CU\", \"DB\", \"DS\", \"DY\", \"ER\", \"ES\", \"EU\", \"FE\", \"FM\", \"FR\", \"GD\", \"GA\", \"GE\", \"AU\", \"HE\", \"HF\", \"HO\", \"HS\", \"HG\", \"IN\", \"IR\", \"KR\", \"LA\", \"LV\", \"LR\", \"LI\", \"LU\", \"MD\", \"MG\", \"MN\", \"MO\", \"MT\", \"NA\", \"NB\", \"ND\", \"NE\", \"NI\", \"NO\", \"NP\", \"OS\", \"PA\", \"PB\", \"PD\", \"PM\", \"PO\", \"PT\", \"PU\", \"PR\", \"RA\", \"RB\", \"RE\", \"RF\", \"RG\", \"RH\", \"RN\", \"RU\", \"SB\", \"SC\", \"SE\", \"SI\", \"SG\", \"SM\", \"SN\", \"SR\", \"TA\", \"TB\", \"TC\", \"TE\", \"TH\", \"TI\", \"TL\", \"TM\", \"XE\", \"YB\", \"ZN\", \"ZR\" };\n\nint elemental1(char c) {\n\tint i;\n\n\tfor (i = 0; i < 16; i++)\n\t\tif (ss[i][0] == c)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental2(char c1, char c2) {\n\tint i;\n\n\tfor (i = 0; i < 128; i++)\n\t\tif (tt[i][0] == c1 && tt[i][1] == c2)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int dp[N + 1];\n\tint n, i;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tif (dp[i]) {\n\t\t\tif (elemental1(cc[i]))\n\t\t\t\tdp[i + 1] = 1;\n\t\t\tif (i + 1 < n && elemental2(cc[i], cc[i + 1]))\n\t\t\t\tdp[i + 2] = 1;\n\t\t}\n\tprintf(dp[n] ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0183ae9cffc4ebffd5f2f3d01804f929", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t10\n\nchar ss[16][2] = { \"B\", \"C\", \"F\", \"H\", \"I\", \"K\", \"N\", \"O\", \"P\", \"S\", \"U\", \"V\", \"W\", \"Y\" };\nchar tt[128][4] = { \"AC\", \"AG\", \"AL\", \"AM\", \"AR\", \"AS\", \"AT\", \"AU\", \"BA\", \"BE\", \"BH\", \"BI\", \"BK\", \"BR\", \"CA\", \"CD\", \"CE\", \"CF\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CS\", \"CU\", \"DB\", \"DS\", \"DY\", \"ER\", \"ES\", \"EU\", \"FE\", \"FL\", \"FM\", \"FR\", \"GD\", \"GA\", \"GE\", \"HE\", \"HF\", \"HO\", \"HS\", \"HG\", \"IN\", \"IR\", \"KR\", \"LA\", \"LV\", \"LR\", \"LI\", \"LU\", \"MC\", \"MD\", \"MG\", \"MN\", \"MO\", \"MT\", \"NA\", \"NB\", \"ND\", \"NE\", \"NH\", \"NI\", \"NO\", \"NP\", \"OG\", \"OS\", \"PA\", \"PB\", \"PD\", \"PM\", \"PO\", \"PT\", \"PU\", \"PR\", \"RA\", \"RB\", \"RE\", \"RF\", \"RG\", \"RH\", \"RN\", \"RU\", \"SB\", \"SC\", \"SE\", \"SI\", \"SG\", \"SM\", \"SN\", \"SR\", \"TA\", \"TB\", \"TC\", \"TE\", \"TH\", \"TI\", \"TL\", \"TM\", \"XE\", \"YB\", \"ZN\", \"ZR\" };\n\nint elemental1(char c) {\n\tint i;\n\n\tfor (i = 0; i < 16; i++)\n\t\tif (ss[i][0] == c)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental2(char c1, char c2) {\n\tint i;\n\n\tfor (i = 0; i < 128; i++)\n\t\tif (tt[i][0] == c1 && tt[i][1] == c2)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int dp[N + 1];\n\tint n, i;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tif (dp[i]) {\n\t\t\tif (elemental1(cc[i]))\n\t\t\t\tdp[i + 1] = 1;\n\t\t\tif (i + 1 < n && elemental2(cc[i], cc[i + 1]))\n\t\t\t\tdp[i + 2] = 1;\n\t\t}\n\tprintf(dp[n] ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8ede153c541f7ceceb1c485b7a9ad1ba", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t10\n\nchar ss[][2] = { \"B\", \"C\", \"D\", \"F\", \"H\", \"I\", \"K\", \"N\", \"O\", \"P\", \"S\", \"U\", \"V\", \"W\", \"Y\" };\nchar tt[102][4] = { \"AC\", \"AG\", \"AL\", \"AM\", \"AR\", \"AS\", \"AT\", \"BA\", \"BE\", \"BH\", \"BI\", \"BK\", \"BR\", \"CA\", \"CD\", \"CE\", \"CF\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CS\", \"CU\", \"DB\", \"DS\", \"DY\", \"ER\", \"ES\", \"EU\", \"FE\", \"FL\", \"FM\", \"FR\", \"GD\", \"GA\", \"GE\", \"AU\", \"HE\", \"HF\", \"HO\", \"HS\", \"HG\", \"IN\", \"IR\", \"KR\", \"LA\", \"LR\", \"LI\", \"LU\", \"LV\", \"MD\", \"MG\", \"MN\", \"MO\", \"MT\", \"NA\", \"NB\", \"ND\", \"NE\", \"NI\", \"NO\", \"NP\", \"OG\", \"OS\", \"PA\", \"PB\", \"PD\", \"PM\", \"PO\", \"PT\", \"PU\", \"PR\", \"RA\", \"RB\", \"RE\", \"RF\", \"RG\", \"RH\", \"RN\", \"RU\", \"SB\", \"SC\", \"SE\", \"SI\", \"SG\", \"SM\", \"SN\", \"SR\", \"TA\", \"TB\", \"TC\", \"TE\", \"TH\", \"TI\", \"TL\", \"TM\", \"XE\", \"YB\", \"ZN\", \"ZR\" };\n\nint elemental1(char c) {\n\tint i;\n\n\tfor (i = 0; i < 15; i++)\n\t\tif (ss[i][0] == c)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental2(char c1, char c2) {\n\tint i;\n\n\tfor (i = 0; i < 101; i++)\n\t\tif (tt[i][0] == c1 && tt[i][1] == c2)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental3(char c1, char c2, char c3) {\n\treturn c1 == 'U' && c2 == 'U' && (c3 == 'T' || c3 == 'P' || c3 == 'S');\n}\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int dp[N + 1];\n\tint n, i;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tif (dp[i]) {\n\t\t\tif (elemental1(cc[i]))\n\t\t\t\tdp[i + 1] = 1;\n\t\t\tif (i + 1 < n && elemental2(cc[i], cc[i + 1]))\n\t\t\t\tdp[i + 2] = 1;\n\t\t\tif (i + 2 < n && elemental3(cc[i], cc[i + 1], cc[i + 2]))\n\t\t\t\tdp[i + 3] = 1;\n\t\t}\n\tprintf(dp[n] ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eec8d080bfd65d819b57edeb5a85a7bb", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t10\n\nchar ss[][2] = { \"B\", \"C\", \"D\", \"F\", \"H\", \"I\", \"K\", \"N\", \"O\", \"P\", \"S\", \"U\", \"V\", \"W\", \"Y\" };\nchar tt[102][4] = { \"AC\", \"AG\", \"AL\", \"AM\", \"AR\", \"AS\", \"AT\", \"BA\", \"BE\", \"BH\", \"BI\", \"BK\", \"BR\", \"CA\", \"CD\", \"CE\", \"CF\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CS\", \"CU\", \"DB\", \"DS\", \"DY\", \"ER\", \"ES\", \"EU\", \"FE\", \"FL\", \"FM\", \"FR\", \"GD\", \"GA\", \"GE\", \"AU\", \"HE\", \"HF\", \"HO\", \"HS\", \"HG\", \"IN\", \"IR\", \"KR\", \"LA\", \"LR\", \"LI\", \"LU\", \"LV\", \"MD\", \"MG\", \"MN\", \"MO\", \"MT\", \"NA\", \"NB\", \"ND\", \"NE\", \"NI\", \"NO\", \"NP\", \"OG\", \"OS\", \"PA\", \"PB\", \"PD\", \"PM\", \"PO\", \"PT\", \"PU\", \"PR\", \"RA\", \"RB\", \"RE\", \"RF\", \"RG\", \"RH\", \"RN\", \"RU\", \"SB\", \"SC\", \"SE\", \"SI\", \"SG\", \"SM\", \"SN\", \"SR\", \"TA\", \"TB\", \"TC\", \"TE\", \"TH\", \"TI\", \"TL\", \"TM\", \"XE\", \"YB\", \"ZN\", \"ZR\" };\n\nint elemental1(char c) {\n\tint i;\n\n\tfor (i = 0; i < 15; i++)\n\t\tif (ss[i][0] == c)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental2(char c1, char c2) {\n\tint i;\n\n\tfor (i = 0; i < 102; i++)\n\t\tif (tt[i][0] == c1 && tt[i][1] == c2)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental3(char c1, char c2, char c3) {\n\treturn c1 == 'U' && c2 == 'U' && (c3 == 'T' || c3 == 'P' || c3 == 'S');\n}\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int dp[N + 1];\n\tint n, i;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tif (dp[i]) {\n\t\t\tif (elemental1(cc[i]))\n\t\t\t\tdp[i + 1] = 1;\n\t\t\tif (i + 1 < n && elemental2(cc[i], cc[i + 1]))\n\t\t\t\tdp[i + 2] = 1;\n\t\t\tif (i + 2 < n && elemental3(cc[i], cc[i + 1], cc[i + 2]))\n\t\t\t\tdp[i + 3] = 1;\n\t\t}\n\tprintf(dp[n] ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "26141e69d91c0f372dd008a27aa7b273", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t10\n\nchar ss[][2] = { \"B\", \"C\", \"D\", \"F\", \"H\", \"I\", \"K\", \"N\", \"O\", \"P\", \"S\", \"U\", \"V\", \"W\", \"Y\" };\nchar tt[][4] = { \"AC\", \"AG\", \"AL\", \"AM\", \"AR\", \"AS\", \"AT\", \"BA\", \"BE\", \"BH\", \"BI\", \"BK\", \"BR\", \"CA\", \"CD\", \"CE\", \"CF\", \"CL\", \"CM\", \"CO\", \"CR\", \"CS\", \"CU\", \"DB\", \"DS\", \"DY\", \"ER\", \"ES\", \"EU\", \"FE\", \"FL\", \"FM\", \"FR\", \"GD\", \"GA\", \"GE\", \"AU\", \"HE\", \"HF\", \"HO\", \"HS\", \"HG\", \"IN\", \"IR\", \"KR\", \"LA\", \"LR\", \"LI\", \"LU\", \"LV\", \"MD\", \"MG\", \"MN\", \"MO\", \"MT\", \"NA\", \"NB\", \"ND\", \"NE\", \"NI\", \"NO\", \"NP\", \"OG\", \"OS\", \"PA\", \"PB\", \"PD\", \"PM\", \"PO\", \"PT\", \"PU\", \"PR\", \"RA\", \"RB\", \"RE\", \"RF\", \"RG\", \"RH\", \"RN\", \"RU\", \"SB\", \"SC\", \"SE\", \"SI\", \"SG\", \"SM\", \"SN\", \"SR\", \"TA\", \"TB\", \"TC\", \"TE\", \"TH\", \"TI\", \"TL\", \"TM\", \"XE\", \"YB\", \"ZN\", \"ZR\" };\n\nint elemental1(char c) {\n\tint i;\n\n\tfor (i = 0; i < 15; i++)\n\t\tif (ss[i][0] == c)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint elemental2(char c1, char c2) {\n\tint i;\n\n\tfor (i = 0; i < 100; i++)\n\t\tif (tt[i][0] == c1 && tt[i][1] == c2)\n\t\t\treturn 1;\n\treturn 0;\n}\n\nint main() {\n\tstatic char cc[16];\n\tstatic int dp[N + 1];\n\tint n, i;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tif (dp[i]) {\n\t\t\tif (elemental1(cc[i]))\n\t\t\t\tdp[i + 1] = 1;\n\t\t\tif (i + 1 < n && elemental2(cc[i], cc[i + 1]))\n\t\t\t\tdp[i + 2] = 1;\n\t\t}\n\tprintf(dp[n] ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1ef04b8a565ef792a099a164a142d8ff", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n#include \n \nint main()\n{\n int a[32],i,n,w,x=0,p,q,r,s,t,perm[120]={12345 ,12354 ,12435 ,12453 ,12543 ,12534 ,13245 ,13254 ,13425 ,13452 ,13542 ,13524 ,14325 ,14352 ,14235 ,14253 ,14523 ,14532 ,15342 ,15324 ,15432 ,15423 ,15243 ,15234 ,21345 ,21354 ,21435 ,21453 ,21543 ,21534 ,23145 ,23154 ,23415 ,23451 ,23541 ,23514 ,24315 ,24351 ,24135 ,24153 ,24513 ,24531 ,25341 ,25314 ,25431 ,25413 ,25143 ,25134 ,32145 ,32154 ,32415 ,32451 ,32541 ,32514 ,31245 ,31254 ,31425 ,31452 ,31542 ,31524 ,34125 ,34152 ,34215 ,34251 ,34521 ,34512 ,35142 ,35124 ,35412 ,35421 ,35241 ,35214 ,42315 ,42351 ,42135 ,42153 ,42513 ,42531 ,43215 ,43251 ,43125 ,43152 ,43512 ,43521 ,41325 ,41352 ,41235 ,41253 ,41523 ,41532 ,45312 ,45321 ,45132 ,45123 ,45213 ,45231 ,52341 ,52314 ,52431 ,52413 ,52143 ,52134 ,53241 ,53214 ,53421 ,53412 ,53142 ,53124 ,54321 ,54312 ,54231 ,54213 ,54123 ,54132 ,51342 ,51324 ,51432 ,51423 ,51243 ,51234};\n char b[5];\n for (i=5; i<31; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for (i = 0; i<120; i++)\n {\n sprintf(b, \"%d\", perm[i]);\n p = b[0] - '0';\n q = b[1] - '0';\n r = b[2] - '0';\n s = b[3] - '0';\n t = b[4] - '0';\n n = a[(p*5)+q]+a[(q*5)+p]+a[(r*5)+s]+a[(s*5)+r]+a[(q*5)+r]+a[(r*5)+q]+a[(s*5)+t]+a[(t*5)+s]+a[(r*5)+s]+a[(s*5)+r]+a[(s*5)+t]+a[(t*5)+s];\n if (n>x)\n {\n x = n;\n }\n }\n printf(\"%d\",x);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "28140a544ffd5eabba27b3872cc6f0b1", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nchar P[120][6];\nint l=0;\nswap(char *a, char *b)\n{\n char t;\n t=*a;\n *a=*b;\n *b=t;\n}\nint cost(int W[5][5], char *S)\n{\n int sum, o,t,th,f,fi;\n o=S[0]-49;\n t=S[1]-49;\n th=S[2]-49;\n f=S[3]-49;\n fi=S[4]-49;\n sum=W[o][t]+W[t][o]+W[th][f]+W[f][th]+W[t][th]+W[th][t]+W[f][fi]+W[fi][f]+W[th][f]+W[f][th]+W[f][fi]+W[fi][f];\n return sum;\n}\nperm(char *num, int pres, int size)\n{\n int i;\n if (pres==(size-1))\n {\n\tstrcpy(P[l], num);\n\tl++;\n }\n else\n {\n\tfor (i=pres;imax)\n\t max=C[i];\n }\n printf(\"%i\\n\", max);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "685e7cc999665cdb7ad23b2114e67b07", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#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) ? (y):(x)\n#define scnn fscanf(stdin,\"%i\",&n)\n#define scnnd fscanf(stdin,\"%i %i\",&n,&d)\n#define scnmi fscanf(stdin,\"%i\",&m[i])\n#define forn for(i=0;itmp) {tmp=try;res=try;} \n}\n}\nprintf(\"%i\",res);\nsystem(\"pause\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "19441a8fe2b055881209adf41470dd4c", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\t\n\tint x,y,z,w,u,i,sum=0,maxsum=0,k;\n\tint **a=(int **)malloc(sizeof(int *)*5);\n\tfor(i=0;i<5;i++)\n\ta[i]=(int*)malloc(sizeof(int)*5);\n\t\n\tfor(i=0;i<5;i++)\n\t\tfor(k=0;k<5;k++)\n\t\t\tscanf(\"%d\",&a[i][k]);\n\t\n\tfor(x=0;x<5;x++)\n\t\tfor(y=0;y<5;y++)\n\t\t{\n\t\t\tif(y==x)\n\t\t\tcontinue;\n\t\t\tfor(z=0;z<5;z++)\n\t\t\t{\n\t\t\t\tif(z==x || z==y)\n\t\t\t\tcontinue;\n\t\t\t\tfor(w=0;w<5;w++)\n\t\t\t\t{\n\t\t\t\t\tif(w==x || w==y || w==z)\n\t\t\t\t\tcontinue;\n\t\t\t\t\tfor(u=0;u<5;u++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(u==x || u==y || u==z || u==w)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tsum=a[x][y]+a[y][x]+2*(a[z][w]+a[w][z]+a[w][u]+a[u][w])+a[y][z]+a[z][y];\n\t\t\t\t\t\tif(sum>maxsum)\n\t\t\t\t\t\tmaxsum=sum;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\tprintf(\"%d\\n\",maxsum);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9d6833ae7ade5f3187204eec1b99d344", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "\n#include \n#include \n#include \n\n#define N 5\n\nint main(void) {\n int arr[N][N];\n int i, j;\n int k[N];\n for (i = 0; i < N; i++)\n for (j = 0; j < N; j++)\n scanf(\"%d\", &arr[i][j]);\n int d = 0, good, ans = 0;\n for (k[d] = 0; k[d] < 5; k[d]++){\n good = 1;\n for (i = 0; good && i < d; i++)\n good = !(k[i] == k[d]);\n if (!good)\n continue;\n d++;\n for (k[d] = 0; k[d] < 5; k[d]++){\n good = 1;\n for (i = 0; good && i < d; i++)\n good = !(k[i] == k[d]);\n if (!good)\n continue;\n d++; \n for (k[d] = 0; k[d] < 5; k[d]++){\n good = 1;\n for (i = 0; good && i < d; i++)\n good = !(k[i] == k[d]);\n if (!good)\n continue;\n d++;\n for (k[d] = 0; k[d] < 5; k[d]++){\n good = 1;\n for (i = 0; good && i < d; i++)\n good = !(k[i] == k[d]);\n if (!good)\n continue;\n d++;\n for (k[d] = 0; k[d] < 5; k[d]++){\n good = 1;\n for (i = 0; good && i < d; i++)\n good = !(k[i] == k[d]);\n if (!good)\n continue;\n tans = (arr[k[1]][k[2]] + arr[k[2]][k[1]] + 2*arr[0][4]+ 2*arr[4][0] + 2*arr[3][4] + 2*arr[3][4] + arr[0][2] + arr[2][0]);\n if (tans > ans)\n ans = tans;\n }\n d--;\n }\n d--;\n }\n d--;\n }\n d--;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8a3c26821fa58d7344176bb15ad9e480", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(){\n\tchar a[10], b[10], x;\n\tint i, j = 0;\n\t\n\tfor(i = 0; i < 4; ++i){\n\t\tscanf(\" %c\", &a[i]);\n\t}\n\tfor(i = 0; i < 4; ++i){\n\t\tscanf(\" %c\", &b[i]);\n\t}\n\t\n\tx = a[2]; a[2] = a[3]; a[3] = x; \n\tx = b[2]; b[2] = b[3]; b[3] = x;\n\t\n\tj = 0;\n\tfor(i = 0; i < 4; ++i){\n\t\tif(a[i] != 'X'){\n\t\t\ta[j] = a[i];\n\t\t\tj++;\n\t\t}\n\t}\n\t\n\tj = 0;\n\tfor(i = 0; i < 4; ++i){\n\t\tif(b[i] != 'X'){\n\t\t\tb[j] = b[i];\n\t\t\tj++;\n\t\t}\n\t}\n\ta[3] = '\\0';\n\tb[3] = '\\0';\n\t\n\twhile(a[0] != b[0]){\n\t\tx = b[0];\n\t\tfor(i = 1; i < 3; ++i){\n\t\t\tb[i-1] = b[i];\n\t\t}\n\t\tb[2] = x;\n\t}\t\n\t\n\tif(strcmp(a, b) == 0){\n\t\tprintf(\"YES\");\n\t}else\n\t\tprintf(\"NO\");\n\t\t\nreturn 0;\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c149f8028358dcde9f5c015f6b94fb10", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define swap(a,b,t) t=a,a=b,b=t\nint main()\n{\n char a[3],b[3],c[3],d[3],t;\n int i;\n scanf(\"%s%s%s%s\",a,b,c,d);\n for (i=0;i<900;i++)\n if (!strcmp(a,c)&&!strcmp(b,d))\n {\n puts(\"YES\");\n return 0;\n }\n else if (a[0]==88) swap(a[0],a[1],t);\n else if (a[1]==88) swap(b[1],a[1],t);\n else if (b[0]==88) swap(a[0],b[0],t);\n else if (b[1]==88) swap(b[0],b[1],t);\n puts(\"NO\");\n return 0;\n}/*2016-04-13 21:12:50.952*/", "lang_cluster": "C", "compilation_error": false, "code_uid": "0d7a5785ec6cb2c3b3a0141021492c23", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "include\n#include\n\nint main(){\n\tchar a[10], b[10], x;\n\tint i, j = 0;\n\t\n\tfor(i = 0; i < 4; ++i){\n\t\tscanf(\" %c\", &a[i]);\n\t}\n\tfor(i = 0; i < 4; ++i){\n\t\tscanf(\" %c\", &b[i]);\n\t}\n\t\n\tx = a[2]; a[2] = a[3]; a[3] = x; \n\tx = b[2]; b[2] = b[3]; b[3] = x;\n\t\n\tj = 0;\n\tfor(i = 0; i < 4; ++i){\n\t\tif(a[i] != 'X'){\n\t\t\ta[j] = a[i];\n\t\t\tj++;\n\t\t}\n\t}\n\t\n\tj = 0;\n\tfor(i = 0; i < 4; ++i){\n\t\tif(b[i] != 'X'){\n\t\t\tb[j] = b[i];\n\t\t\tj++;\n\t\t}\n\t}\n\ta[3] = '\\0';\n\tb[3] = '\\0';\n\t\n\twhile(a[0] != b[0]){\n\t\tx = b[0];\n\t\tfor(i = 1; i < 3; ++i){\n\t\t\tb[i-1] = b[i];\n\t\t}\n\t\tb[2] = x;\n\t}\t\n\t\n\tif(strcmp(a, b) == 0){\n\t\tprintf(\"YES\");\n\t}else\n\t\tprintf(\"NO\");\n\t\t\nreturn 0;\t\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4eb74378aa83035f8c1e0949392873f7", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\t\n\tchar a[2][2], b[2][2], aa[4], bb[4];\n\tint i, j, a_x, a_y, b_x, b_y, same=0;\n\n\t//for (i=0; i<2; i++)\n\t//\tscanf(\"%c%c\\n%c%c\\n\", &a[0][0], &a[0][1], &a[1][0], &a[1][1]);\n\tscanf(\"%c%c\\n%c%c\\n\", &aa[0], &aa[3], &aa[1], &aa[2]);\n\t//for (i=0; i<2; i++)\n\t//\tscanf(\"%c%c\\n%c%c\", &b[0][0], &b[0][1], &b[1][0], &b[1][1]);\n\tscanf(\"%c%c\\n%c%c\", &bb[0], &bb[3], &bb[1], &bb[2]);\n\n\t/*printf(\"%s %s\\n\", a[0], b[0]);\n\n\tfor (i=0; i<2; i++){\n\t\tfor (j=0; j<2; j++){\n\t\t\tif ( a[i][j] == 'X' ){\n\t\t\t\ta_x = i; a_y = j;\n\t\t\t}\n\t\t\tif ( b[i][j] == 'X' ){\n\t\t\t\tb_x = i; b_y = j;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d %d %d %d\\n\", a_x, a_y, b_x, b_y); \n*/\n\t//printf(\"%c %c %c %c\\n\", aa[0], aa[1], aa[2], aa[3]);\n\t//printf(\"%c %c %c %c\\n\", bb[0], bb[1], bb[2], bb[3]);\n\n\tfor (i=0; i<4; i++){\n\t\tif (aa[i] == 'X')\n\t\t\tcontinue;\n\t\ta_x = aa[i];\n\n\t\tfor (j=0; j%4<4; j++){\n\t\t\tif (a_x == bb[j])\n\t\t\t\tbreak;\n\t\t}\n\n\t\twhile (1){\n\t\t\tif ( aa[i] == 'X'){\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if ( bb[j%4] == 'X'){\n\t\t\t\tj++;\n\t\t\t\tcontinue;}\n\t\t\t//printf(\"%d %d\\n\", i , j);\n\t\t\tif (i==4)\n\t\t\t\tbreak;\n\t\t\tif ( aa[i++] == bb[(j++)%4] )\n\t\t\t{\n\t\t\t\tsame++;\n\t\t\t}\n\n\t\t\t\n\t\t}\n\t}\n\n\tif ( same==3 )\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "855f057732a72935a383c1534a6e2aa0", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\t\n\tchar a[2][2], b[2][2], aa[4], bb[4];\n\tint i, j, a_x, a_y, b_x, b_y, same=0;\n\n\t//for (i=0; i<2; i++)\n\t//\tscanf(\"%c%c\\n%c%c\\n\", &a[0][0], &a[0][1], &a[1][0], &a[1][1]);\n\tscanf(\"%c%c\\n%c%c\\n\", &aa[0], &aa[3], &aa[1], &aa[2]);\n\t//for (i=0; i<2; i++)\n\t//\tscanf(\"%c%c\\n%c%c\", &b[0][0], &b[0][1], &b[1][0], &b[1][1]);\n\tscanf(\"%c%c\\n%c%c\", &bb[0], &bb[3], &bb[1], &bb[2]);\n\n\t/*printf(\"%s %s\\n\", a[0], b[0]);\n\n\tfor (i=0; i<2; i++){\n\t\tfor (j=0; j<2; j++){\n\t\t\tif ( a[i][j] == 'X' ){\n\t\t\t\ta_x = i; a_y = j;\n\t\t\t}\n\t\t\tif ( b[i][j] == 'X' ){\n\t\t\t\tb_x = i; b_y = j;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d %d %d %d\\n\", a_x, a_y, b_x, b_y); \n*/\n\t//printf(\"%c %c %c %c\\n\", aa[0], aa[1], aa[2], aa[3]);\n\t//printf(\"%c %c %c %c\\n\", bb[0], bb[1], bb[2], bb[3]);\n\n\tfor (i=0; i<4; i++){\n\t\tif (aa[i] == 'X')\n\t\t\tcontinue;\n\t\ta_x = aa[i];\n\n\t\tfor (j=0; j%4<4; j++){\n\t\t\tif (a_x == bb[j])\n\t\t\t\tbreak;\n\t\t}\n\n\t\twhile (1){\n\t\t\tif ( aa[i] == 'X'){\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if ( bb[j%4] == 'X'){\n\t\t\t\tj++;\n\t\t\t\tcontinue;}\n\t\t\t//printf(\"%d %d\\n\", i , j);\n\t\t\tif ( aa[i++] == bb[(j++)%4] )\n\t\t\t{\n\t\t\t\tsame++;\n\t\t\t}\n\n\t\t\tif (i==4)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( same==3 )\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3ba9248e36429e57b6874c14bbb9d84", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n\nint N, M;\nlong long ans;\n\nint main()\n{\n\tscanf(\"%d%d\",&N,&M);\n\tregister int x, z, y;\n\tfor (x=M+1;2*x<=N+1;x++)\n\t{\n\t\tint st=(long long)(N-M-2*x)*(N+1-x)/(M-N-x);\n\t\tif (st<=M) st=M+1;\n\t\tans+=(st-M-1)*(N-M-M);\n\t\tregister long long a, b;\n\t\ta=N+1-x+st-1;\n\t\tb=(long long)x*(2*(N+1-x)-st+1);\n\t\tfor (z=st;z<=N-M;z++)\n\t\t{\n\t\t\ta++;\n\t\t\tb-=x;\n\t\t\ty=b/a;\n\t\t\tif (a*y==b) y--;\n\t\t\tif (y>N-M) y=N-M;\n\t\t\tif (y<=M) break;\n\t\t\tans+=y-M;\n\t\t\tif (2*x\n#include\n#include\n\nint N, M, y, z;\nlong long ans;\n\nint main()\n{\n\tscanf(\"%d%d\",&N,&M);\n\tfor (y=M+1;y<=N-M;y++)\n\t\tfor (z=y;z<=N-M;z++)\n\t\t{\n\t\t\tlong long b, c, d, x1, x2;\n\t\t\tdouble _d;\n\t\t\tb=-y+z-2*(N+1);\n\t\t\tc=(N+1)*y+y*z;\n\t\t\td=b*b-8*c;\n\t\t\tif (d<0) continue;\n\t\t\t_d=sqrt(d);\n\t\t\tx1=floor((-b-_d)*0.25);\n\t\t\tx2=ceil((-b+_d)*0.25);\n\t\t\tif (x1N-M+1) x2=N-M+1;\n\t\t\tif (x2-x1>1) ans+=(x2-x1-1)*(z>y?2:1);\n\t\t}\n\tprintf(\"%I64d\\n\",ans*3);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f72b250e1ef7bdb655ab90f44ba0554", "src_uid": "355cc23d7a4addfc920c6e5e72a2bb64", "difficulty": 2700.0} {"lang": "GNU C", "source_code": "#include\n\nint N, M;\nlong long ans;\n\nint main()\n{\n\tscanf(\"%d%d\",&N,&M);\n\tregister int x, z, y;\n\tfor (x=M+1;2*x<=N+1;x++)\n\t{\n\t\tint st=(long long)(N-M-2*x)*(N+1-x)/(M-N-x);\n\t\tif (st<=M) st=M+1;\n\t\tans+=(st-M-1)*(N-M-M);\n\t\tregister int a;\n\t\tregister long long b;\n\t\ta=N+1-x+st-1;\n\t\tb=(long long)x*(2*(N+1-x)-st+1);\n\t\ty=M+1;\n\t\tfor (z=st;z<=N-M && y>M;z++)\n\t\t{\n\t\t\ta++;\n\t\t\tb-=x;\n\t\t\ty=b/a;\n\t\t\tif (a*y==b) y--;\n\t\t\tans+=(y-M)*((2*x\n\nint N, M;\nlong long ans;\n\nint main()\n{\n\tscanf(\"%d%d\",&N,&M);\n\tregister int x, z, y;\n\tfor (x=M+1;2*x<=N+1;x++)\n\t{\n\t\tint st=(long long)(N-M-2*x)*(N+1-x)/(M-N-x);\n\t\tif (st<=M) st=M+1;\n\t\tans+=(st-M-1)*(N-M-M);\n\t\tregister int a;\n\t\tregister long long b;\n\t\ta=N+1-x+st-1;\n\t\tb=(long long)x*(2*(N+1-x)-st+1)-1;\n\t\ty=M+1;\n\t\tfor (z=N-2*M;z && y>M;z--)\n\t\t\tans+=((y=(b-=x)/++a)-M)*((2*x\n\nint N, M;\nlong long ans;\n\n#define f(x,y) ((x)*(x)+(y)*(y)-(x)*(y))\n\nint main()\n{\n\tscanf(\"%d%d\",&N,&M);\n\tregister int x1, x2, y, z;\n\tfor (y=M+1;y<=N-M;y++)\n\t\tfor (x1=M+1,x2=N-M,z=y;z<=N-M;z++)\n\t\t{\n\t\t\tint t(f(N+1-y,N+1-z));\n\t\t\twhile (x1=0) x1++;\n\t\t\twhile (x2>M+1 && f(x2,y)+f(N+1-x2,z)-t>=0) x2--;\n\t\t\tif (x1>x2) break;\n\t\t\tans+=(x2-x1+1)*((z>y)+1);\n\t\t}\n\tprintf(\"%I64d\\n\",ans*3);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d71f925ba9bdebf879d2197ae4705244", "src_uid": "355cc23d7a4addfc920c6e5e72a2bb64", "difficulty": 2700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define mod 1000000009\n#define max(a,b) ((a)>(b)?(a):(b))\n\nchar str[15][15]={0};\nchar prefix[106][15]={0};\nlong o=0;\nlong g[106][4]={0},m;\nchar gene[5]=\"ACGT\";\n\nlong f[1006][106][15]={0};\nlong a[106]={0};\nchar opt[15]={0};\n\nlong find(char opt[],long l,long r)\n{\n long i,j,k;\n long a[15]={0};\n \n for(i=1;i<=m;i++)\n {\n for(j=1;opt[j];j++)\n {\n for(k=0;opt[j+k]==str[i][1+k]&&opt[j+k]&&str[i][1+k];k++);\n if(!str[i][1+k])\n for(k=0;str[i][1+k];k++)\n a[j+k]=1;\n }\n }\n for(j=l;j<=r;j++)\n if(!a[j])\n return 0;\n return 1;\n}\n\nlong search(char opt[],long l)\n{\n long i,j,k;\n long a[15]={0};\n \n for(i=1;i<=m;i++)\n {\n for(j=1;opt[j];j++)\n {\n for(k=0;opt[j+k]==str[i][1+k]&&opt[j+k]&&str[i][1+k];k++);\n if(!str[i][1+k])\n for(k=0;str[i][1+k];k++)\n a[j+k]=1;\n }\n }\n for(i=l+1;a[i];i++);\n return i-1;\n}\n\nint main()\n{\n long n,i,j,k,l,t;\n long ans=0;\n char ch;\n \n scanf(\"%ld%ld\",&n,&m);\n for(i=1;i<=m;i++)\n scanf(\"%s\",str[i]+1);\n for(i=1;i<=m;i++)\n for(j=1;str[i][j];j++)\n {\n ch=str[i][j+1];\n str[i][j+1]=0;\n for(k=1;k<=o;k++)\n if(strcmp(prefix[k]+1,str[i]+1)==0)\n break;\n if(k>o)\n {\n strcpy(prefix[++o]+1,str[i]+1);\n prefix[o][0]=strlen(prefix[o]+1);\n }\n str[i][j+1]=ch;\n if(!str[i][j+1])\n a[k]=1;\n }\n \n for(i=0;i<=o;i++)\n {\n for(j=0;j<4;j++)\n {\n // prefix[i][prefix[i][0]+1]=gene[j];\n memset(opt,0,sizeof(opt));\n strcpy(opt,prefix[i]);\n opt[opt[0]+1]=gene[j];\n for(k=1;k<=prefix[i][0]+1;k++)\n for(l=1;l<=o;l++)\n {\n if(strcmp(opt+k,prefix[l]+1)==0)\n {\n g[i][j]=l;\n goto loop;\n }\n }\n loop:;\n }\n //prefix[i][prefix[i][0]+1]=0;\n }\n \n f[0][0][0]=1;\n for(i=0;i=0||find(opt,k+1,prefix[j][0]+1-prefix[g[j][l]][0]))\n t=search(opt,k);\n if(t>=prefix[j][0]+1-prefix[g[j][l]][0])\n {\n f[i+1][g[j][l]][t-(prefix[j][0]+1-prefix[g[j][l]][0])]+=f[i][j][k];\n f[i+1][g[j][l]][t-(prefix[j][0]+1-prefix[g[j][l]][0])]%=1000000009;\n }\n }\n }\n for(j=1;j<=o;j++)\n for(k=0;k<=prefix[j][0];k++)\n if(find(prefix[j],k+1,prefix[j][0]))\n {\n ans+=f[n][j][k];\n ans%=mod;\n }\n printf(\"%ld\\n\",ans);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ac72fa102f7fad02b3b46e5eba9cad9c", "src_uid": "3f053c07deaac55c2c51df6147080340", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define M 1000000009\n\ntypedef long long LL;\nint n,m,sz,son[110][4],fail[110],term[110],par[110],l[110],q[110],dig[110];\nLL f[1010][110][20];\nLL dp(int i,int u,int o);\n\nint main(void)\n{\n //freopen(\"gene.in\",\"r\",stdin);\n //freopen(\"gene.out\",\"w\",stdout);\n scanf(\"%d%d\",&n,&m);\n memset(son,0,sizeof(son));\n memset(term,0,sizeof(term));\n sz=1; l[1]=0;\n int i,j,u,v,t,d;\n char str[20];\n for(i=1;i<=m;i++)\n {\n scanf(\"%s\",str);\n for(u=1,j=0;str[j];j++)\n {\n if(str[j]=='A') t=0;\n else if(str[j]=='C') t=1;\n else if(str[j]=='G') t=2;\n else t=3;\n if(!son[u][t])\n {\n l[++sz]=l[u]+1;\n son[u][t]=sz;\n }\n par[son[u][t]]=u;\n u=son[u][t];\n }\n term[u]=1;\n }\n memset(fail,-1,sizeof(fail));\n fail[1]=0;\n for(i=0;i<4;i++)\n fail[son[1][i]]=1;\n int front=1,rear=1;\n q[1]=1;\n while(front<=rear)\n {\n u=q[front]; d=dig[front];\n front++;\n if(fail[u]<0)\n for( fail[u]=1,v=fail[par[u]] ; v ; v=fail[v] )\n if(son[v][d])\n {\n fail[u]=son[v][d];\n break;\n }\n for(i=0;i<4;i++)\n if(son[u][i])\n {\n rear++;\n q[rear]=son[u][i]; dig[rear]=i;\n }\n }\n memset(f,-1,sizeof(f));\n printf(\"%I64d\\n\",dp(0,1,0));\n return 0;\n}\n\nLL dp(int i,int u,int o)\n{\n if(f[i][u][o]>=0) return f[i][u][o];\n else if(i==n)\n return f[i][u][o] = o ? 0 : 1;\n f[i][u][o]=0;\n int j,v,w,t;\n for(j=0;j<4;j++)\n {\n for( w=0,v=u ; v&&l[v]>=o ; v=fail[v] )\n if(son[v][j])\n {\n w=son[v][j];\n break;\n }\n if(w)\n {\n for(t=w;l[t]>=o+1;t=fail[t])\n if(term[t]) break;\n f[i][u][o] = ( f[i][u][o] + dp(i+1,w,l[t]\n#include \n\n#define dimension 1000000009\n#define maximo(a,b) ((a)>(b)?(a):(b))\n\nchar mat[15][15]={0};\nchar prefix[106][15]={0};\nlong o=0;\nlong g[106][4]={0},m;\nchar gene[5]=\"ACGT\";\n\nlong f[1006][106][15]={0};\nlong a[106]={0};\nchar opt[15]={0};\n\nlong find(char opt[],long l,long r)\n{\n long i,j,k;\n long a[15]={0};\n\n for(i=1;i<=m;i++)\n {\n for(j=1;opt[j];j++)\n {\n for(k=0;opt[j+k]==mat[i][1+k]&&opt[j+k]&&mat[i][1+k];k++);\n if(!mat[i][1+k])\n for(k=0;mat[i][1+k];k++)\n a[j+k]=1;\n }\n }\n for(j=l;j<=r;j++)\n if(!a[j])\n return 0;\n return 1;\n}\n\nlong search(char opt[],long l)\n{\n long i,j,k;\n long a[15]={0};\n\n for(i=1;i<=m;i++)\n {\n for(j=1;opt[j];j++)\n {\n for(k=0;opt[j+k]==mat[i][1+k]&&opt[j+k]&&mat[i][1+k];k++);\n if(!mat[i][1+k])\n for(k=0;mat[i][1+k];k++)\n a[j+k]=1;\n }\n }\n for(i=l+1;a[i];i++);\n return i-1;\n}\n\nint main()\n{\n long n,i,j,k,l,t;\n long ans=0;\n char ch;\n\n scanf(\"%ld%ld\",&n,&m);\n for(i=1;i<=m;i++)\n scanf(\"%s\",mat[i]+1);\n for(i=1;i<=m;i++)\n for(j=1;mat[i][j];j++)\n {\n ch=mat[i][j+1];\n mat[i][j+1]=0;\n for(k=1;k<=o;k++)\n if(strcmp(prefix[k]+1,mat[i]+1)==0)\n break;\n if(k>o)\n {\n strcpy(prefix[++o]+1,mat[i]+1);\n prefix[o][0]=strlen(prefix[o]+1);\n }\n mat[i][j+1]=ch;\n if(!mat[i][j+1])\n a[k]=1;\n }\n\n for(i=0;i<=o;i++)\n {\n for(j=0;j<4;j++)\n {\n memset(opt,0,sizeof(opt));\n strcpy(opt,prefix[i]);\n opt[opt[0]+1]=gene[j];\n for(k=1;k<=prefix[i][0]+1;k++)\n for(l=1;l<=o;l++)\n {\n if(strcmp(opt+k,prefix[l]+1)==0)\n {\n g[i][j]=l;\n goto loop;\n }\n }\n loop:;\n }\n //prefix[i][prefix[i][0]+1]=0;\n }\n\n f[0][0][0]=1;\n for(i=0;i=0||find(opt,k+1,prefix[j][0]+1-prefix[g[j][l]][0]))\n t=search(opt,k);\n if(t>=prefix[j][0]+1-prefix[g[j][l]][0])\n {\n f[i+1][g[j][l]][t-(prefix[j][0]+1-prefix[g[j][l]][0])]+=f[i][j][k];\n f[i+1][g[j][l]][t-(prefix[j][0]+1-prefix[g[j][l]][0])]%=1000000009;\n }\n }\n }\n for(j=1;j<=o;j++)\n for(k=0;k<=prefix[j][0];k++)\n if(find(prefix[j],k+1,prefix[j][0]))\n {\n ans+=f[n][j][k];\n ans%=dimension;\n }\n printf(\"%ld\\n\",ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a4d54c0036eec8bdf32859f28c5db61d", "src_uid": "3f053c07deaac55c2c51df6147080340", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i= len[i]) if(ok_len + len[i] >= now_len){\n if(is_same(in[i], now+now_len-len[i], len[i])) match = 1;\n }\n\n next_word = 0; next_word_len = 0; next_ok_len = 0;\n if(match) fin = 1;\n \n rep(i,n) REP(j,1,len[i]){\n if(next_word_len >= j) continue;\n if(is_same(in[i],now+now_len-j,j)==0) continue;\n\n if(match) ok_chk = j;\n else ok_chk = ok_len - (now_len - j);\n\n if(ok_chk < 0) continue;\n\n fin = 1;\n next_word = i;\n next_word_len = j;\n next_ok_len = ok_chk;\n }\n\n if(fin==0){edge1[word][word_len][ok_len][k] = -1; continue;}\n edge1[word][word_len][ok_len][k] = next_word;\n edge2[word][word_len][ok_len][k] = next_word_len;\n edge3[word][word_len][ok_len][k] = next_ok_len;\n }\n}\n\nint solve(int depth, int word, int word_len, int ok_len){\n int i,j,k;\n int next_word, next_word_len, next_ok_len;\n int res = 0;\n\n if(dp[depth][word][word_len][ok_len] >= 0) return dp[depth][word][word_len][ok_len];\n if(depth==lim){\n if(word_len==ok_len) res++;\n return dp[depth][word][word_len][ok_len] = res;\n }\n\n rep(k,4){\n if(edge1[word][word_len][ok_len][k] < 0) continue;\n next_word = edge1[word][word_len][ok_len][k];\n next_word_len = edge2[word][word_len][ok_len][k];\n next_ok_len = edge3[word][word_len][ok_len][k];\n\n res += solve(depth+1, next_word, next_word_len, next_ok_len);\n res %= M;\n }\n\n return dp[depth][word][word_len][ok_len] = res;\n}\n\nint main(){\n int i,j,k,l,m,res;\n\n while(scanf(\"%d%d\",&lim,&n)==2){\n rep(i,n) scanf(\"%s\",in[i]);\n rep(i,n){\n for(j=0;;j++) if(in[i][j]<' ') break;\n len[i] = j;\n }\n\n rep(i,1011) rep(j,12) rep(k,12) rep(l,12) dp[i][j][k][l] = -1;\n edge_generator();\n\n res = solve(0,0,0,0);\n printf(\"%d\\n\",res);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9155c0638576ac26f4e2fb077e5bdce7", "src_uid": "3f053c07deaac55c2c51df6147080340", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i= len[i]) if(ok_len + len[i] >= now_len){\n if(is_same(in[i], now+now_len-len[i], len[i])) match = 1;\n }\n\n next_word = 0; next_word_len = 0; next_ok_len = 0;\n if(match) fin = 1;\n \n rep(i,n) REP(j,1,len[i]){\n if(next_word_len >= j) continue;\n if(is_same(in[i],now+now_len-j,j)==0) continue;\n\n if(match) ok_chk = j;\n else ok_chk = ok_len - (now_len - j);\n\n if(ok_chk < 0) continue;\n\n fin = 1;\n next_word = i;\n next_word_len = j;\n next_ok_len = ok_chk;\n }\n\n if(fin==0){edge1[word][word_len][ok_len][k] = -1; continue;}\n edge1[word][word_len][ok_len][k] = next_word;\n edge2[word][word_len][ok_len][k] = next_word_len;\n edge3[word][word_len][ok_len][k] = next_ok_len;\n }\n}\n\nint solve(int depth, int word, int word_len, int ok_len){\n int i,j,k;\n int next_word, next_word_len, next_ok_len;\n int res = 0;\n\n if(dp[depth][word][word_len][ok_len] >= 0) return dp[depth][word][word_len][ok_len];\n if(depth==lim){\n if(word_len==ok_len) res++;\n return dp[depth][word][word_len][ok_len] = res;\n }\n\n rep(k,4){\n if(edge1[word][word_len][ok_len][k] < 0) continue;\n next_word = edge1[word][word_len][ok_len][k];\n next_word_len = edge2[word][word_len][ok_len][k];\n next_ok_len = edge3[word][word_len][ok_len][k];\n\n res += solve(depth+1, next_word, next_word_len, next_ok_len);\n res %= M;\n }\n\n return dp[depth][word][word_len][ok_len] = res;\n}\n\nint main(){\n int i,j,k,l,m,res;\n\n while(scanf(\"%d%d\",&lim,&n)==2){\n rep(i,n) scanf(\"%s\",in[i]);\n rep(i,n){\n for(j=0;;j++) if(in[i][j]<' ') break;\n len[i] = j;\n }\n\n rep(i,1011) rep(j,12) rep(k,12) rep(l,12) dp[i][j][k][l] = -1;\n edge_generator();\n\n res = solve(0,0,0,0);\n printf(\"%d\\n\",res);\n }\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fca0d3946702cca21d3b2633ee0df046", "src_uid": "3f053c07deaac55c2c51df6147080340", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n\nint\nmain ()\n{\n int a, b, mod;\n long long i;\n scanf (\"%d %d %d\", &a, &b, &mod);\n if (b >= mod)\n {\n printf (\"2\\n\");\n return 0;\n }\n for (i = 0; i <= a && i < mod; i++)\n if ((i * 1000000000) % mod != 0 && ((i * 1000000000) % mod + b) < mod)\n {\n\tprintf (\"1 %09d\\n\", (int)i);\n\treturn 0;\n }\n printf (\"2\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9b680984e3fb7ac34f8c969dba72a6b4", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\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\",&T)\n#define Print(T) printf(\"%d\\n\",T)\n#define LL long long\n#define MAXN 214748364\nint N,a,b,mod;\n_Bool H[10000002];\nvoid init();\nvoid doit();\nvoid print(int);\nint main()\n{\n //Opfile_in(\"BUAA_temp.in\");\n scanf(\"%d%d%d\",&a,&b,&mod);\n doit();\n return 0;\n}\nvoid doit()\n{\n int i,k,tmp,t;\n for(tmp=i=1;i<=9;i++)\n tmp=tmp*10 % mod;\n if(tmp==0||mod==1||b>=mod) {Print(2);return;}\n k=min(mod,a);\n for(t=tmp,i=1;i<=k;i++)\n if(!H[i])\n {\n if(t0) {print(i);return ;}\n t=(t+tmp) % mod;\n if(t>mod) t-=mod;\n }\n Print(2);\n}\nvoid print(int k)\n{\n int L=0,i,t = k;\n printf(\"1 \");\n while(t /= 10) L++;\n for(i=1;i<9-L;i++)\n printf(\"0\");\n Print(k);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa4231c8627954cd7db1977d420230b7", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\n#define M 1000000000LL\n#define min(x,y) ((x)>(y)?(y):(x))\n\nint main() {\n\tint a, b, mod;\n\tint i, t, winner;\n\tlong long p;\n\twinner = 2;\n\tscanf(\"%d%d%d\", &a, &b, &mod);\n\tt = min(a+1, mod);\n\tfor (i = 0; i < t; ++i) {\n\t\tp = M * i % mod;\n\t\tif (p > 0 && p + b < mod) {\n\t\t\twinner = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (winner == 1) {\n\t\tprintf(\"1 %09d\", i);\n\t} else {\n\t\tprintf(\"2\");\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "086a840df1da425792ed51c308cfe0de", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n long a,b,mod,i,j;\n \n scanf(\"%ld%ld%ld\",&a,&b,&mod);\n for(i=0;i<=a&&i\n\nint main()\n{\n int a, b, m, i;\n\n scanf(\"%d %d %d\", &a, &b, &m);\n\n if (b >= m - 1) {\n\t puts(\"2\");\n } else {\n\t for (i = 0; i < m; i++) {\n\t int p = (long long)i * 1000000000 % m;\n\n\t if (p > 0 && p <= m - b - 1) break;\n\t }\n\n\t if (i < m) {\n\t printf(\"1 %09d\\n\", i);\n\t } else {\n\t puts(\"2\");\n\t }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "690b69cd80715d0328d23ed5a98b8648", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint max=0;\nint a[10];//\ufffd\ufffd\ufffd\u4a2c? \nint p[100];\ntypedef struct Ch\n{\n\tint val;\n\tint mvrg;\n\tint thrg;\n};\ntypedef struct Ch CA[4];\nint movethrow(CA,int);\n\nint search(int pe)\n{\n\tint i,t;\n\tfor (i=1;i<45;i++)\t\n\t{\n\t\tif (p[i]>0)\n\t\t{\n\t\t\tt=p[i];\n\t\t\twhile (t)\n\t\t\t{\n\t\t\t\tif ((t%10)==pe)\n\t\t\t\t\treturn i;\n\t\t\t\tt=t/10;\n\t\t\t}\n\t\t}\n\t}\n}\nint ans(CA C)\n{\n\tint i,t;\n\tfor (i=44;i>=1;i--)\t\n\t{\n\t\tif (p[i]>0)\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\treturn 0;\n\t\t}\n\t}\n}\nint change(int pe,int pos)\n{\n\tint t;\n\tt=search(pe);\n\tp[t]=0;\n\tp[pos]=pe;\n\t\n}\nint tr(CA C,int pe)\n{\n\tint i,j;\n\tint f,m,r;\n\tint temp;\n\tm=search(pe);\n\ttemp=p[m];\n\tf=m-C[pe].thrg;\n\tr=m+C[pe].thrg;\n\tif (f<=0)\n\t\tf=1;\n\tfor (i=f;i<=r;i++)\n\t{\n\t\tif (i!=m&&p[i]==0)\n\t\t{\n\t\t\tp[i]=temp/10;\n\t\t\tp[m]=temp%10;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tans(C);\n\t\t\tp[i]=0;\n\t\t\tp[m]=temp;\n\t\t}\n\t}\n\treturn 0;\n}\nint mv(CA C,int pe)\n{\n\tint i,j;\n\tint f,m,r;\n\tm=search(pe);\n\tf=m-C[pe].mvrg;\n\tr=m+C[pe].mvrg;\n\tif (f<=0)\n\t\tf=1;\n\tfor (i=f;i<=r;i++)\n\t{\n\t\tif (i!=m&&p[i]==0)\n\t\t{\n\t\t\tchange(pe,i);\n\t\t\t\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tans(C);\n\t\t}\n\t}\n\tchange(pe,m);\n\treturn 0;\n}\n\nint movethrow(CA C,int fr)\n{\n\tint i,j;\n\tint rt;\n\tif (fr%3==1)\n\t{\n\t\trt=fr/3+1;\n\t\tif (a[fr+1]==1&&a[fr+2]==0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[search(rt)]>10)\n\t\t{\n\t\t\treturn 0;\n\t \t}\n\t\telse\n\t\t{\n\t\t\tmv(C,rt);\n\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\tif (fr%3==2)\n\t{\n\t\tint px;\n\t\trt=fr/3+1;\n\t\tpx=search(rt);\n\t\tif (p[px]>10)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[px-1]>0)\n\t\t{\n\t\t\tint temp;\n\t\t\tp[px]+=p[px-1]*10;\n\t\t\ttemp=p[px-1];\n\t\t\tp[px-1]=0;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[px]=rt;\n\t\t\tp[px-1]=temp;\n\t\t}\n\t\telse if (p[px+1]>0)\n\t\t{\n\t\t\tint temp;\n\t\t\tp[px]+=p[px+1]*10;\n\t\t\ttemp=p[px+1];\n\t\t\tp[px+1]=0;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[px]=rt;\n\t\t\tp[px+1]=temp;\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif (fr%3==0)\n\t{\n\t\trt=fr/3;\n\t\tint px;\n\t\tpx=search(rt);\n\t\tif (a[fr-1]==0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[px]%10!=rt)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse \n\t\t{\n\t\t\ttr(C,rt);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\nint main()\n{\n\tCA C;\n\tint i,j;\n\tfor (i=1;i<100;i++)\n\t{\n\t\tp[i]=0;\n\t}\n\tfor (i=1;i<=3;i++)\n\t{\n\t\tscanf(\"%d %d %d\",&C[i].val,&C[i].mvrg,&C[i].thrg);\n\t\tp[C[i].val]=i;\n\t}\n\tfor (i=0;i<=9;i++)\n\t{\n\t\ta[i]=0;\n\t}\n\tfor (i=1;i<=9;i++)\n\t{\n\t\ta[i]=1;a[0]++;\n\t\tmovethrow(C,i);\n\t\ta[i]=0;a[0]--;\n\t}\n\t\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7ed16c7478e62c8d1f0ed69ca777e128", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n#define my_abs(x) ((x) < 0 ? -(x) : (x))\n#define chk(x) (x != p[0] && x != p[1] && x != p[2])\n#define min(x, y) ((x) < (y) ? (x) : (y))\n#define max(x, y) ((x) > (y) ? (x) : (y))\n#define true 1\ntypedef int bool; \nbool vis[55][55][55][9][9]; \nint p[5], m[5], t[5], ans; \nvoid dfs(int *p, int x, int y)\n{\n\tif (vis[p[0]][p[1]][p[2]][x][y])\n\t\treturn; \n\tvis[p[0]][p[1]][p[2]][x][y] = true; \n\tint far = 0, near = 50; \n\tfor (int i = 0; i < 3; i++)\n\t{\n\t\tif (p[i] < 45)\n\t\t\tfar = max(far, p[i]); \n\t\tnear = min(near, p[i]);\n\t}\n\tans = max(ans, far); \n\tfor (int j = 0; j < 3; j++)\n\t{\n\t\tint arr[] = {p[0], p[1], p[2]}, z = 1 << j; \n\t\tif (p[j] >= 45)\n\t\t{\n\t\t\tint pos = p[j] - 45; \n\t\t\tif (p[pos] >= 45)\n\t\t\t\tcontinue;\n\t\t\tfor (int i = p[pos] + t[pos]; i >= p[pos] - t[pos] && i > near - 2 && i; i--)\n\t\t\t{\n\t\t\t\tif (chk(i))\n\t\t\t\t{\n\t\t\t\t\tarr[j] = i; \n\t\t\t\t\tdfs(arr, x, y); \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (chk(j + 45))\n\t\t{\n\t\t\tif (y & z)\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t{\n\t\t\t\t\tif (my_abs(p[i] - p[j]) != 1)\n\t\t\t\t\t\tcontinue; \n\t\t\t\t\tarr[i] = 45 + j; \n\t\t\t\t\tdfs(arr, x, y ^ z); \n\t\t\t\t\tarr[i] = p[i]; \n\t\t\t\t}\n\t\t\t}\n\t\t\tif (x & z)\n\t\t\t{\n\t\t\t\tfor (int i = p[j] + m[j]; i >= p[j] - m[j] && i > near - 2 && i; i--)\n\t\t\t\t{\n\t\t\t\t\tif (!chk(i))\n\t\t\t\t\t\tcontinue; \n\t\t\t\t\tarr[j] = i; \n\t\t\t\t\tdfs(arr, x ^ z, y); \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\nint main()\n{\n\t// freopen(\"105E.in\", \"r\", stdin); \n\tfor (int i = 0; i < 3; i++)\n\t\tscanf(\"%d%d%d\", p + i, m + i, t + i); \n\tdfs(p, 7, 7); \n\tprintf(\"%d\\n\", ans);\n\treturn 0; \n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e4892d544e9f4c912f700a68ad42ccf8", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint max=0;\nint a[10];\nint p[100];\ntypedef struct\n{\n\tint val;\n\tint mvrg;\n\tint thrg;\n}Ch;\ntypedef Ch CA[4];\nint movethrow(CA,int);\nint search(int pe)\n{\n\tint i,t;\n\tfor (i=1;i<45;i++)\t\n\t{\n\t\tif (p[i]>0)\n\t\t{\n\t\t\tt=p[i];\n\t\t\twhile (t)\n\t\t\t{\n\t\t\t\tif ((t%10)==pe)\n\t\t\t\t\treturn i;\n\t\t\t\tt=t/10;\n\t\t\t}\n\t\t}\n\t}\n}\nint change(int pe,int pos)\n{\n\tint t;\n\tt=search(pe);\n\tp[t]=0;\n\tp[pos]=pe;\n\t\n}\nint tr(CA C,int pe)\n{\n\tint i,j;\n\tint f,m,r,t[4];\n\tint temp;\n\tt[1]=search(1);\n\tt[2]=search(2);\n\tt[3]=search(3);\n\tm=t[pe];\n\ttemp=p[m];\n\tf=m-C[pe].thrg;\n\tr=m+C[pe].thrg;\n\tif (r>max)\n\t\tmax=r;\n\tif (f<=0)\n\t\tf=1;\n\tfor (i=f;i<=r;i++)\n\t{\n\t\tif (i!=m&&p[i]==0&&\n\t\t\t(abs(i-t[1])==1||abs(i-t[2]==1)||abs(i-t[3])==1||i==r))\n\t\t{\n\t\t\t\n\t\t\tp[i]=temp/10;\n\t\t\tp[m]=temp%10;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[i]=0;\n\t\t\tp[m]=temp;\n\t\t}\n\t}\n\treturn 0;\n}\nint mv(CA C,int pe)\n{\n\tint i,j;\n\tint f,m,r,t[4];\n\tt[1]=search(1);\n\tt[2]=search(2);\n\tt[3]=search(3);\n\tint temp;\n\ttemp=t[pe];\n\tm=t[pe];\n\tt[pe]=t[3];\n\tt[3]=temp;\n\tf=m-C[pe].mvrg;\n\tr=m+C[pe].mvrg;\n\tif (r>max)\n\t\tmax=r;\n\tif (f<=0)\n\t\tf=1;\n\tfor (i=f;i<=r;i++)\n\t{\n\t\tif (i!=m&&p[i]==0&&\n\t\t\t(abs(i-t[1])<=2||abs(i-t[2]<=2)||abs(i-t[3])<=1||i==r))\n\t\t{\n\t\t\tchange(pe,i);\n\t\t\t\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tchange(pe,m);\n\treturn 0;\n}\n\nint movethrow(CA C,int fr)\n{\n\tint i,j;\n\tint rt;\n\tif (fr%3==1)\n\t{\n\t\trt=fr/3+1;\n\t\tif (a[fr+1]==1&&a[fr+2]==0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[search(rt)]>10)\n\t\t{\n\t\t\treturn 0;\n\t \t}\n\t\telse\n\t\t{\n\t\t\tmv(C,rt);\n\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\tif (fr%3==2)\n\t{\n\t\tint px;\n\t\trt=fr/3+1;\n\t\tpx=search(rt);\n\t\tif (p[px]>10)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[px-1]>0)\n\t\t{\n\t\t\tint temp;\n\t\t\tp[px]+=p[px-1]*10;\n\t\t\ttemp=p[px-1];\n\t\t\tp[px-1]=0;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[px]=rt;\n\t\t\tp[px-1]=temp;\n\t\t}\n\t\telse if (p[px+1]>0)\n\t\t{\n\t\t\tint temp;\n\t\t\tp[px]+=p[px+1]*10;\n\t\t\ttemp=p[px+1];\n\t\t\tp[px+1]=0;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[px]=rt;\n\t\t\tp[px+1]=temp;\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif (fr%3==0)\n\t{\n\t\trt=fr/3;\n\t\tint px;\n\t\tpx=search(rt);\n\t\tif (a[fr-1]==0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[px]%10!=rt)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse \n\t\t{\n\t\t\ttr(C,rt);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\nint main()\n{\n\tCA C;\n\tint i,j;\n\tfor (i=1;i<100;i++)\n\t{\n\t\tp[i]=0;\n\t}\n\tfor (i=1;i<=3;i++)\n\t{\n\t\tscanf(\"%d %d %d\",&C[i].val,&C[i].mvrg,&C[i].thrg);\n\t\tp[C[i].val]=i;\n\t}\n\tfor (i=0;i<=9;i++)\n\t{\n\t\ta[i]=0;\n\t}\n\tfor (i=1;i<=9;i++)\n\t{\n\t\ta[i]=1;a[0]++;\n\t\tmovethrow(C,i);\n\t\ta[i]=0;a[0]--;\n\t}\n\t\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "54bbb0ed5d345cb9f36e4785a1b6303f", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nint max=0;\nint a[10];\nint p[100];\ntypedef struct\n{\n\tint val;\n\tint mvrg;\n\tint thrg;\n}Ch;\ntypedef Ch CA[4];\nint movethrow(CA,int);\n\nint search(int pe)\n{\n\tint i,t;\n\tfor (i=1;i<45;i++)\t\n\t{\n\t\tif (p[i]>0)\n\t\t{\n\t\t\tt=p[i];\n\t\t\twhile (t)\n\t\t\t{\n\t\t\t\tif ((t%10)==pe)\n\t\t\t\t\treturn i;\n\t\t\t\tt=t/10;\n\t\t\t}\n\t\t}\n\t}\n}\nint change(int pe,int pos)\n{\n\tint t;\n\tt=search(pe);\n\tp[t]=0;\n\tp[pos]=pe;\n\t\n}\nint tr(CA C,int pe)\n{\n\tint i,j;\n\tint f,m,r,t[3];\n\tint temp;\n\tt[1]=search(1);\n\tt[2]=search(2);\n\tt[3]=search(3);\n\tm=search(pe);\n\ttemp=p[m];\n\tf=m-C[pe].thrg;\n\tr=m+C[pe].thrg;\n\tif (r>max)\n\t\tmax=r;\n\tif (f<=0)\n\t\tf=1;\n\tfor (i=f;i<=r;i++)\n\t{\n\t\tif (i!=m&&p[i]==0&&\n\t\t\t(abs(i-t[1])==1||abs(i-t[2]==1)||abs(i-t[3])==1||i==r))\n\t\t{\n\t\t\tp[i]=temp/10;\n\t\t\tp[m]=temp%10;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[i]=0;\n\t\t\tp[m]=temp;\n\t\t}\n\t}\n\treturn 0;\n}\nint mv(CA C,int pe)\n{\n\tint i,j;\n\tint f,m,r,t[3];\n\tt[1]=search(1);\n\tt[2]=search(2);\n\tt[3]=search(3);\n\tm=search(pe);\n\tf=m-C[pe].mvrg;\n\tr=m+C[pe].mvrg;\n\tif (r>max)\n\t\tmax=r;\n\tif (f<=0)\n\t\tf=1;\n\tfor (i=f;i<=r;i++)\n\t{\n\t\tif (i!=m&&p[i]==0&&\n\t\t\t(abs(i-t[1])==1||abs(i-t[2]==1)||abs(i-t[3])==1||i==r))\n\t\t{\n\t\t\tchange(pe,i);\n\t\t\t\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tchange(pe,m);\n\treturn 0;\n}\n\nint movethrow(CA C,int fr)\n{\n\tint i,j;\n\tint rt;\n\tif (fr%3==1)\n\t{\n\t\trt=fr/3+1;\n\t\tif (a[fr+1]==1&&a[fr+2]==0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[search(rt)]>10)\n\t\t{\n\t\t\treturn 0;\n\t \t}\n\t\telse\n\t\t{\n\t\t\tmv(C,rt);\n\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\tif (fr%3==2)\n\t{\n\t\tint px;\n\t\trt=fr/3+1;\n\t\tpx=search(rt);\n\t\tif (p[px]>10)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[px-1]>0)\n\t\t{\n\t\t\tint temp;\n\t\t\tp[px]+=p[px-1]*10;\n\t\t\ttemp=p[px-1];\n\t\t\tp[px-1]=0;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[px]=rt;\n\t\t\tp[px-1]=temp;\n\t\t}\n\t\telse if (p[px+1]>0)\n\t\t{\n\t\t\tint temp;\n\t\t\tp[px]+=p[px+1]*10;\n\t\t\ttemp=p[px+1];\n\t\t\tp[px+1]=0;\n\t\t\tfor (j=1;j<=9;j++)\n\t\t\t{\n\t\t\t\tif (a[j]==0)\n\t\t\t\t{\n\t\t\t\t\ta[j]=1;a[0]++;\n\t\t\t\t\tmovethrow(C,j);\n\t\t\t\t\ta[j]=0;a[0]--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp[px]=rt;\n\t\t\tp[px+1]=temp;\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif (fr%3==0)\n\t{\n\t\trt=fr/3;\n\t\tint px;\n\t\tpx=search(rt);\n\t\tif (a[fr-1]==0)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse if (p[px]%10!=rt)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse \n\t\t{\n\t\t\ttr(C,rt);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\nint main()\n{\n\tCA C;\n\tint i,j;\n\tfor (i=1;i<100;i++)\n\t{\n\t\tp[i]=0;\n\t}\n\tfor (i=1;i<=3;i++)\n\t{\n\t\tscanf(\"%d %d %d\",&C[i].val,&C[i].mvrg,&C[i].thrg);\n\t\tp[C[i].val]=i;\n\t}\n\tfor (i=0;i<=9;i++)\n\t{\n\t\ta[i]=0;\n\t}\n\tfor (i=1;i<=9;i++)\n\t{\n\t\ta[i]=1;a[0]++;\n\t\tmovethrow(C,i);\n\t\ta[i]=0;a[0]--;\n\t}\n\t\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b2396ea530f3e86cee591fcd354db60f", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n#define my_abs(x) ((x) < 0 ? -(x) : (x))\n#define chk(x) (x != p[0] && x != p[1] && x != p[2])\nbool vis[55][55][55][9][9]; \nint p[5], m[5], t[5], ans; \nvoid dfs(int *p, int x, int y)\n{\n\tif (vis[p[0]][p[1]][p[2]][x][y])\n\t\treturn; \n\tvis[p[0]][p[1]][p[2]][x][y] = true; \n\tint far = 0, near = 50; \n\tfor (int i = 0; i < 3; i++)\n\t{\n\t\tif (p[i] < 45)\n\t\t\tfar = max(far, p[i]); \n\t\tnear = min(near, p[i]);\n\t}\n\tans = max(ans, far); \n\tfor (int j = 0; j < 3; j++)\n\t{\n\t\tint arr[] = {p[0], p[1], p[2]}, z = 1 << j; \n\t\tif (p[j] >= 45)\n\t\t{\n\t\t\tint pos = p[j] - 45; \n\t\t\tif (p[pos] >= 45)\n\t\t\t\tcontinue;\n\t\t\tfor (int i = p[pos] + t[pos]; i >= p[pos] - t[pos] && i > near - 2 && i; i--)\n\t\t\t{\n\t\t\t\tif (chk(i))\n\t\t\t\t{\n\t\t\t\t\tarr[j] = i; \n\t\t\t\t\tdfs(arr, x, y); \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (chk(j + 45))\n\t\t{\n\t\t\tif (y & z)\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t{\n\t\t\t\t\tif (my_abs(p[i] - p[j]) != 1)\n\t\t\t\t\t\tcontinue; \n\t\t\t\t\tarr[i] = 45 + j; \n\t\t\t\t\tdfs(arr, x, y ^ z); \n\t\t\t\t\tarr[i] = p[i]; \n\t\t\t\t}\n\t\t\t}\n\t\t\tif (x & z)\n\t\t\t{\n\t\t\t\tfor (int i = p[j] + m[j]; i >= p[j] - m[j] && i > near - 2 && i; i--)\n\t\t\t\t{\n\t\t\t\t\tif (!chk(i))\n\t\t\t\t\t\tcontinue; \n\t\t\t\t\tarr[j] = i; \n\t\t\t\t\tdfs(arr, x ^ z, y); \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\nint main()\n{\n\t// freopen(\"105E.in\", \"r\", stdin); \n\tfor (int i = 0; i < 3; i++)\n\t\tscanf(\"%d%d%d\", p + i, m + i, t + i); \n\tdfs(p, 7, 7); \n\tprintf(\"%d\\n\", ans);\n\treturn 0; \n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "30c306f5f909725a8e5e859f05f8f9cc", "src_uid": "a14739b86d1fd62a030226263cdc1afc", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\nint fun(char *);\nint fun(char *s)\n{\n char s1[27]={\"AEFHIKLMNTVWXYZ\"};\n char s2[27]={\"BCDGJOPQRSU\"};\n int p1=0,p2=0;\n char *st=s;\n while(*st)\n {\n if(strchr(s1,*st)!=NULL)\n {\n p1=1;\n }\n if(strchr(s2,*st)!=NULL)\n {\n p2=1;\n }\n st++;\n }\n if(p1==1&&p2==1)\n {\n return 0;\n }\n return 1;\n}\nint main()\n{\n char a[11];\n scanf(\"%s\",a);\n printf((fun(a)==1)?\"YES\\n\":\"NO\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "244baae6deac4c308bbc3bc9e0b94926", "src_uid": "15008dcb8dc8506c39aef0e3d8fca70c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint A[520],i,p,q;\nchar c[40];\nint main(){\n\tA['B']=A['C']=A['D']=A['G']=A['J']=A['O']=A['P']=A['Q']=A['R']=A['S']=A['U']=1;\n\tscanf(\"%s\",c);\n\tfor(i=0;c[i];i++){\n\t\tif(A[c[i]])p=1;\n\t\telse q=1;\n\t}\n\tif(p^q)printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd93c9f9f34f855d8c1031d5f864a0eb", "src_uid": "15008dcb8dc8506c39aef0e3d8fca70c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main(){\nchar a[10];\nscanf(\"%s\",a);\nint n=0;\nint i;\n\nfor (i=0;a[i]!='\\0';i++){\n if((a[i]=='B')||(a[i]=='C')||(a[i]=='D')||(a[i]=='G')||(a[i]=='J')||(a[i]=='O')||(a[i]=='P')||(a[i]=='Q')||(a[i]=='R')||(a[i]=='S')||(a[i]=='U')){\n n++;\n\n\n }\n\n\n\n}\n if((n!=0)&&(n!=i)){printf(\"NO\");}\n else {printf(\"YES\");}\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bbfc7cb39dfd84598321af482b864a92", "src_uid": "15008dcb8dc8506c39aef0e3d8fca70c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main()\n{\nint i,s=0;\nint verif=0;\nint l=0;\nchar chaine[27];\nscanf(\"%s\", chaine);\nl=strlen(chaine);\nfor(i=0; i<=l; i++)\n{\nif(chaine[i]=='A' || chaine[i]=='E' || chaine[i]=='F' || chaine[i]=='H' || chaine[i]=='I'\n|| chaine[i]=='K' || chaine[i]=='L'|| chaine[i]=='M' || chaine[i]=='N' || chaine[i]=='T'\n|| chaine[i]=='V' || chaine[i]=='W' || chaine[i]=='X' || chaine[i]=='Y' || chaine[i]=='Z')\ns++;\n}\nif(s==l || s==0)\nprintf(\"YES\");\nelse\nprintf(\"NO\");\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "491d7f1e815e644a8ea25b7071bf2587", "src_uid": "15008dcb8dc8506c39aef0e3d8fca70c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint main()\n{ \n char Linear []={'A','E','Z','T','Y','I','F','H','K','L','M','W','X','V','N','\\0'};\n char Curved []={'R','U','O','P','Q','S','D','G','J','C','B','\\0'};\n int x=0,i=0;\n char ch[10];\n scanf(\"%s\",ch);\n \n if (strlen(ch)==1)\n {printf(\"YES\");return 0;}\n else {\n \n if (strchr(Linear,ch[0]))\n x=1;\n else if (Curved,ch[0])\n x=2;\n if (x==1)\n { while (i\nchar generate[200000][1500];\nint main(){\n int a,b,c,d,e; int add=0;\n char test,test1,test2,test3,test4,test5;\n for(test2='a';test2<='f';test2++){\n for(test3='a';test3<='f';test3++){\n for(test4='a';test4<='f';test4++){\n for(test5='a';test5<='f';test5++){\n generate[add][0]=test2;\n generate[add][1]=test3;\n generate[add][2]=test4;\n generate[add][3]=test5;\n add++;\n }\n }\n }\n }\n char f_storage[50][50];\n char l_storage[50][50];\n scanf(\"%d%d\",&a,&b);\n getchar();\n int i;\n for(i=0;i\n#include\n\nchar a[50][5], b[50][5];\nchar dict[10000][10];\nint ans=0;\n\nint dfs(char str[], int q, int n)\n{\n\tint i,j,k;\n\n\t//printf(\"%s\\n\", str);\n\n\tif(strlen(str)==n)\n\t{\n\t\tint flag=0;\n\t\tfor(i=0;i\n#include \n#include \n\nint n, glen;\nchar perm[65336][7];\nchar tran[128][128];\n\nvoid\nstrgen (char *inp)\n{\n char i;\n\n if (strlen (inp) == n) {\n strcpy (perm[glen++], inp);\n return;\n } else {\n for (i = 'a'; i <= 'f'; ++i) {\n char out[8];\n strcpy (out, inp);\n strcat (out, &i);\n\n strgen(out);\n\n }\n }\n}\n\nint\nmain ()\n{\n int i, q, ans = 0;\n scanf (\"%d%d\", &n, &q);\n\n strgen (\"\");\n for (i = 0; i < q; ++i) {\n char f[4], s[2];\n\n scanf (\"%s%s\", f, s);\n tran[f[0]][f[1]] = s[0];\n }\n for (i = 0; i < glen; i++) {\n int j;\n char o = perm[i][0];\n\n for (j = 1; j < n; ++j) {\n o = tran[o][perm[i][j]];\n if (o == 0) {\n break;\n }\n }\n if (o == 'a') {\n ++ans;\n }\n }\n printf (\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "98678cc85cc6de62cece34bf3246caa8", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nchar a[50][5], b[50][5];\nchar dict[50000][10];\nint ans=0;\n\nint dfs(char str[], int q, int n)\n{\n\tint i,j,k;\n\n\t//printf(\"%s\\n\", str);\n\n\tif(strlen(str)==n)\n\t{\n\t\tint flag=0;\n\t\tfor(i=0;i\n#include\nint main(){\n char s[101];\n long long i=0,k=strlen(s)-1,a=0,mu=1,m=1000000007;\n gets(s);\n for(;s[i];i++,k--,mu=(mu*4)%m)\n a = ((a/2)+(s[k]-'0')*mu)%m;\n printf(\"%d\\n\",a);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "03289160eb54bdb19c488ee6119f6e3e", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nlong long no=1000000007;\nmain()\n{\n char s[200];\n scanf(\"%s\",s);\n int len =strlen(s);\n if(len==1)\n {\n if(s[0]=='1')\n printf(\"1\");\n else\n printf(\"0\");\n return 0;\n }\n int i;\n long long no1=0,no2=1,no3,power=1,flag=0;\n for(i=len-1;i>=0;i--)\n {\n no1=(no1+power*(s[i]-'0'))%no;\n power=(power*2)%no;\n if(s[i]=='0')\n flag=1;\n }\n for(i=1;i\n#define MOD 1000000007\nint main()\n{\n long long int num=0;\n int f=0;\n char c[105];\n scanf(\"%s\",c);\n for(f=0;c[f]!='\\0';f++)\n {\n if(c[f]=='1')\n num++;\n num*=2;\n num = num % MOD;\n }\n for(;f>2;f--)\n {\n num*=2;\n num = num % MOD;\n }\n printf(\"%I64d\\n\",num);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6bccce5a4b6f7e9ce1cfb4a23c6a3dcb", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define MOD 1000000007\nint main()\n{\n long long int num=0;\n int f=0;\n while(1)\n {\n char c = getchar();\n if(c=='0'||c=='1')\n {\n if(c=='1')\n num++;\n num*=2;\n f++;\n num = num % MOD;\n }\n else break;\n }\n for(;f>2;f--)\n {\n num*=2;\n num = num % MOD;\n }\n printf(\"%I64d\\n\",num);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "67a6c108d95113e1e21b24ce933aa3c4", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define MOD 1000000007\nint main()\n{\n long long int num=0;\n int f=0;\n while(1)\n {\n char c = getchar();\n if(c!='\\n' && c!= EOF && c!=' ')\n {\n if(c=='1')\n num++;\n num*=2;\n f++;\n num = num % MOD;\n }\n else break;\n }\n for(;f>2;f--)\n {\n num*=2;\n num = num % MOD;\n }\n printf(\"%I64d\\n\",num);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a2582e7a9a33d4d7321fea027af1b97b", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n\ntypedef unsigned long long int uint64;\ntypedef unsigned char uint8;\n\nuint8 findsum(uint64 x)\n{\n uint8 sum=0;\n uint8 temp;\n while(x!=0)\n {\n temp = x%10;\n sum += temp;\n x= x/10;\n }\n return sum;\n}\n\nint main(void)\n{\n uint64 x;\n uint64 maxsum=0,maxnum=0,sum;\n scanf(\"%llu\",&x);\n for(int i=x;i>0;i--)\n {\n sum = findsum(i);\n if(sum > maxsum)\n {\n maxsum = sum;\n maxnum = i;\n }\n }\n\n printf(\"%llu\",maxnum);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "97f217f0a0bf8ce193fd1e9eeece6c65", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n #include \n #include \n \n int main(int argc, char *argv[]) {\n long long i, max = 0, sum = 0, maxL, j, Len, noL;\n char num[18], maxNum[19];\n scanf(\"%s\", num);\n strcpy(maxNum, num);\n Len = strlen(num);\n for (i = 0; i < Len; i++) {\n max += (int)num[i] - 48;\n }\n for (j = Len - 2; j >= 0; j--) {\n sum = 0;\n for (i = Len - 1; i > j; i--) {\n //zamena\n num[i] = '9';\n }\n num[j] = (char)((int)num[j] - 1);\n for (i = 0; i < Len; i++) {\n sum += (int)num[i] - 48;\n }\n if (max < sum) {\n max = sum;\n strcpy(maxNum, num);\n }\n }\n \n for(i = 0; i < Len; i++) {\n if (i == 0 && maxNum[i] == '0') {\n continue;\n } else {\n printf(\"%c\", maxNum[i]);\n }\n \n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1bb6981ead36ca7d72a95ada544dec1", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint\t\tmain(void)\n{\n\tchar *str;\n\tint sum, s;\n\tint a, b;\n\n\tscanf(\"%s\", str);\n\ta = strlen(str);\n\tif (a == 1)\n\t{\n\t\tprintf(\"%s\\n\",str );\n\t\treturn (0);\n\t}\n\tb = 1;\n\tsum = 0;\n\ts = 0;\n\twhile (b < a)\n\t{\n\t\tsum += str[b] - 48;\n\t\ts += 9;\n\t\tb++;\n\t}\n\n\tif (s > sum + 1)\n\t{\n\t\tif (str[0] > 49)\n\t\t\tprintf(\"%c\", str[0] - 1);\n\t\twhile(a > 1)\n\t\t{\n\t\t\tprintf(\"9\");\n\t\t\ta--;\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\telse\n\t\tprintf(\"%s\\n\", str);\n\treturn (0);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd5eb822589c82831345bcdf32876b25", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n{\n\tint i, k, h, y=0, z=0, a[10], b[10], x, f=0;\n\tchar s[10];\n\t\n\tscanf(\"%s\", s);\n\tx=strlen(s);\n\t\n\tfor(i=0; i=z)\n\t{\n\t\tprintf(\"%s\", s);\n\t}\n\telse\n\t{\n\t\tfor(h=0; h\n#include \n#define MAX 22\nstruct INFO\n{\n\tint sum;\n\tlong long value;\n\tchar line[MAX];\n};\nstruct INFO m[MAX];\nlong long x;\nvoid Read(long long *a)\n{\t\t \n scanf(\"%lld\", a); \n return;\n}\nvoid Swap(char *a, char *b)\n{\n\tchar t;\n\tt=*a;\n\t*a=*b;\n\t*b=t;\n\treturn;\n}\nvoid Conv(long long a, char s[])\n{\n\tint i, j, l, x;\n\tl=0;\n\twhile (a>0)\n\t{\n\t\tx=a%10;\n\t\ts[l++]=(char)(x+'0');\n\t\ta/=10;\n\t}\n\tfor (i=0; i=0; i--, k*=10)\n\t\tsum+=(s[i]-'0')*k;\n\treturn sum;\n}\nvoid SWAP(struct INFO *a, struct INFO *b)\n{\n\tstruct INFO t;\n\tt=*a;\n\t*a=*b;\n\t*b=t;\n\treturn;\n}\nvoid Sort(struct INFO m[], int l)\n{\n\tint i, fl;\n\tdo\n\t{\n\t\tfl=1;\n\t\tfor (i=0; i'0')\n\t\t {\n\t\t\t m[k].line[i]--;\n\t\t\t Change(m[k].line, i);\n\t\t k++;\n\t\t }\t\t\n for (i=0; i<=l; i++)\n\t{\n\t\tm[i].sum=SumOfTheDigits(m[i].line);\n\t\tm[i].value=GetValue(m[i].line);\n\t}\n\tSort(m, l);\n\tWrite(m[0].line);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b562fffe3279b92b5cbf15b99b1626d2", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\n\tint n, m, s;\n\tlong long ans = 0ll;\n\n\tscanf(\"%d %d %d\", &n, &m, &s );\n\tans = (long long)(n/s) + (long long)(m/s);\n\tans *= ans;\n\tans *= (long long)(n-s);\n\tif( ans == 0ll ) ans = n*m;\n\tprintf(\"%lld\\n\", ans );\n\n\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3fb6bc0cd71ffec98f5474568ad53020", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\n\tint n, m, s;\n\tlong long ans = 0ll;\n\n\tscanf(\"%d %d %d\", &n, &m, &s );\n\tans = (long long)( n/s ) + (long long)( m/s );\n\tans += (ans-1ll) + ((ans-1ll)*(ans-1ll));\n\tans *= (long long)(n-s);\n\tans *= (long long)(m-s);\n\tif( ans == 0ll ) ans = n*m;\n\tprintf(\"%lld\\n\", ans );\n\n\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d1a4b1345cc6a0fb2e22623e59d74018", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main(){\n\n\t__int64 n, m, s, ans;\n\n\tscanf(\"%I64 %I64 %I64\", &n, &m, &s ); n--, m--;\n\tans = ( (n/s) + 1 ) * ( (m/s)+1 );\n\tans *= ( (n%s) + 1 )*( (m%s) + 1 );\n\tprintf(\"%I64\\n\", ans );\n\n\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7382049c2d90ca521fd9050267c72fb1", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n\tlong i, j, k, l, m, n, ans;\n\tlong p1, p2, p3, p4;\n\tscanf(\"%ld%ld%ld\", &n, &m, &k);\n\tp1 = (n - 1) / k;\n\tp2 = n - p1 * k;\n\tp3 = (m - 1) / k;\n\tp4 = m - p3 * k;\n\tp1++;\n\tp3++;\n\tl = p1 * p3;\n\tans = l * p2 * p4;\n\tprintf(\"%ld\", ans);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fc9a1484f1069836b7d84a145b52102d", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n\tlong long i, j, k, l, m, n, ans;\n\tlong long p1, p2, p3, p4;\n\tscanf(\"%I64d%I64d%I64d\", &n, &m, &k);\n\tp1 = (n - 1) / k;\n\tp2 = n - p1 * k;\n\tp3 = (m - 1) / k;\n\tp4 = m - p3 * k;\n\tp1++;\n\tp3++;\n\tl = p1 * p3;\n\tans = l * p2 * p4;\n\tprintf(\"%I64d\", ans);\n\tgetch();\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6d71898208af3db4ccdbda8afe590818", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#define NMAX 2000\n#define MOD 998244353\nlong long dp[NMAX+1][NMAX+1];\nint main()\n{\n int i,j,n,m,k;\n scanf(\"%d%d%d\",&n,&m,&k);\n for(i=1;i<=n;i++)\n dp[i][0]=m;\n for(i=1;i<=n;i++){\n for(j=1;j<=m;j++)\n dp[i][j]=(dp[i-1][j]+dp[i-1][j-1]*(m-1))%MOD;\n }\n printf(\"%I64d\\n\",dp[n][k]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c9aff2cd7a79792111f520f1ad079ee", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nlong long int dp[4000][4000];\nint main()\n{\n\tlong long int n, m, k, j, i;\n\tscanf(\"%lld%lld%lld\", &n, &m, &k);\n\tfor (long long int i = 1; i <=n; ++i)\n\t{\n\t\tfor(dp[i][0]=m, j=1; j<=k; j++)\n\t\t{\n\t\t\tdp[i][j]=(dp[i-1][j]+dp[i-1][j-1]*(m-1))%998244353;\n\t\t\tprintf(\"%lld %lld %lld\\n\", i, j, dp[i][j]);\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", dp[n][k]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa8c5ab72b5ad44242c70dd6a1c19931", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 998244353\nlong long int n,m,k,number_of_ways;\nlong long int ways[2000][2000];\nlong long int Ways(int edges,int k)\n{\n if(ways[edges][k]!=-1)\n {\n return ways[edges][k];\n }\n if(k==0) return m-1;\n long long number_of_ways=0,make_a_way;\n int i;\n for(i=1;i<=edges-k+1;i++)\n {\n make_a_way=m-1;\n make_a_way=(make_a_way*Ways(edges-i,k-1))%MOD;\n number_of_ways=(number_of_ways+make_a_way)%MOD;\n }\n ways[edges][k]=number_of_ways;\n return number_of_ways;\n}\nint main()\n{\n int i,j;\n for(i=0;i<2000;i++)\n {\n for(j=0;j<2000;j++)\n {\n ways[i][j]=-1;\n }\n }\n scanf(\"%I64d %I64d %I64d\",&n,&m,&k);\n number_of_ways=m;\n if(k>0) number_of_ways=(number_of_ways*Ways(n-1,k))%MOD;\n printf(\"%I64d\",number_of_ways);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f7c9e3dafe1ec7025fb2ca59b0e80aa", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 998244353\nlong long int n,m,k,number_of_ways;\nlong long int ways[2000][2000];\nlong long int Ways(int edges,int k)\n{\n if(ways[edges][k]!=-1)\n {\n return ways[edges][k];\n }\n if(k==0) return 1;\n long long number_of_ways=0,make_a_way;\n int i;\n for(i=1;i<=edges-k+1;i++)\n {\n make_a_way=m-1;\n make_a_way=(make_a_way*Ways(edges-i,k-1))%MOD;\n number_of_ways=(number_of_ways+make_a_way)%MOD;\n }\n ways[edges][k]=number_of_ways;\n return number_of_ways;\n}\nint main()\n{\n int i,j;\n for(i=0;i<2000;i++)\n {\n for(j=0;j<2000;j++)\n {\n ways[i][j]=-1;\n }\n }\n scanf(\"%I64d %I64d %I64d\",&n,&m,&k);\n number_of_ways=m;\n number_of_ways=(number_of_ways*Ways(n-1,k))%MOD;\n printf(\"%I64d\",number_of_ways);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "deeb8cdcdb8b5aebd4f4ba5f91e944db", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nint dp[10000][10000];\nint main()\n{\n\tint n, m, k, j, i;\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tfor (int i = 1; i <=n; ++i)\n\t{\n\t\tfor(dp[i][0]=m, j=1; j<=m; j++)\n\t\t{\n\t\t\tdp[i][j]=dp[i-1][j]+dp[i-1][j-1]*(m-1);\n\t\t\t//printf(\"%d %d %d\\n\", i, j, dp[i][j]);\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"%d\\n\", dp[n][k]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4c204ee0a94b616f4bf67ab0195d6e7c", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n\tlong long int n,k,p;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\t\n\tif(k==0 || k==1){\t\n\t\t\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(k==2){\n\t\t\n\t\tprintf(\"%I64d\\n\",(n*(n-1))/2 + 1);\n\t\treturn 0;\n\t}\n\tif(k==3){\n\t\n\t\tprintf(\"%I64d\\n\",n*(n-1)*(n-2)/3 + (n*(n-1))/2 + 1);\t\n\t\treturn 0;\n\t}\n\tif(k==4){\n\t\n\t\tprintf(\"%I64d\\n\",(n*(n-1)*(n-2)*(n-3)*3)/8+(n*(n-1)*(n-2))/3 + (n*(n-1))/2 + 1);\n\t\treturn 0;\n\t\t\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d98a84cf582b3476459e81d3187c7183", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n//1 \n//2 c(n, 2) * (2!-1)\n//3 c(n, 3) * (3!-1)\n//4 c(n, 4) * (4!-1)\n\nint\nmain() \n{\n int64_t n, k, r = 1, t;\n scanf(\"%\"SCNd64\"%\"SCNd64, &n, &k);\n if (n >= 2 && k >= 2) {\n t = n * (n-1) / 2;\n r += t;\n }\n if (n >= 3 && k >= 3) {\n t = n * (n-1) * (n-2) / 6 * 2;\n r += t;\n }\n if (n >= 4 && k >= 4) {\n t = n * (n-1) * (n-2) * (n-3) / 24 * 9;\n r += t;\n }\n printf(\"%\"PRId64\"\\n\", r);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a002b8036777c40dc3d88bf88646dec0", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n\nlong long perm(int n, int i) {\n\tlong long sum = 1;\n\twhile (i--) sum = sum * n--;\n\treturn sum;\n}\n\nlong long comb(int n, int i) {\n\treturn perm(n, i) / perm(i, i);\n}\n\nint main() {\n\tint n, k, temp;\n\tscanf(\"%d %d\", &n, &k);\n\tlong long dp[5], sum, tt;\n\tdp[0] = 1;\n\tdp[1] = 1;\n\n\tif (n == 4 && k == 4) { printf(\"15\"); return 0; }\n\n\tfor (int i = 2; i <= k; i++) {\n\t\tsum = comb(n, i) * perm(i, i);\n\t\ttemp = 0;\n\t\tfor (int j = i - 1; j >= 0; j--) {\n\t\t\tif(n - j > i)\n\t\t\t\ttt = comb(n - j, i) - 1;\n\t\t\telse\n\t\t\t\ttt = comb(n - j, n - i) - 1;\n\t\t\tsum -= (tt - temp) * dp[j];\n\t\t\ttemp += tt - temp;\n\t\t}\n\t\tdp[i] = sum;\n\t}\n\n\tprintf(\"%lld\", dp[k]);\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c49ed1bcabf0185e752dcc03bc05a229", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nlong long comb[1001][5];\nlong long N[5] = { 1, 0, 1, 2, 9 };\n\nvoid Set_C(int n, int k)\n{\n\tif (k == 0 || n == k)\n\t{\n\t\tcomb[n][k] = 1;\n\t\tcomb[n][n - k] = 1;\n\t}\n\telse if (k == 1 || k == n - 1)\n\t{\n\t\tcomb[n][k] = n;\n\t\tcomb[n][n - k] = n;\n\t}\n\telse\n\t{\n\t\tif (comb[n - 1][k] == 0)\n\t\t\tSet_C(n - 1, k);\n\t\tif (comb[n - 1][k - 1] == 0)\n\t\t\tSet_C(n - 1, k - 1);\n\t\tcomb[n][k] = comb[n - 1][k - 1] + comb[n - 1][k];\n\t\tcomb[n][n - k] = comb[n - 1][k - 1] + comb[n - 1][k];\n\t}\n}\n\nint main(void)\n{\n\tint n, k, a, b;\n\tlong long ans = 0;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (a = 1; a <= n; a = a + 1)\n\t{\n\t\tfor (b = 0; b <= (a >= 4 ? 4 : a); b = b + 1)\n\t\t{\n\t\t\tSet_C(a, b);\n\t\t}\n\t}\n\tfor (a = n - k; a <= n; a = a + 1)\n\t{\n\t\tans = ans + comb[n][a] * N[n - a];\n\t}\n\tprintf(\"%I64d\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5849d55856fda8ec6e6c0220a8ae3fd1", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n\nlong long perm(int n, int i) {\n\tlong long sum = 1;\n\twhile (i--) sum = sum * n--;\n\treturn sum;\n}\n\nlong long comb(int n, int i) {\n\treturn perm(n, i) / perm(i, i);\n}\n\nint main() {\n\tint n, k, temp;\n\tscanf(\"%d %d\", &n, &k);\n\tlong long dp[5], sum, tt;\n\tdp[0] = 1;\n\tdp[1] = 1;\n\n\tif (n == 4 && k == 4) { printf(\"16\"); return 0; }\n\n\tfor (int i = 2; i <= k; i++) {\n\t\tsum = comb(n, i) * perm(i, i);\n\t\ttemp = 0;\n\t\tfor (int j = i - 1; j >= 0; j--) {\n\t\t\ttt = comb(n - j, n - i) - 1;\n\t\t\tsum -= (tt - temp) * dp[j];\n\t\t\ttemp += tt - temp;\n\t\t}\n\t\tdp[i] = sum;\n\t}\n\n\tprintf(\"%lld\", dp[k]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "15ef7306d40df334dc6c054edf3d5d16", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() {\n\tstatic char cc[100001], s[100001], t[100001];\n\tstatic int kk[10], kk_[10];\n\tint n, ns, nt;\n\tint h, i, d, d_, k, k_, k0;\n\tint max, kmax, dmax;\n\n\tscanf(\"%s\", cc);\n\tn = strlen(cc);\n\tk0 = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tkk[cc[i] - '0']++;\n\t\tif (cc[i] == '0')\n\t\t\tk0++;\n\t}\n\tmax = kmax = dmax = -1, k = 0;\n\twhile (kk[0] >= 0) {\n\t\tfor (d = 0; d <= 9; d++)\n\t\t\tkk_[d] = kk[d];\n\t\tif (max < k) {\n\t\t\tmax = kmax = k;\n\t\t\tdmax = -1;\n\t\t}\n\t\tfor (d = 1; d <= 9; d++)\n\t\t\tif (kk[d] > 0 && kk_[10 - d] > 0) {\n\t\t\t\tkk[d]--, kk_[10 - d]--;\n\t\t\t\tk_ = 0;\n\t\t\t\tfor (d_ = 0; d_ <= 9; d_++)\n\t\t\t\t\tk_ += kk[d_] < kk_[9 - d_] ? kk[d_] : kk_[9 - d_];\n\t\t\t\tkk[d]++, kk_[10 - d]++;\n\t\t\t\tif (max < k + 1 + k_) {\n\t\t\t\t\tmax = k + 1 + k_;\n\t\t\t\t\tkmax = k;\n\t\t\t\t\tdmax = d;\n\t\t\t\t}\n\t\t\t}\n\t\tkk[0]--;\n\t\tk++;\n\t}\n\tns = nt = 0;\n\tkk[0] = kk_[0] = k0 - kmax;\n\tkk[dmax]--, kk_[10 - dmax]--;\n\tfor (d_ = 0; d_ <= 9; d_++) {\n\t\tfor (h = kk[d_]; h < kk_[9 - d_]; h++)\n\t\t\tt[nt++] = 9 - d_ + '0';\n\t\tfor (h = kk_[9 - d_]; h < kk[d_]; h++)\n\t\t\ts[ns++] = d_ + '0';\n\t}\n\tfor (d_ = 0; d_ <= 9; d_++)\n\t\tfor (h = 0; h < kk[d_] && h < kk_[9 - d_]; h++) {\n\t\t\ts[ns++] = d_ + '0';\n\t\t\tt[nt++] = 9 - d_ + '0';\n\t\t}\n\ts[ns++] = dmax + '0';\n\tt[nt++] = 10 - dmax + '0';\n\tfor (h = 0; h < kmax; h++)\n\t\ts[ns++] = t[nt++] = '0';\n\tprintf(\"%s\\n\", s);\n\tprintf(\"%s\\n\", t);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f91707a8a2f4cf30b6a4d3aab0927d21", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() {\n\tstatic char cc[100001], s[100001], t[100001];\n\tstatic int kk[10], kk_[10];\n\tint n, ns, nt;\n\tint h, i, d, d_, k, k_, k0;\n\tint max, kmax, dmax;\n\n\tscanf(\"%s\", cc);\n\tn = strlen(cc);\n\tk0 = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tkk[cc[i] - '0']++;\n\t\tif (cc[i] == '0')\n\t\t\tk0++;\n\t}\n\tmax = kmax = dmax = -1, k = 0;\n\twhile (kk[0] >= 0) {\n\t\tfor (d = 0; d <= 9; d++)\n\t\t\tkk_[d] = kk[d];\n\t\tif (max < k) {\n\t\t\tmax = kmax = k;\n\t\t\tdmax = -1;\n\t\t}\n\t\tfor (d = 1; d <= 9; d++)\n\t\t\tif (kk[d] > 0 && kk_[10 - d] > 0) {\n\t\t\t\tkk[d]--, kk_[10 - d]--;\n\t\t\t\tk_ = 0;\n\t\t\t\tfor (d_ = 0; d_ <= 9; d_++)\n\t\t\t\t\tk_ += kk[d_] < kk_[9 - d_] ? kk[d_] : kk_[9 - d_];\n\t\t\t\tkk[d]++, kk_[10 - d]++;\n\t\t\t\tif (max < k + 1 + k_) {\n\t\t\t\t\tmax = k + 1 + k_;\n\t\t\t\t\tkmax = k;\n\t\t\t\t\tdmax = d;\n\t\t\t\t}\n\t\t\t}\n\t\tkk[0]--;\n\t\tk++;\n\t}\n\tns = nt = 0;\n\tkk[0] = kk_[0] = k0 - kmax;\n\tif (dmax >= 0) {\n\t\tkk[dmax]--, kk_[10 - dmax]--;\n\t\tfor (d_ = 0; d_ <= 9; d_++) {\n\t\t\tfor (h = kk[d_]; h < kk_[9 - d_]; h++)\n\t\t\t\tt[nt++] = 9 - d_ + '0';\n\t\t\tfor (h = kk_[9 - d_]; h < kk[d_]; h++)\n\t\t\t\ts[ns++] = d_ + '0';\n\t\t}\n\t\ts[ns++] = dmax + '0';\n\t\tt[nt++] = 10 - dmax + '0';\n\t} else\n\t\tfor (d_ = 0; d_ <= 9; d_++) {\n\t\t\tfor (h = 0; h < kk[d_]; h++)\n\t\t\t\ts[ns++] = d_ + '0';\n\t\t\tfor (h = 0; h < kk_[d_]; h++)\n\t\t\t\tt[nt++] = d_ + '0';\n\t\t}\n\tfor (h = 0; h < kmax; h++)\n\t\ts[ns++] = t[nt++] = '0';\n\tprintf(\"%s\\n\", s);\n\tprintf(\"%s\\n\", t);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "605cf854a48d0ffd5f7bb7d8b577c8e8", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint min(int a, int b)\n{\n if (a < b) {\n\treturn a;\n } else {\n\treturn b;\n }\n}\n\nint main()\n{\n int n, m, p = 0, num = -1, i, j;\n char s[100001];\n char c1[100001], c2[100001];\n int a[10] = {0};\n int b[10] = {0};\n\n scanf(\"%s\", s);\n\n n = strlen(s);\n\n for (i = 0; i < n; i++) {\n\ta[s[i] - '0']++;\n\tb[s[i] - '0']++;\n }\n\n c1[n] = c2[n] = '\\0';\n\n n--;\n\n for (i = 0; i < a[0] - a[9]; i++) {\n\tc1[n - i] = c2[n - i] = '0';\n }\n\n if (a[0] > a[9]) {\n\tn -= a[0] - a[9];\n\n\ta[0] = b[0] = a[9];\n }\n\n for (i = 1; i <= 5; i++) {\n\tint c = 1;\n\n\ta[i]--;\n\tb[10 - i]--;\n\n\tif (a[i] < 0 || b[10 - i] < 0) {\n\t a[i]++;\n\t b[10 - i]++;\n\n\t continue;\n\t}\n\n\tfor (j = 0; j < 5; j++) {\n\t c += min(a[j], b[9 - j]);\n\t}\n\n\tif (c > p) {\n\t p = c;\n\t num = i;\n\t}\n\n\ta[i]++;\n\tb[10 - i]++;\n }\n\n if (num > 0) {\n\tif (num == 1 && a[0] == a[9] && a[0] > 0) {\n\t c1[n] = '0';\n\t c2[n--] = '0';\n\n\t a[0]--;\n\t b[0]--;\n\t}\n\n\tc1[n] = num + '0';\n\tc2[n--] = 10 - num + '0';\n\n\ta[num]--;\n\tb[10 - num]--;\n }\n\n for (i = 0; i < 10; i++) {\n\twhile (1) {\n\t if (a[i] > 0 && b[9 - i] > 0) {\n\t\tc1[n] = i + '0';\n\t\tc2[n--] = 9 - i + '0';\n\n\t\ta[i]--;\n\t\tb[9 - i]--;\n\t } else {\n\t\tbreak;\n\t }\n\t}\n }\n\n m = n;\n\n for (i = 0; i < 10; i++) {\n\tfor (j = 0; j < a[i]; j++) {\n\t c1[n--] = i + '0';\n\t}\n\tfor (j = 0; j < b[i]; j++) {\n\t c2[m--] = i + '0';\n\t}\n }\n\n printf(\"%s\\n\", c1);\n printf(\"%s\\n\", c2);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d925425c795b685f52a8b10f29aa0ea2", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n//186a\nint main()\n{\n char s[11];\n char c[12][11]={\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"};\n scanf(\"%s\",s);\n int d,i;\n // gets(s);\n scanf(\"%d\",&d);\n // printf(\"d=%d\",d);\n for(i=0;i<12;i++)\n {\n // printf(\"i=%d\\n\",i);\n if(strcmp(s,c[i])==0)\n {\n i=i+d;\n // printf(\"Success,i=%d\\n\",i);\n while(i>12)\n {\n i=i-12;\n }\n // printf(\"i=%d,in loop\\n\",i);\n break;\n }\n }\n //for(i=0;i<12;i++)\n puts(c[i]);\n return 0;\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f40ee0dfda96903eed6400349a27d88b", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n char months[12][15];\n\n strcpy(months[0],\"January\");strcpy(months[1],\"February\");strcpy(months[2],\"March\");\n strcpy(months[3],\"April\");strcpy(months[4],\"May\");strcpy(months[5],\"June\");\n strcpy(months[6],\"July\");strcpy(months[7],\"August\");strcpy(months[8],\"September\");\n strcpy(months[9],\"October\");strcpy(months[10],\"November\");strcpy(months[11],\"December\");\n\n char input[15];\n int currentMonth,i,x,s,n,counter;\n\n scanf(\"%s\",&input);\n scanf(\"%d\",&n);\n\n for(i = 0; i < 12; i++)\n {\n if(strcmp(input,months[i]) == 0)\n {\n currentMonth = i + 1;\n }\n }\n\n x = (currentMonth + n) % 12;\n\n printf(\"%s\",months[x - 1]);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "95ad8ead81b57105ab7c79c3cce3c894", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\nchar a[101], b[20][101];\nint c,d,e,f,x,y,z;\nscanf(\"%s\",&a);\nscanf(\"%d\",&c);\nstrcpy(b[1],\"January\");\nstrcpy(b[2],\"February\");\nstrcpy(b[3],\"March\");\nstrcpy(b[4],\"April\");\nstrcpy(b[5],\"May\");\nstrcpy(b[6],\"June\");\nstrcpy(b[7],\"July\");\nstrcpy(b[8],\"August\");\nstrcpy(b[9],\"September\");\nstrcpy(b[10],\"October\");\nstrcpy(b[11],\"November\");\nstrcpy(b[12],\"December\");\nc=c%12;\nfor(x=1;x<=12;x=x+1)\n{\nif(strcmp(a,b[x])==0)\n{\nd=(c+x)%12;\nbreak;\n}\n}\nprintf(\"%s\",b[d]);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a0efa1342913976eaf8d6f0d2b11381a", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0} {"lang": "GNU C11", "source_code": "#include \n#include \nusing namespace std;\nint main()\n{\n string ssin;\n cin>>ssin;\n int n;\n cin>>n;\n int tempin,tempout;\n if(ssin==\"January\") tempin=1;\n if(ssin==\"February\") tempin=2;\n if(ssin==\"March\") tempin=3;\n if(ssin==\"April\") tempin=4;\n if(ssin==\"May\") tempin=5;\n if(ssin==\"June\") tempin=6;\n if(ssin==\"July\") tempin=7;\n if(ssin==\"August\") tempin=8;\n if(ssin==\"September\") tempin=9;\n if(ssin==\"October\") tempin=10;\n if(ssin==\"November\") tempin=11;\n if(ssin==\"December\") tempin=12;\n tempout=(n+tempin)%12;\n if(tempout==1) cout<<\"January\";\n if(tempout==2) cout<<\"February\";\n if(tempout==3) cout<<\"March\";\n if(tempout==4) cout<<\"April\";\n if(tempout==5) cout<<\"May\";\n if(tempout==6) cout<<\"June\";\n if(tempout==7) cout<<\"July\";\n if(tempout==8) cout<<\"August\";\n if(tempout==9) cout<<\"September\";\n if(tempout==10) cout<<\"October\";\n if(tempout==11) cout<<\"November\";\n if(tempout==12) cout<<\"December\";\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1d70c1fd72f3aaa95a61c8e39c33fbc2", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main(int argc, char *argv[]) {\n\tlong *players;\n\tchar *gPlayers;\n\tlong i;\n\tlong num;\n\tscanf(\"%l\", &num);\n\tplayers = malloc(sizeof(long)*num);\n\tgPlayers = malloc(sizeof(char)*num);\n\tscanf(\"%s\", gPlayers);\n\tfor(i=0;i\r\n#include \r\n#include \r\n\r\nint main(){\r\n int a;\r\n char str[7] = \"\";\r\n scanf(\"%d\", &a);\r\n sprintf(str, \"%d\", a);\r\n while(strlen(str) > 1){\r\n a = 0;\r\n for(int i = 0; i < strlen(str); i++){\r\n a = a + str[i] - '0';\r\n }\r\n sprintf(str, \"%d\", a);\r\n }\r\n printf(\"%d\", atoi(str));\r\n}\r\n\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7dab364dcc2744abfe7c41d9295d6dab", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n\r\nint main()\r\n{\r\n int x,y,z,i,j,k,a,b,c = 0,n,m,t;\r\n scanf(\"%d\",&a);\r\n \r\n loop:\r\n while(a > 0)\r\n {\r\n c += a%10;\r\n a /= 10; \r\n }\r\n if(c >= 10)\r\n {\r\n a = c;\r\n goto loop;\r\n }\r\n printf(\"%d\\n\",c);\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3e4c52195d93d71cbcee2d7cfb7eda64", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n \r\nint main()\r\n{\r\n int n;\r\n cin>>n;\r\n if (n % 9 == 0)\r\n printf(\"9\\n\");\r\n else\r\n printf(\"%d\\n\",(n % 9));\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f4555754c0e575203959786aab20bbeb", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n\r\nint main()\r\n{\r\n int n;\r\n cin>>n;\r\n if (n % 9 == 0)\r\n cout<<\"9\\n\";\r\n else\r\n cout<<(n % 9)<<'\\n';\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9e1e4629f07d67e4381c70740d58e52b", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\r\nint main()\r\n{\r\n int n,x[100],sum=0,i;\r\n scanf(\"%d\",&n);\r\n while(n!=0)\r\n {\r\n x[i++]=n%10;\r\n n=n/10;\r\n }\r\n for(int j=0;j\n#include \n\n#define N\t20000\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nlong long dot2(int x1, int y1, int x2, int y2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2;\n}\n\nlong long cross2(int x1, int y1, int x2, int y2) {\n\treturn (long long) x1 * y2 - (long long) x2 * y1;\n}\n\nint xx[N + 1], yy[N + 1];\n\nlong long cross(int i, int j, int k) {\n\treturn cross2(xx[j] - xx[i], yy[j] - yy[i], xx[k] - xx[i], yy[k] - yy[i]);\n}\n\nint aa[N + 1], dp[N + 1], dq[N + 1], n;\n\nvoid solve(int l, int r) {\n\tstatic int qu[N + 1], qq[N + 1], pp[N + 1];\n\tint m, h, i, j, q, p, cnt;\n\n\tif (r - l == 1)\n\t\treturn;\n\tm = (l + r) / 2;\n\tsolve(l, m);\n\tsolve(m, r);\n\tq = 0;\n\tfor (i = m - 1; i >= l; i--)\n\t\tqq[i] = q = max(q, aa[i]);\n\tp = 0;\n\tfor (i = m; i < r; i++)\n\t\tpp[i] = p, p = max(p, aa[i]);\n\tcnt = 0;\n\tfor (j = m, i = m - 1, h = 0; j < r; j++) {\n\t\twhile (i >= l && qq[i] <= pp[j]) {\n\t\t\txx[i] = i, yy[i] = dp[i];\n\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\tcnt--;\n\t\t\tqu[cnt++] = i;\n\t\t\tif (h >= cnt - 2)\n\t\t\t\th = cnt - 1;\n\t\t\ti--;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], pp[j], -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], pp[j], -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], pp[j] * j - dot2(xx[qu[h]], yy[qu[h]], pp[j], -1));\n\t}\n\tcnt = 0;\n\tfor (j = r - 1, i = l, h = 0; j >= m; j--) {\n\t\twhile (i < m && qq[i] > pp[j]) {\n\t\t\txx[i] = qq[i], yy[i] = dp[i] - qq[i] * i;\n\t\t\tif (cnt && xx[qu[cnt - 1]] == xx[i]) {\n\t\t\t\tif (yy[qu[cnt - 1]] > yy[i])\n\t\t\t\t\tqu[cnt - 1] = i;\n\t\t\t} else {\n\t\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\t\tcnt--;\n\t\t\t\tqu[cnt++] = i;\n\t\t\t}\n\t\t\tif (h >= cnt - 2)\n\t\t\t\th = cnt - 1;\n\t\t\ti++;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], -j, -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], -j, -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], -dot2(xx[qu[h]], yy[qu[h]], -j, -1));\n\t}\n}\n\nint main() {\n\tint k, i;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmemset(dp, 0x3f, (n + 1) * sizeof *dp), dp[0] = 0;\n\twhile (k--) {\n\t\tmemset(dq, 0x3f, (n + 1) * sizeof *dq);\n\t\tsolve(0, n + 1);\n\t\tmemcpy(dp, dq, (n + 1) * sizeof *dp);\n\t}\n\tprintf(\"%d\\n\", dp[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3fdca1e439b10c1167db9672679147a4", "src_uid": "f42faaaa88628748a8da49111936be00", "difficulty": 3000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t20000\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nlong long dot2(int x1, int y1, int x2, int y2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2;\n}\n\nlong long cross2(int x1, int y1, int x2, int y2) {\n\treturn (long long) x1 * y2 - (long long) x2 * y1;\n}\n\nint xx[N + 1], yy[N + 1];\n\nlong long cross(int i, int j, int k) {\n\treturn cross2(xx[j] - xx[i], yy[j] - yy[i], xx[k] - xx[i], yy[k] - yy[i]);\n}\n\nint aa[N + 1], dp[N + 1], dq[N + 1];\n\nvoid solve(int l, int r) {\n\tstatic int qu[N + 1], qq[N + 1], pp[N + 1];\n\tint m, h, i, j, q, p, cnt;\n\n\tif (r - l == 1)\n\t\treturn;\n\tm = (l + r) / 2;\n\tsolve(l, m), solve(m, r);\n\tq = 0;\n\tfor (i = m - 1; i >= l; i--)\n\t\tqq[i] = q = max(q, aa[i]);\n\tp = 0;\n\tfor (i = m; i < r; i++)\n\t\tpp[i] = p, p = max(p, aa[i]);\n\tcnt = 0;\n\tfor (j = m, i = m - 1, h = 0; j < r; j++) {\n\t\twhile (i >= l && qq[i] <= pp[j]) {\n\t\t\txx[i] = i, yy[i] = dp[i];\n\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\tcnt--;\n\t\t\tif (h >= cnt - 1)\n\t\t\t\th = cnt;\n\t\t\tqu[cnt++] = i--;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], pp[j], -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], pp[j], -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], pp[j] * j - dot2(xx[qu[h]], yy[qu[h]], pp[j], -1));\n\t}\n\tcnt = 0;\n\tfor (j = r - 1, i = l, h = 0; j >= m; j--) {\n\t\twhile (i < m && qq[i] > pp[j]) {\n\t\t\txx[i] = qq[i], yy[i] = dp[i] - qq[i] * i;\n\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\tcnt--;\n\t\t\tif (h >= cnt - 1)\n\t\t\t\th = cnt;\n\t\t\tqu[cnt++] = i++;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], -j, -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], -j, -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], -dot2(xx[qu[h]], yy[qu[h]], -j, -1));\n\t}\n}\n\nint main() {\n\tint n, k, h, i;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmemset(dp, 0x3f, (n + 1) * sizeof *dp), dp[0] = 0;\n\tfor (h = 1; h <= k; h++) {\n\t\tmemset(dq, 0x3f, (n + 1) * sizeof *dq), dq[0] = 0;\n\t\tsolve(0, n + 1);\n\t\tmemcpy(dp, dq, (n + 1) * sizeof *dp);\n\t}\n\tprintf(\"%d\\n\", dp[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "795e5a037f1e1f822d792824618c411a", "src_uid": "f42faaaa88628748a8da49111936be00", "difficulty": 3000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t20000\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nlong long dot2(int x1, int y1, int x2, int y2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2;\n}\n\nlong long cross2(int x1, int y1, int x2, int y2) {\n\treturn (long long) x1 * y2 - (long long) x2 * y1;\n}\n\nint xx[N + 1], yy[N + 1];\n\nlong long cross(int i, int j, int k) {\n\treturn cross2(xx[j] - xx[i], yy[j] - yy[i], xx[k] - xx[i], yy[k] - yy[i]);\n}\n\nint aa[N + 1], dp[N + 1], dq[N + 1], n;\n\nvoid solve(int l, int r) {\n\tstatic int qu[N + 1], qq[N + 1], pp[N + 1];\n\tint m, h, i, j, q, p, cnt;\n\n\tif (r - l == 1)\n\t\treturn;\n\tm = (l + r) / 2;\n\tsolve(l, m);\n\tsolve(m, r);\n\tq = 0;\n\tfor (i = m - 1; i >= l; i--)\n\t\tqq[i] = q = max(q, aa[i]);\n\tp = 0;\n\tfor (i = m; i < r; i++)\n\t\tpp[i] = p, p = max(p, aa[i]);\n\tcnt = 0;\n\tfor (j = m, i = m - 1, h = 0; j < r; j++) {\n\t\twhile (i >= l && qq[i] <= pp[j]) {\n\t\t\txx[i] = i, yy[i] = dp[i];\n\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\tcnt--;\n\t\t\tqu[cnt++] = i;\n\t\t\tif (h >= cnt - 2)\n\t\t\t\th = cnt - 1;\n\t\t\ti--;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], pp[j], -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], pp[j], -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], pp[j] * j - dot2(xx[qu[h]], yy[qu[h]], pp[j], -1));\n\t}\n\tcnt = 0;\n\tfor (j = r - 1, i = l, h = 0; j >= m; j--) {\n\t\twhile (i < m && qq[i] > pp[j]) {\n\t\t\txx[i] = qq[i], yy[i] = dp[i] - qq[i] * i;\n\t\t\tif (cnt && xx[qu[cnt - 1]] == xx[i]) {\n\t\t\t\tif (yy[qu[cnt - 1]] > yy[i])\n\t\t\t\t\tqu[cnt - 1] = i;\n\t\t\t} else {\n\t\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\t\tcnt--;\n\t\t\t\tqu[cnt++] = i;\n\t\t\t}\n\t\t\tif (h >= cnt - 2)\n\t\t\t\th = cnt - 1;\n\t\t\ti++;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], -j, -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], -j, -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], -dot2(xx[qu[h]], yy[qu[h]], -j, -1));\n\t}\n}\n\nint main() {\n\tint k, i, j;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmemset(dp, 0x1f, (n + 1) * sizeof *dp), dp[0] = 0;\n\tk = 6;\n\twhile (k--) {\n\t\tmemset(dq, 0x1f, (n + 1) * sizeof *dq);\n\t\tsolve(0, n + 1);\n\t\tmemcpy(dp, dq, (n + 1) * sizeof *dp);\n\t}\n\tprintf(\"%d\\n\", dp[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "13289ae09449ad7ec3f17e3f9051cb12", "src_uid": "f42faaaa88628748a8da49111936be00", "difficulty": 3000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t20000\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\nint max(int a, int b) { return a > b ? a : b; }\n\nlong long dot2(long long x1, long long y1, long long x2, long long y2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2;\n}\n\nlong long cross2(long long x1, long long y1, long long x2, long long y2) {\n\treturn (long long) x1 * y2 - (long long) x2 * y1;\n}\n\nlong long xx[N + 1], yy[N + 1];\n\nlong long cross(int i, int j, int k) {\n\treturn cross2(xx[j] - xx[i], yy[j] - yy[i], xx[k] - xx[i], yy[k] - yy[i]);\n}\n\nint aa[N + 1], dp[N + 1], dq[N + 1], n;\n\nvoid solve(int l, int r) {\n\tstatic int qu[N + 1], qq[N + 1], pp[N + 1];\n\tint m, h, i, j, q, p, cnt;\n\n\tif (r - l == 1)\n\t\treturn;\n\tm = (l + r) / 2;\n\tsolve(l, m);\n\tsolve(m, r);\n\tq = 0;\n\tfor (i = m - 1; i >= l; i--)\n\t\tqq[i] = q = max(q, aa[i]);\n\tp = 0;\n\tfor (i = m; i < r; i++)\n\t\tpp[i] = p, p = max(p, aa[i]);\n\tcnt = 0;\n\tfor (j = m, i = m - 1, h = 0; j < r; j++) {\n\t\twhile (i >= l && qq[i] <= pp[j]) {\n\t\t\txx[i] = i, yy[i] = dp[i];\n\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\tcnt--;\n\t\t\tqu[cnt++] = i;\n\t\t\tif (h >= cnt - 2)\n\t\t\t\th = cnt - 1;\n\t\t\ti--;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], pp[j], -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], pp[j], -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], pp[j] * j - dot2(xx[qu[h]], yy[qu[h]], pp[j], -1));\n\t}\n\tcnt = 0;\n\tfor (j = r - 1, i = l, h = 0; j >= m; j--) {\n\t\twhile (i < m && qq[i] > pp[j]) {\n\t\t\txx[i] = qq[i], yy[i] = dp[i] - qq[i] * i;\n\t\t\tif (cnt && xx[qu[cnt - 1]] == xx[i]) {\n\t\t\t\tif (yy[qu[cnt - 1]] > yy[i])\n\t\t\t\t\tqu[cnt - 1] = i;\n\t\t\t} else {\n\t\t\t\twhile (cnt >= 2 && cross(qu[cnt - 2], qu[cnt - 1], i) >= 0)\n\t\t\t\t\tcnt--;\n\t\t\t\tqu[cnt++] = i;\n\t\t\t}\n\t\t\tif (h >= cnt - 2)\n\t\t\t\th = cnt - 1;\n\t\t\ti++;\n\t\t}\n\t\twhile (h > 0 && dot2(xx[qu[h]], yy[qu[h]], -j, -1) < dot2(xx[qu[h - 1]], yy[qu[h - 1]], -j, -1))\n\t\t\th--;\n\t\tif (cnt)\n\t\t\tdq[j] = min(dq[j], -dot2(xx[qu[h]], yy[qu[h]], -j, -1));\n\t}\n}\n\nint main() {\n\tint k, i;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmemset(dp, 0x3f, (n + 1) * sizeof *dp), dp[0] = 0;\n\twhile (k--) {\n\t\tmemset(dq, 0x3f, (n + 1) * sizeof *dq);\n\t\tsolve(0, n + 1);\n\t\tmemcpy(dp, dq, (n + 1) * sizeof *dp);\n\t}\n\tprintf(\"%d\\n\", dp[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e0049d29913c5de672ae8ad0a89041cb", "src_uid": "f42faaaa88628748a8da49111936be00", "difficulty": 3000.0} {"lang": "GNU C", "source_code": "// PRIME1 - C99 (gcc)\n// AC Time: 0.07s\n#include \n#include \n#include \n#include \n\nint main() {\n int primes[4000];\n int numprimes = 0;\n\n primes[numprimes++] = 2;\n for (int i = 3; i <= 32000; i+=2) {\n bool isprime = true;\n int cap = sqrt(i)+1;\n for (int j = 0; j < numprimes; j++) {\n if (primes[j] >= cap) break;\n if (i % primes[j] == 0) {\n isprime = false;\n break;\n }\n }\n if (isprime) primes[numprimes++] = i;\n }\n\n int N,M;\n\n scanf(\"%d %d\",&M,&N);\n int start = N%2?(N-2):N-1;\n for (int i = start; i > M; i-=2) {\n // printf(\"Checking %d\\n\",i);\n bool isprime = true;\n int cap = sqrt(i)+1;\n for (int j = 0; j < numprimes; j++) {\n // printf(\"%d\\n\",primes[j]);\n if (primes[j] >= cap or primes[j] > M) break;\n if (i % primes[j] == 0) {\n isprime = false;\n break;\n }\n }\n if (isprime){\n printf(\"%d\\n\", i);return 0;\n }\n }\n printf(\"-1\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "c56db7cdd143b7dd66006a3de5149813", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint isPrime(int n)\n{\n\t// Corner cases\n\tif (n <= 1) return 0;\n\tif (n <= 3) return 1;\n\n\t// This is checked so that we can skip \n\t// middle five numbers in below loop\n\tif (n % 2 == 0 || n % 3 == 0) return 0;\n\n\tfor (int i = 5; i*i <= n; i = i + 6)\n\t\tif (n%i == 0 || n % (i + 2) == 0)\n\t\t\treturn 0;\n\n\treturn 1;\n}\n\nint main()\n{\n\tint y, p;\n\tint c = 0;\n\tscanf(\"%d %d\", &p, &y);\n\tint i = y;\n\twhile (i > p)\n\t{\n\t\tif (i % 2 == 0)\n\t\t\ti--;\n\t\telse\n\t\t{\n\t\t\tif (isPrime(i))\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i);\n\t\t\t\tc = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (sqrt(i) <= p)\n\t\t\t\ti--;\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i);\n\t\t\t\tc = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (c == 0)\n\t\tprintf(\"-1\");\n\treturn 0;\n}\nclose", "lang_cluster": "C", "compilation_error": true, "code_uid": "db41c034411ab3b82471dbe44313f81a", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint isPrime(int n)\n{\n\t// Corner cases\n\tif (n <= 1) return 0;\n\tif (n <= 3) return 1;\n\n\t// This is checked so that we can skip \n\t// middle five numbers in below loop\n\tif (n % 2 == 0 || n % 3 == 0) return 0;\n\n\tfor (int i = 5; i*i <= n; i = i + 6)\n\t\tif (n%i == 0 || n % (i + 2) == 0)\n\t\t\treturn 0;\n\n\treturn 1;\n}\n\nint main()\n{\n\tint y, p;\n\tint c = 0;\n\tscanf(\"%d %d\", &p, &y);\n\tint i = y;\n\twhile (i > p)\n\t{\n\t\tif (i % 2 == 0)\n\t\t\ti--;\n\t\telse\n\t\t{\n\t\t\tif (isPrime(i))\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i);\n\t\t\t\tc = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (sqrt(i) <= p)\n\t\t\t\ti--;\n\t\t\telse\n\t\t\t{\n\t\t\t\tint j = p;\n\t\t\t\tint c1 = 0;\n\t\t\t\twhile (j > 2)\n\t\t\t\t{\n\t\t\t\t\tif (i%j == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tc1 = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\tif (c1 = 1)\n\t\t\t\t\ti--;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\", i);\n\t\t\t\t\tc = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (c == 0)\n\t\tprintf(\"-1\")\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1032f0a365aadaa258cc311826cb29eb", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint isPrime(int n)\n{\n\t// Corner cases\n\tif (n <= 1) return 0;\n\tif (n <= 3) return 1;\n\n\t// This is checked so that we can skip \n\t// middle five numbers in below loop\n\tif (n % 2 == 0 || n % 3 == 0) return 0;\n\n\tfor (int i = 5; i*i <= n; i = i + 6)\n\t\tif (n%i == 0 || n % (i + 2) == 0)\n\t\t\treturn 0;\n\n\treturn 1;\n}\n\nint main()\n{\n\tint y, p;\n\tint c = 0;\n\tscanf(\"%d %d\", &p, &y);\n\tint i = y;\n\twhile (i > p)\n\t{\n\t\tif (i % 2 == 0)\n\t\t\ti--;\n\t\telse\n\t\t{\n\t\t\tif (isPrime(i))\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i);\n\t\t\t\tc = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (sqrt(double(i)) <= p)\n\t\t\t\ti--;\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\", i);\n\t\t\t\tc = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (c == 0)\n\t\tprintf(\"-1\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5f6ab0a0cc215d6a6a32ad6500a3fd00", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nstruct node{\n\tint data;\n\tstruct node* next;\n};\nstruct node** hash;\nint size=100001;\nvoid init_hash()\n{\n\tint i;\n\tfor(i=0;idata=data;\n\thead->next=hash[pos];\n\thash[pos]=head;\n}\nint is_present(int data)\n{\n\tint pos=data%size;\n\tstruct node* cur=hash[pos];\n\twhile(cur)\n\t{\n\t\tif(cur->data==data)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\tcur=cur->next;\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint p,y;\n\tint i,j,k;\n\thash=malloc(size*sizeof(struct node*));\n\tinit_hash();\n\tscanf(\"%d %d\",&p,&y);\n\tint flag=0;\n\tfor(i=2;i<=p;i++)\n\t{\n\t\tif(!is_present(i))\n\t\t{\n\t\t\tfor(j=i;j<=end;j+=i)\n\t\t\t{\n\t\t\t\tif(j>p)\n\t\t\t\t hash_it(j);\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=y;i>p;i--)\n\t{\n\t\tif(!is_present(i))\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(!flag)\n\t printf(\"-1\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1e9a966e49e42779675e00e3dff1cd15", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n\tint t,n,l,k,d[200],a[200],flag,i,tmr,temp;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%d %d %d\",&n,&k,&l);\n\t\tfor(i=0;il)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\t// printf(\"%d-%d\\n\",d[i],i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(d[i]+k>l)\n\t\t\t{\n\t\t\t\tif(i==0 || tmr==1000)\n\t\t\t\t{\n\t\t\t\t\ta[i]=l;\n\t\t\t\t\ttmr=l-d[i];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(tmr>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp=a[i-1]-d[i-1];\n\t\t\t\t\t\ta[i]=a[i-1]-1;\n\t\t\t\t\t\ttmr--;\n\t\t\t\t\t\twhile(a[i]>l)\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\ta[i]--;\n\t\t\t\t\t\t\ttmr--;\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\tif(a[i-1]+1>l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t\t// printf(\"hi\\n\");\n\t\t\t\t\t\t\tbreak;\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\ta[i]=a[i-1]+1;\n\t\t\t\t\t\t\ttmr=tmr-1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if(tmr==-k)\n\t\t\t\t\t\t// {\n\t\t\t\t\t\t// \ttmr=k;\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\tif(flag==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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6930fb202edc4e008b9a2144a7945257", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n\tint t,n,l,k,d[200],a[200],flag,i,tmr,temp;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%d %d %d\",&n,&k,&l);\n\t\tfor(i=0;il)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\t// printf(\"%d-%d\\n\",d[i],i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(d[i]+k>l)\n\t\t\t{\n\t\t\t\tif(i==0 || tmr==1000)\n\t\t\t\t{\n\t\t\t\t\ta[i]=l;\n\t\t\t\t\ttmr=l-d[i];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(tmr>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp=a[i-1]-d[i-1];\n\t\t\t\t\t\ta[i]=a[i-1]-1;\n\t\t\t\t\t\ttmr--;\n\t\t\t\t\t\twhile(a[i]>l)\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\ta[i]--;\n\t\t\t\t\t\t\ttmr--;\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\tif(a[i-1]+1>l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t\t// printf(\"hi\\n\");\n\t\t\t\t\t\t\tbreak;\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\ta[i]=a[i-1]+1;\n\t\t\t\t\t\t\ttmr=tmr-1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(tmr==-k)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttmr=k;\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\tif(flag==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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bfdf08f99394893d6d31dcd2c99947d4", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n\tint t,n,l,k,d[200],a[200],flag,i,tmr,temp;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%d %d %d\",&n,&k,&l);\n\t\tfor(i=0;il)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\t// printf(\"%d-%d\\n\",d[i],i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(d[i]+k>l)\n\t\t\t{\n\t\t\t\tif(i==0 || tmr==1000)\n\t\t\t\t{\n\t\t\t\t\ta[i]=l;\n\t\t\t\t\ttmr=l-d[i];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(tmr>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp=a[i-1]-d[i-1];\n\t\t\t\t\t\ta[i]=d[i]+temp-1;\n\t\t\t\t\t\tif(a[i]<=l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttmr=tmr-1;\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\ttemp=a[i]-l;\n\t\t\t\t\t\t\ttmr=tmr-temp-1;\n\t\t\t\t\t\t\ta[i]=l;\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\tif(a[i-1]+1>l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t\t// printf(\"hi\\n\");\n\t\t\t\t\t\t\tbreak;\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\ta[i]=a[i-1]+1;\n\t\t\t\t\t\t\ttmr=tmr-1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(tmr==-k)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttmr=k;\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\tif(flag==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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b29633d4953ee4fc9a505ebda4b836b7", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n\tint t,n,l,k,d[200],a[200],flag,i,tmr,temp;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%d %d %d\",&n,&k,&l);\n\t\tfor(i=0;il)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\t// printf(\"%d-%d\\n\",d[i],i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(d[i]+k>l)\n\t\t\t{\n\t\t\t\tif(i==0 || tmr==1000)\n\t\t\t\t{\n\t\t\t\t\ta[i]=l;\n\t\t\t\t\ttmr=l-d[i];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(tmr>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp=a[i-1]-d[i-1];\n\t\t\t\t\t\ta[i]=d[i]+tmr-1;\n\t\t\t\t\t\ttmr--;\n\t\t\t\t\t\twhile(a[i]>l)\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\ta[i]--;\n\t\t\t\t\t\t\ttmr--;\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\ttmr=tmr-1;\n\t\t\t\t\t\tif(d[i]-tmr>l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t\t// printf(\"%d\\n\",i);\n\t\t\t\t\t\t\tbreak;\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\ta[i]=d[i]-tmr;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if(tmr==-k)\n\t\t\t\t\t\t// {\n\t\t\t\t\t\t// \ttmr=k;\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\tif(flag==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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ed7eddc9b3010a9bc5ac3aef72cae505", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint main()\n{\n\tlong long int t,n,l,k,d[200],a[200],flag,i,tmr,temp;\n\tscanf(\"%lld\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%lld %lld %lld\",&n,&k,&l);\n\t\tfor(i=0;il)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\t// printf(\"%d-%d\\n\",d[i],i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(d[i]+k>l)\n\t\t\t{\n\t\t\t\tif(i==0 || tmr==1000)\n\t\t\t\t{\n\t\t\t\t\ta[i]=l;\n\t\t\t\t\ttmr=l-d[i];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(tmr>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp=a[i-1]-d[i-1];\n\t\t\t\t\t\ta[i]=d[i]+tmr-1;\n\t\t\t\t\t\ttmr--;\n\t\t\t\t\t\tif(a[i]>l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttmr=tmr-(a[i]-l);\n\t\t\t\t\t\t\ta[i]=l;\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\ttmr=tmr-1;\n\t\t\t\t\t\tif(d[i]-tmr>l)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t\t// printf(\"%d\\n\",i);\n\t\t\t\t\t\t\tbreak;\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\ta[i]=d[i]-tmr;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if(tmr==-k)\n\t\t\t\t\t\t// {\n\t\t\t\t\t\t// \ttmr=k;\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\tif(flag==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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8c8e6bc1cb795e0156f0c1eccbce97d8", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \"stdio.h\"\n#include \"math.h\"\n\nint main()\n{\n\tint n,m,a,b;\n\tscanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\t\n\tif((lround(ceil((double)a/m)) == lround(ceil((double)b/m))) || m==1 || (a%m==1 && (b==n || b%m==0 ))){\n\t\tprintf(\"1\\n\");\n\t}else if(((b-a+1)%m) == 0 && (m-((a%m)?(a%m):m)+b%m+1) == m)\n\t{\n\t\tprintf(\"2\\n\");\n\t}else{\n\t\tint num = 1;\n\t\tif(a%m != 1)\n\t\t\tnum++;\n\n\t\tif(b%m != 0 && b!=n)\n\t\t\tnum++;\n\n\t\tif(b-a <= (2*m-((a%m)?(a%m):m)) && num == 3)\n\t\t\tnum--;\n\t\tprintf(\"%d\\n\",num);\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d9268b1e740f5a8945834d6ba4d9092d", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n,m,a,b,x1,y1,x2,y2;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n a--;\n b--;\n x1=a/m;\n y1=a%m;\n x2=b/m;\n y2=b%m;\n if (x1==x2)\n puts(\"1\");\n else if (x1==x2-1)\n puts(!y1&&(y2==m-1||b==n-1)?\"1\":\"2\");\n else\n printf(\"%d\\n\",3-!y1-(y2==m-1||b==n-1||y1==y2+1));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ccedbbb7a3afff873add9fb3e5f8a92", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n, m, a, b, p, q, r;\n\n scanf(\"%d %d %d %d\", &n, &m, &a, &b);\n\n p = m - (a - 1) % m;\n q = m;\n r = b % m;\n\n if (p >= b - a + 1) {\n\t puts(\"1\");\n } else if (b - a - p + 1 <= m) {\n\t if (p == m && (b - a - p + 1 == m || b == n)) {\n\t puts(\"1\");\n\t } else {\n\t puts(\"2\");\n\t }\n } else {\n\t int c = 3;\n\n\t if (p == q) c--;\n\t if (r == 0 || b == n || p + r == m) c--;\n\n\t printf(\"%d\\n\", c);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "df320564d1b12e727d34c12321a929d9", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int n,m,a,b,x1,y1,x2,y2;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n a--;\n b--;\n x1=a/m;\n y1=a%m;\n x2=b/m;\n y2=b%m;\n if (x1==x2)\n puts(\"1\");\n else if (x1==x2-1)\n puts(!y1&&(y2==m-1||b==n-1)?\"1\":\"2\");\n else\n printf(\"%d\\n\",3-!y1-(y2==m-1||b==n-1||y1==y2+1));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fdd0882378a12c14dd7b9478c6e6fd07", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nmain()\n{\n int n,m,a,b,r1,r2,ans;\n \n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n \n if (a==b)\n ans=1;\n else if (m==1)\n ans=1;\n else\n {\n r1=a%m;\n r2=b%m; \n if (b==n)\n {\n if (r2==0)\n r2=m;\n if (r1==1||r2-(b-a)>0)\n ans=1;\n else \n ans=2;\n } \n \n else if (r1==1&&r2==0)\n ans=1;\n else if (r1==1)\n {\n if (r1+b-a<=m)\n ans=1;\n else\n ans=2;\n }\n else if (r2==0)\n {\n if (m-(b-a)>=0)\n ans=1;\n else\n ans=2;\n }\n else\n {\n if (r1==0)\n r1=m; \n if (r1+(b-a)<=m)\n ans=1;\n else if (m-r1+r2==b-a)\n ans=2;\n else\n {\n if (r2+1==r1)\n ans=2;\n else\n ans=3;\n }\n }\n }\n \n printf(\"%d\\n\",ans); \n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1e4d7eb782ba4ec1b502f920a3ee8e4", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\nint minprime[5000005], l, r;\nlong long t, sum = 0;\nlong long f[5000005];\nint main()\n{\n\tscanf(\"%I64d %d %d\", &t, &l, &r);\n\tfor (int i = 2; i <= r; i++)\n\t\tminprime[i] = i;\n\tfor (int i = 2; i*i <= r; i++)\n\t{\n\t\tfor (int j = i*i; j <= r; j += i)\n\t\t{\n\t\t\tif (minprime[j] > i)\n\t\t\t\tminprime[j] = i;\n\t\t}\n\t}\n\tmemset(f, 0, sizeof(f));\n\tfor (int i = 2; i <= r; i++)\n\t{\n\t\tif (minprime[i] == i)\n\t\t{\n\t\t\tf[i] = ((long long)(i*i - i) / 2) % (1000000000 + 7);\n\t\t}\n\t\telse\n\t\tfor (int j = i; j != 1; j /= minprime[j])\n\t\t{\n\t\t\tf[i] += (f[minprime[j]])*(j/minprime[j]);\n\t\t\tf[i] %= (1000000000 + 7);\n\t\t}\n\t}\n\tfor (int i = l; i <= r; i++)\n\t{\n\t\tsum += pow(t, i - l)*f[i];\n\t\tsum %= (1000000000 + 7);\n\t}\n\tprintf(\"%I64d\\n\", sum);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a5509e915f1aa9f7669af9fed4aa331b", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n#define BS_NOT_FOUND 0\n#define BS_FOUND 1\n\nll f[5000006]={0};\nll prime[5000006]={0};\n\nlong long expo(long long x, long long n){\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\nint main(){\n //calculate f[i]\n ll i,j;\n for(i=2;i<=5000000;i++){\n if(prime[i]>0) continue;\n prime[i]=i;\n for(j=2*i;j<=5000000;j+=i){\n if(prime[j]==0) prime[j]=i;\n }\n }\n f[1]=0;\n for(i=2;i<=5000000;i++) f[i]=(f[i/prime[i]]+i*(prime[i]-1)/2%MOD)%MOD;\n\n /*\n f[2]=1;\n f[3]=3;\n f[4]=3;\n f[5]=10;\n f[7]=21;\n f[11]=55;\n f[13]=66;\n f[17]=17*16/2;\n f[19]=19*9;\n f[23]=253;\n f[29]=29*14;\n ll i,index,j,num;\n for(i=6;i<=5000000;i++){\n num=i;\n index=2;\n if(i%2==0) {f[i]=i/2+f[i/2];continue;}\n if(i%3==0) {f[i]=i+f[i/3];continue;}\n if(i%5==0) {f[i]=i*2+f[i/5];continue;}\n if(i%7==0) {f[i]=i*3+f[i/7];continue;}\n if(i%11==0) {f[i]=i*5+f[i/11];continue;}\n if(i%13==0) {f[i]=i*6+f[i/13];continue;}\n if(i%17==0) {f[i]=i*8+f[i/17];continue;}\n if(i%19==0) {f[i]=i*9+f[i/19];continue;}\n if(i%23==0) {f[i]=i*11+f[i/23];continue;}\n if(i%29==0) {f[i]=i*14+f[i/29];continue;}\n while(num%index!=0 && index*index<=num) index++;\n if(index*index>num){\n f[i]=(i*(i-1)/2);\n continue;\n }\n f[i]=i/index*f[index]+f[i/index];\n }\n */\n //for(i=2;i<=5000000;i++) printf(\"%lld,\",f[i]);\n\n ll t,l,r;\n scanf(\"%lld %lld %lld\",&t,&l,&r);\n ll ans=0;\n for(i=l;i<=r;i++){\n ll x=expo(t,i-l);\n ll y=(x*(f[i]))%MOD;\n ans=(ans+y)%MOD;\n }\n printf(\"%lld\\n\",ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0aa96f7cc8b125c115d7febc443adadd", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\nlong long int mod=1000000007;\n\nlong long int add(long long int a, long long int b)\n{\n long long int temp=a+b;\n return (temp%mod);\n}\n\nlong long int mult(long long int a, long long int b)\n{\n long long int temp=a*b;\n return (temp%mod);\n}\n\nint main()\n{\n long long int t,l,r;\n scanf(\"%lld %lld %lld\",&t, &l, &r);\n long long int f[5000005],i,j;\n bool key;\n for(i=1;i<=r;i++)\n {\n if(i==1)\n f[i]=0;\n else\n {\n key=true;\n for(j=2;j\ntypedef long long int lli;\nlli m=1e9+7;\nlli d[5000001];\nint main()\n{\n for(int i=1;i<=5000000;i++) d[i]=1e18;\n d[1]=0;\n for(lli i=1;i<=5000000;i++)\n {\n for(lli j=2*i;j<=5000000;j+=i)\n {\n lli g=j/i;\n lli u=d[i]+(j*(g-1))/2;\n if(d[j]>u) d[j]=u;\n }\n }\n lli t,l,r;\n scanf(\"%lld %lld %lld\",&t,&l,&r);\n lli a=0,k=1;\n for(int i=r;i>=l;i--){\n a=(a*t)%m;\n a=(a+d[i])%m;\n }\n printf(\"%lld\",a);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c338582cf9ce28b3f5a2a97cf1fd899f", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n#define BS_NOT_FOUND 0\n#define BS_FOUND 1\n\nll f[5000006];\n\nlong long expo(long long x, long long n){\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\nint main(){\n //calculate f[i]\n f[2]=1;\n f[3]=3;\n f[4]=3;\n f[5]=10;\n ll i,index,j,num;\n for(i=6;i<=5000000;i++){\n num=i;\n index=2;\n if(i%2==0) {f[i]=n/2+f[n/2];continue;}\n if(i%3==0) {f[i]=n/3+f[n/3];continue;}\n if(i%5==0) {f[i]=n/5+f[n/5];continue;}\n while(num%index!=0 && index*index<=num) index++;\n if(index*index>num){\n f[i]=(i*(i-1)/2);\n continue;\n }\n f[i]=i/index*f[index]+f[i/index];\n }\n\n ll t,l,r;\n scanf(\"%lld %lld %lld\",&t,&l,&r);\n ll ans=0;\n for(i=l;i<=r;i++){\n ll x=expo(t,i-l);\n ll y=(x*(f[i]%MOD))%MOD;\n ans=(ans+y)%MOD;\n }\n printf(\"%lld\\n\",ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd94976c73fed4de8bbcc46a1db5e968", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define min(a,b) ((a)<(b)?(a):(b))\n\ntypedef long long ll;\n\nchar str[200001];\n\nint main()\n{\n\tint i,n,m,res;\n\tll val, pw;\n\tscanf(\"%s%d\",str,&m);\n\tn=strlen(str);\n\tres=m;\n\tpw=1;\n\tval=0;\n\tfor(i=0;i\n#include \n\n#define MAX 200005\nchar s[MAX];\nint m, len;\nlong long base, pref, suf[MAX], res, tmp;\n\nint main(){\n //freopen(\"in.txt\", \"r\", stdin);\n scanf(\"%s %d\", s, &m);\n len = strlen(s);\n for (int i = len - 1; i >= 0; --i)\n suf[i] = (suf[i + 1] * 10 + s[i] - '0') % m;\n\n res = 1e18;\n base = 1;\n for (int i = 0; i < len; ++i){\n if (s[i] != '0'){\n tmp = (suf[i] * base + pref) % m;\n if (res > tmp)\n res = tmp;\n }\n base = (base * 10) % m;\n pref = (pref * 10 + s[i] - '0') % m;\n }\n printf(\"%lld\", res);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "557c63c6f43cd3f952f6a46345158405", "src_uid": "d13c7b5b5fc5c433cc8f374ddb16ef79", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\n\n#define fo(i, n) for(int i = 1; i <= n; ++i)\n#define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i))\n\n#define ll long long\nint N = 200200;\nchar s[400400];\n\nll res = 2e9;\nll a[400400];\n\nll ost;\n\nll min(ll a, ll b)\n{\n\tif(a > b)\n\t\treturn b;\n\treturn a;\n}\n\nint main()\n{\n\tscanf(\"%s\", s);\n\tint n = strlen(s);\n\tint m;\n\tscanf(\"%d\", &m);\n\tll st = 1;\n\tfor(int i = 1; i <= n; ++i)\n\t\tst = st * 10 % m;\n\tfor(int i = 1; i <= n + n; ++i)\n\t if(i <= n)\n\t\t\ta[i] = s[(i - 1)] - '0';\n\t\telse\n\t\t\ta[i] = s[(i - 1 - n)] - '0';\n\tfor(int i = 1; i <= n; ++i)\n\t\tost = (ost * 10 + a[i]) % m;\n\tres = min(res, ost);\n\tfor(int i = 2; i <= n; ++i)\n\t{\n\t\tost = (ost * 10 + a[i + n - 1]) % m;\n\t\tost = (ost + m - st * a[i - 1] % m) % m;\n\t\tres = min(res, ost);\n\t}\n\tprintf(\"%lld\", res);\n\treturn 0;\t\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "32f855607396f9f6cd2b5f16c7091e6b", "src_uid": "d13c7b5b5fc5c433cc8f374ddb16ef79", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#define M 500005\nchar s[M];\nint n,m,now,p=1,ans;\nint read(){\n\tchar c=getchar();int ans=0;\n\twhile (c<'0'||c>'9') c=getchar();\n\twhile (c>='0'&&c<='9') ans=ans*10+c-'0',c=getchar();\n\treturn ans;\n}\nint min(int x,int y){return x\n#include \n#include \nusing namespace std;\n//\u8eab\u4efd\u8bc1 && \u51c6\u8003\u8bc1 && \u80f8\u5361\nconst int N = 200003;\nint n, a[N]; char s[N];\nint M, t;\ninline int ksm (int p, int x) {\nint s = 1;\nwhile (x) {\nif (x & 1) s = 1ll * s * p % M;\np = 1ll * p * p % M;\nx >>= 1;\n}\nreturn s;\n}\nint main () {\nscanf (\"%s %d\", s + 1, &M);\nn = strlen (s + 1);\nint i; for (i = 1; i <= n; ++i) a[i] = s[i] ^ 48, t = ((t << 3) + (t << 1) + a[i]) % M;\nint mn = t, k = ksm (10, n + 1);\nfor (i = 1; i <= n; ++i) {\nt = ((t << 3) + (t << 1)) % M;\nt = (t - 1ll * k * a[i] % M + M) % M;\nt = (t + a[i]) % M;\nif (a[i + 1]) mn = min (mn, t);\n}\nprintf (\"%d\\n\", mn);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4cdc62ff611320b569ec29f373249cc8", "src_uid": "d13c7b5b5fc5c433cc8f374ddb16ef79", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\nint main() {\n\tint x1, x2, x, a, b, r, tmp, flipped;\n\n\tscanf(\"%d%d%d%d\", &x1, &x2, &a, &b);\n\tx = x2 - x1;\n\tif (x >= a && x <= b) {\n\t\tprintf(\"FIRST\\n\");\n\t\tprintf(\"%d\\n\", x2);\n\t\treturn 0;\n\t}\n\tflipped = 0;\n\tif (x < 0) {\n\t\tx = -x;\n\t\tflipped = 1;\n\t\ttmp = a, a = -b, b = -tmp;\n\t}\n\tif (a <= 0) {\n\t\tprintf(\"DRAW\\n\");\n\t\treturn 0;\n\t}\n\tr = x % (a + b);\n\tif (r == 0) {\n\t\tprintf(\"SECOND\\n\");\n\t\treturn 0;\n\t}\n\tif (r < a || r > b) {\n\t\tprintf(\"DRAW\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"FIRST\\n\");\n\tprintf(\"%d\\n\", x1 + (flipped ? -r : r));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a3f67b57a9bd627842f642abf69eb8b0", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i b){\n puts(\"DRAW\");\n continue;\n }\n\n if(stone > b && fgg){\n puts(\"DRAW\");\n continue;\n }\n\n stone -= mod;\n puts(\"FIRST\");\n if(fg==0) printf(\"%d\\n\",x2-stone);\n else printf(\"%d\\n\",x2+stone);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "194d47b17935d9e2f9c3b7050917b742", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i b && fgg){\n puts(\"DRAW\");\n continue;\n }\n\n stone -= mod;\n puts(\"FIRST\");\n if(fg==0) printf(\"%d\\n\",x2-stone);\n else printf(\"%d\\n\",x2+stone);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4eaf4ca4ec129a0613c2b7d4d906cf6f", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\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} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "66d8e2fb2b21d525b2e5438a2f673097", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0} {"lang": "GNU C", "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\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} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "6e0a7a0528d231adb477a3a41ab5ae90", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0} {"lang": "GNU C", "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} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "db9fb21905f8f5ac53911542b631b427", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0} {"lang": "GNU C", "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} ", "lang_cluster": "C", "compilation_error": false, "code_uid": "8eeb0c67e80e5cef46a24e7220476d20", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include\nint a[10000];\nint main()\n{\n int c,d,n,m,k,total,ans,sum,i=0;\n scanf(\"%d %d %d %d %d\",&c,&d,&n,&m,&k);\n total=n*m-k;\n while((total-i)>0)\n {\n if((total-i)%n==0)\n {\n a[i]=(((total-i)/n)*c)+(i*d);\n }\n else\n a[i]=((((total-i)/n)+1)*c)+(i*d);\n i++;\n }\n ans=a[0];\n for(int j=1;ja[j])\n ans=a[j];\n }\n printf(\"%d\\n\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a673405285ac02070a4b9a9294e8011c", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint c,d,n,m,k,q,i,p;\nint check(int n)\n{\n return(c>d*n);\n} \nint main(void) {\n scanf(\"%d %d\",&c,&d);\n scanf(\"%d %d\",&n,&m);\n scanf(\"%d\",&k);\n p=n*m-k;\n i=check(n);\n if(i==1)\n printf(\"%d\",p*d);\n else\n {\n while(p>=n)\n {\n q+=c;\n p-=n;\n }\n while(p>0)\n {\n i=check(p);\n if(i==1)\n {\n q+=d;\n p--;\n } \n else\n {\n q+=c;\n p-=n;\n }\n }\n printf(\"%d\",q);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dbadf769d4dff8e01127a56120e5a0a1", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nvoid main()\n{\n\tint n,m,c,d,k,s;\n\twhile(scanf(\"%d%d%d%d%d\",&c,&d,&n,&m,&k)!=EOF)\n\t{\n\t\tif(k>=n*m)\n\t\t\tprintf(\"0\\n\");\n\t\telse\n\t\t{\n\t\t\ts=n*m-k;\n\t\t\tif(c/n>1)\n\t\t\t\tprintf(\"s\\n\");\n\t\t\telse\n\t\t\t{\tif(s%n==0)\n\t\t\t\t\tprintf(\"%d\\n\",s/n);\n\t\t\t\telse\n\t\t\t\t\t\tprintf(\"%d\\n\",s/n+1);\n\t\t\t}\n\t\t}\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "857255014d26ae5c59c7b34f9718a54f", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\nint a[101];\nint main()\n{\n int c,d,n,m,k,total,ans,sum,i=0;\n scanf(\"%d %d %d %d %d\",&c,&d,&n,&m,&k);\n total=n*m-k;\n while((total-i)>0)\n {\n if((total-i)%n==0)\n {\n a[i]=(((total-i)/n)*c)+(i*d);\n }\n else\n a[i]=((((total-i)/n)+1)*c)+(i*d);\n i++;\n }\n ans=a[0];\n for(int j=1;ja[j])\n ans=a[j];\n }\n printf(\"%d\\n\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "11ceb8d6ee2f7282ffa1aec5af3b38d3", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\n int c,d,n,m,k,ans,tot;\n scanf(\"%d %d\",&c,&d);\n scanf(\"%d %d\",&n,&m);\n scanf(\"%d\",&k);\n tot=n*m-k;\n if (c>d&&n==1)\n {\n ans=tot*d;\n }\n else\n {\n ans=0;\n ans=ans+(tot/n)*c;\n tot=tot-tot/n*n;\n if (tot*dt[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}\nint dfs3(struct card piles[],int n,int a[55][55][55][55]){\n\tint dfs1(struct card[],int,int [][][][]);\n\tif(n<=3)\n\t\treturn 0;\n\tif(a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id]!=-1)\n\t\treturn a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id];\n\tif(piles[n-1].suit==piles[n-4].suit || piles[n-1].val==piles[n-4].val){\n\t\tstruct card p[n];\n\t\tint i;\n\t\tfor(i=0;i2)\n\t\tif(a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id]!=-1)\n\t\t\t\t\treturn a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id];\n\tif(piles[n-1].val==piles[n-2].val || piles[n-1].suit==piles[n-2].suit){\n\t\tstruct card p[n-1];\n\t\tint i;\n\t\tfor(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}\nint dfs3(struct card piles[],int n,int a[55][55][55][55]){\n\tint dfs1(struct card[],int,int [][][][]);\n\tif(n<=3)\n\t\treturn 0;\n\tif(a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id]!=-1)\n\t\treturn a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id];\n\tif(piles[n-1].suit==piles[n-4].suit || piles[n-1].val==piles[n-4].val){\n\t\tstruct card p[n];\n\t\tint i;\n\t\tfor(i=0;i2)\n\t\tif(a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id]!=-1)\n\t\t\t\t\treturn a[n][piles[n-1].id][piles[n-2].id][piles[n-3].id];\n\tif(piles[n-1].val==piles[n-2].val || piles[n-1].suit==piles[n-2].suit){\n\t\tstruct card p[n-1];\n\t\tint i;\n\t\tfor(i=0;i\n\nint translate(char c) {\n\tswitch (c) {\n\t\tcase 'S':\n\t\t\treturn 0;\n\t\tcase 'D':\n\t\t\treturn 1;\n\t\tcase 'H':\n\t\t\treturn 2;\n\t\tcase 'C':\n\t\t\treturn 3;\n\t\tcase 'T':\n\t\t\treturn 10;\n\t\tcase 'J':\n\t\t\treturn 11;\n\t\tcase 'Q':\n\t\t\treturn 12;\n\t\tcase 'K':\n\t\t\treturn 13;\n\t\tcase 'A':\n\t\t\treturn 14;\n\t\tdefault:\n\t\t\treturn c - '0';\n\t}\n}\n\nint can(int n1, int s1, int n2, int s2) {\n\treturn n1 == n2 || s1 == s2;\n}\n\nint main() {\n\tint i, n, k, n0, s0, n1, s1, n2, s2, n3, s3;\n\tstatic int nn[52], ss[52], dp[52][15][4][15][4][15][4];\n\tstatic char s[3];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%s\", s);\n\t\tnn[i] = translate(s[0]);\n\t\tss[i] = translate(s[1]);\n\t}\n\tif (n == 1)\n\t\tprintf(\"YES\\n\");\n\telse if (n == 2)\n\t\tprintf(\"%s\\n\", can(nn[1], ss[1], nn[0], ss[0]) ? \"YES\" : \"NO\");\n\telse {\n\t\tfor (n2 = 2; n2 <= 14; n2++)\n\t\t\tfor (s2 = 0; s2 < 4; s2++)\n\t\t\t\tfor (n1 = 2; n1 <= 14; n1++)\n\t\t\t\t\tfor (s1 = 0; s1 < 4; s1++)\n\t\t\t\t\t\tfor (n0 = 2; n0 <= 14; n0++)\n\t\t\t\t\t\t\tfor (s0 = 0; s0 < 4; s0++)\n\t\t\t\t\t\t\t\tdp[2][n2][s2][n1][s1][n0][s0] =\n\t\t\t\t\t\t\t\t\t(n1 == n0 || s1 == s0)\n\t\t\t\t\t\t\t\t\t&& (n2 == n0 || s2 == s0);\n\t\tfor (k = 3; k <\tn; k++) {\n\t\t\tn3 = nn[k - 3];\n\t\t\ts3 = ss[k - 3];\n\t\t\tfor (n2 = 2; n2 <= 14; n2++)\n\t\t\t\tfor (s2 = 0; s2 < 4; s2++)\n\t\t\t\t\tfor (n1 = 2; n1 <= 14; n1++)\n\t\t\t\t\t\tfor (s1 = 0; s1 < 4; s1++)\n\t\t\t\t\t\t\tfor (n0 = 2; n0 <= 14; n0++)\n\t\t\t\t\t\t\t\tfor (s0 = 0; s0 < 4; s0++) {\n\t\t\t\t\t\t\t\t\tint yes = 0;\n\n\t\t\t\t\t\t\t\t\tif (can(n0, s0, n1, s1))\n\t\t\t\t\t\t\t\t\t\tyes = yes\n\t\t\t\t\t\t\t\t\t\t\t|| dp[k - 1][n3][s3][n2][s2][n0][s0];\n\t\t\t\t\t\t\t\t\tif (can(n0, s0, n3, s3))\n\t\t\t\t\t\t\t\t\t\tyes = yes || dp[k - 1][n0][s0][n2][s2][n1][s1];\n\t\t\t\t\t\t\t\t\tdp[k][n2][s2][n1][s1][n0][s0] = yes;\n\t\t\t\t\t\t\t\t}\n\t\t}\n\t\tprintf(\"%s\\n\", dp[n - 1][nn[n - 3]][ss[n - 3]][nn[n - 2]][ss[n - 2]][nn[n - 1]][ss[n - 1]] ? \"YES\" : \"NO\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb9e46bc2125faa9f10b20612b63cce9", "src_uid": "1805771e194d323edacf2526a1eb6768", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint a[52];\nint dp[2][52][52][52][52];\n\nint hash(char s[3])\n{\n int x = 0;\n \n if (s[0] >= '2' && s[0] <= '9') {\n x = s[0] - '1';\n } else if (s[0] == 'T') {\n x = 9;\n } else if (s[0] == 'J') {\n x = 10;\n } else if (s[0] == 'Q') {\n x = 11;\n } else if (s[0] == 'K') {\n x = 12;\n }\n \n if (s[1] == 'S') {\n x += 13;\n } else if (s[1] == 'D') {\n x += 26;\n } else if (s[1] == 'H') {\n x += 39;\n }\n \n return x;\n}\n\nint ok(int a, int b)\n{\n if (a / 13 == b / 13 || a % 13 == b % 13) {\n return 1;\n } else {\n return 0;\n }\n}\n\nint check(int n)\n{\n int tmp;\n \n if (n == 0) return 1;\n \n if (n == 3 && ok(a[0], a[3])) {\n tmp = a[0];\n a[0] = a[3];\n \n if (check(n - 1) == 1) return 1;\n \n a[3] = a[0];\n a[0] = tmp;\n }\n \n if (ok(a[n - 1], a[n])) {\n tmp = a[n - 1];\n a[n - 1] = a[n];\n \n if (check(n - 1) == 1) return 1;\n \n a[n] = a[n - 1];\n a[n - 1] = tmp;\n }\n \n return 0;\n}\n\nint main()\n{\n int n, i, j, k, l, m;\n \n scanf(\"%d\", &n);\n \n for (i = 0; i < n; i++) {\n char s[3];\n \n scanf(\"%s\", s);\n \n a[i] = hash(s);\n }\n \n if (n < 4) {\n if (check(n) == 1) {\n puts(\"YES\");\n } else {\n puts(\"NO\");\n }\n \n return 0;\n }\n \n dp[(n - 1) % 2][a[n - 4]][a[n - 3]][a[n - 2]][a[n - 1]] = 1;\n \n for (i = n - 1; i >= 4; i--) {\n for (j = 0; j < 52; j++) {\n for (k = 0; k < 52; k++) {\n for (l = 0; l < 52; l++) {\n for (m = 0; m < 52; m++) {\n if (dp[i % 2][j][k][l][m] == 0) continue;\n \n if (ok(j, m)) {\n dp[(i - 1) % 2][a[i - 4]][m][k][l] = 1;\n }\n \n if (ok(l, m)) {\n dp[(i - 1) % 2][a[i - 4]][j][k][m] = 1;\n }\n \n dp[i % 2][j][k][l][m] = 0;\n }\n }\n }\n }\n }\n \n for (i = 0; i < 52; i++) {\n for (j = 0; j < 52; j++) {\n for (k = 0; k < 52; k++) {\n for (l = 0; l < 52; l++) {\n if (dp[1][i][j][k][l] == 1) {\n a[0] = i;\n a[1] = j;\n a[2] = k;\n a[3] = l;\n \n if (check(3) == 1) {\n puts(\"YES\");\n \n return 0;\n }\n }\n }\n }\n }\n }\n \n puts(\"NO\");\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0cddc3f5902d163944b2ff9ab33ee9ed", "src_uid": "1805771e194d323edacf2526a1eb6768", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "/*\n * =====================================================================================\n *\n * Filename: Solitaire.c\n *\n * Description: \n *\n * Version: 1.0\n * Created: 2012\u5e7407\u670825\u65e5 13\u65f647\u520601\u79d2\n * Revision: none\n * Compiler: gcc\n *\n * Author: YOUR NAME (), \n * Organization: \n *\n * =====================================================================================\n */\n#include \n#include \n#include \n#define MAXN 2<<6\n#define OP1 1\n#define OP2 3\nint dp[MAXN][MAXN][MAXN][MAXN];\ntypedef struct Card {\n\tchar val;\n\tchar suit;\n} Card_t;\nCard_t cards[MAXN];\n/* \nint dfs(Card_t *cards, int n, int op) {\n\tif(n == 1) return 1;\n\tif(n - op <=0 ) return 0;\n\n\tif(cards[n].val == cards[n - op].val) {\n\t\tint tmpSuit = cards[n - op].suit;\n\t\tcards[n - op].suit = cards[n].suit;\n\t\tif(dfs(cards, n-1, OP1) || dfs(cards, n-1, OP2)) \n\t\t\treturn 1;\n\t\telse \n\t\t\tcards[n - op].suit = tmpSuit;\n\t}\n\tif(cards[n].suit == cards[n - op].suit) {\n\t\tint tmpVal = cards[n- op].val;\n\t\tcards[n - op].val = cards[n].val;\n\t\tif(dfs(cards, n-1, OP1) || dfs(cards, n-1, OP2))\n\t\t\treturn 1;\n\t\telse \n\t\t\tcards[n -op].val = tmpVal;\n\t}\n\treturn 0;\n}\n*/\n\nint calc(int n, int a, int b, int c) {\n\tif(n == 1) return 1;\n\tif(n == 2) {\n\t\tif(cards[a].val == cards[b].val || cards[a].suit == cards[b].suit) return 1;\n\t\telse return 0;\n\t}\n\tif(n == 3) {\n\t//\tprintf(\"n-%d a-%d b-%d c-%d\\n\",n,a,b,c);\n\t\tif(cards[c].val == cards[b].val || cards[c].suit == cards[b].suit) {\n\t//\t\tprintf(\"cards[%d].val=%c cards[%d].val=%c\\n\",c,cards[c].val,b,cards[b].val);\n\t\t\tif(cards[c].val == cards[a].val || cards[c].suit == cards[a].suit) \n\t\t\t\treturn 1;\n\t\t\telse \n\t\t\t\treturn 0;\n\t\t}\n\t\telse \n\t\t\treturn 0;\n\t}\n\treturn 0;\n}\n\nint main() {\n\tint i,j,k,l,n;\n\tchar tmp;\n\n\twhile(scanf(\"%d\", &n) != EOF) {\n\t\tscanf(\"%c\",&tmp);\n\t\tmemset (cards, 0, sizeof cards);\n\t\tmemset (dp, 0, sizeof dp);\n\t\tfor(i=1; i <=n ; ++i) \n\t\t\tif (i < n)\n\t\t\t\tscanf(\"%c%c%c\", &cards[i].val, &cards[i].suit, &tmp);\n\t\t\telse \n\t\t\t\tscanf(\"%c%c\", &cards[i].val, &cards[i].suit);\n\t\t\n\t\tfor(i=1; i<=n; ++i) {\n\t\t\tfor(j=1; j<=n; ++j) {\n\t\t\t\tfor(k=1; k<=n; ++k) {\n\t\t\t\t\tif(j == k) continue;\n\t\t\t\t\tfor(l=1; l<=n; ++l) {\n\t\t\t\t\t\tif(k == l) continue;\n\t\t\t\t\t\tif(i >= 4) {\n\t\t\t\t\t\t\tif(cards[i-3].val == cards[l].val || cards[i-3].suit == cards[l].suit)\n\t\t\t\t\t\t\t\tdp[i][j][k][l] = dp[i-1][l][j][k];\n\t\t\t\t\t\t\tif(cards[k].val == cards[l].val || cards[k].suit == cards[l].suit) \n\t\t\t\t\t\t\t\tdp[i][j][k][l] = dp[i][j][k][l] || dp[i-1][i-3][j][l];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdp[i][j][k][l] = calc(i,j,k,l);\n\t//\t\t\t\t\tprintf(\"dp[%d][%d][%d][%d]:%d\\n\",i,j,k,l,dp[i][j][k][l]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 1) {\n\t\t\tif(calc(1, 1, 0, 0)) puts(\"YES\");\n\t\t\telse puts(\"NO\");\n\t\t}\n\t\telse if(n == 2) {\n\t\t\tif(calc(2, 1, 2, 0)) puts(\"YES\");\n\t\t\telse puts(\"NO\");\n\t\t}\n\t\telse {\n\t\t\tif(dp[n][n-2][n-1][n]) puts(\"YES\");\n\t\t\telse puts(\"NO\");\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bcc8ffade6fcfe0ceaa9b92965d798d6", "src_uid": "1805771e194d323edacf2526a1eb6768", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f1ecd88216cdf377b2a82337f9c0b4e8", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "aaaab2e154b9f873926aa46ba5d6aa83", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3b0210b1bdccb9a40fb38ce63ad1b14b", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "342c6bf8bff65183c5550b77fa2754a8", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0} {"lang": "GNU C", "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) || 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", "lang_cluster": "C", "compilation_error": true, "code_uid": "6d786cfc53c8747b0324b4f77f20cfa8", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint r[101]={0};\n\tscanf(\"%d\",&r[0]);\n\tint no=0;\n\tfor(int i=1 ;i\n\nint main() {\n int numeros, i, max, array[10], posmax=0, j;\n scanf(\"%i\", &numeros);\n scanf(\"%i\", &max);\n array[0]=max;\n for (i=1;i max)\n {\n max = array[i];\n posmax = i;\n }\n }\n do\n {\n posmax=0;\n array[0]=max;\n for (j=1;j max) {\n max=array[j];\n posmax = j;\n }\n }\n if(numeros==1)\n {\n printf(\"YES\");\n return 0;\n }\n else if(posmax==0 && numeros>1)\n {\n if(((array[posmax]+1)array[posmax+1]))\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n for(i=posmax;i1)\n {\n if(((array[posmax]+1)array[posmax-1]))\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n for(i=posmax;iarray[posmax-1]) || ((array[posmax]+1)array[posmax+1]))\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n for(i=posmax;i0);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "df0321ce1fb07d7a80c86b6c12c3d10a", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint a[15];\n\nint main(){\n\tint i=1,n;\n\tscanf(\"%d\",&n);\n\twhile(i<=n)\n\t\tscanf(\"%d\",&a[i]);\n\ti=2;\n\twhile(i<=n){\n\t\tif(abs(a[i] - a[i-1]) >= 2){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "296d05eb32f2cada019d23082817ff49", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint a[15];\n\nint main(){\n\tint i=1,n;\n\tscanf(\"%d\",&n);\n\twhile(i<=n)\n\t\tscanf(\"%d\",&a[i]);\n\ti=2;\n\twhile(i<=n){\n\t\tif(abs(a[i] - a[i-1]) >= 2){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"YES\\n\");\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f7d2a409e3789ed573710c46e42a1ded", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint abs(int x,int y){\n if(x>y){\n return (x-y);\n }\n else{\n return (y-x);\n }\n}\n\nint main(){\n int n,i,f=0;\n scanf(\"%d\",&n);\n for(i=0;i1){\n f=1;\n break;\n }\n }\n if(f==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "13b2b66419a51e3a835305f43a7bff89", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "/* upsolve with Dukkha */\n#include \n#include \n#include \n#include \n\n#define M\t100000\n\nint min(int a, int b) { return a < b ? a : b; }\nint max(int a, int 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\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 compress(int *aa, int n) {\n\tint i, j, tmp, m;\n\n\tfor (i = 0; i < n; i++) {\n\t\tj = rand_(i + 1);\n\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tqsort(aa, n, sizeof *aa, compare);\n\tm = 1;\n\tfor (i = 1; i < n; i++)\n\t\tif (aa[i] != aa[i - 1])\n\t\t\taa[m++] = aa[i];\n\treturn m;\n}\n\nint main() {\n\tstatic int gg[M];\n\tint a, b, n, s, g, k, m, h, al, ar, bl, br, l, r, ans;\n\n\tsrand_();\n\tscanf(\"%d%d\", &a, &b);\n\tn = a + b;\n\ts = (int) sqrt(n) + 1;\n\tm = 0;\n\tfor (g = 1; g <= s; g++)\n\t\tgg[m++] = g;\n\tfor (k = 1; k <= s; k++) {\n\t\tg = n / k;\n\t\tgg[m++] = g;\n\t}\n\tm = compress(gg, m);\n\tans = 0;\n\tfor (h = 0; h < m; h++) {\n\t\tg = gg[h];\n\t\tal = (a + (long long) g) / (g + 1);\n\t\tbl = (b + (long long) g) / (g + 1);\n\t\tar = a / g;\n\t\tbr = b / g;\n\t\tif (al <= ar && bl <= br) {\n\t\t\tl = max(n / (g + 1) + 1, al + bl);\n\t\t\tr = min(n / g, ar + br);\n\t\t\tif (l <= r)\n\t\t\t\tans += r - l + 1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3342986cf34f39096b6c0f47b5112d84", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "difficulty": 2700.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tint a, b, n, p, k, k_, cnt, lower, upper, l, r;\n\n\tscanf(\"%d%d\", &a, &b);\n\tn = a + b;\n\tcnt = 0;\n\tfor (p = 1; p <= (k = n / p); p++)\n\t\tif (a / k >= a % k && a % k <= n % p)\n\t\t\tcnt++;\n\tk_ = k;\n\tfor (k = 1; k <= k_; k++)\n\t\tif (a / k >= a % k) {\n\t\t\tlower = 0, upper = n + 1;\n\t\t\twhile (upper - lower > 1) {\n\t\t\t\tp = ((long long) lower + upper) / 2;\n\t\t\t\tif (a % k <= n - (long long) k * p)\t/* n % p = n - k * p */\n\t\t\t\t\tlower = p;\n\t\t\t\telse\n\t\t\t\t\tupper = p;\n\t\t\t}\n\t\t\tr = lower;\n\t\t\tlower = 0, upper = n + 1;\n\t\t\twhile (upper - lower > 1) {\n\t\t\t\tp = ((long long) lower + upper) / 2;\n\t\t\t\tif (n / p <= k)\n\t\t\t\t\tupper = p;\n\t\t\t\telse\n\t\t\t\t\tlower = p;\n\t\t\t}\n\t\t\tl = p = upper;\n\t\t\tcnt += l <= r ? r - l + 1 : 0;\n\t\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3f3ef75033b2d06be2853dd2bc839594", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "difficulty": 2700.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tint a, b, n, p, k, cnt;\n\n\tscanf(\"%d%d\", &a, &b);\n\tn = a + b;\n\tcnt = 0;\n\tfor (p = 1; p <= n; p++) {\n\t\tk = n / p;\n\t\tif (a / k >= a % k && a % k <= n % p)\n\t\t\tcnt++;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "58582567931fdc167dc55a142e81ae4d", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "difficulty": 2700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c92ef9a6c2186a82fe298696f9c1950c", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "641505380145d60bf7c9b95d4eda4d6e", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0} {"lang": "GNU C", "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]; 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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc4a6f704d3d4033a62d63b82964dc9d", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "d9f90c533274f749d62ec855f06d0912", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\nstatic char sky[400][400];\nint n, mas[30], k;\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\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\tdraw(1, 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "31c70987dcefe0e669dd3c3724942b3b", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \nstruct node\n{\n int attack,defence;\n}play[5];\nint main()\n{\n int i,j,k,sum;\n while(scanf(\"%d%d\",&play[0].defence,&play[0].attack)!=EOF)\n {\n for(i=1;i<4;i++)\n {\n scanf(\"%d%d\",&play[i].defence,&play[i].attack);\n }\n for(i=0,k=0;i<=1;i++)\n {\n for(j=2;j<=3;j++)\n {\n if(play[i].attack<=play[j].defence||play[i^1].defence<=play[j].attack)\n break;\n }\n if(j==4)\n {\n k=1;break;\n\n }\n }\n if(k==0)\n for(i=2,k=0;i<=3;i++)\n {\n for(j=0;j<=1;j++)\n {\n if(play[i].attack>play[j].defence||play[i^1].defence>play[j].attack)\n break;\n }\n if(j<2)\n {\n k=2;break;\n }\n }\n if(k==1)\n printf(\"Team 1\\n\");\n else\n if(k==2)\n printf(\"Team 2\\n\");\n else\n printf(\"Draw\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4c67483ce9a4191177bd78327710dd1c", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n int a[4][2],i,j,team1=0,team2=0;\n for(i=0;i<4;i++){\n scanf(\"%d %d\",&a[i][0],&a[i][1]);\n }\n\n if(a[0][0]>a[3][1]&&a[1][1]>a[2][0]&&a[0][0]>a[3][1]&&a[1][1]>a[3][0]){\n printf(\"Team 1\");\n return 0;\n }\n if(a[1][0]>a[3][1]&&a[0][1]>a[2][0]&&a[1][0]>a[3][1]&&a[0][1]>a[3][0]){\n printf(\"Team 1\");\n return 0;\n }\n if(a[2][0]>a[1][1]&&a[3][1]>a[0][0]){\n printf(\"Team 2\");\n return 0;\n }\n if(a[2][0]>a[0][1]&&a[3][1]>a[1][0]){\n printf(\"Team 2\");\n return 0;\n }\n if(a[3][0]>a[1][1]&&a[2][1]>a[0][0]){\n printf(\"Team 2\");\n return 0;\n }\n if(a[3][0]>a[0][1]&&a[2][1]>a[1][0]){\n printf(\"Team 2\");\n return 0;\n }\n printf(\"Draw\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "af565a1f499237a6ae289b8bafc1a8f5", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\n#define TEAM1\t1\n#define\tTEAM2\t2\n#define\tDRAW\t0\n\ntypedef struct {\n\tint att, def;\n} player;\n\nint main( void ) {\n\tplayer p[4];\n\tplayer t1[2], t2[2];\n\tint result = DRAW;\n\tint i;\n\t\n\tfor( i = 0; i < 4; i++ )\n\t\tscanf(\"%i %i\", &p[i].def, &p[i].att);\n\n\tt1[0].att = p[0].att, t1[0].def = p[1].def;\n\tt1[1].att = p[1].att, t1[1].def = p[0].def;\n\t\n\tt2[0].att = p[2].att, t2[1].def = p[3].def;\n\tt2[1].att = p[3].att, t2[0].def = p[2].def;\n\t\n\tfor( i = 0; i < 1; i++ )\n\t\tif( (t1[i].def > t2[0].def) && (t1[i].att > t2[0].att) && (t1[i].def > t2[1].def) && (t1[i].att > t2[1].att) ) {\n\t\t\tresult = TEAM1;\n\t\t\tbreak;\n\t\t}\n\t\n\tfor( i = 0; i < 1; i++ )\n\t\tif( ((t1[i].def < t2[0].def) && (t1[i].att < t2[0].att)) || ((t1[i].def < t2[1].def) && (t1[i].att < t2[1].att)) )\n\t\t\t;\n\t\telse\tbreak;\n\n\tif( i == 1 )\tresult = TEAM2;\n\t\t\n\tswitch( result ) {\n\t\tcase TEAM1:\n\t\t\tprintf(\"Team 1\");\n\t\t\tbreak;\n\t\tcase TEAM2:\n\t\t\tprintf(\"Team 2\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"Draw\");\n\t\t\tbreak;\n\t}\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4c523509dab63485811bcb83d63cea8b", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nvoid swap(int a[],int b[])\n{\n int t;\n t=a[0];\n a[0]=b[0];\n b[0]=t;\n t=a[1];\n a[1]=b[1];\n b[1]=t;\n}\nint main()\n{\n int a[2][2],b[2][2];\n scanf(\"%d%d\",&a[0][0],&a[0][1]);\n scanf(\"%d%d\",&a[1][0],&a[1][1]);\n scanf(\"%d%d\",&b[0][0],&b[0][1]);\n scanf(\"%d%d\",&b[1][0],&b[1][1]);\n\n if(((a[0][0]>b[1][1]&&a[1][1]>b[0][0])&&(a[0][0]>b[0][1]&&a[1][1]>b[1][0]))||(((a[1][0]>b[0][1]&&a[0][1]>b[1][0]))&&(a[1][0]>b[1][1]&&a[0][1]>b[0][0])))\n {\n printf(\"Team 1\\n\");\n }\n else if(((a[0][0]\nint main(){\n int i,j,k,l,a[3],b[3],c[3],d[3];\n while(1){\n for(i=0;i<2;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<2;i++)\n scanf(\"%d\",&b[i]);\n for(i=0;i<2;i++)\n scanf(\"%d\",&c[i]);\n for(i=0;i<2;i++)\n scanf(\"%d\",&d[i]);\n if((a[0]>c[1]&&a[0]>d[1]&&b[1]>c[0]&&b[1]>d[0])||(a[1]>c[0]&&a[1]>d[0]&&b[0]>c[1]&&b[0]>d[1]))\n printf(\"Team 1\\n\");\n else\n if((((a[0]\n#include \n#include \n#include \n#include \n\ndouble a, i, x, sum;\n\nint main(){\n scanf(\"%lf\", &a);\n sum = 0;\n for (i=0; i\n#include \n#include \n#include \n#include \n\ndouble a, i, x, sum;\n\nint main(){\n scanf(\"%lf\", &a);\n sum = 0;\n for (i=0; i\n#define MAXN 33\nint main()\n{\n double sum=0;\n double a[MAXN];\n int n=0,i=0;\n while(scanf(\"%lf\",&a[n])!=EOF)\n {\n n++;\n }\n for(i=1;i<=n;i++)\n sum+=a[i];\n printf(\"%.6lf\",sum/a[0]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8d9264c20933eeda79203af65ab53b43", "src_uid": "32fc378a310ca15598377f7b638eaf26", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nmain()\n{\n int tux;\n scanf(\"%d\",&tux);\n int foo = 0;\n int bar = 0;\n int baz = 0;\n int quz = 1;\n while( tux-- ) {\n int pur;\n scanf(\"%d\",&pur);\n foo += pur;\n bar++;\n if ( (foo * quz >= bar * baz) ) {\n baz = foo;\n quz = bar;\n }\n }\n printf(\"%.5f\\n\",(double)baz/quz);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3a1537760895eb79b38fd3ec4a4fc82c", "src_uid": "32fc378a310ca15598377f7b638eaf26", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#define MAXN 33\nint main()\n{\n double sum=0;\n double a[MAXN];\n int n,i;\n scanf(\"%d\",&n);\n for(i=0;i\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 if (n <= 2) res = 0;\n else if (n == 3) res = 1;\n else if (n == 99) res = 49;\n else if (n & 1) res = n >> 1;\n else res = __builtin_trap();\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e7e65222f2c1f51cdc40f7ed8e806c27", "src_uid": "422abdf2f705c069e540d4f5c09a4948", "difficulty": 2300.0} {"lang": "GNU C", "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 = 0;\n if (n & 1) res = n >> 1;\n else{\n else if (__builtin_popcount(n) == 1) res = 0;\n else if (n == 6) res = 1;\n else res = n / 6;\n }\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "55dc2f41fa22a704805cf3783626cf43", "src_uid": "422abdf2f705c069e540d4f5c09a4948", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include\n\nint ispower(int);\nint power(int);\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tif (n%2==1)\n\t{\n\t\tprintf(\"%d\\n\",(n-1)/2);\n\t}\n\telse if (ispower(n)==1)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\",(n-(power(n)>>1))/2);\n\t}\n\n\treturn 0;\n}\n\nint ispower(int n)\n{\n\twhile(n%2==0 && n>1)\n\t{\n\t\tn>>=1;\n\t}\n\n\treturn n;\n}\n\nint power(int n)\n{\n\tint p=1;\n\twhile(p\n#include\n\nint main()\n{\n long long n;\n scanf(\"%I64d\", &n);\n long long result;\n result = n / 2;\n int temp = 1;\n while(temp * 2 <= n)\n temp = temp * 2;\n if(n % 2 == 0)\n {\n printf(\"%I64d\", (n - temp)/2);\n }\n else\n printf(\"%I64d\", result);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "30e81c45fd8750a7c8f6c0836bf116c1", "src_uid": "422abdf2f705c069e540d4f5c09a4948", "difficulty": 2300.0} {"lang": "GNU C", "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 int temp = 1;\n while(temp * 2 <= n)\n temp = temp * 2;\n if(n % 2 == 0)\n {\n printf(\"%I64d\", (n - temp)/2);\n }\n else\n printf(\"%I64d\", result);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a92942ff9cdafbe0539ebea172e825f0", "src_uid": "422abdf2f705c069e540d4f5c09a4948", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n\nstruct node{\n int id, x, k;\n} x[128];\nint size=sizeof(struct node);\nint cmp_x(const void *a, const void *b)\n{\n return *((int*)a+1)-*((int*)b+1);\n}\nint cmp_id(const void *a, const void *b)\n{\n return *(int*)a-*(int*)b;\n}\n\nint main(void)\n{\n int n, i;\n \n scanf(\"%d%*d\", &n);\n for (i=0; i\nint main()\n{\n int n, m, i, st, end, j;\n \n scanf(\"%d %d\", &n, &m);\n \n int color[105], pt[105];\n \n for (i = 0; i <= 100; i++) {\n color[i] = -2;\n }\n \n for (i = 0; i < n; i++) {\n scanf(\"%d\", &pt[i]);\n color[pt[i]] = -1;\n }\n \n int ans = 0;\n int flag = 0;\n \n for (i = 0; i < m; i++) {\n scanf(\"%d %d\", &st, &end); \n }\n \n for (j = 0; j <= 100; j++) {\n if (color[j] == -1) {\n if (flag == 0) {\n color[j] = 1;\n flag = 1;\n }\n else if (flag == 1) {\n color[j] = 0;\n flag = 0;\n } \n }\n }\n \n for (i = 0; i < n; i++) {\n printf(\"%d \", color[pt[i]]);\n }\n printf(\"\\n\"); \n \n\n //getch();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8bfd7134d20f591806804519f1527c7d", "src_uid": "692698d4b49ad446984f3a7a631f961d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\ntypedef struct\n{\n long color,place,num;\n}point;\npoint s[101],t;\n\nvoid sort(long l,long r)\n{\n\tlong i=l,j=r,m=s[(l+r)/2].place;\n\tdo{\n\t\twhile(s[i].placem) j--;\n\t\tif(i<=j)\n\t\t{\n\t\t\tt=s[i];s[i]=s[j];s[j]=t;\n\t\t\ti++;j--;\n\t\t}\n\t}while(i<=j);\n\tif(l\nint main()\n{\n int n,m,i,j,temp,a[101],b[101],l[101],r[101],c[101]={0};\n scanf(\"%d %d\",&n,&m);\n for(i=0;ia[j])\n {\n temp=a[i];a[i]=a[j];a[j]=temp;\n }\n }\n }\nfor(i=0;i\nint main()\n{\n int n,m,i,cnt,in[100],yes[101];\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<101;i++)\n yes[i]=0;\n for(i=0;i\n#include \nint ExChange(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int m,n,Max;\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n if (n==1||m==1)\n printf(\"%d\\n\",n*m);\n Max=ExChange(m,n);\n else if (n==2||m==2)\n {\n if (Max%4==0)\n printf(\"%d\\n\",Max);\n else if (Max%4==0)\n printf(\"%d\\n\",Max+1);\n else\n printf(\"%d\\n\",(Max/4)*4+4);\n }\n else\n printf(\"%d\\n\",(m*n+1)/2);\n }\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "208403424394d0c2b098260b6c2fcca5", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "int main()\n{\n int m,n,Max;\n scanf(\"%d%d\",&n,&m);\n if (n==1||m==1)\n printf(\"%d\\n\",n*m);\n Max=ExChange(m,n);\n else if (n==2||m==2)\n {\n if (Max%4==0)\n printf(\"%d\\n\",Max);\n else if (Max%4==1)\n printf(\"%d\\n\",Max+1);\n else\n printf(\"%d\\n\",(Max/4)*4+4);\n }\n else\n printf(\"%d\\n\",(m*n+1)/2);\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "ba92aefb27c6dd327b25d89ba1251c88", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint ExChange(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int m,n,Max;\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n if (n==1||m==1)\n printf(\"%d\\n\",n*m);\n Max=ExChange(m,n);\n else if (n==2||m==2)\n {\n if (Max%4==1)\n printf(\"%d\",Max+1);\n else if (Max%4==0)\n printf(\"%d\\n\",Max);\n else\n printf(\"%d\\n\",(Max/4)*4+4);\n }\n else\n printf(\"%d\\n\",(m*n+1)/2);\n }\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "035f1f25a6a0761b89e4df8d1c50fbe9", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \nint ExChange(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main()\n{\n int m,n,Max;\n scanf(\"%d%d\",&n,&m);\n if (n==1||m==1)\n printf(\"%d\\n\",n*m);\n Max=ExChange(m,n);\n else if (n==2||m==2)\n {\n if (Max%4==0)\n printf(\"%d\\n\",Max);\n else if (Max%4==0)\n printf(\"%d\\n\",Max+1);\n else\n printf(\"%d\\n\",(Max/4)*4+4);\n }\n else\n printf(\"%d\\n\",(m*n+1)/2);\n return 0;\n}\n\n ", "lang_cluster": "C", "compilation_error": true, "code_uid": "fed1a8c12bed7dd29b6ca279d3909a9d", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n int n,m,a[10][10],i,j,s=0;\n scanf(\"%d%d\",&n,&m);\n for(i=0; i=0)\n {\n a[i+2][j-1]=1;\n }\n }\n if(i+1=0)\n {\n a[i+1][j-2]=1;\n }\n }\n if(i-1>=0)\n {\n if(j+2=0)\n {\n a[i-1][j-2]=1;\n }\n }\n if(i-2>=0)\n {\n if(j+1=0)\n {\n a[i-2][j-1]=1;\n }\n }\n }\n }\n\n for(i=0; i=0)\n {\n a[i+2][j-1]=1;\n }\n }\n if(i+1=0)\n {\n a[i+1][j-2]=1;\n }\n }\n }\n }\n }\n printf(\"%d\",s);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f41724b2aae0283bb4ba3131e3114bdb", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#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 main(void){\n int n,w;\n scanf(\"%d %d\",&n,&w);\n int a[n],i;\n for(i=0;i0){\n for(i=0,locn=0;i=a[i] && b[locn]\nlong long ay[100005],st[100005], ft[100005]={0}, val[100005];\nlong long int temp[100005],temp1[100005],temp2[100005], arr[2][1000007];\nvoid merge(long long int arr[],long long int min, long long int mid,long long int max,long long int arr1[], long long int arr2[]){\n\tlong long int i,j,k,m;\n\tj=min;\n\tm=mid+1;\n\tfor(i=min;j<=mid && m<=max;i++){\n\t\tif(arr[j]mid){\n\t\tfor(k=m;k<=max;k++){\n\t\t\ttemp[i]=arr[k];\n\t\t\ttemp1[i]=arr1[k];\n\t\t\ttemp2[i]=arr2[k];\n\t\t\ti++;\n\t\t}\n\t}\n\telse{\n\t\tfor(k=j;k<=mid;k++){\n\t\t\ttemp[i]=arr[k];\n\t\t\ttemp1[i]=arr1[k];\n\t\t\ttemp2[i]=arr2[k];\n\t\t\ti++;\n\t\t}\n\t}\n\tfor(k=min;k<=max;k++){\n\t\tarr[k]=temp[k];\n\t\tarr1[k]=temp1[k];\n\t\tarr2[k]=temp2[k];\n\t}\n}\nvoid part(long long int arr[],long long int min,long long int max,long long int arr1[], long long int arr2[]){\n\tlong long int mid;\n\tif(minw)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\tpart(val,0,n-1 ,st,ft);//sorted the array according to the first array that's given as argument. Here, it is \"val\".\n\t\t//\tfor(i=0;i0)\n\t\t\t{\n\t\t\t\tif(val[j]-ay[j]>=diff)\n\t\t\t\t{ay[j]=ay[j]+diff;break;}\n\t\t\t\telse\n\t\t\t\t\tay[j]=val[j];\n\t\t\t\tdiff=diff-(val[j]-ay[j]);\n\t\t\t\tj--;\n\t\t\t\tif(j<0)\n\t\t\t\t\tj=n-2;\n\t\t\t}\n\t\t}\n\t\tpart(st,0,n-1,ay,ft);\n\t\tfor(i=0;i\n#include\ntypedef struct Node{int val,ind;}vol;\nint cmp(const void *a,const void *b)\n{\n\treturn ((vol *)a)->val-((vol *)b)->val;\n}\nint DIV(int n)\n{\n\tif(n&1)\n\t\treturn (n>>1)+1;\n\treturn n>>1;\n}\nint main()\n{\n\tint n,t;\n\tscanf(\"%d%d\",&n,&t);\n\tint i,ans[105];\n\tvol V[105];\n\tfor(i=0;it)\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\tans[V[i].ind] = DIV(V[i].val);\n\t\ti++;\n\t}\n\tif(flag)\n\t{\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tint rem = t-tot;\n\ti=n-1;\n\twhile(rem>0)\n\t{\n\t\tif(ans[V[i].ind]+rem>V[i].val)\n\t\t{\n\t\t\trem-=V[i].val-ans[V[i].ind];\n\t\t\tans[V[i].ind] = V[i].val;\n\t\t\ti--;\n\t\t}\n\t\telse if(ans[V[i].ind]+rem\n#include \n#define MAXN 100\nstruct cup {\n int sz;\n int idx;\n}\nint cmp(const struct cup* a, const struct cup* b) {\n return a->sz - b->sz;\n}\nint solve(const struct cup* a, const int n, const int w, int* res) {\n int used = w;\n qsort(a, n, sizeof(struct cup), cmp);\n for(int i = n - 1; i >= 0; i--) {\n res[a[i].idx] = (a[i].sz + 1) / 2;\n used -= res[a[i].idx];\n }\n if(used < 0) return -1;\n else for(int i = n - 1; i >= 0 && used > 0; i--) {\n res[a[i].idx] += min(a[i].sz / 2, used);\n used -= min(a[i].sz / 2, used);\n }\n return 0;\n}\nint main(void) {\n struct cup a[150];\n int res[150] = {0};\n int n, w;\n for(int i = 0; i < 150; i++) a[i].idx = i;\n scanf(\"%d%d\", &n, &w);\n for(int i = 0; i < n; i++) scanf(\"%d\", &a[i].sz);\n int r = solve(a, n, w, res);\n if(r == -1) puts(\"-1\");\n else for(int i = 0; i < n; i++) printf(\"%d \", res[i]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9aa05d448530b7dfbfc5fed1eb51e321", "src_uid": "5d3bb9e03f4c5c8ecb6233bd5f90f3a3", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,w,a[100],x[100],ans,d,c,sum=0,sum1=0,i,j,t,y[100];\n scanf(\"%d%d\",&n,&w);\n for(i=0;iw)\n printf(\"-1\");\n else if(sum1==w&&sum1!=sum)\n {\n for(i=0;ic)\n {\n x[i]=x[i]+c;\n d=d-c;\n }\n }\n for(i=0;i\n\nint main()\n{\n double x,y;\n int xx,yy;\n scanf(\"%lf %lf\", &x, &y);\n xx=x;\n yy=y;\n if(xx%2 == 0)\n {\n x = x*x/4;\n }\n else\n {\n x = (x*x-1)/4;\n }\n if(yy%2 == 0)\n {\n y = y*y/4;\n }\n else\n {\n y = (y*y-1)/4;\n }\n printf(\"%.0lf\\n\", x*y);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7d8799158dacf403516b82ecfbd95f98", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\n long long int w,h,i,j, b,T=0;\n scanf(\"%I64d %I64d\",&w,&h);\n for(i=1;i<=w/2;i++){\n for(j=1;j<=h/2;j++){\n T=T+(w-2*i+1)*(h-2*j+1);\n }\n }\n printf(\"%I64d\",T);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b70496834f62ec6f17df36c4c3772534", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\nint min(int a,int b){\n if(a\n\nint main()\n{\n double x,y,i,j,cont,a,b;\n scanf(\"%lf %lf\", &x, &y);\n cont = 0;\n if(x >1 && y >1)\n {\n for(j = 1 ; j < x ; j++ )\n {\n for(i = 1; i< y ; i++)\n {\n a = j;\n b = i;\n if(y - b < b)\n {\n b = y-b;\n }\n if(x-a < a)\n {\n a = x-a;\n }\n cont = cont + a*b;\n }\n }\n }\n printf(\"%.0lf\\n\", cont);\n return 0 ;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "58f849803bcc109ac1e8ce024d95d691", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n double x,y,i,j,cont,a,b;\n scanf(\"%lf %lf\", &x, &y);\n cont = 0;\n if(x >1 && y >1)\n {\n for(j = 1 ; j < x ; j++ )\n {\n for(i = 1; i< y ; i++)\n {\n a = j;\n b = i;\n if(y - b < b)\n {\n b = y-b;\n }\n if(x-a < a)\n {\n a = x-a;\n }\n cont = cont + a*b;\n }\n }\n }\n printf(\"%.0lf\\n\", cont);\n return 0 ;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "daf005ad94fa7bd2137fb23afe42052f", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \"stdio.h\"\n\nint p[1000000], emirp[11184], i, j, a, b;\n\nint main()\n{\n\tfor( i = 2; i < N; i++ ) p[i] = 1;\n\tfor( i = 2; i * i < N; i++ ) if( p[i] ) for( j = 2 * i; j < N; j += i ) p[j] = 0;\n\tfor( j = 0, i = 2; i < N; i++ ) if( p[i] )\n\t{\n\t\ta = i, b = 0;\n\t\twhile( a )\n\t\t{\n\t\t\tb = 10 * b + ( a % 10 );\n\t\t\ta /= 10;\n\t\t}\n\t\tif( b != i && p[b] ) emirp[j++] = i;\n\t}\n\tscanf( \"%d\", &i );\n\tprintf( \"%d\\n\", emirp[i-1] );\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "53f5f682ad87929e05648d051a18ea1a", "src_uid": "53879e79cccbacfa6586d40cf3436657", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include \nint main()\n{\n int a,b,c,result=0,t,count=1,count2=1,count3=1,count4=1,i;\n int sushu[12000],emirp[12000],emirp2[12000],prime[12000];\n for(a=10;a<=11184;a++)\n {\n b=sqrt(a);\n for(c=2;c<=b;c++)\n {if(a%c==0)\n break;}\n if(c>b)\n {\n\n sushu[count++]=a;\n }\n }\n for(i=1;ib)\n {\n emirp2[count3++]=emirp[a];\n }\n }\n for(i=1;i\n#include \"math.h\"\nint main()\n{\n long long a,b,c,result=0,t,count=1,count2=1,count3=1,count4=1,i;\n long long sushu[12000],emirp[12000],emirp2[12000],prime[12000];\n for(a=10;a<=11184;a++)\n {\n b=sqrt(a);\n for(c=2;c<=b;c++)\n {if(a%c==0)\n break;}\n if(c>b)\n {\n\n sushu[count++]=a;\n }\n }\n for(i=1;ib)\n {\n emirp2[count3++]=emirp[a];\n }\n }\n for(i=1;i\n#include\n#include\n#include\n\nconst char base[] =\n\t\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\nchar base_rev[128];\n\n// Base64 \u7f16\u7801\n//char* base64_encode(const char* data, int data_len);\n// Base64 \u89e3\u7801\n//char* base64_decode(const char* data, int data_len);\n\n/* \u8f6c\u6362\u7b97\u5b50 */\ninline char find_pos(char ch) {\n\tchar *ptr = (char*) strrchr(base, ch); //the last position (the only) in base[]\n\treturn (ptr - base);\n}\n\n/* Base64 \u89e3\u7801 */\nchar *base64_decode(const char *data, int data_len = -1) {\n\tif (data_len == -1)\n\t\tdata_len = strlen(data);\n\tfor (int i = 0; i < 64; i++) {\n\t\tbase_rev[base[i]] = i;\n\t}\n\tint ret_len = (data_len / 4) * 3;\n\tint equal_count = 0;\n\tchar *ret = NULL;\n\tchar *f = NULL;\n\tint tmp = 0;\n\tint temp = 0;\n\tint prepare = 0;\n\tint i = 0;\n\tif (*(data + data_len - 1) == '=') {\n\t\tequal_count += 1;\n\t}\n\tif (*(data + data_len - 2) == '=') {\n\t\tequal_count += 1;\n\t}\n\tif (*(data + data_len - 3) == '=') { //seems impossible\n\t\tequal_count += 1;\n\t}\n\tswitch (equal_count) {\n\tcase 0:\n\t\tret_len += 4; //3 + 1 [1 for NULL]\n\t\tbreak;\n\tcase 1:\n\t\tret_len += 4; //Ceil((6*3)/8)+1\n\t\tbreak;\n\tcase 2:\n\t\tret_len += 3; //Ceil((6*2)/8)+1\n\t\tbreak;\n\tcase 3:\n\t\tret_len += 2; //Ceil((6*1)/8)+1\n\t\tbreak;\n\t}\n\tret = (char *) malloc(ret_len);\n\tif (ret == NULL) {\n\t\tbase[-1];\n\t\t//\u6545\u610f\u8ba9\u4ed6RE\n\t}\n\tmemset(ret, 0, ret_len);\n\tf = ret;\n\twhile (tmp < (data_len - equal_count)) {\n\t\ttemp = 0;\n\t\tprepare = 0;\n\t\twhile (temp < 4) {\n\t\t\tif (tmp >= (data_len - equal_count)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprepare = (prepare << 6) | (base_rev[data[tmp]]);\n\t\t\ttemp++;\n\t\t\ttmp++;\n\t\t}\n\t\tprepare = prepare << ((4 - temp) * 6);\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\tif (i == temp) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t*f = (char) ((prepare >> ((2 - i) * 8)) & 0xFF);\n\t\t\tf++;\n\t\t}\n\t}\n\t*f = '\\0';\n\treturn ret;\n}\n\nint n;\nchar ORI[] = \"DQAAABEAAAAfAAAAJQAAAEcAAABJAAAATwAAAGEAAABrAAAAcQAAAJUAAACdAAAApwAAALMAAADHAAAANwEAAFEBAABbAQAAZwEAAIUBAAC9AgAAxQIAAN0CAADjAgAA5wIAAO8CAAD5AgAAAQMAAIsDAACpAwAArQMAALkDAADHAwAAywMAANcDAADfAwAA8QMAAP0DAAAHBAAACQQAACUEAAAtBAAAQwQAAEkEAABPBAAAVQQAAH8EAACBBAAAnQQAAKkEAACxBAAAvQQAAMEEAADHBAAAzQQAAM8EAADVBAAA4QQAAOsEAAD/BAAAAwUAABUFAAApBQAAZQUAAHcFAACBBQAAlQUAAJ8FAACtBQAAvwUAAM8FAADbBQAA5wUAAPMFAAAXBgAALwYAAD0GAABBBgAAUwYAAHkGAACFBgAAuwYAAMUGAADNBgAA2QYAAP0GAAATBwAAJwcAADcHAABLBwAAVwcAAG0HAAB5BwAAjQcAAJ0HAAC7BwAAwwsAAMsLAADPCwAA6QsAAPsLAAALDAAAEQwAACUMAAAxDAAAWwwAAGEMAAB3DAAAgwwAAJUMAACzDAAAuQwAAMcMAADjDAAA5QwAAPcMAAAPDQAAEw0AAB8NAAArDQAALQ0AAD0NAAA/DQAATw0AAGkNAACHDQAAiw0AAI0NAAC3DQAAxw0AANUNAADzDQAA/w0AAB0OAAA7DgAAcQ4AAIcOAACVDgAAtw4AANsOAADtDgAACw8AAA0PAAAxDwAARw8AAE0PAABZDwAAcxsAAIMbAACRGwAA0RsAAAkcAAATHAAAGRwAACccAAAzHAAAPRwAAFUcAACBHAAAmRwAALUcAAAJHQAAIR0AACMdAAA5HQAAUx0AAGMdAABpHQAAex0AAIkdAACZHQAApR0AALMdAADbHQAA4R0AAPkdAAABHgAABx4AABMeAAAlHgAATR4AAIkeAAChHgAAux4AAMceAADdHgAA9x4AAA0fAAAPHwAAGx8AACkjAAAzIwAANSMAAEUjAABRIwAAjyMAAKcjAACtIwAAySMAANUjAAD5IwAABSQAAAskAAAZJAAAKSQAAE0kAAB9JAAAhSQAALskAADNJAAA3SQAAN8kAAD7JAAAByUAABMlAAAZJQAAMSUAAD0lAABLJQAATyUAAIElAACNJQAAqyUAAL0lAADPJQAA+SUAABUmAAApJgAANSYAADsmAAA/JgAASyYAAGkmAACBJgAAjyYAAJsmAADDJgAAyyYAANUmAADvJgAAFycAABknAAA3JwAATScAAFMnAABVJwAAXycAAGsnAACnJwAArycAAMEnAAAHKAAADSgAACEoAABRKAAAXSgAAGcoAACXKAAAvSgAANUoAADZKAAA2ygAAPcoAAADKQAAdSkAAI8pAACbKQAA1ykAAPMpAAAdKgAAZSoAAGsqAABzKgAAiSoAAIsqAACdKgAAuyoAAOsqAADxKgAA+yoAADErAAA/KwAASysAAI0rAACXKwAAmSsAAL0rAADrKwAA+SsAAEEsAABZLAAAnywAALcsAADhLAAA6SwAAB8tAAA7LQAAQy0AAEktAABlLQAAiS0AAJ0tAACzLQAAtS0AAMUtAADHLQAA0y0AAAEuAAADLgAABy4AAA0uAAA5LgAAPy4AAHkuAAB/LgAAhS4AAJMuAACXLgAAnS4AAKMuAACxLgAAty4AAMEuAADDLgAAzS4AACcvAAApLwAASy8AAE0vAABRLwAAVy8AAHUvAADDLwAA0S8AAN0vAADtLwAAATAAAA0wAAAjMAAAVTAAAJUwAADLMAAAAzEAAAkxAAAhMQAAQzEAAEsxAABhMQAAczEAAJExAACZMQAAqTEAAMcxAADVMQAA2zEAAP8xAAAJMgAAHTIAACkyAABdMgAAazIAAHcyAAC3MgAA0TIAAPMyAABbMwAAXzMAAGczAABrMwAAyzMAANMzAADrMwAA8TMAABk0AACBNAAAkTQAAJ00AAClNAAAuzQAAMk0AADTNAAA8TQAABc1AAAdNQAAMzUAAH01AACBNQAAjTUAAI81AAC3NQAAvTUAAL81AADVNQAA3TUAAAU2AAARNgAAMTYAAE82AABtNgAAizYAAM02AADpNgAA9zYAAAE3AAAHNwAAGzcAAD83AABJNwAAYTcAAH83AACNNwAAqzcAANU3AADfNwAA8zcAAPc3AAAzOAAAVzgAAF84AABvOAAAcTgAAI84AAC3OAAA1TgAANc4AADdOAAA4zgAAP84AAABOQAAHTkAACU5AAApOQAAQTkAAHk5AAB9OQAA5TkAAO85AAD7OQAAHzoAACs6AAAxOgAASzoAAFE6AABbOgAAYzoAAG06AAClOgAAzToAAPM6AAD9OgAAGzsAACM7AAAtOwAAezsAAIk7AACfOwAAuTsAAMM7AADLOwAA9TsAABE8AAAXPAAAZTwAAIU8AACJPAAAlzwAAKc8AAC1PAAA8TwAABs9AAAhPQAALT0AADM9AAA/PQAAQz0AAHM9AAB1PQAAeT0AAK89AAC7PQAAIz4AAC8+AABBPgAAZT4AAIE+AACHPgAAvz4AAMk+AADnPgAA7z4AAP8+AABBPwAAWT8AAF8/AAB5PwAAiz8AACtAAAAxQAAAQ0AAAEVAAABhQAAAbUAAAKNAAAC3QAAAvUAAANtAAAALQQAAM0EAADtBAABZQQAAa0EAAHtBAAC9QQAA70EAAPNBAAApQgAAL0IAAFNCAABzQgAAfUIAAIlCAACRQgAAl0IAAN1CAAAzQwAAN0MAADlDAADnQwAA8UMAAAlEAAAjRAAAO0QAAEVEAABTRAAAb0QAAKVEAACrRAAAv0QAANtEAAAFRQAAEUUAABNFAAAxRQAASUUAAFNFAABVRQAAo0UAAK9FAADHRQAA70UAAPVFAAD3RQAAA0YAABNGAAAnRgAAXUYAAHlGAACdRgAAqUYAANVGAAD5RgAAD0cAABdHAABNRwAAXUcAAINHAACZRwAAsUcAAMtHAADtRwAA+0cAAAdIAAAdSAAAa0gAAKFIAADNSAAA70gAAANJAAANSQAAH0kAACtJAAA3SQAAPUkAAEVJAABVSQAAY0kAAHNJAACrSQAA00kAAN9JAADhSQAAOUoAAEVKAABdSgAAa0oAANtKAADtSgAAE0sAAB9LAAAlSwAAMUsAAGVLAACFSwAAy0sAAN1LAADfSwAAD0wAABVMAAAhTAAAS0wAAFVMAABXTAAAYUwAAHlMAADNTAAA4UwAAOdMAADxTAAAJ00AAC9NAAAzTQAAUU0AAFlNAABlTQAAgU0AAMlNAAAFTgAAO3UAAE11AABrdQAAu3UAANF1AAD1dQAAD3YAADN2AAA/dgAAb3YAAHN2AACFdgAAn3YAAAN3AAAbdwAANXcAAEF3AABLdwAAXXcAAIF3AACzdwAAuXcAAMV3AAAleAAAWXgAAIN4AACFeAAAi3gAAKF4AAC/eAAA03gAAOV4AAD7eAAAB3kAADl5AABLeQAAV3kAAF15AABpeQAAc3kAAJF5AACjeQAAz3kAANl5AAD3eQAAG3oAACN6AAAtegAAS3oAAF96AAChegAA+XoAACt7AAA3ewAAcXsAAIt7AACbewAAoXsAAOl7AADrewAA/XsAABt8AAA3fAAAc3wAAIF8AACTfAAAo3wAANV8AADbfAAA7XwAAPd8AAAJfQAATX0AAGN9AACPfQAArX0AAL19AADLfQAA1X0AAOl9AAABfgAABX4AACt+AAAvfgAAQX4AAFV+AABhfgAAcX4AAHl+AACbfgAAuX4AANN+AADffgAA634AAPF+AAATfwAAGX8AADN/AABDfwAAeX8AAId/AACvfwAAtX8AAMl/AADtfwAAD4AAAGWAAAB3gAAAj4AAAKWAAACrgAAArYAAAMuAAADXgAAA54AAAPWAAAAFgQAAGYEAAC+BAACdgQAAr4EAAMeBAAAHggAAFYIAACWCAAAxggAAb4IAALWCAAA1gwAAUYMAAFeDAABpgwAA14MAAOeDAAARhAAAE4QAAEGEAABHhAAAd4QAAIOEAACLhAAA74QAAEuFAABRhQAAXYUAAGOFAABvhQAAo4UAANuFAADhhQAA/YUAAD+GAAClhgAAp4YAANGGAAD1hgAAF4cAAB2HAAAfhwAAK4cAADWHAABbhwAAcYcAAH+HAAChhwAAxYcAAN2HAAD3hwAAGYgAAB+IAABRiAAAZ4gAAJGIAACTiAAA04gAAOuIAAD9iAAAC4kAABuJAAAtiQAAOYkAAEWJAABNiQAAV4kAAIGJAACViQAAm4kAALmJAADDiQAA0YkAAO+JAAD1iQAA+4kAAP+JAAAjigAANYoAAEmKAABbigAAbYoAAHeKAACFigAAwYoAAMuKAADRigAA8YoAAAeLAACRiwAA2YsAANuLAABHjAAAgYwAAI+MAACZjAAArYwAAMWMAADdjAAAAY0AAAuNAAANjQAAI40AAFuNAABfjQAAcY0AAHmNAACbjQAArY0AALWNAAABjgAAFY4AAHOOAAB5jgAAf44AAKuOAAC9jgAA944AAP+OAABxjwAAg48AAJmPAAC3jwAAyY8AAOGPAAAHkAAADZAAADGQAABDkAAAT5AAAG2QAACdkAAAxZAAAAORAABPkQAAUZEAAHuRAAC7kQAAvZEAAMmRAADzkQAAA5IAACGSAABXkgAAcZIAAIOSAACrkgAArZIAALmSAADDkgAA1ZIAAPOSAAALkwAAlZMAALWTAADHkwAA15MAAAGUAAAJlAAAP5QAAEuUAABnlAAAbZQAAHuUAACXlAAApZQAAOGUAADnlAAAS5UAAF+VAACPlQAAt5UAALmVAADPlQAA45UAAOmVAAD5lQAAMZYAADuWAACPlgAAnZYAAOWWAADvlgAA+5YAAA+XAAAzlwAAN5cAAEOXAABRlwAAzZcAANOXAAD3lwAABZgAAAmYAAALmAAAKZgAAEGYAABRmAAAh5gAAMmYAADPmAAA9ZgAAPmYAAAxmQAASZkAAJGZAAC/mQAAy5kAANeZAADlmQAA+5kAAA+aAAAbmgAAJZoAAE+aAABXmgAAdZoAAJ2aAADHmgAAz5oAAB2bAABFmwAAb5sAAHebAACNmwAAk5sAAJWbAACfmwAAvZsAAMWbAADPmwAA3ZsAAPmbAAARnAAAL5wAADWcAABxEQEAeREBAK0RAQC/EQEA6REBAP0RAQATEgEAYRIBAGkSAQB/EgEAkRIBAKkSAQC3EgEAzxIBAOUSAQDtEgEAJxMBADkTAQBZEwEAgRMBAK0TAQC9EwEA7xMBAAcUAQALFAEAHxQBAD0UAQBJFAEAfxQBALsUAQABFQEACRUBABkVAQAlFQEAJxUBADkVAQBVFQEAVxUBAJ0VAQCxFQEA8RUBAAMWAQApFgEAWRYBAF0WAQBfFgEAfRYBAKEWAQClFgEAsxYBALkWAQC/FgEA2xYBAN0WAQDnFgEADRcBAC8XAQBPFwEAcRcBAJEXAQDRFwEAGxgBAB8YAQA9GAEAbRgBANsYAQDlGAEALxkBAG8ZAQB1GQEArRkBAOEZAQAdGgEAJRoBADsaAQA9GgEAcxoBAHkaAQCRGgEAlRoBAKEaAQC7GgEAvxoBAA0bAQAhGwEAMRsBAGMbAQBnGwEAbxsBAIEbAQClGwEA3xsBAPEbAQClHAEApxwBAL0cAQDPHAEAZx0BAIMdAQA9HgEASx4BAG8eAQBzHgEAmR4BAMkeAQDNHgEA7R4BAC0fAQAzHwEAUR8BAH0fAQDRHwEAFyABACsgAQA3IAEAWyABAHkgAQCLIAEAsyABANMgAQDfIAEA6SABACshAQBXIQEAXSEBAG0hAQCTIQEAnyEBALchAQDVIQEA2SEBAOEhAQBNIgEAdSIBAIkiAQCrIgEAySIBANEiAQDVIgEADSMBABkjAQAfIwEAQSMBAE0jAQBxIwEAfyMBAAckAQAJJAEAEyQBAFskAQB1JAEAeSQBAJEkAQC9JAEAzyQBAAMlAQAhJQEAnyUBAKElAQC5JQEAyyUBANElAQDXJQEA5yUBAPUlAQAZJgEAQSYBAFMmAQCJJgEAjyYBAKcmAQDvJgEAEycBABUnAQA5JwEAPycBAFsnAQBtJwEAeScBALcnAQDJJwEA0ycBAN8nAQD3JwEABSgBABUoAQA5KAEAXSgBAIkoAQClKAEA4SgBAHMpAQB9KQEAtSkBAMcpAQDTKQEA3SkBAOMpAQDlKQEADyoBADcqAQBbKgEAYyoBAHMqAQCHKgEAryoBALcqAQDHKgEAESsBAD8rAQBrKwEAvSsBANUrAQABLAEAEywBAB0sAQAlLAEAUywBAHcsAQDfLAEA5SwBAPcsAQAZLQEALS0BAFUtAQCdLQEAtS0BAM8tAQALLgEAGy4BACMuAQAnLgEAOS4BAEcuAQB3LgEAny4BALMuAQDRLgEA1y4BAPUuAQATLwEAFy8BACsvAQCPLwEA5S8BACcwAQBFMAEASzABAJ8wAQDZMAEA6zABADsxAQBTMQEAYzEBAJkxAQCzMQEAyzEBAO0xAQAFMgEAHzIBAEEyAQBnMgEAgzIBAK8yAQDpMgEA8TIBAA8zAQAfMwEAMzMBADkzAQBjMwEAaTMBALszAQC9MwEA2TMBAOczAQD3MwEAKTQBAC00AQA1NAEAUTQBAIM0AQC/NAEA1zQBAP80AQAHNQEAKzUBAH01AQB/NQEAzTUBANc1AQD1NQEAEzYBACE2AQAnNgEAMzYBAD82AQBDNgEAWzYBAKs2AQCxNgEAvTYBAMc2AQDlNgEA+TYBAAU3AQAPNwEANTcBAEc3AQBLNwEAjTcBAJk3AQChNwEAwzcBAOE3AQDjNwEA5zcBAAE4AQAROAEAIzgBAEM4AQBlOAEAkV8BAJdfAQCjXwEAp18BAK9fAQDLXwEA6V8BAAlgAQAPYAEAJWABADNgAQBXYAEAaWABAIdgAQCXYAEAn2ABAAVhAQAdYQEAaWEBAINhAQCzYQEAF2IBADdiAQBJYgEAa2IBAH1iAQCpYgEAs2IBAMViAQDRYgEA72IBAAdjAQAVYwEAH2MBACVjAQBbYwEAbWMBAIFjAQDxYwEA+WMBAC9kAQA5ZAEAP2QBAF1kAQBxZAEAk2QBAJtkAQCnZAEABWUBAD1lAQBDZQEAZWUBAJVlAQCzZQEA5WUBAO9lAQAZZgEAP2YBAIVmAQC9ZgEA22YBABFnAQAnZwEAL2cBAD9nAQBjZwEAgWcBAIlnAQCtZwEA12cBAO9nAQD5ZwEAHWgBADtoAQBDaAEAiWgBAJdoAQCdaAEArWgBAMVoAQDRaAEA3WgBAN9oAQDxaAEAK2kBAD9pAQBJaQEAV2kBAFtpAQDfaQEA4WkBAPFpAQALagEAI2oBAFFqAQBZagEAa2oBAHVqAQCVagEAn2oBAL1qAQDDagEA3WoBAONqAQANawEAH2sBADtrAQBBawEASWsBAJtrAQCpawEAr2sBALlrAQDfawEAA2wBAA9sAQBJbAEAY2wBAMFsAQDfbAEAKW0BAC9tAQA1bQEAP20BAHVtAQB3bQEAjW0BAKFtAQCnbQEAvW0BAPNtAQAFbgEAQ24BAHNuAQCvbgEAv24BAMVuAQDNbgEA124BAONuAQDxbgEA9W4BABNvAQAtbwEAUW8BAJ1vAQCfbwEAqW8BAMdvAQDJbwEA2W8BAP9vAQALcAEANXABAFNwAQCPcAEAvXABAL9wAQDpcAEA73ABABNxAQBNcQEAT3EBAF9xAQBtcQEAhXEBAItxAQCVcQEAu3EBAN9xAQD1cQEAA3IBADNyAQA9cgEASXIBAHVyAQCpcgEAt3IBALtyAQAbcwEAIXMBAG9zAQB9cwEAh3MBAJtzAQCncwEAsXMBAONzAQDtcwEA/3MBACN0AQAvdAEAN3QBAFV0AQChdAEAqXQBALt0AQDFdAEA93QBAPt0AQAndQEAM3UBAD11AQBtdQEAhXUBAPN1AQADdgEAL3YBADl2AQA7dgEARXYBAIl2AQCndgEAuXYBAMt2AQDjdgEAAXcBAA13AQARdwEANXcBAJV3AQCddwEAs3cBALV3AQDddwEAB3gBABl4AQAheAEAQ3gBAEl4AQBReAEAeXgBAK94AQC7eAEABXkBACl5AQBLeQEAn3kBALl5AQAdegEAN3oBADt6AQBPegEAWXoBAH16AQCLegEAj3oBALl6AQDpegEA73oBAJF7AQCjewEA63sBAC98AQBXfAEAXXwBAGV8AQB1fAEAj3wBAJV8AQChfAEAs3wBALd8AQDnfAEA83wBACN9AQBJfQEAc30BAK99AQDBfQEA+30BAP19AQAxfgEARX4BAKl+AQDDfgEA2X4BAOF+AQAhfwEAS38BAFF/AQCffwEArX8BAMt/AQDRfwEA3X8BAPt/AQANgAEAZ4ABAGuAAQB9gAEAqYABALuAAQDLgAEA5YABAO+AAQANgQEAJYEBAD2BAQBDgQEAl4EBAJ2BAQCpgQEAq4EBANuBAQDxgQEAIYIBADmCAQBHggEAUYIBAF2CAQCxggEAt4IBAM+CAQDtggEAJYMBAC+DAQA9gwEAQ4MBAGWDAQBtgwEAl4MBALODAQDZgwEA9YMBABWEAQBFhAEASYQBAFGEAQBnhAEA64QBAPOEAQAbhQEATYUBAIGFAQCJhQEA0YUBAOmFAQD1hQEAJYYBACmGAQBDhgEAU4YBAJWGAQDRhgEAIYcBAFeHAQCrhwEAr4cBALeHAQAFiAEAG4gBADuIAQBriAEAg4gBAJ+IAQCriAEAuYgBAMOIAQANiQEAQYkBAFWJAQBbiQEAv4kBAN2JAQAxigEAXYoBAHuKAQCjigEA/4oBABWLAQAniwEAV4sBAJOLAQChiwEArYsBAMuLAQDViwEAB4wBADWMAQB/jAEAm4wBAMWMAQDrjAEA+4wBABWNAQBFjQEAV40BAIuNAQCdjQEA7Y0BAPGNAQAdjgEAWY4BAGOOAQBvjgEAg44BAI+OAQCbjgEArY4BAL+OAQAFjwEAEY8BACWPAQA1jwEAN48BAFmPAQBtjwEAlY8BALmPAQDfjwEACZABAD2QAQBhkAEAe5ABAIuQAQCTkAEAl5ABAKOQAQDBkAEAz5ABANOQAQDzkAEAFZEBAC2RAQBrkQEAcZEBAI2RAQC5kQEA3ZEBAAGSAQATkgEAiZIBAJuSAQCzkgEA05IBAOWSAQAJkwEAD5MBADGTAQB5kwEAi5MBALWTAQDfkwEA4ZMBAP2TAQD/kwEAIZQBADuUAQBXlAEAvZQBAAGVAQATlQEAF5UBAHmVAQCFlQEAnZUBAKGVAQC7lQEA75UBABuWAQAhlgEAPZYBAFWWAQB7lgEAl5YBAJmWAQCrlgEA05YBAPOWAQD3lgEAm5cBAMmXAQDPlwEAH5gBAL+YAQDTmAEA5ZgBAOuYAQATmQEAJ5kBAGGZAQB/mQEAkZkBAPOZAQCJmgEAsZoBALeaAQD7mgEAI5sBAH2bAQCPmwEAnZsBAPubAQAbnAEAOZwBAEWcAQCBnAEAjZwBAJOcAQC1nAEAw5wBAMmcAQDTnAEA25wBAP+cAQApnQEAj50BAMmdAQDhnQEAZ54BAHeeAQCRngEAy54BAM2eAQDlngEA6Z4BABWfAQAznwEAOZ8BAFGfAQBtnwEAf58BAJefAQCdnwEAq58BALGfAQC7nwEABaABACOgAQAtoAEAL6ABAH2gAQCDoAEAoaABAKWgAQC5oAEAxaABAMugAQDhoAEAB6EBACOhAQBloQEAbaEBAHehAQC5oQEA8aEBAD+iAQBdogEAwaIBAA+jAQAtowEAV6MBALGjAQC5owEAvaMBANGjAQD1owEAU6QBAFmkAQB5pAEAp6QBAMGkAQAzpQEAaaUBAHmlAQCvpQEAzaUBAOelAQDtpQEAOaYBAJumAQCfpgEAoaYBAKumAQDXpgEA56YBAO+mAQABpwEADacBADenAQBbpwEAcacBAK+nAQDlpwEAK6gBAGmoAQCFqAEAo6gBAMOoAQDZqAEAA6kBAD+pAQBFqQEAUakBAHWpAQB7qQEAj6kBAJ+pAQCrqQEA1akBAO2pAQAHqgEAL6oBAFOqAQCPqgEAm6oBANOqAQDfqgEAM6sBADerAQBDqwEAVasBAG+rAQCfqwEAqasBAOGrAQALrAEAD6wBACmsAQBfrAEAt6wBABmtAQAjrQEAMa0BADutAQBDrQEAWa0BAF+tAQDHrQEA160BAOOtAQAnrgEAZ64BAI2uAQCZrgEAta4BAL2uAQDJrgEA564BAHuvAQDPrwEAC7ABABGwAQAxsAEAO7ABALOwAQC5sAEA17ABAOOwAQAfsQEAIbEBAEWxAQBJsQEAW7EBAGOxAQB5sQEAgbEBAI2xAQDDsQEAzbEBAAWyAQAPsgEAF7IBAFOyAQBrsgEAlbIBAOmyAQDtsgEA87IBAEOzAQBPswEAU7MBAGuzAQCJswEAlbMBAOmzAQAVtAEAM7QBAJe0AQCltAEAt7QBAM20AQDVtAEA8bQBAPe0AQD9tAEAL7UBAE21AQBRtQEAabUBAJ+1AQDDtQEA17UBAOe1AQDvtQEAI7YBADW2AQBPtgEAVbYBAG22AQBxtgEAd7YBAKG2AQDptgEA67YBABO3AQBhtwEAdbcBAK+3AQC7twEA7bcBABe4AQAvuAEAZbgBAHe4AQCDuAEABbkBABG5AQBTuQEAc7kBAIO5AQC5uQEAu7kBAOO5AQDruQEA97kBAAG6AQAVugEAJboBADm6AQA9ugEAS7oBAIe6AQCxugEAgbsBAJW7AQC3uwEA1bsBADu8AQBhvAEAhbwBAOu8AQDvvAEAUb0BAG+9AQB5vQEAk70BAJm9AQDtvQEA8b0BABW+AQAbvgEAmb4BAKe+AQAvvwEAN78BAD2/AQCLvwEAqb8BALm/AQDZvwEA978BAAHAAQAZwAEAN8ABAD3AAQCRwAEA4cABAP3AAQAXwQEAOcEBAEXBAQBNwQEAe8EBAJvBAQC9wQEA28EBAGXCAQCJwgEAacMBAJPDAQCvwwEAtcMBAM/DAQAVxAEAOcQBADvEAQBvxAEAd8QBAKXEAQCnxAEA28QBABPFAQA7xQEAScUBAIXFAQCLxQEAo8UBAMfFAQDpxQEAMcYBADfGAQBFxgEAf8YBAJ3GAQDbxgEAA8cBAHHHAQDvxwEAC8gBAD3IAQCvyAEAPckBAE/JAQCNyQEAr8kBAMnJAQDTyQEA+ckBACHKAQA7ygEAUcoBAFPKAQBpygEApcoBAPnKAQD7ygEAScsBAIvLAQCnywEAx8sBANnLAQDfywEA/csBAAPMAQANzAEAG8wBACXMAQAxzAEAUcwBAHnMAQB7zAEAgcwBABXNAQAbzQEAQc0BAJnNAQCbzQEArc0BAOnNAQDzzQEAWc4BAGHOAQCJzgEAl84BAJ3OAQC5zgEA3c4BAA/PAQAVzwEAK88BADfPAQCRzwEAtc8BAL3PAQDbzwEA5c8BAAPQAQAP0AEAO9ABAGvQAQB30AEAgdABAL3QAQD/0AEAMdEBAFnRAQB30QEAj9EBAJfRAQDF0QEA/dEBABnSAQBD0gEAXdIBAHnSAQCX0gEAwdIBADvTAQBL0wEAUdMBAN3TAQDn0wEA9dMBAAHUAQAF1AEAE9QBAD3UAQBJ1AEAkdQBAK/UAQC51AEA79QBACHVAQA51QEAXdUBAIHVAQDb1QEA69UBADPWAQBR1gEAXdYBAGvWAQC31gEAv9YBANvWAQDz1gEAQdcBAFXXAQBf1wEAhdcBAInXAQC71wEAy9cBAA/YAQAf2AEAJ9gBADnYAQBX2AEAadgBAG3YAQCR2AEApdgBALvYAQC92AEAP9kBALPZAQDL2QEA6dkBABnaAQBN2gEAX9oBAG3aAQDp2gEA99oBAAnbAQAh2wEAJdsBAGHbAQB/2wEAo9sBAEHcAQBL3AEAUdwBAF3cAQCb3AEAq9wBALncAQDD3AEA4dwBABPdAQAl3QEAW90BAJfdAQCn3QEA190BAOvdAQBL3gEAZ94BAIHeAQCl3gEAJ98BAHXfAQCJ3wEAmd8BAPPfAQAL4AEAKeABAIngAQDT4AEA8eABAPfgAQAH4QEAUeEBAF3hAQCZ4QEAq+EBAPPhAQAP4gEAG+IBAGviAQCH4gEAoeIBAL/iAQDJ4gEA0eIBABPjAQA74wEAU+MBAKnjAQCt4wEAueMBAO/jAQAH5AEAE+QBAFXkAQC35AEAweQBANnkAQDr5AEAFeUBAEflAQCN5QEAj+UBAJXlAQCz5QEAveUBAL/lAQAN5gEAEeYBAEnmAQBh5gEA4+YBAEPnAQBR5wEAY+cBAGnnAQCX5wEA6+cBAPfnAQAX6AEANegBAH3oAQAj6QEAO+kBAHPpAQDH6QEA3+kBAEPqAQBv6gEAu+oBAMfqAQDJ6gEA0+oBANvqAQDl6gEA8+oBAF/rAQBr6wEAfesBAKfrAQC/6wEAyesBAPXrAQAx7AEAQ+wBAE/sAQBz7AEAm+wBAK/sAQD37AEAA+0BAGftAQCX7QEAve0BAOvtAQD97QEAI+4BADXuAQBT7gEAV+4BAHfuAQCJ7gEAle4BAKfuAQC97gEA2+4BAPnuAQAX7wEAKe8BAGfvAQCD7wEA5e8BADnwAQBL8AEAZ/ABAJPwAQDn8AEAJ/EBAC3xAQCN8QEA1/EBAPnxAQAF8gEAKfIBADXyAQBx8gEAlfIBAJvyAQCv8gEAv/IBAN/yAQD18gEA+/IBABPzAQAl8wEAXfMBAGnzAQC78wEAz/MBAOXzAQAh9AEAb/QBAHH0AQAB9QEAQfUBAFX1AQB59QEAj/UBAMH1AQDN9QEA3fUBAOP1AQAJ9gEAJ/YBAFv2AQA/9wEAafcBAG/3AQDJ9wEAy/cBAPP3AQAZ+AEAQfgBAGH4AQBn+AEAqfgBAMX4AQDH+AEA/fgBAAH5AQAH+QEAIfkBAEP5AQCj+QEAsfkBANn5AQD5+QEAM/oBADX6AQA5+gEAR/oBAF36AQBp+gEAh/oBAMn6AQAB+wEAMfsBAGX7AQCn+wEA+/sBABX8AQAf/AEAY/wBAJf8AQCZ/AEAo/wBAMH8AQDb/AEA5/wBAC39AQA//QEAQf0BAEv9AQBr/QEAd/0BANX9AQD5/QEAO/4BAD3+AQBJ/gEAWf4BAH/+AQCF/gEA3/4BAPf+AQAb/wEAq/8BAE0AAgBjAAIAlQACAN0AAgDhAAIA7wACAG0BAgCVAQIA/QECAAcCAgAbAgIAewICAJMCAgCfAgIAuwICANUCAgB3AwIAgQMCANsDAgDnAwIAkQQCALsEAgC/BAIAywQCAEUFAgCrBQIAwwUCACcGAgA7BgIARwYCAIMGAgCPBgIAmwYCAOEGAgDzBgIA+QYCAP8GAgAXBwIAWQcCAGcHAgB9BwIAqQcCAM0HAgDpBwIA7wcCAF0IAgCXCAIAowgCAMcIAgDZCAIAAwkCABsJAgDPCQIAEQoCABkKAgA7CgIATQoCAE8KAgBVCgIAWwoCAN0KAgBLCwIAbwsCAJELAgClCwIAyQsCACEMAgA/DAIAUwwCAHEMAgB3DAIAfQwCAJMMAgDXDAIA2wwCAOMMAgD/DAIAJQ0CAEcNAgC7DQIAwQ0CANENAgANDgIAGw4CACsOAgAzDgIAYQ4CAHkOAgDJDgIA0w4CAAsPAgAjDwIAJw8CAFcPAgBpDwIAiQ8CAJMPAgC9DwIA7w8CALkQAgDdEAIA8RACAAMRAgAlEQIALRECADcRAgBJEQIAnRECAKURAgCvEQIAsRECAL0RAgDBEQIA3xECAPcRAgAREgIAZRICAKESAgDPEgIAKRMCAKMTAgABFAIAGRQCAB8UAgAtFAIAVRQCAI0UAgCXFAIAtRQCALsUAgDTFAIAFxUCACEVAgA/FQIARxUCAEsVAgBjFQIAfRUCAJ8VAgCtFQIAyxUCAPUVAgCdFgIA9RYCAPcWAgAbFwIAJxcCAIEXAgCdFwIAqxcCAMEXAgBXGAIAaRgCAI8YAgCTGAIAmRgCAC8ZAgBBGQIAcxkCAKcZAgC1GQIA8RkCAA8aAgAxGgIAYxoCAGcaAgCNGgIAtRoCANUaAgAJGwIAFxsCADkbAgDPGwIAoRwCAKMcAgDdHAIAAR0CAA8dAgBVHQIA6x0CAAseAgBFHgIAdR4CAJMeAgDPHgIAZR8CAHEfAgC/HwIAwR8CABsgAgAnIAIAMSACAEsgAgB7IAIAgSACAIUgAgCRIAIAnyACAMEgAgDlIAIA9yACABshAgBHIQIATSECAFkhAgBjIQIAjSECALEhAgDJIQIAXyICAGsiAgCjIgIApyICANciAgDfIgIAbyMCAL0jAgDNIwIA2SMCAO0jAgD5IwIACSQCAC0kAgBdJAIAeyQCAIMkAgClJAIAuSQCAO8kAgA7JQIAQyUCAIklAgCLJQIA1yUCAB8mAgBDJgIARSYCALcmAgDfJgIABScCAAsnAgAtJwIAZScCAGknAgB7JwIAfScCAJknAgD1JwIA+ycCADsoAgC5KAIAuygCADMpAgA3KQIAVSkCAIEpAgCNKQIAlykCAOspAgAFKgIACSoCABsqAgAnKgIALyoCAFMqAgC3KgIAzyoCAOEqAgDzKgIAESsCAEcrAgBZKwIAbSsCAIMrAgCXKwIA2SsCACEsAgDBLAIA5ywCAP8sAgBRLQIAdy0CAKUtAgCnLQIAEy4CABkuAgA3LgIAZS4CAJEuAgADLwIABy8CAAkvAgA3LwIAhy8CAIsvAgCRLwIAsS8CALsvAgDhLwIA5S8CAP0vAgBlMAIAazACAIEwAgCNMAIApzACALEwAgDVMAIAfzECAK8xAgDNMQIA2TECACUyAgBpMgIAvTICAMcyAgDJMgIAIzMCACczAgB9MwIAjzMCAKszAgCzMwIAwzMCABc0AgAZNAIAHTQCACs0AgA3NAIAYTQCAJ00AgCzNAIAwTQCAD01AgCXNQIAzzUCABU2AgAtNgIATTYCAJM2AgCnNgIAazcCAIM3AgDFNwIA7zcCAPc3AgAZOAIAITgCADc4AgBFOAIATzgCAF04AgDBOAIAwzgCAP04AgA5OQIAcTkCAIc5AgDFOQIA1zkCAO85AgAvOgIAWzoCAGU6AgBxOgIAiToCAJ06AgDxOgIAeTsCAIU7AgCTOwIA9zsCAFc8AgBZPAIAgzwCAJU8AgCxPAIA+zwCAA09AgAfPQIAPT0CAFk9AgB3PQIAgz0CAMs9AgDpPQIACT4CAC0+AgBVPgIAoz4CAME+AgALPwIAFT8CAB0/AgA1PwIAPz8CAFk/AgBdPwIAvz8CAC9AAgBbQAIAX0ACAH9AAgChQAIArUACAM1AAgDXQAIAV0ECAB1CAgBdQgIAt0ICAL1CAgDpQgIAE0MCAE1DAgCJQwIAr0MCAM1DAgADRAIAM0QCAF1EAgCTRAIAt0QCAOdEAgALRQIAG0UCAFFFAgCDRQIAm0UCALlFAgDFRQIAHUYCAD1GAgBNRgIAp0YCALVGAgDdRgIA90YCAANHAgAnRwIAMUcCAFVHAgBnRwIAo0cCAKtHAgCvRwIAwUcCABFIAgAdSAIAOUgCADtIAgBLSAIAY0gCAHdIAgB7SAIAuUgCAONIAgBDSQIAa0kCAHFJAgCFSQIAi0kCAOlJAgD7SQIAS0oCAFFKAgCHSgIAyUoCAM1KAgDPSgIA30oCABtLAgA5SwIAR0sCAGtLAgBvSwIAp0sCAPtLAgAFTAIAH0wCAE9MAgCDTAIAwUwCANdMAgDvTAIADU0CAGNNAgBpTQIAkU0CAPNNAgALTgIAEU4CAFFOAgBxTgIAdU4CAIFOAgCVTgIAyU4CAM9OAgD5TgIAB08CACtPAgBTTwIAVU8CAH9PAgCFTwIAu08CAN1PAgDrTwIA/U8CABtQAgA3UAIAY1ACAIdQAgClUAIA51ACAPdQAgAhUQIAKVECAD9RAgBZUQIAZVECAJ9RAgATUgIAhVICAJVSAgCbUgIA31ICAOVSAgA5UwIAV1MCAGdTAgB7UwIAjVMCALVTAgDHUwIA81MCAPdTAgAVVAIAL1QCADVUAgBRVAIAk1QCAMlUAgABVQIAB1UCAEFVAgBtVQIAlVUCAJ1VAgDvVQIAn1YCALdWAgDhVgIA+VYCAE1XAgB9VwIAj1cCANVXAgD1VwIAC1gCABdYAgBZWAIAZVgCAItYAgCVWAIAD1kCAB9ZAgA5WQIAVVkCAFtZAgC7WQIA2VkCAPFZAgAPWgIAZVoCAHVaAgCDWgIApVoCAN1aAgA3WwIAW1sCAHdbAgCvWwIAzVsCAN1bAgD7WwIAOVwCAGdcAgB7XAIAkVwCABFdAgAvXQIAgV0CABFeAgA3XgIAQV4CAENeAgCnXgIAv14CAD1fAgB1XwIAgV8CAKVfAgCxXwIAu18CAL1fAgDPXwIA5V8CABdgAgAzYAIARWACAF1gAgCBYAIAh2ACAJVgAgCtYAIAyWACAMtgAgDXYAIAa2ECAJ1hAgD3YQIAOWICAGFiAgDTYgIAaWMCAHtjAgDLYwIA12MCAP9jAgAFZAIAC2QCAB9kAgA9ZAIATWQCAG1kAgB/ZAIAl2QCANdkAgDjZAIAK2UCADNlAgBPZQIAW2UCAIVlAgCZZQIAr2UCALVlAgD9ZQIAL2YCAFdmAgBZZgIApWYCALNmAgDzZgIA9WYCAPlmAgARZwIAK2cCAElnAgBTZwIAu2cCAOVnAgAlaAIAK2gCAEloAgBhaAIAZ2gCAHVoAgCraAIAyWgCAM1oAgDtaAIAJ2kCADNpAgBBaQIAd2kCAL1pAgC/aQIAF2oCABlqAgBVagIAeWoCAJdqAgCjagIAN2sCAFdrAgBjawIAZ2sCAJ1rAgDHawIAHWwCACdsAgBTbAIAe2wCAJNsAgDPbAIABW0CABFtAgApbQIAiW0CAI9tAgDLbQIA320CAPdtAgABbgIAdW4CAJ1uAgC9bgIAx24CAEFvAgBlbwIAgW8CAIdvAgCPbwIAt28CANFvAgDVbwIA228CAOlvAgAZcAIAMXACAG1wAgB/cAIAm3ACAMFwAgAJcQIAIXECAElxAgBPcQIAV3ECAI1xAgCfcQIAt3ECAMlxAgDzcQIAV3ICALlyAgDjcgIAa3MCAH1zAgCLcwIAr3MCAO9zAgAVdAIAJ3QCAEl0AgBtdAIA1XQCAOV0AgDxdAIAF3UCACN1AgBFdQIAdXUCAId1AgCPdQIAsXUCANF1AgDvdQIANXYCAFN2AgB/dgIAg3YCAON2AgD3dgIAGXcCACF3AgA3dwIAZ3cCAGl3AgCTdwIAtXcCAMF3AgDPdwIA93cCAA94AgCzeAIAv3gCANt4AgDheAIAH3kCACt5AgCheQIAtXkCAPV5AgAnegIAN3oCAFV6AgBXegIAbXoCAPl6AgAhewIAKXsCAG97AgCPewIAp3sCAON7AgDnewIAK3wCAEF8AgCbfAIAy3wCANN8AgBtfQIAi30CAP99AgAjfgIAQX4CAFF+AgBZfgIAvX4CADF/AgA1fwIAO38CAHF/AgCRfwIAlX8CAMV/AgDNfwIA438CAOt/AgABgAIAB4ACABOAAgAfgAIAi4ACAI2AAgCdgAIANYECAFeBAgBfgQIAaYECAImBAgCbgQIAw4ECAMuBAgD1gQIABYICAEOCAgChggIAs4ICAOuCAgD3ggIADYMCADeDAgDVgwIA34MCALeEAgDXhAIAKYUCADWFAgBthQIAcYUCAMGFAgDfhQIAA4YCABWGAgBJhgIAh4YCABWHAgBLhwIATYcCAHWHAgDFhwIA4YcCAP+HAgA1iAIAX4gCAIWIAgCLiAIAm4gCAAOJAgANiQIAGYkCAIGJAgAJigIAHYoCAFeKAgCNigIAxYoCAMmKAgDLigIA1YoCAA2LAgBDiwIAU4sCAFWLAgB9iwIAu4sCABOMAgA3jAIAYYwCAJ+MAgCljAIAu4wCAMOMAgA1jQIAY40CAI2NAgCPjQIAq40CANWNAgDhjQIA740CAPWNAgAvjgIArY4CAMWOAgDRjgIAW48CAGGPAgBjjwIAeY8CALWPAgDBjwIAz48CANOPAgARkAIATZACAFeQAgCtkAIAAZECAE2RAgDHkQIA2ZECAPGRAgAJkgIAK5ICAEuSAgBPkgIAXZICAJmSAgCpkgIAt5ICAOWSAgAhkwIAOZMCAE2TAgDDkwIA6ZMCACuUAgBrlAIAbZQCAHeUAgCFlAIAiZQCANmUAgDvlAIAAZUCAEOVAgBhlQIAt5UCANOVAgALlgIAh5YCAKGWAgCxlgIAuZYCANuWAgAplwIAX5cCAG2XAgDllwIAA5gCAAeYAgBPmAIAYZgCAOWYAgD3mAIAA5kCACeZAgBXmQIAb5kCAMmZAgDPmQIAAZoCAA2aAgApmgIAK5oCAD2aAgBTmgIAg5oCAMGaAgDNmgIA05oCANeaAgAHmwIACZsCAA+bAgAVmwIAGZsCADmbAgBVmwIAY5sCAGmbAgB5mwIAh5sCAJObAgD/mwIAJ5wCAHucAgCrnAIAw5wCAAedAgA1nQIAQZ0CAHedAgDLnQIA/Z0CACGeAgA/ngIAYZ4CAG2eAgCFngIAmZ4CALGeAgDBngIA7Z4CACOfAgAvnwIAV58CAGmfAgCZnwIAoZ8CAKufAgDhnwIAEaACAEGgAgCLoAIAv6ACAPegAgD7oAIAK6ECAD+hAgCZoQIAcaICAImiAgCPogIAraICALGiAgDPogIAAaMCAB2jAgCpowIAtaMCAMGjAgDdowIAGaQCAB+kAgArpAIAVaQCAH+kAgDBpAIAz6QCANOkAgDZpAIA8aQCAHelAgCzpQIABaYCAE+mAgBTpgIAc6YCAHemAgCRpgIAzaYCANemAgDvpgIA+6YCABunAgArpwIAVacCALenAgDDpwIAC6gCAEWoAgCNqAIAyagCAPmoAgAfqQIAX6kCAIOpAgCXqQIAm6kCAPepAgAHqgIAFaoCACeqAgAtqgIAUaoCAFeqAgBvqgIAqaoCAK+qAgC1qgIA7aoCAC2rAgA1qwIAX6sCAG+rAgClqwIAv6sCAGusAgCjrAIArawCALusAgDHrAIA9awCACGtAgAzrQIAZ60CAHmtAgCFrQIAi60CAKOtAgC3rQIAEa4CAFOuAgBrrgIAia4CAMOuAgDjrgIA7a4CAAGvAgATrwIAL68CAHmvAgCVrwIAr68CANevAgA/sAIAT7ACAIWwAgDbsAIAS7ECAJOxAgClsQIAp7ECAPWxAgALsgIAR7ICAEmyAgBlsgIAcbICAImyAgCLsgIAqbICANGyAgDZsgIAB7MCABmzAgAbswIAH7MCACWzAgA3swIAXbMCAHOzAgB1swIAe7MCAM2zAgDrswIAObQCADu0AgBHtAIAabQCAKe0AgANtQIAGbUCAEG1AgBntQIAfbUCAIO1AgAbtgIAT7YCAGG2AgBjtgIAe7YCAOW2AgAdtwIAZbcCAJO3AgCrtwIA3bcCAOe3AgD5twIAL7gCAHG4AgCduAIArbgCAK+4AgC5uAIA2bgCACW5AgBFuQIAabkCAKW5AgCpuQIAq7kCAPm5AgADugIABboCAAm6AgBdugIAgboCAKu6AgC9ugIA0boCANu6AgDzugIA+7oCAAe7AgBVuwIAi7sCANm7AgDluwIAA7wCAAm8AgANvAIAK7wCAD28AgBFvAIAtbwCAO28AgD9vAIAF70CAHW9AgB9vQIAh70CAIm9AgDDvQIAyb0CAOe9AgDtvQIAB74CAEO+AgBZvgIAa74CAG2+AgBzvgIAib4CAMW+AgDjvgIA674CABW/AgAnvwIAN78CAGe/AgBpvwIA1b8CAP2/AgAJwAIAD8ACACfAAgBTwAIAV8ACAJPAAgCbwAIANcECAA/CAgA/wgIAS8ICAJPCAgBHwwIAWcMCAJXDAgClwwIAv8MCAM/DAgDRwwIA28MCAAXEAgAdxAIAccQCAJXEAgChxAIArcQCANHEAgDTxAIA+8QCAAnFAgATxQIAIcUCAIfFAgC9xQIA98UCAP3FAgD/xQIAA8YCABHGAgAbxgIANcYCAMXGAgD7xgIAC8cCAA3HAgAZxwIAK8cCAFPHAgBVxwIAj8cCAKPHAgDBxwIA48cCAEXIAgDHyAIA58gCADPJAgBvyQIAgckCAIPJAgC3yQIAHcoCAHPKAgCJygIAkcoCAAHLAgBvywIAf8sCAM/LAgDbywIA38sCAPnLAgAVzAIAL8wCAI3MAgDVzAIA58wCADvNAgBVzQIAg80CANHNAgABzgIAD84CAGPOAgBvzgIAh84CAI3OAgCjzgIAw84CAM3OAgDnzgIA684CAF3PAgB7zwIAfc8CAJPPAgDDzwIA0c8CANfPAgAx0AIAYdACAHnQAgCn0AIAqdACAO/QAgD70AIAH9ECACHRAgA30QIAXdECAH/RAgCR0QIA99ECABvSAgBF0gIAR9ICAInSAgCh0gIApdICAO3SAgAr0wIAy9MCANfTAgDr0wIAE9QCABnUAgCL1AIAk9QCALvUAgDD1AIAx9QCAM/UAgDf1AIA+dQCACnVAgBR1QIAXdUCAHvVAgDF1QIA1dUCANvVAgDn1QIA6dUCAPnVAgAl1gIAZdYCAHPWAgCX1gIAudYCAPfWAgD71gIAAdcCAAfXAgBL1wIAddcCAH/XAgCH1wIAk9cCAJ/XAgC91wIAzdcCAAnYAgAL2AIAU9gCANXYAgDp2AIAGdkCAG3ZAgCV2QIAr9kCAPfZAgD92QIACdoCACXaAgBP2gIAqdoCAOfaAgD92gIAA9sCACnbAgBR2wIAV9sCAKfbAgDL2wIA1dsCAOHbAgDz2wIA+9sCABHcAgAZ3AIAH9wCAHPcAgCL3AIAp9wCAAPdAgAN3QIAFd0CADPdAgBJ3QIAc90CAK/dAgDV3QIA390CAOvdAgD53QIAa94CAMveAgDp3gIAC98CAGXfAgBx3wIAx98CAOXfAgAB4AIAZ+ACAMHgAgAP4QIAFeECAB3hAgAn4QIAX+ECAGvhAgCB4QIAm+ECAL/hAgDv4QIAC+ICAB3iAgBb4gIAheICANPiAgDd4gIA8eICAA/jAgBD4wIAV+MCAHvjAgCZ4wIAseMCAO3jAgD/4wIAIeQCADPkAgA15AIAa+QCALHkAgDV5AIAAeUCAAXlAgAv5QIAf+UCAJvlAgDZ5QIAGeYCAB/mAgAl5gIAS+YCAGPmAgBv5gIAseYCAM/mAgAp5wIANecCAF3nAgBx5wIAlecCAMPnAgAH6AIAbegCAHHoAgC56AIAy+gCAP3oAgAn6QIAQ+kCAFfpAgCX6QIAq+kCAL3pAgAV6gIAP+oCAEfqAgCh6gIAp+oCAMXqAgAF6wIA2esCAOXrAgAJ7AIAE+wCAB/sAgA/7AIAi+wCAKnsAgC17AIAt+wCAMnsAgDb7AIA5ewCADntAgBT7QIAV+0CAKftAgAN7gIAHe4CAGHuAgBx7gIAee4CAK3uAgDB7gIA5e4CAAPvAgAH7wIAVe8CAHXvAgB/7wIAr+8CAM3vAgDP7wIAEfACADvwAgBF8AIAR/ACAFnwAgBl8AIAafACALnwAgDh8AIA9fACAFXxAgCj8QIA0/ECAEXyAgBt8gIAgfICAKXyAgDt8gIAA/MCABXzAgAv8wIAOfMCAFfzAgCP8wIAp/MCAAX0AgAN9AIAF/QCACX0AgBB9AIAcfQCAM30AgDj9AIA/fQCAAf1AgBF9QIAVfUCAFv1AgBj9QIAkfUCAJP1AgDJ9QIA0/UCAOH1AgDr9QIALfYCAGX2AgCD9gIA2/YCAEP3AgBJ9wIAbfcCAKf3AgDL9wIACfgCABX4AgB/+AIAmfgCAJ34AgCj+AIAqfgCAPn4AgAX+QIALfkCAC/5AgAz+QIAS/kCAHX5AgCT+QIApfkCAM/5AgDj+QIA5/kCAAX6AgAR+gIAH/oCADH6AgA7+gIAWfoCAKn6AgDN+gIA7/oCAAH7AgAP+wIAVfsCAJf7AgDT+wIAD/wCAHH8AgCZ/AIAm/wCAJ/8AgDh/AIANf0CAEn9AgBP/QIAW/0CAH/9AgCD/QIAif0CAKP9AgAV/gIAK/4CAEn+AgBR/gIAYf4CALX+AgDP/gIA0/4CAOv+AgAb/wIAI/8CAH3/AgCT/wIAlf8CAKv/AgDj/wIABQADAE8AAwBlAAMAdwADAKMAAwDRAAMA9QADAAcBAwAJAQMAKwEDADcBAwBhAQMAgQEDAJ8BAwCpAQMAwwEDACcCAwBTAgMAcQIDAHsCAwCNAgMAlQIDAN0CAwDjAgMA7wIDAAcDAwANAwMAKwMDAC8DAwBBAwMATQMDAJEDAwCjAwMAwQMDAN0DAwDfAwMADwQDAJMEAwDNBAMAFQUDACcFAwBLBQMAUQUDAJ8FAwC5BQMAywUDAN0FAwDvBQMAMQYDADUGAwBNBgMATwYDAHEGAwDLBgMA9wYDACcHAwA/BwMATwcDAFsHAwCBBwMAmQcDAKsHAwDBBwMA1QcDAPEHAwD3BwMAEQgDAE0IAwBpCAMAmwgDAKcIAwCrCAMAuQgDAPUIAwARCQMAVQkDAH8JAwC/CQMA8QkDACcKAwBPCgMAkQoDAKkKAwD5CgMAIQsDAEsLAwCHCwMAjwsDAJ8LAwCzCwMA9QsDAP8LAwA7DAMARwwDAHcMAwB/DAMA+wwDAP0MAwAZDQMAKZQEAFeUBACDlAQAm5QEAM+UBAD1lAQAI5UEAH2VBADBlQQAy5UEAC2WBABplgQAgZYEAJOWBACvlgQAw5YEAMeWBAAJlwQAM5cEADmXBABFlwQAgZcEAJmXBAChlwQAp5cEALGXBADFlwQAEZgEAH+YBACbmAQAo5gEAAeZBAATmQQAFZkEAGGZBACTmQQAl5kEAK+ZBAAXmgQAIZoEADOaBABxmgQAh5oEALeaBAC5mgQA9ZoEAE2bBABtmwQAm5sEAKebBACtmwQAK5wEAD+cBABXnAQAW5wEAIWcBACNnAQA+ZwEAD+dBABLnQQAe50EAJOdBADXnQQA550EAO2dBAD7nQQABZ4EABGeBAAlngQAN54EAHeeBACDngQAm54EAK+eBAC7ngQAx54EANGeBADxngQACZ8EAD2fBABPnwQAe58EAJ+fBAAPoAQAI6AEACegBAAvoAQAcaAEAJmgBACzoAQAB6EEADGhBAA9oQQAZ6EEAG2hBACzoQQAv6EEANOhBADdoQQA46EEAOmhBAAbogQAH6IEAD+iBABDogQAS6IEAHOiBAClogQAu6IEAMmiBADTogQAO6MEAEGjBABvowQAfaMEALGjBADbowQAQaQEAFOkBABfpAQAfaQEAJekBADLpAQA3aQEAOukBAAJpQQALaUEADGlBAA3pQQA4aUEAPelBABZpgQAdaYEAKemBACtpgQAv6YEANGmBADvpgQA86YEAAGnBAAHpwQAL6cEAFOnBAB5pwQAfacEAMWnBADNpwQA36cEAIGoBAAPqQQAvakEAMOpBADhqQQAN6oEAE2qBAB3qgQAwaoEAMuqBADRqgQA/aoEAAerBABbqwQAeasEANWrBAD3qwQAmawEAK2sBADJrAQA56wEACmtBABHrQQAT60EAG2tBACRrQQA5a0EAA2uBAA9rgQAS64EAHmuBACFrgQAn64EALeuBAD9rgQAL68EAFmvBACVrwQAn68EALmvBADhrwQA9a8EAD2wBABNsAQAU7AEAFmwBABlsAQAi7AEAMewBAAPsQQAGbEEAIWxBACxsQQAw7EEAOexBADtsQQA/7EEAC+yBABpsgQAz7IEAKmzBACtswQAubMEAEW0BABPtAQAVbQEAGO0BABntAQAbbQEANW0BAAdtQQAKbUEAGu1BAB1tQQAQbYEAHO2BAC7tgQA/bYEAFe3BABztwQAybcEAPm3BAAVuAQAHbgEACm4BAA/uAQARbgEAJu4BADRuAQA6bgEACO5BAAluQQAX7kEAHe5BAB9uQQAhbkEAKe5BADRuQQACboEADO6BABdugQAdboEAG+7BABxuwQAz7sEAAG8BAATvAQA0bwEAOu8BADvvAQAE70EACu9BABjvQQAc70EAIe9BADJvQQAzb0EAPO9BAAFvgQAEb4EAE2+BABTvgQAdb4EAGG/BADvvwQA+78EAP2/BAADwAQALcAEAJfABADtwAQA8cAEAPPABAARwQQAZcEEAGvBBACBwQQAw8EEAA3CBAATwgQAPcIEAI/CBACVwgQA18IEAAfDBAAJwwQAi8MEAJPDBAC7wwQA4cMEAPfDBAALxAQAHcQEAFfEBABdxAQAg8QEAJXEBAC9xAQA88QEAA3FBAAZxQQAK8UEAIXFBAA3xgQAQ8YEAG3GBACLxgQAS8cEAHfHBAChxwQAuccEAP/HBAAHyAQAhcgEAK3IBADZyAQA38gEAEXJBAB/yQQAo8kEALHJBAC3yQQA5ckEAP3JBAAbygQAIcoEAEHKBABLygQAacoEAHvKBACHygQAjcoEAJPKBAClygQA+8oEABnLBAAvywQAZcsEAGvLBAB/ywQAg8sEAJHLBACVywQAScwEAHvMBACBzAQAr8wEAN/MBAADzQQARc0EAFfNBACJzQQAm80EAP/NBAAlzgQAL84EADXOBACnzgQA2c4EAOXOBAArzwQALc8EAFfPBABvzwQAec8EAP3PBAAR0AQAHdAEAEXQBACJ0AQAydAEAM/QBAAd0QQAX9EEAGfRBACD0QQAtdEEAPvRBAAh0gQALdIEAKnSBAC30gQAwdIEAM3SBADl0gQAIdMEAD/TBACD0wQAidMEAI3TBACz0wQA1dMEABfUBAA31AQAVdQEAFvUBABz1AQAl9QEAKHUBADN1AQA2dQEAPXUBAAT1QQAUdUEAG/VBACT1QQAr9UEALXVBADb1QQA99UEAF3WBAB31gQA89YEAPvWBAAF1wQAK9cEAJXXBAC71wQA49cEAOvXBAAT2AQAM9gEAJ/YBACp2AQAsdgEALXYBADf2AQA59gEAP3YBAAF2QQAI9kEAF3ZBACD2QQAj9kEAKHZBADP2QQAEdoEAB/aBAAj2gQAfdoEAJfaBADl2gQAFdsEADPbBABJ2wQAXdsEAIHbBADD2wQA09sEADvcBABd3AQAX9wEAHXcBADV3AQAF90EAB/dBABZ3QQAYd0EAGfdBACj3QQAv90EAMXdBAAZ3gQAM94EAD3eBABJ3gQAjd4EAJneBACr3gQA4d4EAOveBABf3wQAb98EAHffBACn3wQAs98EAO3fBAD73wQAAeAEAAvgBABP4AQAZ+AEAHfgBABD4QQAS+EEAFXhBACd4QQAr+EEALfhBADl4QQA7eEEAPnhBAAL4gQAG+IEAD/iBABR4gQAa+IEAHfiBACN4gQAleIEAJniBADV4gQA7eIEABHjBABJ4wQAeeMEAIPjBADd4wQAG+QEAE/kBABh5AQAc+QEAIfkBACR5AQAF+UEAEflBABd5QQAn+UEABfmBAA15gQAd+YEAJHmBACz5gQAy+YEABXnBAAf5wQAK+cEADHnBABX5wQAdecEAJPnBACp5wQA5ecEAFHoBAC56AQAB+kEAN3pBAAD6gQACeoEAC3qBAC16gQAyeoEAN/qBABj6wQAcesEAJ/rBADR6wQA1+sEAP/rBAAN7AQAF+wEADXsBABH7AQASewEAFnsBACV7AQAu+wEANPsBADd7AQA9+wEADftBAA97QQAS+0EAGftBABp7QQAh+0EALXtBAC77QQAD+4EABXuBAAd7gQAM+4EAE3uBACH7gQABe8EACnvBABx7wQA++8EAP3vBAAN8AQAJ/AEADnwBABz8AQAhfAEALfwBADb8AQAJ/EEAF3xBACT8QQAv/EEANXxBADj8QQA6fEEAPnxBAAv8gQAN/IEAJvyBADF8gQAzfIEACfzBABV8wQAY/MEAHXzBACX8wQApfMEALHzBADr8wQAIfQEAK30BAC39AQAy/QEAAX1BAAd9QQAJfUEAEP1BABN9QQAVfUEAHP1BACJ9QQAm/UEALv1BAAN9gQAK/YEAD32BABD9gQARfYEAFH2BABj9gQAb/YEAAP3BAA/9wQAV/cEAGX3BACN9wQAw/cEAOf3BAD/9wQAO/gEAD34BAB3+AQAtfgEAOX4BAD1+AQARfkEAGn5BADD+QQA/fkEAP/5BAAP+gQALfoEAGv6BACz+gQAz/oEAEP7BACn+wQAJfwEAHX8BADT/AQA9/wEABv9BAAd/QQAJ/0EAFf9BACT/QQA+/0EAAv+BAAj/gQAKf4EAE/+BABT/gQAX/4EAI/+BACX/gQAo/4EAOn+BAD7/gQAQ/8EAEv/BACB/wQAk/8EAJ3/BADf/wQA7f8EABsABQBjAAUAgQAFAJMABQCtAAUA7QAFAPMABQAfAQUALwEFAGUBBQB/AQUA6wEFAIcCBQCXAgUAtQIFALsCBQC9AgUA5QIFACEDBQA/AwUAXwMFAIMDBQCtAwUAuQMFAL0DBQDLAwUA7wMFADEEBQBNBAUAUwQFAG0EBQCPBAUAswQFALsEBQDBBAUA1wQFAAEFBQAVBQUATQYFAFMGBQBpBgUAdQYFAIMGBQDXBgUAEQcFAHMHBQCbBwUAuQcFAL8HBQDHBwUA9QcFAPsHBQAzCAUASQgFAEsIBQCLCAUA2wgFAOUIBQDxCAUANQkFAEUJBQBNCQUAcQkFAFsKBQC/CgUAxwoFAD0LBQBbCwUAbwsFAJELBQC3CwUAzwsFAOELBQD9CwUAJwwFAEUMBQBXDAUAhwwFABMNBQCRDQUA0Q0FAEkOBQB/DgUA9w4FAAMPBQAXDwUAGw8FADsPBQBTDwUAWQ8FAF0PBQCPDwUAvw8FAAUQBQBrEAUAhRAFAKcQBQDFEAUA3xAFAOkQBQDrEAUAMREFAHMRBQCBEQUAlxEFAKkRBQDnEQUAHRIFAG8SBQCtEgUAsxIFAL0SBQAREwUAGRMFAB0TBQC5EwUAxxMFAOsTBQD3EwUAMxQFAJcUBQDlFAUA8RQFACkVBQAtFQUALxUFAGkVBQCZFQUAqxUFAMUVBQALFgUAGRYFAB0WBQBVFgUAeRYFAIsWBQCRFgUA+xYFAD8XBQBjFwUAkRcFAJcXBQDJFwUA2xcFAOsXBQAvGAUAYxgFAGkYBQB1GAUAhxgFAJUYBQCtGAUADRkFAO8ZBQD9GQUAQxoFAFUaBQBbGgUAzRoFAC0bBQAzGwUAnxsFAKcbBQCzGwUAuRsFAL8bBQDDGwUAyRsFAPsbBQANHAUAfRwFAJEcBQDHHAUAyxwFAOUcBQDpHAUACR0FAHUdBQAXHgUAWR4FAF0eBQCTHgUAnx4FAM8eBQARHwUAJR8FAEkfBQBNHwUAcR8FAH8fBQCbHwUAwR8FABkgBQAtIAUARSAFAJ8gBQC7IAUAzyAFAPkgBQAdIQUARyEFAF8hBQBjIQUAfSEFAIchBQDpIQUADSIFAHciBQCVIgUAuyIFAMEiBQDlIgUAMSMFAD8jBQBXIwUAdSMFAHkjBQB/IwUAhSMFAJkjBQC3IwUA2SMFAN8jBQADJAUADyQFAEEkBQBlJAUAdSQFAJkkBQDJJAUAASUFANElBQD1JQUAEyYFAFEmBQBnJgUAeSYFAIEmBQCHJgUAxyYFAPMmBQARJwUAOScFAFcnBQC9JwUA0ScFAOMnBQAdKAUA3SgFAPcoBQAbKQUANykFAD0pBQBLKQUAZykFAJEpBQClKQUAqykFAM8pBQDnKQUA6ykFABEqBQAtKgUAjSoFAJUqBQD/KgUAOysFAM0rBQDdKwUAeywFAJ8sBQDBLAUAwywFADktBQB7LQUA1S0FACMuBQDFLgUA1y4FANkuBQDfLgUA+y4FAA8vBQAnLwUAVy8FAIEvBQCvLwUA5y8FABcwBQA/MAUAbzAFAI8wBQCfMAUA6TAFAJExBQCjMQUArTEFAM0xBQDfMQUA4zEFAOUxBQABMgUAPTIFAF0yBQBhMgUAbzIFAKMyBQCxMgUAtTIFANUyBQAzMwUANTMFAEszBQB7MwUAoTMFAK0zBQAHNAUAMTQFAIM0BQC7NAUAxzQFANM0BQAtNQUANzUFAD81BQBJNQUAYzUFAG01BQCvNQUA5TUFAP01BQAnNgUANTYFAFM2BQBxNgUAdzYFAJs2BQDvNgUAETcFAFs3BQCnNwUAuzcFAME3BQDHNwUAyzcFAC04BQA3OAUAqzgFAAk5BQBFOQUARzkFAFc5BQB1OQUAjTkFALM5BQD5OQUAEzoFAEE6BQBHOgUAdzoFAH06BQDlOgUABzsFADk7BQBPOwUAaTsFAHM7BQClOwUAuzsFAAs8BQAVPAUALzwFAHE8BQCfPAUAszwFAMs8BQDdPAUA+TwFABE9BQBNPQUAVT0FAHM9BQD7PQUACT4FABs+BQAnPgUATz4FAK8+BQD3PgUA+T4FAAk/BQAPPwUAaT8FAIc/BQC9PwUA0T8FAPU/BQAvQAUAZ0AFAH1ABQCdQAUAu0AFAMdABQDRQAUA5UAFACFBBQBhQQUAhUEFAJ9BBQAXQgUAI0IFAC1CBQBNQgUAdUIFAI9CBQDzQgUAC0MFAB9DBQBZQwUAiUMFAJtDBQCzQwUALUQFADNEBQA3RAUA8UQFAEVFBQBrRQUAd0UFAI9FBQDLRQUA40UFAO1FBQABRgUAK0YFAFlGBQBrRgUAhUYFAJ1GBQCtRgUA00YFAN9GBQB7RwUAjUcFAJ1HBQC7RwUA30cFADlIBQBZSAUAv0gFAPlIBQABSQUANUkFAD1JBQBBSQUAVUkFAK9JBQC5SQUAV0oFAGFKBQCpSgUA80oFAP1KBQB7SwUAq0sFALNLBQD5SwUA+0sFAAdMBQAZTAUAYUwFALVMBQDBTAUAzUwFAAlNBQATTQUALU0FAHlNBQCNTQUAu00FAMdNBQDlTQUAUU4FAFNOBQBjTgUAe04FAKVOBQD7TgUAGU8FAEFPBQBNTwUAT08FAFVPBQB/TwUAlU8FAK1PBQCzTwUAwU8FAANQBQA5UAUAY1AFAM9QBQADUQUAEVEFABtRBQCbUQUAp1EFANVRBQDdUQUA9VEFACVSBQBhUgUAi1IFAJtSBQCnUgUAs1IFAJdTBQDNUwUA/1MFAA9UBQCfVAUAuVQFAL1UBQDFVAUA11QFANtUBQAfVQUANVUFAFlVBQCLVQUA41UFAGlWBQB7VgUAmVYFAOdWBQDrVgUA7VYFAA9XBQBNVwUAUVcFAJ9XBQC5VwUAz1cFAONXBQALWAUAMVgFAFVYBQDXWAUA31gFAOtYBQA5WQUAe1kFAMFZBQDHWQUA91kFAP9ZBQARWgUAG1oFAEVaBQBZWgUAe1oFAN1aBQAvWwUAR1sFAJ1bBQCvWwUAy1sFAD1cBQBPXAUAb1wFAJdcBQCfXAUAw1wFAOFcBQDtXAUACV0FAB1dBQApXQUAP10FAGNdBQDbXQUA810FAPVdBQA7XgUAVV4FAHdeBQCPXgUAr14FALleBQD3XgUAbV8FAG9fBQC1XwUAyV8FAAtgBQBNYAUAcWAFAI9gBQCTYAUAuWAFAMtgBQDjYAUA6WAFAE1hBQBfYQUAeWEFAONhBQDlYQUAc2IFAI1iBQC1YgUAIWMFAC1jBQBdYwUAlWMFAJtjBQDvYwUAJWQFAKNkBQCtZAUA0WQFAPtkBQAfZQUAXWUFAK9lBQDJZQUA8WUFAAVmBQAPZgUAG2YFAEtmBQBNZgUAfWYFAKtmBQD5ZgUA+2YFAElnBQBlZwUAeWcFABloBQAxaAUARWgFAEloBQCLaAUA5WgFAPdoBQBTaQUAa2kFAHVpBQCNaQUAy2kFAOdpBQDvaQUADWoFABdqBQAfagUAm2oFALVqBQDBagUA12oFAN1qBQDpagUA8WoFAA9rBQAVawUAY2sFAHlrBQC9awUA4WsFAPlrBQALbAUAY2wFAPVsBQA7bQUAX20FAHFtBQCLbQUA120FADNuBQBhbgUAb24FAH9uBQDHbgUA/W4FAAVvBQARbwUALW8FAEtvBQCTbwUAW3AFAH9wBQCVcAUAtXAFANFwBQANcQUAJ3EFAHtxBQDTcQUARXIFAFNyBQB1cgUAh3IFANtyBQDvcgUAO3MFAI9zBQDHcwUALXQFADd0BQBhdAUAjXQFAMN0BQDTdAUA7XQFABF1BQAndQUALXUFAGl1BQChdQUAv3UFAGV2BQBtdgUADXcFAEt3BQBVdwUAhXcFAJN3BQCpdwUAu3cFABF4BQAbeAUAO3gFAGN4BQCreAUAyXgFANV4BQAjeQUAKXkFAEN5BQBNeQUAW3kFAH95BQDTeQUA33kFAPd5BQD7eQUAJ3oFAD16BQBRegUAV3oFAFt6BQCXegUAx3oFAOd6BQApewUAP3sFAF97BQDRewUAGXwFAE18BQDZfAUA73wFAEN9BQBRfQUAZ30FAJ19BQDnfQUA+X0FAFd+BQCHfgUAm34FAOl+BQD1fgUA+34FAAF/BQBhfwUAMYAFAF2ABQCNgAUAvYAFAHeBBQClgQUAxYEFAPmBBQARggUAE4IFACuCBQD7ggUAP4MFAGGDBQDhgwUAG4QFACOEBQAnhAUAM4QFAGmEBQCxhAUA+4QFACOFBQBHhQUAT4UFAHOFBQCRhQUAlYUFAPWFBQD7hQUACYYFAGGGBQBthgUAsYYFAO2GBQD5hgUAM4cFADWHBQBjhwUAa4cFAHGHBQCDhwUAjYcFAL+HBQDLhwUA0YcFANuHBQCJiAUA44gFAPWIBQD9iAUAAYkFAAeJBQAxiQUAc4kFAJGJBQDJiQUAHYoFADOKBQBvigUAlYoFAJmKBQDLigUABYsFAGGLBQBtiwUAi4sFAKeLBQDpiwUAOYwFAD2MBQCjjAUAx4wFANOMBQDnjAUA7YwFACGNBQBvjQUAfY0FAIeNBQC3jQUAKY4FAEeOBQBhjgUAv44FAAOPBQAPjwUAVY8FAIGPBQDrjwUA/Y8FAP+PBQAbkAUAP5AFAFOQBQBxkAUAfZAFAK2QBQDDkAUAy5AFAAGRBQAdkQUASZEFAE+RBQBbkQUAbZEFAImRBQDdkQUASZIFAFuSBQB7kgUAkZIFAJ2SBQDDkgUA8ZIFAA+TBQAVkwUAgZMFAJuTBQCnkwUAsZMFAEmUBQB5lAUAg5QFALOUBQC/lAUAzZQFAA+VBQAblQUAdZUFAJ+VBQC9lQUA5ZUFAP2VBQAvlgUANZYFAFmWBQBdlgUAd5YFAIOWBQCNlgUAk5YFAJ+WBQDFlgUA1ZYFAOOWBQBJlwUAZZcFAH2XBQCvlwUAB5gFAHmYBQCBmAUA+ZgFAAOZBQAVmQUANZkFADuZBQBLmQUAaZkFAHeZBQB9mQUAh5kFAK2ZBQCzmQUA3ZkFABGaBQA7mgUATZoFAGGaBQBzmgUAf5oFAKmaBQDLmgUA0ZoFAAmbBQAfmwUAXZsFAJ+bBQDtmwUA85sFAEecBQBTnAUAX5wFAGmcBQCbnAUApZwFAMucBQDXnAUA4ZwFABGdBQBVnQUAlZ0FAJ2dBQDNnQUA650FAO+dBQANngUAGZ4FACueBQBnngUAc54FAPGeBQA7nwUAa58FAHufBQCJnwUAp58FAPmfBQBZoAUAoaAFAPGgBQAzoQUAb6EFAIWhBQD3oQUAdaIFAI2iBQCVogUAs6IFAMmiBQBTowUACaQFAH+kBQCBpAUA1aQFAFOlBQCNpQUAoaUFALelBQD5pQUAEaYFABemBQAlpgUAR6YFAMWmBQDrpgUA96YFAAmnBQATpwUAH6cFAC2nBQA9pwUAYacFAGmnBQC1pwUAu6cFAGmoBQC/qAUAy6gFAFOpBQBxqQUAfakFAI+pBQD3qQUAG6oFAFuqBQBvqgUAi6oFAJmqBQC9qgUAaasFAKGrBQDPqwUA86sFAAesBQB9rAUAnawFALmsBQDXrAUA5awFAPWsBQADrQUALa0FADetBQBjrQUA060FADWuBQBBrgUAWa4FAJOuBQCZrgUA264FAAGvBQCDrwUAla8FAJ2vBQC1rwUAu68FAA+wBQAbsAUAPbAFAF2wBQBvsAUAkbAFAO2wBQDzsAUAUbEFAL+xBQDJsQUAK7IFAF+yBQBlsgUAbbIFAHOyBQCDsgUAkbIFAM2yBQDXsgUA77IFAP2yBQANswUAbbMFAH+zBQCZswUApbMFAL2zBQDZswUAEbQFAD+0BQBNtAUAsbQFALe0BQANtQUAGbUFAB+1BQChtQUArbUFAN+1BQAPtgUAFbYFAFe2BQDTtgUACbcFAB23BQBLtwUArbcFAOG3BQDztwUABbgFAA24BQAXuAUAX7gFAG24BQDFuAUAy7gFANG4BQDpuAUAA7kFAAm5BQAzuQUAPbkFAG25BQCjuQUAt7kFAMG5BQDbuQUALboFAEe6BQBLugUAX7oFAJu6BQChugUAAbsFAE+7BQB5uwUAm7sFAOu7BQD3uwUAGbwFACG8BQAxvAUAo7wFAL28BQDBvAUAw7wFAMm8BQAjvQUAa70FAHe9BQCtvQUAsb0FAPO9BQBhvgUAl74FAKO+BQC1vgUA474FAP2+BQAhvwUAP78FAFG/BQBvvwUA2b8FAOu/BQA7wAUAZcAFAHXABQCDwAUA78AFAG3BBQCDwQUA8cEFABvCBQB/wgUAhcIFAMfCBQDbwgUAF8MFACHDBQBRwwUAb8MFAInDBQCVwwUAN8QFAI/EBQDXxAUA9cQFADPFBQBRxQUAgcUFAKvFBQDNxQUAUcYFAF/GBQCHxgUAy8YFAOHGBQArxwUAQ8cFAG3HBQCJxwUAxccFABXIBQA9yAUAYcgFAHXIBQCByAUAn8gFAM/IBQD9yAUAC8kFABvJBQApyQUAM8kFAD/JBQCJyQUAmckFAMXJBQDpyQUAKcoFADHKBQBDygUA18oFAA/LBQAzywUAScsFAIvLBQCjywUAqcsFAMnLBQDNywUA08sFAAXMBQAJzAUAm8wFAFvNBQB/zQUAl80FANnNBQDfzQUAH84FAM/OBQA5zwUAUc8FAKXPBQCnzwUAq88FAAHQBQAr0AUAN9AFAEnQBQBT0AUAhdAFAJXQBQCv0AUA79AFAPHQBQD90AUAMdEFAGfRBQBp0QUAddEFAIfRBQC70QUAvdEFANnRBQAV0gUAL9IFAHfSBQCn0gUAvdIFAOnSBQAp0wUANdMFAGHTBQB50wUAo9MFANfTBQDd0wUA8dMFAPfTBQBF1AUAVdQFAO3UBQAV1QUAF9UFAD/VBQBf1QUAe9UFALfVBQDd1QUA+dUFADfWBQBN1gUAZ9YFAO/WBQAb1wUAV9cFAH/XBQCZ1wUA8dcFAAPYBQBL2AUAXdgFAGvYBQB72AUAfdgFAIPYBQCx2AUAw9gFADvZBQBB2QUAodkFAMXZBQD72QUAAdoFACHaBQAt2gUAedoFAKvaBQDD2gUAIdsFAC/bBQA12wUAWdsFAF3bBQCl2wUAAdwFABHcBQAx3AUAPdwFAJfcBQC73AUAy9wFAP3cBQAB3QUALd0FAGfdBQB/3QUA2d0FAPHdBQBF3gUATd4FAGPeBQCh3gUA4d4FAO/eBQA13wUASd8FAHnfBQCR3wUAwd8FAA/gBQA34AUAP+AFAIfgBQCT4AUAx+AFAOHgBQDz4AUAC+EFACnhBQAz4QUAceEFAL/hBQBV4gUAreIFAM3iBQAT4wUALeMFADPjBQBt4wUAx+MFAOHjBQD54wUAR+QFAGXkBQBx5AUA5+QFAP/kBQA75QUAQ+UFAE3lBQBP5QUAYeUFAH3lBQB/5QUAxeUFANnlBQA95gUAUeYFAFvmBQB15gUA2eYFAKvnBQDX5wUAT+gFAFnoBQBh6AUAfegFAJvoBQDF6AUA8egFACvpBQBp6QUAr+kFALXpBQDJ6QUA3+kFAB3qBQCl6gUA1+oFAA3rBQAR6wUAR+sFAHHrBQDT6wUA8esFACXsBQBb7AUAnewFAKPsBQDZ7AUAJ+0FADPtBQBV7gUAW+4FAGfuBQCt7gUAze4FANfuBQD77gUAD+8FACXvBQBD7wUAo+8FALHvBQDB7wUA2+8FAP3vBQAp8AUAL/AFAEXwBQBr8AUAp/AFALHwBQCz8AUAt/AFAO3wBQAX8QUAZ/EFAJfxBQC58QUAu/EFAL/xBQDB8QUA/fEFAB/yBQA38gUAUfIFAFvyBQBv8gUAz/IFAOvyBQAX8wUAXfMFAG/zBQCz8wUA0fMFAN3zBQAR9AUAT/QFAHf0BQCz9AUA1/QFAN/0BQD39AUAIfUFAFv1BQBj9QUAZ/UFAIv1BQCZ9QUA/fUFAC/2BQDp9gUAL/cFADH3BQBt9wUAl/cFAKH3BQD39wUAM/gFAE/4BQB7+AUAzfgFANv4BQDr+AUAcfkFAIH5BQCb+QUAvfkFAM/5BQD/+QUAC/oFAB/6BQBt+gUAefoFALX6BQDB+gUA0/oFAN/6BQDx+gUAA/sFAHX7BQCF+wUAo/sFAKX7BQCx+wUAw/sFAM/7BQDZ+wUA8fsFAAn8BQA7/AUARfwFAEf8BQBp/AUAk/wFAOf8BQD7/AUAE/0FABn9BQBl/QUAkf0FAKP9BQC1/QUA1/0FAN39BQD7/QUAIf4FACX+BQA//gUAY/4FAGf+BQB7/gUAkf4FAJP+BQDP/gUA2/4FAN/+BQDh/gUA/f4FAAP/BQAv/wUAY/8FAB8ABgBHAAYAUwAGAFUABgCRAAYAnQAGAKEABgCnAAYAuQAGALsABgBDAQYAVQEGAGMBBgBpAQYAbwEGAMMBBgDtAQYAIQIGAIECBgCDAgYAjwIGAL8CBgDJAgYAywIGANsCBgBZAwYAywMGAFcEBgB/BAYAqwQGAAsFBgBLBQYAUwUGAOEFBgD7BQYAOwYGAEEGBgCzBgYAvwYGAOUGBgDrBgYA8QYGAB8HBgA9BwYAUQcGAGMHBgBnBwYAbwcGAIEHBgCLBwYAwQcGAOsHBgD9BwYAHQgGACcIBgA5CAYAjwgGAKcIBgD5CAYAPQkGAFsJBgCJCQYAxwkGANkJBgBJCgYAYQoGAHMKBgCRCgYAwwoGAOEKBgD/CgYACwsGAJULBgCnCwYAuQsGAD0MBgBVDAYAWQwGAH0MBgCVDAYAmwwGAN0MBgDrDAYA9QwGACUNBgA5DQYATw0GAFcNBgCfDQYApQ0GAKkNBgBHDgYAUQ4GAFMOBgB3DgYAiQ4GAKsOBgDjDgYAEQ8GAEcPBgB/DwYA8Q8GABkQBgAtEAYAdRAGAHkQBgCdEAYAHREGAEERBgBLEQYAaREGALcRBgC5EQYAvREGAOcRBgAFEgYAKxIGAGESBgBzEgYAfxIGAIsSBgAnEwYAfxMGALsTBgADFAYAURQGAFcUBgCDFAYAhxQGAIkUBgDpFAYA9RQGAP8UBgAjFQYATRUGALMVBgDxFQYACRYGAEUWBgBJFgYAXRYGANMWBgDbFgYAOxcGAF0XBgCJFwYApxcGAB0YBgAfGAYASRgGAHEYBgB5GAYAhRgGAKMYBgCnGAYA0xgGAPEYBgBLGQYAZxkGAHMZBgCNGQYAqxkGAOsZBgDtGQYADxoGACcaBgApGgYARRoGAHuuCgCjrgoAsa4KAM2uCgDhrgoAC68KAFGvCgCPrwoA468KAOmvCgArsAoAN7AKAKGwCgC1sAoA07AKAN+wCgAJsQoAT7EKAIGxCgCfsQoAsbEKACOyCgBfsgoAobIKAOeyCgBJswoAkbMKAJ2zCgDHswoA17MKANmzCgDlswoA6bMKACe0CgCZtAoAqbQKAKu0CgC1tAoAu7QKAPG0CgAttQoAQbUKAI21CgCntQoAubUKAM+1CgBBtgoAfbYKAJW2CgCvtgoA47YKAAO3CgAftwoAMbcKAGm3CgBztwoA37cKAAW4CgAhuAoAe7gKAI+4CgDPuAoAAbkKAEO5CgBruQoAf7kKAK25CgAPugoAaboKAI26CgCXugoApboKAEW7CgBZuwoAdbsKAH27CgDRuwoA47sKAAG8CgALvAoAMbwKAEe8CgCvvAoAubwKAL+8CgDLvAoA37wKABO9CgCjvQoAzb0KAO29CgAbvgoAHb4KAKG+CgDVvgoA+74KABe/CgA1vwoAQb8KAI+/CgC5vwoAv78KAAnACgA5wAoAUcAKAFvACgCvwAoAz8AKAOvACgD5wAoAC8EKAEHBCgBRwQoA9cEKAF/CCgCJwgoAi8IKAJHCCgCnwgoAucIKAN/CCgDrwgoA08MKANXDCgDxwwoA/cMKAE3ECgCZxAoAycQKAOnECgDzxAoA9cQKAEfFCgCRxQoAxcUKANnFCgDxxQoAAcYKAAPGCgATxgoAZ8YKAIfGCgCZxgoAn8YKAM3GCgAFxwoAQccKAJ/HCgCxxwoA28cKAEfICgB3yAoArcgKAMXICgANyQoAW8kKAGHJCgBpyQoAkckKAJ3JCgDVyQoA/8kKABvKCgAtygoAO8oKAFHKCgB3ygoA48oKAPnKCgAfywoAZ8sKAG3LCgDXywoA6csKAPXLCgArzAoAacwKAIvMCgC3zAoA2cwKAAnNCgARzQoAXc0KAGPNCgBvzQoAq80KAL/NCgDdzQoA+80KACnOCgBBzgoAQ84KAH/OCgCFzgoArc4KALvOCgDFzgoAAc8KABPPCgAzzwoAVc8KAHnPCgCvzwoAz88KACHQCgAn0AoAO9AKAOfQCgD70AoAc9EKAH/RCgCF0QoAE9IKABXSCgC70goABdMKACHTCgAp0woALdMKAOfTCgAf1AoAO9QKAN3UCgDv1AoA99QKABXVCgAn1QoALdYKAD/WCgB11goAsdYKACvXCgAx1woAU9cKAFvXCgBn1woAd9cKAIPXCgCt1woAG9gKALfYCgDD2AoAJ9kKAEvZCgCx2QoAE9oKAFvaCgCL2goAldoKALnaCgDx2goAA9sKAMHbCgD/2woAC9wKABvcCgAz3AoAn9wKANvcCgDp3AoAAd0KAB/dCgAv3QoAc90KAMXdCgDd3QoAB94KABveCgAt3goAYd4KAG3eCgBv3goAf94KAIHeCgCT3goA2d4KAB3fCgCZ3woAt98KAMvfCgD13woA+d8KAE3gCgCF4AoAi+AKAI/gCgC54AoAzeAKAN/gCgAB4QoAneEKANPhCgAL4goAEeIKABfiCgCJ4goApeIKAK3iCgD74goABeMKAGHjCgDR4woAD+QKAGPkCgCR5AoAr+QKANPkCgB75QoAm+UKAO/lCgDz5QoAeeYKAInmCgDL5goA3+YKAO/mCgDx5goAFecKAFHnCgBp5woAe+cKALHnCgAd6AoALegKADnoCgBL6AoAZegKAIHoCgCN6AoAm+gKAJ/oCgCn6AoA7+gKABfpCgBl6QoAj+kKAJHpCgCj6QoAtekKAN3pCgAx6goAYeoKAG3qCgCF6goAmeoKAJ/qCgCv6goAA+sKADnrCgBl6woA6esKABnsCgBJ7AoAVe0KAFvtCgBv7QoAi+0KAI3tCgAD7goAZe4KAG/uCgB77goA8+4KAFXvCgBz7woAqe8KAMXvCgAJ8AoAOfAKAD3wCgBj8AoAl/AKAJ/wCgC18AoA9/AKACHxCgAj8QoANfEKAF/xCgBp8QoAh/EKAK3xCgDX8QoAC/IKABPyCgBV8goAifIKAJfyCgCz8goA4/IKAO/yCgDz8woA+fMKAF30CgBj9AoAm/QKAOH0CgAH9QoAWfUKAGf1CgBr9QoA3/UKAPH1CgAH9goAnfYKANP2CgBj9woAb/cKAH33CgDd9woA+fcKAP/3CgAX+AoAR/gKAH34CgCh+AoAo/gKANH4CgD9+AoAD/kKAEn5CgBL+QoAT/kKAIf5CgCj+QoA+fkKADX6CgBR+goAV/oKAI/6CgCt+goA7foKABf7CgBB+woAZfsKAGv7CgCF+woAufsKAMX7CgAV/AoAdfwKAIf8CgCX/AoA2fwKANv8CgDl/AoABf0KABf9CgAt/QoAM/0KAF39CgBl/QoAmf0KALf9CgC//QoA6f0KAO/9CgAX/goAa/4KAKP+CgDj/goAFf8KAHv/CgCZ/woA5f8KAO3/CgD3/woAAwALABEACwAzAAsAVwALAHUACwCTAAsAvwALANcACwDzAAsALwELADcBCwCbAQsAqQELALkBCwAfAgsAKwILAL0CCwDTAgsA1QILAP8CCwAXAwsASwMLAIEDCwDjAwsAAQQLAH8ECwCdBAsAxwQLAMsECwDjBAsA9wQLAP0ECwCHBQsAjQULAJ0FCwDBBQsA8QULAP8FCwBNBgsApwYLAMkGCwDPBgsA5wYLAO0GCwAZBwsAXwcLACcICwBpCAsAfwgLAJEICwCvCAsA1QgLABUJCwB3CQsAoQkLAL8JCwALCgsAJQoLAF8KCwBrCgsADwsLAFcLCwBbCwsAbwsLAJMLCwDJCwsACQwLADUMCwCPDAsAlQwLAJsMCwC5DAsA2wwLANENCwDZDQsAMw4LAEkOCwB1DgsAeQ4LAIEOCwD9DgsACw8LAA8PCwAhDwsAdQ8LAI8PCwDVDwsA4Q8LADEQCwBVEAsAfxALAKkQCwDFEAsASRELAF0RCwBtEQsAhRELAJcRCwDJEQsADxILAFMSCwBdEgsAhxILAC8TCwBDEwsAZRMLAIkTCwCpEwsA3xMLAOkTCwD3EwsA/RMLAAcUCwA3FAsAVRQLAFsUCwCNFAsAmRQLAK8UCwBfFQsAjRULALkVCwC/FQsA1xULAPkVCwBJFgsAsxYLAN8WCwANFwsAGRcLADkXCwBtFwsAfxcLAIsXCwCdFwsACRgLAFEYCwB1GAsA0RgLAN0YCwARGQsAHxkLAC8ZCwBxGQsAmxkLAKMZCwC/GQsAzRkLAFEaCwCLGgsAnxoLALEaCwD3GgsARRsLAEcbCwB9GwsAvRsLADEcCwB/HAsAjxwLAJEcCwDlHAsA7xwLAP0cCwBhHQsAzx0LAAMeCwA/HgsAfR4LAIkeCwCTHgsAmx4LAKseCwAFHwsABx8LAAsfCwAlHwsAMR8LADsfCwBPHwsAbR8LAIsfCwC/HwsA4x8LADcgCwBVIAsAbyALAHMgCwCBIAsAzSALABchCwBFIQsAayELAJ8hCwDhIQsAJSILAEciCwBZIgsAdyILAIkiCwCVIgsAsyILAL8iCwD7IgsAFSMLADMjCwA5IwsAPyMLAFcjCwBbIwsAeSMLALEjCwBXJAsAqyQLALkkCwD7JAsAHyULALklCwC/JQsADSYLAHsmCwCvJgsAuyYLAMcmCwD/JgsAFScLAB0nCwAhJwsAWScLAK0nCwCxJwsA6ScLADUoCwA3KAsASSgLAHkoCwCXKAsAFSkLADcpCwBtKQsAdSkLAK8pCwDJKQsAUSoLAF0qCwCbKgsAnyoLAN0qCwDpKgsAHSsLAHcrCwCJKwsArysLAP0rCwAfLAsAMywLADksCwBFLAsA1y0LAAEuCwAlLgsAoS4LAM0uCwDZLgsA7y4LAB8vCwC3LwsAxy8LAM0vCwDbLwsAaTALAJMwCwCVMAsApzALAMswCwDPMAsAJTELADExCwBHMQsAdzELALMxCwD3MQsAATILAGEyCwB1MgsAhTILAJcyCwC3MgsA3zILAPEyCwAdMwsAJzMLAGkzCwCzMwsAzzMLAOEzCwDtMwsAeTQLAK00CwDXNAsA3TQLAN80CwAPNQsAXTULAGc1CwDHNQsA5TULAPM1CwAXNgsAUzYLAFc2CwCVNgsA+zYLABk3CwBbNwsAXzcLAGE3CwCJNwsAozcLAM03CwDZNwsABzgLAA84CwBLOAsATzgLAG04CwDPOAsA8TgLAPc4CwDzOQsA9TkLAPs5CwB/OgsAhToLAJ06CwAlOwsAJzsLAD07CwA/OwsAYTsLAG87CwB5OwsAnzsLAPk7CwARPAsAFzwLAGk8CwB9PAsAmTwLALE8CwC/PAsA1TwLANc8CwD/PAsApz0LALs9CwDRPQsANz4LAEs+CwBPPgsAhz4LAJ8+CwCpPgsADz8LABc/CwAdPwsAIz8LAF8/CwBpPwsAnz8LAAtACwANQAsASUALAMdACwDLQAsA40ALADdBCwA5QQsAt0ELANNBCwDZQQsA7UELABtCCwBFQgsAaUILAIFCCwCHQgsAiUILABdDCwAjQwsAO0MLAH1DCwCpQwsA/UMLAC1ECwBFRAsAS0QLAE9ECwC3RAsAw0QLAPNECwAXRQsAdUULAKFFCwDnRQsAC0YLAElGCwCJRgsAkUYLAKFGCwCtRgsAzUYLAP1GCwAtRwsAMUcLAGNHCwBvRwsA50cLAAlICwAtSAsAP0gLAIdICwCzSAsAuUgLAN1ICwDhSAsAEUkLADVJCwBtSQsAr0kLABVKCwBvSgsAtUoLAPdKCwAbSwsAOUsLAEFLCwBLSwsAX0sLAINLCwC3SwsA6UsLAHlMCwB9TAsAoUwLALVMCwDRTAsA70wLAD9NCwBPTQsAaU0LAG1NCwCBTQsAG04LAKdOCwDXTgsA/04LAGtPCwBxTwsA2U8LABlQCwAhUAsAZ1ALAIVQCwC7UAsAwVALANlQCwDfUAsAHVELAC9RCwDtUQsAGVILAE9SCwBVUgsAuVILAAdTCwAxUwsAQ1MLAFVTCwDPUwsA7VMLAPlTCwBjVAsAa1QLAHFUCwB3VAsAiVQLAAFVCwAZVQsAKVULAENVCwBlVQsAZ1ULAJFVCwD9VQsAN1YLAE9WCwCTVgsAx1YLAOdWCwD/VgsAKVcLADVXCwBfVwsAb1cLAOlXCwD1WAsA91gLAG9ZCwCLWQsAmVkLANNZCwDxWQsA81kLAAtaCwA1WgsAU1oLAGtaCwCHWgsAjVoLAJNaCwCxWgsAyVoLAAdbCwAvWwsAuVsLAMVbCwDHWwsAzVsLANdbCwBbXAsAl1wLAL1cCwARXQsAz10LANVdCwApXgsANV4LAENeCwCtXgsA8V4LAA9fCwAbXwsAf18LAI1fCwCjXwsAtV8LAEdgCwCVYAsAn2ALAMlgCwANYQsAE2ELAFlhCwBtYQsAg2ELAMthCwD9YQsAJ2ILAFViCwCRYgsA22ILAPdiCwADYwsAG2MLAD9jCwCDYwsADWQLACNkCwBlZAsAnWQLAONkCwD7ZAsA/WQLACdlCwAtZQsAN2ULAHVlCwCLZQsA7WULAB1mCwAtZgsAaWYLAINmCwCVZgsAw2YLANdmCwATZwsAj2cLAKNnCwC7ZwsAx2cLAOVnCwAbaAsAK2gLAE9oCwBbaAsAf2gLANloCwDfaAsAI2kLADNpCwA5aQsAP2kLAEFpCwBNaQsAsWkLAMlpCwDLaQsA9WkLAAdqCwCJagsAr2oLALlqCwDZagsA8WoLAPtqCwAxawsAM2sLAElrCwCZawsApWsLABdsCwA7bAsAQWwLAEVsCwBdbAsAuWwLABFtCwAXbQsAMW0LAE1tCwC7bQsA020LAONtCwBXbgsAXW4LAHNuCwDzbgsAI28LACdvCwBRbwsAWW8LAHdvCwCbbwsAE3ALAFVwCwBtcAsAJ3ELAEtxCwBjcQsAZ3ELAJNxCwD9cQsAEXILADlyCwBHcgsATXILAF1yCwCPcgsAlXILAM9yCwARcwsAZXMLAHlzCwDZcwsAMXQLAMN0CwDNdAsA2XQLAEV1CwBRdQsAh3ULAK11CwDRdQsAJXYLAC92CwBNdgsAcXYLAIV2CwDfdgsAA3cLAAd3CwAzdwsAeXcLANt3CwALeAsAEXgLAC14CwA1eAsAb3gLAIN4CwDheAsA7XgLAAd5CwC1eQsA63kLAAl6CwBFegsAT3oLAK96CwAdewsAL3sLAEF7CwBLewsAY3sLAIF7CwALfAsAO3wLAIN8CwCzfAsAtXwLAPt8CwAlfQsAaX0LAMN9CwD3fQsAI34LAE1+CwCbfgsAvX4LAN1+CwABfwsANX8LAHd/CwCLfwsAoX8LALN/CwD7fwsADYALAIGACwCHgAsAw4ALAD+BCwCJgQsAk4ELAL2BCwDpgQsABYILAGuCCwB9ggsAnYILAL+CCwA5gwsAdYMLAI2DCwDDgwsAFYQLAD+ECwB7hAsAjYQLAK2ECwDXhAsA6YQLAPOECwAZhQsAI4ULAC+FCwBZhQsAf4ULAIWFCwDHhQsAJ4YLAEOGCwBvhgsAl4YLALuGCwDBhgsAx4YLAO2GCwARhwsAX4cLAAeICwAviAsAZYgLAJ2ICwA3iQsAS4kLAFWJCwCriQsA34kLABeKCwAbigsAL4oLADmKCwBrigsAlYoLAMOKCwDvigsA84oLAHGLCwB5iwsAlYsLAMGLCwDliwsAu4wLAOGMCwDrjAsAs40LAL2NCwD5jQsA+40LAP+NCwArjgsAc44LAJuOCwC1jgsAJ48LAEmPCwBnjwsAgY8LAM2PCwDPjwsAIZALADOQCwDpkAsA85ALADeRCwBfkQsAo5ELALuRCwDXkQsAG5ILAHmSCwCfkgsAsZILAOeSCwAhkwsALZMLADOTCwBZkwsAaZMLAI+TCwCrkwsAs5MLALmTCwDvkwsA/5MLACOUCwBTlAsAbZQLAHOUCwDLlAsA2ZQLAOuUCwD1lAsAMZULAEmVCwCFlQsAjZULAP2VCwBllgsA45YLAAeXCwAdlwsAL5cLAJ2XCwDTlwsA9ZcLAEmYCwBzmAsAmZgLAMeYCwAdmQsATZkLAGmZCwCTmQsApZkLALGZCwDRmQsA4ZkLAOmZCwDtmQsAL5oLAFuaCwBnmgsAiZoLALOaCwC/mgsAx5oLANmaCwAfmwsALZsLACecCwBBnAsAZZwLAIGcCwChnAsAH50LAEmdCwBfnQsAc50LAIudCwChnQsAA54LACWeCwBhngsAY54LAHOeCwCRngsAA58LAAufCwBvnwsAsZ8LALOfCwDpnwsAU6ALAH+gCwCRoAsAr6ALAPWgCwAJoQsAjaELAP+hCwADogsAFaILAHuiCwC9ogsAy6ILANGiCwDXogsAF6MLAImjCwANpAsAFaQLACWkCwAnpAsAT6QLAJOkCwCXpAsAu6QLANWkCwDzpAsAFaULABelCwBBpQsAg6ULAKelCwDVpQsA6aULAP+lCwBBpgsAT6YLAGWmCwCdpgsAtaYLALumCwDRpgsA46YLAOumCwABpwsAM6cLAMOnCwDTpwsA/acLABeoCwDPqAsA9agLAAupCwAdqQsASakLAIWpCwCdqQsAp6kLALWpCwDvqQsAN6oLAFWqCwCTqgsAz6oLANWqCwDxqgsA16sLAN2rCwATrAsAKawLAD2sCwCprAsAtawLANGsCwDxrAsAD60LABOtCwA5rQsAQ60LAGOtCwCBrQsAka0LAKmtCwD9rQsA/60LAF2uCwCNrgsAra4LALeuCwCXrwsAm68LANmvCwD9rwsAH7ALACewCwBXsAsAf7ALAIuwCwCfsAsAFbELABexCwBBsQsAcbELAH2xCwChsQsAubELAPWxCwANsgsAJbILAK+yCwATswsAMbMLAFezCwCZswsAnbMLAN+zCwAXtAsAS7QLAF+0CwCHtAsA47QLAD21CwBbtQsA77ULABW2CwA9tgsAkbYLANu2CwBxtwsAe7cLAIm3CwCltwsADbgLACm4CwA7uAsAx7gLAN24CwDxuAsAB7kLAC25CwBhuQsAc7kLAHm5CwCZuQsAo7kLAK+5CwDfuQsA67kLAPe5CwBNugsAb7oLAHW6CwCDugsA77oLAP+6CwAZuwsASbsLAFO7CwBVuwsAWbsLAJu7CwCtuwsA17sLAOu7CwBdvAsAe7wLAH+8CwCHvAsAz7wLAN+8CwDrvAsACb0LAB29CwA7vQsAg70LAJW9CwC9vQsABb4LABG+CwArvgsAN74LAH2+CwB/vgsAu74LAMG+CwCXvwsAw78LAPe/CwAJwAsAFcALAEvACwCDwAsAh8ALAJ/ACwCzwAsAN8ELAFPBCwCPwQsAkcELAN/BCwDlwQsA/cELAB/CCwAlwgsAUcILAGfCCwDJwgsA/cILABvDCwAvwwsAccMLAMvDCwAlxAsAa8QLAMXECwDdxAsA5cQLAGfFCwBtxQsAkcULAPHFCwAjxgsAX8YLAGvGCwBxxgsAxcYLAE3HCwB5xwsAhccLAKPHCwCzxwsAAcgLAD/ICwBJyAsAVcgLALHICwC3yAsAycgLAP3ICwAbyQsAV8kLAGPJCwBryQsA28kLAO/JCwAXygsAN8oLAFPKCwBfygsAccoLAPXKCwAnywsAOcsLAJ/LCwClywsA28sLAIPMCwCZzAsAEc0LACnNCwBHzQsATc0LAHPNCwDfzQsA480LAOnNCwAbzgsAMc4LAD3OCwC9zgsA2c4LAOvOCwDtzgsAM88LAEHPCwBjzwsAZc8LAG/PCwCHzwsAn88LALnPCwDzzwsA/88LAEnQCwBZ0AsAqdALAK3QCwDB0AsAe9ELAI3RCwCx0QsAC9ILABfSCwAj0gsAddILAKXSCwCx0gsAL9MLAF/TCwCD0wsAs9MLANHTCwD70wsAFdQLAGPUCwDD1AsA4dQLAPnUCwAR1QsANdULAF3VCwCz1QsAvdULANHVCwDX1QsAH9YLADvWCwBN1gsA0dYLADPXCwBd1wsACdgLAKXYCwDR2AsAAdkLAAXZCwBB2QsAedkLAJfZCwDL2QsA69kLABnaCwAx2gsAYdoLAG3aCwBz2gsAhdoLAJ3aCwC32gsA89oLAAnbCwAz2wsAb9sLALfbCwDP2wsA0dsLAN3bCwDv2wsA+dsLAAXcCwAj3AsAYdwLAIXcCwCJ3AsAndwLAKfcCwCt3AsAy9wLAM3cCwDX3AsA2dwLAEXdCwBP3QsAqd0LAMfdCwDT3QsAA94LACHeCwA73gsAg94LAJXeCwAF3wsAK98LAE3fCwBf3wsAs98LANnfCwDv3wsA/d8LAJfgCwAP4QsAG+ELACnhCwBl4QsAk+ELAKvhCwC54QsAyeELAOfhCwAH4gsAEeILABniCwBD4gsAX+ILAHfiCwCX4gsAr+ILANPiCwD74gsAA+MLAA3jCwAf4wsAN+MLAD3jCwBd4wsAZ+MLAD/kCwBB5AsATeQLAAvlCwA75QsAR+ULAOPlCwAV5gsAPeYLAGHmCwCX5gsAzeYLAA/nCwAR5wsAHecLAFfnCwBf5wsAjecLALPnCwD/5wsAI+gLADfoCwBT6AsAcegLAIXoCwDT6AsACekLACfpCwA56QsARekLAH/pCwAR6gsAV+oLAK3qCwDL6gsAB+sLADfrCwA96wsAj+sLALvrCwAt7AsAOewLAFXsCwBz7AsAqewLAKvsCwC17AsA0+wLACHtCwAz7QsAce0LAOntCwD57QsAO+4LAJXuCwC57gsA6e4LAAPvCwAH7wsAMe8LADnvCwBn7wsAbe8LAIvvCwCX7wsAq+8LAOfvCwA58AsAifALAGHxCwAB8gsASfILAF3yCwCH8gsAn/ILAK/yCwDD8gsA5fILAFnzCwBd8wsA4fMLAOnzCwAT9AsAf/QLAKn0CwDF9AsA7/QLAAP1CwBL9QsApfULADv2CwDn9gsAN/cLAFv3CwBl9wsA3/cLAPX3CwD79wsAA/gLABv4CwBD+AsAV/gLAGH4CwCd+AsAn/gLAPP4CwAJ+QsAFfkLADn5CwBX+QsAxfkLANv5CwAB+gsAK/oLAIn6CwCd+gsA9/oLAAH7CwAz+wsAN/sLAHX7CwCX+wsAzfsLAA/8CwAX/AsANfwLAHf8CwCN/AsAQ/0LAFn9CwCJ/QsAi/0LAAH+CwAD/gsAG/4LAG/+CwB//gsAjf4LAL3+CwDP/gsA5/4LACP/CwBf/wsAj/8LAJn/CwCh/wsAw/8LAOf/CwARAAwAOwAMAPEADAADAQwACQEMAA0BDAAPAQwAHwEMAEsBDACHAQwAkQEMAKsBDADBAQwAxwEMAAUCDAAbAgwAJwIMAGMCDABxAgwAhwIMAJMCDADtAgwABwMMAD0DDACFAwwA6QMMAA0EDAB1BAwAkQQMAP8EDAA5BQwAOwUMAEEFDABjBQwAbwUMAAUGDAAZBgwAOwYMAEEGDABnBgwAdwYMAHkGDAChBgwAuQYMAL8GDADdBgwA9QYMAAcHDABhBwwAfwcMAIsHDACvBwwAwwcMAOEHDADzBwwA/wcMABEIDAApCAwAMwgMAEUIDABRCAwAqwgMAMUIDADPCAwA7wgMABkJDABxCQwAoQkMAMUJDADfCQwAAQoMAAkKDAAZCgwAJwoMAG0KDABLCwwAgQsMAI0LDADDCwwA4QsMAPULDAAHDAwASQwMAH8MDACzDAwA0QwMAPUMDABXDQwAYQ0MAMkNDADPDQwA2w0MAAUODAARDgwAIw4MACkODABNDgwAmQ4MAOEODAD/DgwABQ8MABEPDAATDwwAOw8MAD0PDABhDwwAlQ8MAJ0PDACzDwwAuw8MAOUPDADxDwwAARAMACcQDAA9EAwAVRAMAG0QDADNEAwAOxEMAHERDACxEQwAuREMAPURDAChEgwA0xIMANkSDAANEwwAWxMMAHMTDADfEwwAERQMAJMUDADdFAwA5xQMAFMVDABZFQwAWxUMAHkVDAC5FQwA5RUMAOkVDADxFQwAAxYMAEMWDACxFgwA1RYMAOUWDAAnFwwAMxcMAD8XDABNFwwA6RcMAPMXDAAZGAwAJRgMAEEYDACFGAwAwRgMANkYDABtGQwAlxkMANMZDAALGgwAIxoMAF0aDABjGgwAZRoMANEaDAD1GgwAIxsMADcbDABnGwwAkRsMAK0bDADLGwwA2RsMAAEcDAAVHAwAIRwMAHUcDACFHAwAqRwMAC0dDABLHQwAZR0MAM8dDADXHQwA/x0MAB0eDAApHgwATx4MAFkeDABfHgwAbR4MAH8eDAD7HgwALR8MAFEfDABzHwwAjR8MAKMfDADTHwwAVyAMAM8gDAAHIQwAKSEMAH8hDADFIQwA9yEMAAMiDABDIgwAZyIMAHMiDAC7IgwAIyMMAG8jDACHIwwAxSMMAP8jDAANJAwAcSQMAHMkDACPJAwAkSQMAJckDACbJAwAtSQMAN8kDADlJAwADSUMABslDADZJQwA7SUMAAsmDAARJgwAHSYMADkmDABXJgwAgyYMALEmDADJJgwA+SYMACsnDABHJwwAcycMAIknDACvJwwADygMALUoDADHKAwAzSgMAAMpDAAXKQwANSkMAFEpDAB7KQwAgSkMAMspDAARKgwAWSoMAH8qDACpKgwAxyoMAOkqDAAhKwwAbysMAIsrDACNKwwAqysMALsrDADPKwwADywMANcsDAAFLQwAGS0MAFstDABzLQwAiS0MAJEtDADHLQwA3S0MAPUtDAArLgwANy4MAMMuDADzLgwAFy8MADkvDAA/LwwARS8MAO0vDAARMAwAHzAMAD0wDABPMAwAZzAMAJcwDACnMAwA0TAMABsxDAAtMQwAVTEMAHMxDAB/MQwA9zEMABsyDABFMgwARzIMAFEyDABlMgwAbzIMAIEyDADdMgwA+TIMACkzDAA3MwwAVTMMAJEzDADvMwwA/TMMAAk0DAAtNAwAPzQMAIE0DACTNAwAzTQMAN27DQA1vA0AQbwNAIm8DQCjvA0Av7wNAP28DQDHvQ0Ayb0NAP+9DQBBvg0Amb4NAL2+DQA1vw0AQb8NAF+/DQBtvw0Aj78NAOW/DQD3vw0AMcANADnADQCFwA0AvcANADXBDQBRwQ0AicENAI3BDQCZwQ0Av8ENAO3BDQAvwg0AN8INAFXCDQB3wg0Au8INAOXCDQADww0AH8MNACvDDQCNww0A+cMNAP3DDQB1xA0AicQNAKfEDQC9xA0Ay8QNAPXEDQBrxQ0ADcYNAD/GDQBDxg0Ac8YNAHnGDQCFxg0Aq8YNACnHDQA7xw0AxccNAAvIDQAdyA0AZcgNAO/IDQD9yA0AGckNALfJDQDZyQ0AFcoNAFHKDQB7yg0AH8sNAKfLDQC1yw0A08sNAPXLDQAJzA0AGcwNABvMDQBvzA0ApcwNAKnMDQD5zA0AC80NAEHNDQBTzQ0Avc0NANXNDQDXzQ0A+c0NABfODQA3zg0ATc4NAGvODQCdzg0Ao84NAMvODQDXzg0A484NAG/PDQCXzw0Ao88NALHPDQC7zw0A/c8NAAvQDQAh0A0ANdANAHHQDQCl0A0AGdENAE/RDQCv0Q0A3dENAOXRDQAn0g0AN9INAEvSDQAb0w0AJ9MNAC3TDQB70w0AidMNAJXTDQDb0w0AidQNAI/UDQCj1A0Au9QNAL/UDQDx1A0AkdUNALHVDQDN1Q0A2dUNABvWDQBf1g0AgdYNAJXWDQCx1g0As9YNAMXWDQAL1w0ADdcNAIPXDQCF1w0AzdcNANfXDQDl1w0A+9cNACHYDQBD2A0AadgNAIHYDQDB2A0AKdkNAD/ZDQBF2Q0AidkNAKvZDQCt2Q0A7dkNAO/ZDQAj2g0AQ9oNALXaDQDj2g0AFdsNABnbDQAn2w0AS9wNAF3cDQCB3A0Ay9wNAPXcDQAF3Q0AL90NADvdDQBJ3Q0AU90NAH/dDQCn3Q0As90NAA3eDQBt3g0Ab94NAJ/eDQDb3g0A7d4NAPPeDQAh3w0AI98NAE3fDQBf3w0Ak98NAKHfDQC/3w0Axd8NAOnfDQAd4A0AO+ANAEfgDQCX4A0AH+ENAG/hDQCj4Q0Ax+ENAN/hDQDx4Q0ACeINAEHiDQBL4g0AU+INAJPiDQCV4g0A9eINACnjDQBh4w0AeeMNAMXjDQAZ5A0AIeQNAG/kDQCH5A0Au+QNAB3lDQB15Q0An+UNALPlDQDP5Q0AAeYNAD3mDQBb5g0AbeYNAIXmDQCb5g0Ao+YNAK/mDQC/5g0A7+YNAP3mDQAH5w0AK+cNAD/nDQB75w0ApecNAMfnDQDf5w0AA+gNAI/oDQCT6A0Ap+gNAOnoDQBB6Q0AQ+kNAHnpDQCF6Q0AFeoNAC3qDQBP6g0AteoNANnqDQDn6g0AQesNAFnrDQBv6w0Ae+sNAJ/rDQDX6w0A3esNABnsDQAd7A0AVewNAGfsDQCJ7A0Ai+wNAHvtDQCF7Q0An+0NAMftDQDV7Q0AP+4NAFPuDQCD7g0Az+4NAPPuDQAf7w0AQe8NAH/vDQCv7w0As+8NABnwDQDn8A0AF/ENADvxDQBZ8Q0Aa/ENAIfxDQDh8Q0AefINAA3zDQA/8w0AkfMNAMHzDQD98w0AHfQNAOH0DQAZ9Q0AI/UNAFn1DQBn9Q0AffUNAJv1DQCz9Q0Ax/UNAP31DQBJ9g0AVfYNAHv2DQD39g0A/fYNABf3DQAv9w0AM/cNAFP3DQBH+A0ATfgNAIX4DQCv+A0AufgNABP5DQAz+Q0Ai/kNAJ35DQCp+Q0Az/kNAD/6DQBR+g0AXfoNAGn6DQCH+g0An/oNAK36DQDJ+g0A0foNANv6DQD1+g0AI/sNAHH7DQCP+w0Ao/sNAMH7DQDj+w0AFfwNAKv8DQCP/Q0Aw/0NAAv+DQAv/g0APf4NAGH+DQBt/g0Alf4NALX+DQDZ/g0AVf8NAHP/DQCf/w0Aw/8NANP/DQD//w0ANQAOAFkADgBrAA4AiQAOALcADgC5AA4A6QAOAH8BDgCnAQ4A0wEOAOkBDgD7AQ4AXQIOAPECDgBLAw4AUQMOAFkDDgBjAw4AdQMOAKsDDgALBA4ANQQOAFUEDgBxBA4AfQQOAJUEDgDRBA4A6wQOAPsEDgAtBQ4ASQUOAF0FDgBzBQ4AgQUOAJ8FDgC7BQ4A7QUOAEUGDgBHBg4AWQYOAHEGDgCVBg4AtwYOAOMGDgAFBw4AKQcOAFUHDgBhBw4AcQcOAHkHDgB9Bw4A3wcOAAcIDgATCA4AJwgOAD0IDgB/CA4AiwgOAI0IDgCXCA4A2QgOAAkJDgAPCQ4AXQkOAGkJDgB3CQ4AoQkOAKsJDgD1CQ4AhQoOAJEKDgDXCg4A2QoOAOMKDgANCw4AOQsOAFcLDgCZCw4AxwsOACEMDgBlDA4AgwwOAKUMDgDVDA4AEQ0OAB8NDgB9DQ4Agw0OAIsNDgCnDQ4AqQ0OAK8NDgC1DQ4AAw4OAG8ODgCrDg4Axw4OACMPDgB3Dw4A2w8OAPUPDgABEA4AHRAOAC8QDgBnEA4AiRAOAI8QDgCVEA4A7xAOAB8RDgAhEQ4ANxEOADkRDgA/EQ4AqxEOALcRDgDJEQ4A0xEOANURDgBvEg4AfRIOAIcSDgCVEg4AqxIOALMSDgDREg4A9RIOAFMTDgB3Ew4AgxMOAJUTDgDBEw4AKxQOADkUDgBdFA4AaRQOAHMUDgB1FA4AtxQOAL0UDgDlFA4AjxUOAKcVDgCrFQ4A4xUOAPMVDgAjFg4AQRYOAEMWDgCvFg4AzRYOAPsWDgATFw4ALRcOADkXDgA9Fw4ATxcOAHUXDgCXFw4ArxcOAMcXDgDPFw4A0xcOACcYDgA/GA4AXxgOAH0YDgDLGA4A3RgOAEkZDgCLGQ4AwRkOAMUZDgDNGQ4A9xkOAHsaDgCLGg4A3xoOAPMaDgADGw4ABRsOABUbDgDjGw4A8xsOAPUbDgALHA4ATxwOAFUcDgBhHA4AeRwOAIscDgCdHA4AqRwOACcdDgCRHQ4AqR0OALUdDgDhHQ4AOR4OAGseDgDLHg4A7x4OAD0fDgBJHw4AGSAOACUgDgBXIA4AwyAOAOEgDgD3IA4AGyEOAC0hDgCxIQ4A2yEOAOchDgD7IQ4AKyIOAEEiDgBVIg4AkSIOAAMjDgCZIw4AwSMOAM8jDgAVJA4AeyQOAJMkDgCzJA4AtyQOAMkkDgAHJQ4AJSUOAGslDgBxJQ4AoSUOALklDgD9JQ4AASYOAIEmDgCrJg4AAycOAC0nDgC9Jw4A7ycOAP8nDgBnKA4AdygOAH0oDgDfKA4AASkOAE8pDgBvKQ4AjSkOAJkpDgCfKQ4ADyoOABEqDgAhKg4AOSoOAFEqDgCtKg4AxSoOAMkqDgDPKg4A1SoOANcqDgABKw4AMSsOAFUrDgBfKw4AGSwOADMsDgBbLA4AkSwOAOssDgDxLA4AGy0OACEtDgA1LQ4AOy0OAIEtDgCTLQ4ArS0OAAEuDgANLg4ANS4OAG0uDgBxLg4Asy4OAN0uDgD3Lg4ADS8OAEkvDgDJLw4Azy8OAGMwDgBpMA4AoTAOANswDgAdMQ4ARzEOAIMxDgCPMQ4AtTEOAKUyDgCxMg4AwzIOAAszDgAXMw4AITMOAE0zDgBdMw4AazMOAJ8zDgCxMw4AHzQOACs0DgBfNA4AnTQOAKE0DgCvNA4ANzUOAGE1DgDnNQ4A9zUOAFk2DgBdNg4A0TYOANc2DgANNw4ASTcOAGs3DgB9Nw4AozcOAMU3DgAJOA4APTgOAEM4DgBdOA4AjTgOAKM4DgDTOA4A8TgOAG85DgB7OQ4A3TkOAPU5DgA9Og4AQzoOAF86DgB5Og4AkToOALk6DgDNOg4A9ToOADc7DgBJOw4AjTsOAKs7DgAPPA4ANTwOAE08DgBpPA4AhzwOAB89DgA1PQ4AYT0OAI89DgCtPQ4ALT4OALE+DgDtPg4ARz8OAIE/DgCVPw4A1z8OAAVADgArQA4AT0AOAJFADgCjQA4A30AOAOlADgDvQA4Ac0EOAIVBDgADQg4AKUIOAHVCDgB7Qg4AiUIOAKdCDgCzQg4A1UIOAA1DDgCPQw4A6UMOAOtDDgAbRA4AQ0QOAEVEDgBtRA4Ab0QOAJ9EDgC1RA4AyUQOACFFDgCHRQ4Av0UOAOFFDgAXRg4AQUYOAJ1GDgCnRg4A10YOAONGDgATRw4AJUcOAFtHDgBvRw4Ai0cOANtHDgDfRw4AR0gOAOFIDgDzSA4A9UgOACNJDgBZSQ4Af0kOANFJDgBJSg4AT0oOAFtKDgCBSg4A20oOAOFKDgDnSg4AG0sOACNLDgB7Sw4A1UsOACtMDgBZTA4Ap0wOAA1NDgAPTQ4AJU0OAIdNDgDNTQ4A900OAEFODgBpTg4Ad04OAKdODgC9Tg4Aw04OAPlODgAXTw4APU8OAElPDgAHUA4AIVAOACdQDgAxUA4AS1AOAGNQDgCFUA4AkVAOAOtQDgALUQ4AgVEOANVRDgD7UQ4AQ1IOANlSDgD7Ug4AN1MOAEtTDgBbUw4Af1MOALtTDgDnUw4A7VMOAANUDgALVA4An1QOAKtUDgC5VA4ANVUOAHFVDgB/VQ4Ar1UOAM1VDgDfVQ4AZ1YOALtWDgARVw4AP1cOAF9XDgBpVw4Am1cOAMNXDgDVVw4A4VcOADdYDgCdWA4A0VgOANlYDgDvWA4ACVkOAA1ZDgAnWQ4Ab1kOAHNZDgC1WQ4Aw1kOAPNZDgAJWg4AHVoOAD9aDgBLWg4At1oOAL1aDgDDWg4A7VoOABFbDgBPWw4AcVsOAHlbDgDRWw4A31sOAEtcDgB7XA4AkVwOAKVcDgALXQ4AL10OAIldDgCNXQ4AlV0OAJtdDgCfXQ4AsV0OALNdDgAFXg4AZV4OAHNeDgA3Xw4Ae18OAJ1fDgCvXw4A2V8OAOFfDgALYA4AV2AOAI9gDgDpYA4ABWEOACNhDgCPYQ4ArWEOAOlhDgD3YQ4ALWIOAIdiDgDbYg4A/2IOAKFjDgC3Yw4AbWQOAHNkDgCtZA4AxWQOAMtkDgAHZQ4ADWUOACtlDgA9ZQ4AtWUOANNlDgDxZQ4A82UOAE1mDgCHZg4AmWYOAKFmDgClZg4A3WYOAOlmDgD/Zg4AT2cOAJFnDgDNZw4A+2cOABVoDgA/aA4AgWgOAIdoDgC1aA4AyWgOAAVpDgBxaQ4Aj2kOAJVpDgCxaQ4AJWoOAC9qDgA9ag4ATWoOALVqDgDBag4A2WoOAOlqDgD3ag4AOWsOAMFrDgD/aw4AG2wOAI1sDgDXbA4A72wOADFtDgCzbQ4AB24OAGduDgCRbg4Ak24OAN9uDgAJbw4AEW8OAFNvDgBvbw4Aq28OAPNvDgAvcA4Am3AOAL9wDgDXcA4A63AOABtxDgA3cQ4Ak3EOAPlxDgBBcg4AcXIOAAVzDgARcw4AWXMOAK9zDgC5cw4A73MOACd0DgA/dA4Al3QOANN0DgBpdQ4Ak3UOALl1DgC/dQ4Aw3UOAMt1DgA9dg4AR3YOAIt2DgDNdg4A13YOABN3DgAndw4AM3cOAD13DgCrdw4At3cOAD94DgBFeA4AfXgOAJl4DgCxeA4As3gOALd4DgAleQ4AR3kOAGV5DgBxeQ4As3kOAL95DgDjeQ4A8XkOAG96DgCXeg4ApXoOAM96DgDreg4A7XoOAHd7DgCBew4A+XsOAPt7DgAFfA4AO3wOAIV8DgCvfA4As3wOAAl9DgA/fQ4AaX0OAHV9DgB/fQ4AkX0OAKl9DgC3fQ4A5X0OAP99DgALfg4A234OAO1+DgBDfw4AkX8OANd/DgAJgA4AS4AOAFuADgB5gA4AgYAOAAOBDgApgQ4AaYEOAMOBDgDRgQ4A14EOAAeCDgA3gg4AU4IOAI+CDgDRgg4ADYMOABWDDgAxgw4AM4MOAD2DDgBDgw4AeYMOAJmDDgDtgw4A8YMOAC2EDgBHhA4AdYQOAI2EDgC3hA4AH4UOAEeFDgBVhQ4A74UOABWGDgAzhg4AT4YOAGeGDgCFhg4Al4YOAJ+GDgDJhg4ANYcOAEGHDgDXhw4A44cOAD2IDgB3iA4AoYgOALuIDgDdiA4A/YgOACuJDgBpiQ4AhYkOAOuJDgDtiQ4AC4oOABuKDgAzig4Ah4oOAKWKDgD1ig4ABYsOAD2LDgCbiw4ArYsOANGLDgBXjA4AgYwOAIuMDgCdjA4Aw4wOABWNDgBrjQ4Ag40OAL+NDgD7jQ4AGY4OAHGODgCRjg4Al44OAJuODgDxjg4A944OADePDgBFjw4AW48OAI2PDgCRjw4Al48OAJ2PDgCljw4Aw48OAAuQDgApkA4AU5AOABmRDgAvkQ4ASZEOAFmRDgBfkQ4AZ5EOAOWRDgD1kQ4AMZIOAF2SDgCdkg4Aq5IOAC+TDgBLkw4AV5MOAKuTDgDJkw4A/5MOAE2UDgBZlA4AhZUOAJ+VDgCllQ4AD5YOADWWDgBXlg4Ak5YOANGWDgDvlg4AeZcOAMWXDgDZlw4A35cOAPGXDgANmA4AaZgOAJmYDgDJmA4AEZkOAE2ZDgBXmQ4AdZkOALGZDgBxmg4Aj5oOAKOaDgD9mg4AG5sOADmbDgA/mw4AT5sOAGmbDgDhmw4A+ZsOAHWcDgB7nA4AoZwOANucDgAHnQ4ADZ0OAJudDgC1nQ4AwZ0OAPGdDgD9nQ4AB54OAFeeDgBbng4Az54OAOeeDgAznw4ANZ8OAHefDgCVnw4AmZ8OAJ+fDgC5nw4AEaAOABegDgBToA4A36AOADmhDgBXoQ4AbaEOAJehDgCjoQ4AtaEOAP2hDgAhog4AdaIOAJuiDgCnog4At6IOAPOiDgAFow4AI6MOACWjDgBlow4Ag6MOAO+jDgD1ow4A96MOAAGkDgCBpA4AwaQOAMmkDgAPpQ4AOaUOAEGlDgBXpQ4AfaUOAI+lDgCxpQ4AE6YOAB+mDgBNpg4AraYOAMemDgDlpg4AJacOAEunDgBhpw4Af6cOAIWnDgDzpw4ARagOAFGoDgCHqA4A+6gOAHmpDgCpqQ4ArakOAMGpDgDRqQ4AJ6oOACuqDgAxqg4ASaoOAEuqDgBVqg4AY6oOAHOqDgB/qg4An6oOANmqDgD9qg4Ad6sOAK2rDgDjqw4AH6wOAFOsDgBbrA4Aa6wOAH2sDgB/rA4Am6wOAKesDgDxrA4A96wOABOtDgAZrQ4AN60OAE+tDgC9rQ4A260OAPmtDgBHrg4Aga4OAAWvDgA7rw4Af68OAJuvDgDNrw4AG7AOANuwDgDfsA4A57AOAPewDgAtsQ4AV7EOAI+xDgCTsQ4Am7EOAMuxDgDXsQ4A47EOABmyDgAxsg4Ac7IOAJuyDgCpsg4AtbIOAPuyDgAnsw4AW7MOAJmzDgCrsw4A/bMOABe0DgA7tA4AU7QOAGm0DgB9tA4Ak7QOALO0DgDDtA4A17QOAOO0DgD/tA4AF7UOAGe1DgCFtQ4Ai7UOAMe1DgDRtQ4AObYOAG+2DgB1tg4Ae7YOAM+2DgD/tg4AR7cOALO3DgDPtw4AHbgOALO4DgC5uA4A3bgOAAe5DgAxuQ4AS7kOAGe5DgDDuQ4A+bkOABu6DgApug4AOboOADu6DgBFug4ATboOAHG6DgCBug4AxboOAO26DgAfuw4Ac7sOAK+7DgAbvA4ALbwOAJ+8DgAFvQ4AJ70OAFG9DgBfvQ4ABb4OAA2+DgAvvg4AQb4OAFO+DgCVvg4Aqb4OAMu+DgDlvg4A674OAB+/DgAnvw4AP78OAFG/DgB5vw4ABcAOAF/ADgB9wA4A7cAOAE/BDgAhwg4AecIOAIHCDgClwg4AtcIOAOXCDgADww4ABcMOABvDDgBNww4AU8MOAFfDDgDzww4AR8QOAGvEDgCjxA4AxcQOAN/EDgDvxA4AD8UOABnFDgA/xQ4AQ8UOAFvFDgBpxQ4Af8UOAKXFDgCvxQ4AscUOAMnFDgDTxQ4A7cUOAInGDgChxg4AucYOAOfGDgD1xg4AC8cOAEfHDgBtxw4Ax8cOANfHDgAZyA4AG8gOAGHIDgB7yA4Af8gOAM/IDgD/yA4AM8kOAE3JDgCJyQ4Aq8kOABfKDgA3yg4AVcoOAI/KDgDjyg4A8coOAPvKDgAJyw4AYcsOAM3LDgDxyw4AD8wOAD/MDgBdzA4Av8wOAMPMDgAvzQ4AO80OAE3NDgCjzQ4A2c0OAP3NDgAVzg4AJ84OAEHPDgBXzw4Aic8OAJPPDgCrzw4A4c8OACPQDgAl0A4ATdAOAH3QDgCX0A4Av9AOANHQDgAT0Q4AH9EOAC3RDgBF0Q4AW9EOAIXRDgCH0Q4AjdEOAJHRDgCj0Q4AqdEOAMfRDgAJ0g4AEdIOAC3SDgBZ0g4AfdIOAInSDgDX0g4A49IOAPnSDgAd0w4AK9MOADHTDgB30w4AwdMOAMvTDgDp0w4AUdQOAI3UDgCj1A4Ar9QOAOHUDgD91A4A/9QOAA/VDgAn1Q4AL9UOAFHVDgCD1Q4AvdUOAOPVDgDv1Q4A9dUOAB/WDgA71g4Ac9YOAHfWDgDB1g4AQ9cOAF3XDgCH1w4Ai9cOAJ3XDgD/1w4AIdgOAGXYDgDJ2A4A59gOAPvYDgAZ2Q4ASdkOAF/ZDgDd2Q4ACdoOABPaDgA92g4AS9oOAFXaDgCT2g4Ar9oOANPaDgDr2g4A+doOAD/bDgBl2w4AcdsOAHvbDgDV2w4A6dsOAP/bDgAN3A4ATdwOABvdDgBD3Q4AT90OAGPdDgCp3Q4AQd4OAEveDgBR3g4AZd4OAGveDgDD3g4Ayd4OAOPeDgD/3g4APd8OAJHfDgAT4A4AH+AOACfgDgAr4A4Ab+AOAHvgDgCH4A4AjeAOAN/gDgDx4A4AHeEOAC/hDgA14Q4AWeEOAF/hDgCx4Q4A2+EOAO/hDgAH4g4AHeIOAE/iDgCF4g4AieIOAL/iDgAh4w4AS+MOAH/jDgC14w4Az+MOANPjDgDx4w4AHeQOAEXkDgBH5A4AX+QOAGnkDgCh5A4A7eQOAPXkDgAT5Q4AMeUOAEHlDgBn5Q4Al+UOAK/lDgCz5Q4AG+YOAFfmDgBd5g4AqeYOAN/mDgD95g4A/+YOAFHnDgAN6A4AF+gOACXoDgBf6A4AfegOAA/pDgAz6Q4AUekOAFfpDgB16Q4A2ekOAP/pDgAF6g4AY+oOAGnqDgDJ6g4AB+sOADvrDgBh6w4Af+sOAJvrDgDZ6w4AA+wOAAfsDgAz7A4AW+wOAHXsDgCB7A4AmewOAOXsDgDt7A4AP+0OAJPtDgCh7Q4A4+0OAO3tDgD77Q4AH+4OACnuDgAv7g4AT+4OAG3uDgC77g4AJ+8OAG/vDgCF7w4Al+8OAKXvDgDD7w4A2+8OAHfwDgCf8A4A2/AOAPXwDgAL8Q4AE/EOAEnxDgBT8Q4AW/EOAHHxDgCh8Q4AqfEOAMvxDgDf8Q4A7/EOAAHyDgBJ8g4AV/IOAMPyDgAF8w4AI/MOAF/zDgCx8w4Az/MOAO3zDgAT9A4AO/QOAIv0DgCV9A4Av/QOAPv0DgBn9Q4AsfUOAMf1DgDP9Q4ARfYOAGP2DgBv9g4AcfYOAO32DgDv9g4A+fYOAPv2DgBB9w4Al/cOAKH3DgCt9w4Ar/cOALn3DgDd9w4AGfgOADn4DgCR+A4An/gOAPn4DgAj+Q4AJ/kOAD/5DgCP+Q4AlfkOAKv5DgC9+Q4Aw/kOANv5DgDh+Q4A6fkOAA36DgAT+g4AF/oOAEH6DgBJ+g4AYfoOAHf6DgDB+g4Ax/oOANH6DgAz+w4Af/sOAJ/7DgDb+w4A3/sOAC/8DgAz/A4AUfwOAFP8DgCH/A4Ap/wOAMP8DgDF/A4AyfwOAAH9DgAd/Q4AMf0OAEH9DgBH/Q4Abf0OAK/+DgDV/g4A5/4OAPH+DgAR/w4ALf8OAFf/DgB3/w4Aff8OALf/DgC9/w4AHQAPAIUADwCLAA8AqQAPAMsADwDdAA8A4wAPABUBDwCXAQ8AmQEPANkBDwDrAQ8AGwIPAEECDwDhAg8A7wIPAAsDDwBJAw8AZwMPAHkDDwCPAw8AswMPALkDDwBVBA8AZwQPAL0EDwDzBA8AEQUPABUFDwAhBQ8APwUPAE0FDwBlBQ8AiQUPAKEFDwDbBQ8A8wUPAJ0GDwBPBw8AUQcPAFsHDwB/Bw8AqwcPAOcHDwAJCA8AKQgPAH0IDwClCA8ABwkPADcJDwBrCQ8AiwkPAK8JDwC7CQ8A/QkPAGcKDwBtCg8AxwoPAAsLDwBBCw8AXwsPANcLDwBPDA8ArwwPAO8MDwABDQ8AKw0PAIsNDwClDQ8Arw0PAMMNDwAJDg8AIw4PAFMODwBfDg8ALw8PAD0PDwBPDw8AhQ8PAJUPDwCjDw8ArQ8PALUPDwDHDw8A3Q8PADkQDwBJEA8A4RAPAP8QDwBREQ8ACxIPAEESDwBbEg8AXRMPAHUTDwCTEw8ApRMPAL0TDwDhEw8AJxQPADkUDwBNFA8AUxQPAJkUDwCfFA8AFxUPAEMVDwChFQ8ACRYPACcWDwBXFg8AWxYPAKUWDwDtFg8AMxcPAFMXDwCrFw8ALxgPAEMYDwCJGA8AoxgPAMEYDwAbGQ8AJxkPAEMZDwDJGQ8AzxkPAOcZDwAvGg8AORoPAFEaDwBrGg8AjRoPAI8aDwDdGg8A8xoPABMbDwAdGw8A2RsPAOMbDwBJHA8AURwPAFUcDwCjHA8ArxwPAL0cDwAvHQ8Apx0PANEdDwDzHQ8AKR4PAE8eDwANHw8ANx8PAD0fDwBdHw8AYR8PAJcfDwCZHw8AzR8PANMfDwDhHw8A8R8PAG8gDwDXIA8ACyEPAE8hDwBbIQ8AhSEPAJEhDwCvIQ8AzSEPACEiDwB7Ig8AkSIPAJ0iDwC3Ig8AuyIPAMciDwDPIg8A2SIPAOUiDwDtIg8A/yIPABUjDwAzIw8AcSMPAOcjDwCJJA8ArSQPALkkDwDNJA8ACSUPAMMlDwBZJg8AmyYPALMmDwDXJg8ADScPABknDwBTJw8AkScPALMnDwDRJw8A5ScPAHUoDwB5KA8AfygPAJcoDwC7KA8A9ygPAAUpDwAVKQ8ANSkPAFEpDwCnKQ8AHSoPADEqDwBfKg8AeSoPAJcqDwCpKg8AvyoPAPcqDwATKw8AFSsPACcrDwAtKw8AXSsPAHMrDwCFKw8AlysPALUrDwDHKw8AAywPABEsDwBBLA8AxSwPAAstDwA9LQ8Agy0PAJctDwCjLQ8AFS4PACUuDwBhLg8Ary4PAEsvDwCbLw8Aqy8PAAEwDwAxMA8AOzAPAHMwDwB3MA8AhTAPAI8wDwC5MA8AyzAPAN8wDwAHMQ8ATzEPAF0xDwBzMQ8AgTEPAKMxDwDPMQ8APzIPAEUyDwB1Mg8AoTIPAE0zDwBlMw8AoTMPAMUzDwDNMw8A4zMPAA80DwBPNA8AuzQPAMc0DwDTNA8A2zQPAPc0DwD5NA8AHTUPAJs1DwCtNQ8A+TUPABM2DwBtNg8AiTYPAJs2DwCtNg8A2TYPAOs2DwD3Ng8AAzcPAB83DwArNw8AYzcPAJ83DwDHNw8AzzcPAN83DwDtNw8A+TcPAA84DwA/OA8ATTgPAKU4DwCxOA8AxTgPANU4DwDdOA8AEzkPADE5DwBfOQ8AbTkPAHc5DwCXOQ8AoTkPALM5DwD3OQ8ACToPAC06DwBnOg8AizoPALc6DwDlOg8ANTsPAEU7DwBjOw8AiTsPAKc7DwBxPA8AizwPANk8DwDlPA8A6TwPAPs8DwBXPQ8Aoz0PAK89DwDJPQ8AzT0PAP09DwAdPg8AIz4PACc+DwB1Pg8Agz4PAL0+DwDdPg8A7T4PAB8/DwBHPw8Aoz8PANE/DwAHQA8Ax0APAM9ADwDlQA8A80APAFlBDwBdQQ8ArUEPAPtBDwAvQg8A\";\nint main() {\n\tchar* DEC = base64_decode(ORI);\n\t//memcpy(ansa, DEC, sizeof(int) * 11184);\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", ((int*) DEC)[n - 1]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "d74358dfbc91298e51e929cce8ef4d71", "src_uid": "53879e79cccbacfa6586d40cf3436657", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint isPrim(int x)\n{\n int d;\n \n if (x % 2 == 0) return 0;\n for (d = 3; d < x; ++d) {\n if (x % d == 0) return 0;\n ++d;\n }\n \n return 1;\n}\n\nint mirror(int x)\n{\n int d, i;\n \n d = x;\n for (i = 1; (x > 0); i *= 10) x = x / 10; \n x = d;\n \n for (d = 0; (x > 0); x = x / 10) {\n i = i / 10;\n d += (x % 10) * i;\n }\n \n return d;\n}\n\nint eots[11184];\n\nvoid genEots(int n)\n{\n int i, j, m;\n \n for (i = 13, j = 0; j < n; ++i) {\n m = mirror(i);\n if (m != i)\n if (isPrim(i) && isPrim(m)) {\n eots[j] = i; ++j;\n }\n ++i;\n }\n}\n\nint main(void)\n{\n int n;\n \n fscanf(stdin, \"%d\", &n);\n genEots(n);\n printf(\"%d\\n\", eots[n-1]);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "de657480161f4a2c99cbb3bc353cea1e", "src_uid": "53879e79cccbacfa6586d40cf3436657", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "/*\n\u0430\u0431\u0432\u0433\u0434\u0435\u0451\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\n\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0451\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\n\n\u0435\u043e\u0442\u0441\u043e\u0440\u043f - \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0447\u044c\u0435 \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\n\u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c.\n\n\u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0435\u043e\u0442\u0441\u043e\u0440\u043f \u043d\u043e\u043c\u0435\u0440 N \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e\n\u0446\u0435\u043b\u043e\u0433\u043e N (1<=n<=11184) - \u043d\u043e\u043c\u0435\u0440\u0430 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u0435\u043e\u0442\u0441\u043e\u0440\u043f\u0430. \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0447. \u0441 \u0435\u0434.\n*/\n#include \n#define max 70000\n\nint prim[max] = { 2, 3, 5, 7, 11, 13 };\nint total = 6;\n\nint isPrim(int x)\n{\n\tint d;\n\t\n\tif (x <= 1) return 0;\n\n\tfor (d = 0; d < total; ++d) {\n\t\tif (x == prim[d]) return 1;\n\t\tif ((x % prim[d]) == 0) return 0;\n\t}\n\t\n\treturn 1;\n}\n\nvoid genPrim(void)\n{\n\tint i, n;\n\t\n\ti = total, n = prim[total-1]+1;\n\twhile (i < max) {\n\t\tif (isPrim(n)) { prim[i] = n; ++i, ++total; }\n\t\t++n;\n\t}\n}\n\nint mirror(int x)\n{\n\tint d, i = 1;\n\t\n\td = x;\n\twhile (x > 0) {\n\t\tx = x / 10; i *= 10;\n\t}\n\tx = d;\n\t\n\td = 0;\n\twhile (x > 0) {\n\t\ti = i / 10;\n\t\td += (x % 10) * i;\n\t\tx = x / 10;\n\t}\n\t\n\treturn d;\n}\n\nint eots[11184];\n\nvoid genEots(void)\n{\n\tint i = 5, j = 0, m, p;\n\t\n\twhile ((i < max) && (j < 11184)) {\n\t\tp = prim[i]; m = mirror(p);\n\t\tif (isPrim(m) && (m != p)) {\n\t\t\teots[j] = p;\n\t\t\t++j;\n\t\t}\n\t\t++i;\n\t}\n}\n\nint main(void)\n{\n\tint n;\n\t\n\tgenPrim(); genEots();\n\n\tfscanf(stdin, \"%d\", &n);\n\tif ((1 <= n) && (n <= 11184))\n\t\tprintf(\"%d\\n\", eots[n-1]);\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b025f748a9758b6397993b9a19e2fdae", "src_uid": "53879e79cccbacfa6586d40cf3436657", "difficulty": 1600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "bc9c821a9d0381a8ed108918613cf765", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b2ff9d8b6c6389dec0ce2e324b35ad0a", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0} {"lang": "GNU C", "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 sb1=(x-1)*m+y;\n sb2=(n-x-1)*m+y;\n long long 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\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6e4360fb251bd181897fbe2e4f55faf7", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0} {"lang": "GNU C", "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 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "602955572a1576501882984d151116ad", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0} {"lang": "GNU C", "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 system(\"PAUSE\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ac3d1050c8a8ff1fde0b2bd379099416", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nlong long arr[3000][2],current[1000];\nmain()\n{\n long long a,b,c,x,w,temp,i=1,no_of_elem=0; long long sum=0,num,flag=0;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&a,&b,&w,&x,&c);\n int no=0,no2=0;\n if(c<=a)\n {\n printf(\"0\");\n return 0;\n }\n long long pos;\n if(b0)\n {\n pos=b;\n break;\n }\n current[b]=i+1; i+=2; \n }\n for(i=current[pos]+2;i<=no_of_elem;i+=2)\n no+=arr[i][1];\n for(i=2;i<=current[pos];i+=2)\n no2+=arr[i][1];\n if(no==0)\n {\n no=no2;no2=0;\n current[pos]=0;\n }\n if(no+no2>=c-a)\n {\n sum=0;\n for(i=1;sum+arr[i+1][1]0)\n {\n pos=b;\n break;\n }\n current[b]=i+1; i+=2;no_of_elem+=2;\n }\n\n for(i=current[pos]+2;i<=no_of_elem;i+=2)\n no+=arr[i][1];\n for(i=2;i<=current[pos];i+=2)\n no2+=arr[i][1];\n if(no==0)\n {\n no=no2;no2=0;\n pos=1;\n }\n if(no+no2>=c-a)\n {\n sum=0;\n for(i=1;sum+arr[i+1][1]\n#include\nlong long arr[3000][2],current[1000];\nmain()\n{\n long long a,b,c,x,w,temp,i=1,no_of_elem=0; long long sum=0,num,flag=0;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&a,&b,&w,&x,&c);\n int no=0,no2=0;\n if(c<=a)\n {\n printf(\"0\");\n return 0;\n }\n long long pos;\n if(b0)\n {\n pos=b;\n break;\n }\n current[b]=i+1; i+=2;no_of_elem+=2;\n }\n for(i=current[pos]+2;i<=no_of_elem;i+=2)\n no+=arr[i][1];\n for(i=2;i<=current[pos];i+=2)\n no2+=arr[i][1];\n if(no==0)\n {\n no=no2;no2=0;\n pos=1;\n }\n if(no+no2>=c-a)\n {\n sum=0;\n for(i=1;sum+arr[i+1][1]0)\n {\n pos=b;\n break;\n }\n current[b]=i+1; i+=2;no_of_elem+=2;\n }\n\n for(i=current[pos]+2;i<=no_of_elem;i+=2)\n no+=arr[i][1];\n for(i=2;i<=current[pos];i+=2)\n no2+=arr[i][1];\n if(no==0)\n {\n no=no2;no2=0;\n pos=1;\n }\n if(no+no2>=c-a)\n {\n sum=0;\n for(i=1;sum+arr[i+1][1]\n#include\n#include\n\nint main()\n{\n int a,b,w,x,c;\n int cnt;\n while(scanf(\"%d%d%d%d%d\",&a,&b,&w,&x,&c) != EOF)\n {\n if(c <= a)\n {\n printf(\"0\\n\");\n continue;\n }\n\n int T = 0,pa = 0;\n int b1 = b;\n if(b >= x)\n {\n T ++,pa ++;\n b -= x;\n }\n else\n {\n b = w - (x - b);\n T ++;\n }\n while(b != b1)\n {\n if(b >= x)\n {\n int temp = b / x;\n T += temp;\n pa += temp;\n b %= x;\n }\n else\n {\n b = w - (x - b);\n T ++;\n }\n }\n\n cnt = 0;\n if((c - a) % pa == 0)\n {\n cnt = (c - a) / pa * T - T;\n c = a + pa;\n }\n else\n {\n cnt = (c - a) / pa * T;\n c = a + (c - a) % pa;\n }\n\n\n while(c > a)\n {\n if(b >= x)\n {\n int temp = b / x;\n if(c - temp < a)\n {\n cnt += c - a;\n break;\n }\n c -= temp;\n cnt += temp;\n b %= x;\n }\n else\n {\n b = w - (x - b);\n a --,c --,cnt ++;\n }\n }\n printf(\"%d\\n\",cnt);\n }\n return 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3424ecf6669504db9d279e8d8e39820d", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void) {\n int a=0,b=0,w=0,x=0,c=0;\n int count=0;\n scanf(\"%d %d %d %d %d\\n\", &a,&b,&w,&x,&c);\n /*printf(\"%d %d %d %d %d\\n\", a,b,w,x,c);\n printf(\"%d\", count);*/\n if(c<=a){\n printf(\"0\");\n }\n else{\n int ch=100;\n while(c>a){\n int q,r;\n //printf(\"a is %d, b is %d, c is %d\\n\",a,b,c);\n //c=c-1;\n if(b>=x){\n q = b/x;\n r = b%x;\n b = b-q*x;\n count+=q;\n c-=q;\n /*if(ch>0){\n printf(\"%d %d %ld\\n\",a,c,count);\n ch--;\n }*/\n }\n else if(b\n#include\nint arr[3000][2],current[1000];\nmain()\n{\n int a,b,c,x,w,temp,i=1,no_of_elem=0; int sum=0,num,flag=0;\n scanf(\"%d%d%d%d%d\",&a,&b,&w,&x,&c);\n int no=0,no2=0;\n if(c<=a)\n {\n printf(\"0\");\n return 0;\n }\n int pos;\n if(b0)\n {\n pos=b;\n break;\n }\n current[b]=i+1; i+=2;no_of_elem+=2;\n }\n for(i=current[pos]+2;i<=no_of_elem;i+=2)\n no+=arr[i][1];\n for(i=2;i<=current[pos];i+=2)\n no2+=arr[i][1];\n if(no==0)\n {\n no=no2;no2=0;\n pos=1;\n }\n if(no+no2>=c-a)\n {\n sum=0;\n for(i=1;sum+arr[i+1][1]0)\n {\n pos=b;\n break;\n }\n current[b]=i+1; i+=2;no_of_elem+=2;\n }\n\n for(i=current[pos]+2;i<=no_of_elem;i+=2)\n no+=arr[i][1];\n for(i=2;i<=current[pos];i+=2)\n no2+=arr[i][1];\n if(no==0)\n {\n no=no2;no2=0;\n pos=1;\n }\n if(no+no2>=c-a)\n {\n sum=0;\n for(i=1;sum+arr[i+1][1]\n#include \n\n#define N\t7\n#define M\t(N * (N - 1) / 2)\n\nint main() {\n\tstatic int ii[M], jj[M], cc[N];\n\tstatic char used[6][6];\n\tint n, m, h, i, j, p, b, max, cnt;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (h = 0; h < m; h++)\n\t\tscanf(\"%d%d\", &ii[h], &jj[h]), ii[h]--, jj[h]--;\n\tp = 1;\n\tfor (i = 0; i < n; i++)\n\t\tp *= 6;\n\tmax = 0;\n\tfor (b = 0; b < p; b++) {\n\t\tint b_;\n\n\t\tfor (i = 0, b_ = b; i < n; i++, b_ /= 6)\n\t\t\tcc[i] = b_ % 6;\n\t\tmemset(used, 0, sizeof used);\n\t\tcnt = 0;\n\t\tfor (h = 0; h < m; h++) {\n\t\t\ti = cc[ii[h]], j = cc[jj[h]];\n\t\t\tif (!used[i][j]) {\n\t\t\t\tused[i][j] = used[j][i] = 1;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tif (max < cnt)\n\t\t\tmax = cnt;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d3c0aff78340b7295b90fd1ad521cb62", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \nchar F[8][8];\nint D[8];\nint C(int a, int b)\n{\n int i;\n int r = 0;\n for (i = 1; i < 8; i++)\n {\n if (F[a][i] && F[b][i])\n {\n r++;\n }\n }\n return r;\n}\nint main()\n{\n int i, j;\n int t;\n int n, m;\n int a, b;\n int temp;\n int mV;\n scanf(\"%d %d\", &n, &m);\n for (i = 1; i <= n; i++)\n {\n for (j = 1; j <= n; j++)\n {\n F[i][j] = 0;\n }\n }\n for (i = 1; i <= n; i++)\n {\n D[i] = 0;\n }\n for (i = 0; i < m; i++)\n {\n scanf(\"%d %d\", &a, &b);\n F[a][b] = 1;\n D[a]++;\n F[b][a] = 1;\n D[b]++;\n }\n for (t = 1; t <= n; t++)\n {\n if (D[t] == 0)\n {\n break;\n }\n }\n if (t == 8)\n {\n mV = 8;\n if (m)\n {\n for (a = 1; a < 8; a++)\n {\n for (b = a + 1; b < 8; b++)\n {\n temp = C(a, b);\n if (temp < mV)\n {\n mV = temp;\n }\n }\n }\n m -= mV;\n }\n }\n printf(\"%d\", m);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f500c1e6223e80bb74c5e57c3573d4e2", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n#include\nstruct {\n int u,v;\n}edges[22];\nint edgeLen = 0;\nint vexnum;\nint vexs[8] = {1,1,1,1,1,1,1,1};\n\nint compute()\n{\n int i = 1;\n int ans = 0;\n while(i <= vexnum)\n {\n int this = 0;\n int fuck[67] = {};\n for(i = 1 ; i <= vexnum && vexs[i] + 1 > 6 ; i ++){\n vexs[i] = 1;\n }\n if(i <= vexnum){\n vexs[i] += 1;\n for(int j = 0 ; j < edgeLen ; j ++)\n {\n int uP = vexs[edges[j].u];\n int vP = vexs[edges[j].v];\n if(uP > vP){\n int temp = uP;\n uP = vP;\n vP = temp;\n }\n int hash = uP*10+vP;\n this += (fuck[hash] == 0) ? 1 : 0;\n fuck[hash] = (fuck[hash] == 0) ? 1 : 0; \n }\n if(ans < this){\n ans = this;\n }\n }\n }\n return ans;\n}\nint main()\n{\n int arcnum;\n scanf(\"%d%d\",&vexnum,&arcnum);\n for(int i = 0 ; i < arcnum ; i ++)\n {\n int u,v;\n scanf(\"%d%d\",&u,&v);\n edges[edgeLen].u = u;\n edges[edgeLen].v = v;\n edgeLen += 1;\n }\n int ans = compute();\n printf(\"%d\",ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bc6fdf92141dc94cb7f4eef9d2398ec6", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0} {"lang": "GNU C11", "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;ndata = u;\n q1->data = v;\n q->prev = NULL;\n q1->prev = NULL;\n q->next = NULL;\n q1->next = NULL;\n \n if(!head[u]) // Add v to u\n {\n head[u] = q1;\n tail[u] = q1;\n }\n else\n {\n tail[u]->next = q1;\n q1->prev = tail[u];\n tail[u] = q1;\n }\n if(!head[v]) // Add u to v\n {\n head[v] = q;\n tail[v] = q;\n }\n else\n {\n tail[v]->next = q;\n q->prev = tail[v];\n tail[v] = q;\n }\n}\n\nvoid display(ll item)\n{\n nd *i = head[item];\n while (i)\n {\n printf(\"|%lld %lld|\\n\",item,i->data);\n i = i->next;\n }\n printf(\"\\n\");\n}\n\nll dominoes[7][7];\nll assign[7];\nll array[100];\n\nint main(int argc, char const *argv[])\n{\n ll T = 1;\n // scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll N , M;\n scanf(\"%lld %lld\",&N,&M);\n ll V1[M],V2[M];\n for (ll m = 0; m < M; m++)\n {\n scanf(\"%lld %lld\",&V1[m],&V2[m]);\n V1[m]--;\n V2[m]--;\n add(V1[m],V2[m]);\n }\n\n\n for (ll n = 0; n < N; n++)\n {\n // display(n);\n }\n \n \n // Numbers to be assigned ->0(no num) 1 2 3 4 5 6 (x) repetition\n for (ll k = 0; k < 823543; k++)\n {\n ll cnt = k;\n ll ind = 0;\n while (cnt)\n {\n array[ind++] = cnt%7;\n cnt /= 7;\n }\n for (ll n = 0; n < N; n++)\n {\n assign[n] = array[n];\n // printf(\"%lld \",assign[n]);\n }\n // printf(\"\\n\");\n // check if correct\n ll sum = 0;\n for (ll m = 0; m < M; m++)\n {\n if(assign[V1[m]] && assign[V2[m]]) // both not assigned 1 \n {\n // printf(\"-> %lld %lld %lld %lld %lld %lld\\n\",assign[V1[m]],assign[V2[m]],V1[m],V2[m],dominoes[V1[m]][V2[m]],dominoes[V2[m]][V1[m]]);\n if(!dominoes[assign[V1[m]]][assign[V2[m]]] && !dominoes[assign[V2[m]]][assign[V1[m]]])\n {\n // printf(\"plp %lld %lld %lld %lld\\n\",assign[V1[m]],assign[V2[m]],V1[m],V2[m]);\n sum++;\n dominoes[assign[V1[m]]][assign[V2[m]]] = 1;\n dominoes[assign[V2[m]]][assign[V1[m]]] = 1;\n }\n // printf(\"%lld %lld ho gya\\n\",dominoes[V1[m]][V2[m]],dominoes[V2[m]][V1[m]]);\n }\n }\n // printf(\"|%lld|\\n\\n\",sum);\n if(sum>MAX)\n {\n MAX = sum;\n }\n for (ll n = 0; n < 7; n++)\n {\n for (ll m = 0; m < 7; m++)\n {\n dominoes[n][m] = 0;\n }\n \n }\n }\n printf(\"%lld\\n\",MAX);\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a68151bf840a43b29158d2cb7dee8941", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tint i, j, k;\n\tint a[30], b[30];\n\tfor (i = 0; i < m; i++)\n\t{\n\t\tscanf(\"%d %d\", &a[i], &b[i]);\n\t\ta[i]--;\n\t\tb[i]--;\n\t}\n\tint max = 1;\n\tfor (i = 0; i < n; i++)\n\t\tmax *= 6;\n\tint used[10][10];\n\tfor (i = 0; i < 10; i++)\n\t\tfor (j = 0; j < 10; j++)\n\t\t\tused[i][j] = 1;\n\tint p, q[10];\n\tint ans = 0, count;\n\tfor (j = 0; j < max; j++)\n\t{\n\t\tp = j;\n\t\tfor (i = 0; i < n; i++)\n\t\t{\n\t\t\tq[i] = p % 6;\n\t\t\tp /= 6;\n\t\t}\n\t\tfor (i = 0; i < 10; i++)\n\t\t\tfor (k = i; k < 10; k++)\n\t\t\t\tused[i][k] = 0;\n\t\tcount = 0;\n\t\tfor (i = 0; i < m; i++)\n\t\t{\n\t\t\tif (q[a[i]] < q[b[i]])\n\t\t\t{\n\t\t\t\tif (used[q[a[i]]][q[b[i]]] == 0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\tused[q[a[i]]][q[b[i]]] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (used[q[b[i]]][q[a[i]]] == 0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\tused[q[b[i]]][q[a[i]]] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (ans < count)ans = count;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8a1aa6a886a960fdbd6ed7f955cdba94", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include\n#include\n#define display(s,i) printf(#s #i \"=%d\",s##i)\n#define ll long long\nll f,h,n1,n2;\nconst long long mod=1e8;\nll dp[102][11][102][11];\nll result(ll f1,ll a, ll h1, ll b)\n{\n if(f1==0 && h1==0) return 1;\n if(dp[f1][a][h1][b]!=-1) return dp[f1][a][h1][b];\n ll c=0,d=0,e=0,f=0;\n if(f1 && a) c=result(f1-1,a-1,h1,n2);\n if(h1 && b) d=result(f1,n1,h1-1,b-1);\n return dp[f1][a][h1][b]=(c+d)%mod;\n}\nll main(ll argc, char *argv[])\n{\n memset(dp,-1,sizeof dp);\n scanf(\"%d%d%d%d\",&f,&h,&n1,&n2);\n ll ans=result(f,n1,h,n2);\n printf(\"%d\",ans%mod);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5176268f1b1f3a56f4ad62c9c3d13724", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n#define M 100000000\nint dp[200][101][101][11][11];\nint n1, n2, k1, k2;\nint call(int i, int x, int y, int x1, int y1)\n{\n\tif(i>=(n1+n2)) return 1;\n\tif(dp[i][x][y][x1][y1]==-1){\n\t\tint r=0;\n\t\tif(x1\nint dp[200][101][101][11][11];\nint n1, n2, k1, k2;\nint call(int i, int x, int y, int x1, int y1)\n{\n\tif(i>=(n1+n2)) return 1;\n\tif(dp[i][x][y][x1][y1]==-1){\n\t\tint r=0;\n\t\tif(x1\n#include \nusing namespace std;\n\nconst int MAXN = 100, MOD = 1e8;\n\nint k1, k2, dp[MAXN+1][MAXN+1][2];\n\nint fn(int n1, int n2, bool flag)\n{\n if(n1 == 0 && n2 == 0) return 1;\n\n if(dp[n1][n2][flag] != -1) return dp[n1][n2][flag];\n\n int ret = 0;\n\n if(flag == 0) {\n for(int man = 1; man <= k1 && n1-man >= 0; ++man)\n ret += fn(n1-man, n2, !flag), ret %= MOD;\n }\n else { // flag == 1\n for(int man = 1; man <= k2 && n2-man >= 0; ++man)\n ret += fn(n1, n2-man, !flag), ret %= MOD;\n }\n\n return dp[n1][n2][flag] = ret;\n}\n\nint main()\n{\n //freopen(\"in\", \"r\", stdin);\n\n int n1, n2;\n\n while(scanf(\"%d %d %d %d\", &n1, &n2, &k1, &k2) != EOF) {\n fill(&dp[0][0][0], &dp[MAXN+1][0][0], -1);\n\n printf(\"%d\\n\", (fn(n1, n2, 0) + fn(n1, n2, 1)) % MOD);\n }\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fa63227334b42f92e9c7b281fcb96f56", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint ans, MOD = 100000000;\nint k1, k2;\n\nint min(int a, int b) { return a < b ? a : b; }\n\nvoid rec(int remain1, int remain2, int turn) {\n if(remain1 + remain2 == 0) {\n ans++;\n if(ans == MOD)\n ans = 0;\n } else {\n int i, val;\n if(turn == 0) {\n val = (remain1 + k1 - 1) / k1;\n if(val > 1 && val - 1 > remain2)\n return;\n for(i = 1; i <= min(k1, remain1); i++) {\n rec(remain1 - i, remain2, 1);\n }\n } else {\n val = (remain2 + k2 - 1) / k2;\n if(val > 1 && val - 1 > remain1)\n return;\n for(i = 1; i <= min(k2, remain2); i++) {\n rec(remain1, remain2 - i, 0);\n }\n }\n }\n}\n\nint main() {\n int n1, n2;\n scanf(\"%d %d %d %d\", &n1, &n2, &k1, &k2);\n rec(n1, n2, 0);\n rec(n1, n2, 1);\n printf(\"%d\\n\", (int)ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "84b477111a8637826d935b423e84cefd", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t400\n#define M\t200\n#define A\t26\n#define MD\t998244353\n\nint max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n\tstatic int kk[A], dp1[M + 1][2], dp2[M + 1][M + 1][3], dq1[N + 1], dq2[N + 1][N + 1], aa1[M + 1], aa2[M + 1][M + 1];\n\tint n, m, i, k, l, k1, l1, k2, l2, a, b, ans;\n\n\tscanf(\"%d\", &n), m = (n + 1) / 2;\n\tfor (a = 0; a < A; a++)\n\t\tscanf(\"%d\", &kk[a]);\n\tdp1[0][0] = dp1[1][1] = 1;\n\tfor (i = 1; i < m; i++)\n\t\tfor (k = i; k >= 0; k--) {\n\t\t\tint x = dp1[k][0], y = dp1[k][1];\n\n\t\t\tdp1[k][0] = ((long long) x * (A - 2) + y) % MD;\n\t\t\tdp1[k + 1][1] = (long long) x * (A - 1) % MD;\n\t\t}\n\tdp2[0][0][0] = dp2[1][0][1] = dp2[0][1][2] = 1;\n\tfor (i = 1; i < m; i++)\n\t\tfor (k = i; k >= 0; k--)\n\t\t\tfor (l = i - k; l >= 0; l--) {\n\t\t\t\tint x = dp2[k][l][0], y = dp2[k][l][1], z = dp2[k][l][2];\n\n\t\t\t\tdp2[k][l][0] = ((long long) x * (A - 3) + y + z) % MD;\n\t\t\t\tdp2[k + 1][l][1] = ((long long) x * (A - 2) + z) % MD;\n\t\t\t\tdp2[k][l + 1][2] = ((long long) x * (A - 2) + y) % MD;\n\t\t\t}\n\tfor (k = 0; k <= m; k++)\n\t\taa1[k] = ((long long) dp1[k][0] * (A - 1) + dp1[k][1]) % MD;\n\tfor (k1 = 0; k1 <= m; k1++)\n\t\tfor (k2 = max(n / 3 + 1 - k1, 0); k2 <= n - m; k2++)\n\t\t\tdq1[k1 + k2] = (dq1[k1 + k2] + (long long) aa1[k1] * aa1[k2]) % MD;\n\tfor (k = 0; k <= m; k++)\n\t\tfor (l = 0; k + l <= m; l++)\n\t\t\taa2[k][l] = ((long long) dp2[k][l][0] * (A - 2) + dp2[k][l][1] + dp2[k][l][2]) % MD;\n\tfor (k1 = 0; k1 <= m; k1++)\n\t\tfor (k2 = max(n / 3 + 1 - k1, 0); k2 <= n - m; k2++)\n\t\t\tfor (l1 = 0; k1 + l1 <= m; l1++)\n\t\t\t\tfor (l2 = max(n / 3 + 1 - l1, 0); k2 + l2 <= n - m; l2++)\n\t\t\t\t\tdq2[k1 + k2][l1 + l2] = (dq2[k1 + k2][l1 + l2] + (long long) aa2[k1][l1] * aa2[k2][l2]) % MD;\n\tans = A * A;\n\tfor (i = 2; i < n; i++)\n\t\tans = (long long) ans * (A - 1) % MD;\n\tfor (a = 0; a < A; a++)\n\t\tfor (k = kk[a] + 1; k <= n; k++)\n\t\t\tans = (ans - dq1[k]) % MD;\n\tfor (a = 0; a < A; a++)\n\t\tfor (b = a + 1; b < A; b++)\n\t\t\tfor (k = kk[a] + 1; k <= n; k++)\n\t\t\t\tfor (l = kk[b] + 1; k + l <= n; l++)\n\t\t\t\t\tans = (ans + dq2[k][l]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "750d5604f87e1d6b5bcb4e73e8038bed", "src_uid": "1f012349f4b229dc98faadf1ca732355", "difficulty": 2700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t400\n#define M\t200\n#define A\t26\n#define MD\t998244353\n\nint max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n\tstatic int kk[A], dp[N + 1][M + 1][2], dq[N + 1][M + 1][M + 1][3], dr[N + 1], ds[N + 1][N + 1], aa1[M + 1], aa2[M + 1], bb1[M + 1][M + 1], bb2[M + 1][M + 1];\n\tint n, m, i, k, l, k1, l1, k2, l2, a, b, ans;\n\n\tscanf(\"%d\", &n), m = (n + 1) / 2;\n\tfor (a = 0; a < A; a++)\n\t\tscanf(\"%d\", &kk[a]);\n\tdp[1][0][0] = dp[1][1][1] = 1;\n\tfor (i = 1; i < m; i++)\n\t\tfor (k = i; k >= 0; k--) {\n\t\t\tint x = dp[i][k][0], y = dp[i][k][1];\n\n\t\t\tdp[i + 1][k][0] = ((long long) x * (A - 2) + y) % MD;\n\t\t\tdp[i + 1][k + 1][1] = (long long) x * (A - 1) % MD;\n\t\t}\n\tdq[1][0][0][0] = dq[1][1][0][1] = dq[1][0][1][2] = 1;\n\tfor (i = 1; i < m; i++)\n\t\tfor (k = i; k >= 0; k--)\n\t\t\tfor (l = i - k; l >= 0; l--) {\n\t\t\t\tint x = dq[i][k][l][0], y = dq[i][k][l][1], z = dq[i][k][l][2];\n\n\t\t\t\tdq[i + 1][k][l][0] = ((long long) x * (A - 3) + y + z) % MD;\n\t\t\t\tdq[i + 1][k + 1][l][1] = ((long long) x * (A - 2) + z) % MD;\n\t\t\t\tdq[i + 1][k][l + 1][2] = ((long long) x * (A - 2) + y) % MD;\n\t\t\t}\n\tfor (k1 = 0; k1 <= m; k1++)\n\t\taa1[k1] = ((long long) dp[m][k1][0] * (A - 1) + dp[m][k1][1]) % MD;\n\tfor (k2 = 0; k2 <= n - m; k2++)\n\t\taa2[k2] = ((long long) dp[n - m][k2][0] * (A - 1) + dp[n - m][k2][1]) % MD;\n\tfor (k1 = 0; k1 <= m; k1++)\n\t\tfor (k2 = max(n / 3 + 1 - k1, 0); k2 <= n - m; k2++)\n\t\t\tdr[k1 + k2] = (dr[k1 + k2] + (long long) aa1[k1] * aa2[k2]) % MD;\n\tfor (k1 = 0; k1 <= m; k1++)\n\t\tfor (l1 = 0; k1 + l1 <= m; l1++)\n\t\t\tbb1[k1][l1] = ((long long) dq[m][k1][l1][0] * (A - 2) + dq[m][k1][l1][1] + dq[m][k1][l1][2]) % MD;\n\tfor (k2 = 0; k2 <= n - m; k2++)\n\t\tfor (l2 = 0; k2 + l2 <= n - m; l2++)\n\t\t\tbb2[k2][l2] = ((long long) dq[n - m][k2][l2][0] * (A - 2) + dq[n - m][k2][l2][1] + dq[n - m][k2][l2][2]) % MD;\n\tfor (k1 = 0; k1 <= m; k1++)\n\t\tfor (k2 = max(n / 3 + 1 - k1, 0); k2 <= n - m; k2++)\n\t\t\tfor (l1 = 0; k1 + l1 <= m; l1++)\n\t\t\t\tfor (l2 = max(n / 3 + 1 - l1, 0); k2 + l2 <= n - m; l2++)\n\t\t\t\t\tds[k1 + k2][l1 + l2] = (ds[k1 + k2][l1 + l2] + (long long) bb1[k1][l1] * bb2[k2][l2]) % MD;\n\tans = A * A;\n\tfor (i = 2; i < n; i++)\n\t\tans = (long long) ans * (A - 1) % MD;\n\tfor (a = 0; a < A; a++)\n\t\tfor (k = kk[a] + 1; k <= n; k++)\n\t\t\tans = (ans - dr[k]) % MD;\n\tfor (a = 0; a < A; a++)\n\t\tfor (b = a + 1; b < A; b++)\n\t\t\tfor (k = kk[a] + 1; k <= n; k++)\n\t\t\t\tfor (l = kk[b] + 1; k + l <= n; l++)\n\t\t\t\t\tans = (ans + ds[k][l]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9adc28856fe8d9b252ba1c9ec7188a2b", "src_uid": "1f012349f4b229dc98faadf1ca732355", "difficulty": 2700.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c37fb22f550eccb7eea2575719c6f507", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "GNU C", "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\n#define MIN(x,y) ((x)<(y))? (x) : (y)\n#define abs(x) ((x)>(0))? (x) : -(x)\n\nint main()\n{\n\tint n,x1,y1,x2,y2,r;\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) printf(\"%d\",x2+(n-y1));\n\telse if(x1==n && y2==0) printf(\"%d\",(n-x2)+y1);\n\telse if(x2==0 && y1==n) printf(\"%d\",x1+(n-y2));\n\telse if(x2==n && y1==0) printf(\"%d\",(n-x1)+y2);\n\telse\n\t{\n\t\tr=x1+y1+x2+y2;\n\t\tprintf(\"%d\",MIN(r,(4*n-r)));\n\t}\n\tgetch();\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "728c72e0d064fdb7533d7e62ba1be564", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "\\subsection{\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03e9}\n% \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd(\ufffd\ufffd\ufffd\ufffd\u0224\ufffd\ufffd\u01bd\ufffd\u0175\ufffd\ufffd\ufffd\ufffd\ufffd\u03e4\ufffd\ufffd\ufffd)\n% \ufffd\ufffd\u0175\ufffd\u02a4\ufffd\ufffd\ufffd\ufffd\u03e1\ufffd\u036d\u033e\ufffd\u023b\u05e4\ufffd\ufffd\ufffd\u02a4\ufffd\u036d\u033e\ufffd\ufffd\ufffd\ua862\ufffd\ufffd\ufffd\ufffd\ufffd\u01e4\u02a4\ufffd\ufffd\ufffd\ufffd\ufffd\u03fa\ufffd\ufffd\ufffd\ufffd\ufffd\u0235\ufffd\ufffd\ufffd\ufffd\u01a4\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\\begin{problem}{Codeforces Round57(\ufffd\ufffd\ufffd\ufffd)}\n$(0,0),(n,0),(0,n),(n,n)$\ufffd\ufffd4\ufffd\ufffd\ufffd\ufffd\u013a\ufffd\ufffd\ufffd\u0224\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0364\ufffd\ufffd\ufffd($n$\ufffd\u03fc\ufffd\ufffd\ufffd\ufffd\ufffd)\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03bc\ufffd\ufffd\ufffd\u03b3\u02bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u037f\ufffd\ufffd\ufffd\ufffd\ufffd\ub863\ufffd\ufffd\ufffd\u03bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05a1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03bc\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0324\ufffd\ufffd\u00fb\ufffd\ufffd\u03e9\ufffd\u03b5\ufffd\u03a5\ufffd\ufffd\u05fb\ufffd\ufffd\ufffd\ufffd\ufffd\u05e5?\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u8863\n\\end{problem}\n\n% \ufffd\ufffd\ufffd\ufffd\ufffd\u03e4\u02e4\u0124\ufffd\ufffd\u01bd\ufffd\n\\begin{inputformat}\n$n$\ufffd\u06a4\ufffd2\ufffd\u02bb\ufffd\ufffd\ufffd\ufffd\u03ba\ufffd\u0278$(x_1,y_1),(x_2,y_2)$\ufffd\u03ba\ufffd\u0278\ufffd\ufffd\ufffd\ufffd\ufffd\u03bd\ufffd\ufffd\u05a4\ufffd\u023e\ufffd\u0476\ufffd\ufffd\ufffd\ufffd\ufffd\u06a4\ufffd\ufffd\u037f\ufffd\ufffd\ufffd\ufffd\ufffd\ub863$n$\ufffd\ufffd1000\ufffd\u02b2\ufffd\ufffd\u01e4\ufffd\ufffd\ua862\ufffd\u02bb\ufffd\ufffd\ufffd\ufffd\u03ba\ufffd\u0278\ufffd\u03e4\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd$n$\ufffd\u02b2\ufffd\ufffd\u01e4\ufffd\ufffd\ub863\n\\end{inputformat}\n\\begin{outputformat}\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03a4\u07e4\ufffd\ufffd\u0324\ufffd\ufffd\u00fb\ufffd\ufffd\u03e9\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0124\u01fd\ufffd\ufffd\u03e4\ufffd\ufffd\u8863\n\\end{outputformat}\n\\begin{multicols}{2}\n\\begin{inputsample}\n2 0 1 2 1\n\\end{inputsample}\n\\begin{outputsample}\n4\n\\end{outputsample}\n\\end{multicols}\n% \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\\begin{explanation}\n\ufffd\ufffd\ufffd\u023d\ufffd\u01e4\ufffd\ufffd\u0464\ufffd\ufffd\u01bd\ud952\udd24\u01a4\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0224\u02e4\u02a4\ub8632\ufffd\ufffd\ufffd\u03b0\ufffd\ufffd\u05b4\u0637\ufffd\ufffd\u01fe\ufffd\ufffd\u023d\ufffd\u01e4\uda53\ude64\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0464\uf937\ufffd\ufffd(\u00ae\ufffd\ufffd\ufffd\u03a4\ufffd\u00ae\ufffd\ufffd)\ufffd\u03a4\u01e1\ufffd\ufffd\u2926\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u00f1\ufffd\ufffd\ufffd\ufffd\u02e1\ufffd\u03e4\u02a4\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0224\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0224\u02e4\u02a4\ub863\ufffd\ufffd\ufffd\ufffd\ufffd\u01e1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u013e\ufffd\ufffd\ufffd\u0224\u07e4\u02a4\ufffd\ufffd\ufffd\u03a4\u0224\ufffd\ufffd\ub863$(0,0)$\ufffd\ufffd\ufffd\u06a4\ufffd\u03a4\u01e4\ufffd\ufffd\ub863\ufffd\ufffd\ufffd\ufffd\ufffd\u01a1\ufffd\ufffd\u0264\ufffd\ufffd\u992b\ufffd\u03bc\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u01a1\ufffd$(0,0)$\ufffd\ufffd\ufffd\ufffd\u03b5\ufffd\u03a5\ufffd\ufffd\u05fb\ufffd\ufffd\ufffd\ufffd\ub863\ufffd\ufffd\ufffd\u03b8\u5862\ufffd\u05fb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03a5\ufffd\ufffd\ufffd\u7926\ufffd\ufffd\ufffd\u0224\u01e1\ufffd\ufffd\ufffd\u03a5\ufffd\ufffd\ufffd\u0424\ub863\ufffd\u2937\ufffd\u293d\ufffd\uc92c\ufffd\ufffd\ufffd\ufffd\ufffd1\ufffd\ufffd\ufffd\ufffd\u023e\u02ac\ufffd\ufffd\ufffd\ufffd\u0139\ufffd\ufffd\ufffd\ufffd\u0421\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd1\ufffd\ufffd\ufffd\ufffd\ufffd\u993d\ufffd\u03b5\ufffd\u03a5\ufffd\ufffd\ufffd\u01a4\ufffd\ufffd\u043a\ufffd\u00fb\ufffd\ufffd\u03a5\ufffd\u02e4\u02a4\ub863\n\\end{explanation}\n\n% \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\\verb|seigyo_bc_sano_9.c|\n\n\\newpage\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0161e5a5914c4784343faa65f967c747", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "GNU C11", "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 }", "lang_cluster": "C", "compilation_error": true, "code_uid": "4b6b57b9945dca5c23af50678f74134e", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "bfcc1aaa55c2f99c639ea21f9e9c581e", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9dae1c7f53f651541ae3d9bf8e24711", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "64ae239467d2e6f121955e380585a73e", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "72490fd09da4a5f5c2e7aa486176925e", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0} {"lang": "GNU C", "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 <= r; a *= x)\n\t\tfor (b = 1; b <= r; b *= y)\n\t\t\tif (a + b >= l && a + b <= r)\n\t\t\t\taa[k++] = a + b;\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2da0e37ac476cbcc0318801aa0b82d17", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define Ma 35+5\ntypedef long long ll;\nll dp[Ma+1][Ma+1],small[Ma+1][Ma+1];\nint n,h,i,j,k;\nll agg;\nint main(void)\n{\n scanf(\"%d %d\",&n,&h);\n dp[0][0]=1;\n for(j=0;j<=Ma;++j) small[0][j]=1;\n dp[1][1]=1;\n for(i=1;i<=n;++i){\n \tfor(j=2;j<=Ma;++j){\n \t\tfor(k=0;k\n#include \n\ntypedef long long int lli;//se declara lli como tipo de dato long long int\nlli matriz[36][36];//una matriz de 36*36 de tipo lli\n\nint main(int argc, char const *argv[]){\n int n,h;\n scanf(\"%d%d\",&n,&h);\n\n for(int k=1;k<=n;k++){\n matriz[0][k-1]=1;\n for(int i=1;i<=n;i++) \n \tfor(int j=0;j\n\n#define SIZE_N 36\n\ntypedef __int64 llg;\n\nllg fit[SIZE_N][SIZE_N];\n\nvoid initeFit()\n{\n int i,j,k;\n\n fit[0][0] = 1;\n for(i = 1;i < SIZE_N;i ++) {\n for(j = 1;j <= i;j ++) {\n for(k = 0;k < i;k ++) {\n fit[i][j] += fit[k][j-1] * fit[i-k-1][0] + fit[k][0] * fit[i-k-1][j-1] - fit[k][j-1] * fit[i-k-1][j-1];\n }\n }\n fit[i][0] = fit[i][1];\n }\n}\n\nint main()\n{\n int n,h;\n\n initeFit();\n while(scanf(\"%d%d\",&n,&h) != EOF) {\n printf(\"%I64d\\n\",fit[n][h]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a65123f9b491bc2de95dc397df5e563f", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() {\n\tlong long **dp, *trees;\n\tint n, h;\n\tint i, j, n1, n2;\n\n\tscanf(\"%d%d\", &n, &h);\n\ttrees = calloc(n + 1, sizeof(long long));\n\tdp = calloc(n + 1, sizeof(long long *)); \n\tdp[0] = calloc(n + 1, sizeof(long long));\n\tdp[1] = calloc(n + 1, sizeof(long long));\n\n\ttrees[0] = 1;\n\tfor (i = 1; i <= n; i++)\n\t\tfor (n1 = 0; n1 < i; n1++) {\n\t\t\tn2 = i - 1 - n1;\n\t\t\ttrees[i] += (trees[n1] * trees[n2]);\n\t\t}\n\n\tdp[1][0] = dp[1][1] = 1;\n\tfor (i = 2; i <= n; i++) {\n\t\tdp[i] = calloc(n + 1, sizeof(long long));\n\t\tfor (j = 1; j <= i; j++) {\n\t\t\tfor (n1 = 0; n1 < i; n1++) {\n\t\t\t\tn2 = i - 1 - n1;\n\t\t\t\tdp[i][j] += (trees[n1] * dp[n2][j - 1]);\n\t\t\t\tdp[i][j] += (trees[n2] * dp[n1][j - 1]);\n\t\t\t\tdp[i][j] -= (dp[n1][j - 1] * dp[n2][j - 1]);\n\t\t\t }\n\t\t}\n\t\tdp[i][0] = dp[i][1];\n\t}\n\tprintf(\"%lld\\n\", dp[n][h]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "db8288b7c7c65520321666cc61487fa2", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "\n #include\n\n#define SIZE_N 36\n\ntypedef __int64 llg;\n\nllg fit[SIZE_N][SIZE_N];\n\nvoid initeFit()\n{\n int i,j,k;\n\n fit[0][0] = 1;\n for(i = 1;i < SIZE_N;i ++) {\n for(j = 1;j <= i;j ++) {\n for(k = 0;k < i;k ++) {\n fit[i][j] += fit[k][j-1] * fit[i-k-1][0] + fit[k][0] * fit[i-k-1][j-1] - fit[k][j-1] * fit[i-k-1][j-1];\n }\n }\n fit[i][0] = fit[i][1];\n }\n}\n\nint main()\n{\n int n,h;\n\n initeFit();\n while(scanf(\"%d%d\",&n,&h) != EOF) {\n printf(\"%I64d\\n\",fit[n][h]);\n }\n return 0;\n}\n\u2192Judgement Protocol\nPrueba: # 1, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n3 2\nSalida\n5\nResponder\n5\ncorrector de registro\nok 1 number(s): \"5\"\nPrueba: # 2, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n3 3\nSalida\n4\nResponder\n4\ncorrector de registro\nok 1 number(s): \"4\"\nPrueba: # 3, tiempo: 0ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n1 1\nSalida\n1\nResponder\n1\ncorrector de registro\nok 1 number(s): \"1\"\nPrueba: # 4, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n2 1\nSalida\n2\nResponder\n2\ncorrector de registro\nok 1 number(s): \"2\"\nPrueba: # 5, tiempo: 30ms, la memoria:. 16KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n2 2\nSalida\n2\nResponder\n2\ncorrector de registro\nok 1 number(s): \"2\"\nPrueba: # 6, tiempo: 30ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n27 11\nSalida\n61162698256896\nResponder\n61162698256896\ncorrector de registro\nok 1 number(s): \"61162698256896\"\nPrueba: # 7, tiempo: 0ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n32 27\nSalida\n22643872890880\nResponder\n22643872890880\ncorrector de registro\nok 1 number(s): \"22643872890880\"\nPrueba: # 8, tiempo: 30ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n4 1\nSalida\n14\nResponder\n14\ncorrector de registro\nok 1 number(s): \"14\"\nPrueba: # 9, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n9 1\nSalida\n4862\nResponder\n4862\ncorrector de registro\nok 1 number(s): \"4862\"\nPrueba: # 10, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n33 4\nSalida\n212336130412243110\nResponder\n212336130412243110\ncorrector de registro\nok 1 number(s): \"212336130412243110\"\nPrueba: # 11, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n4 4\nSalida\n8\nResponder\n8\ncorrector de registro\nok 1 number(s): \"8\"\nPrueba: # 12, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n8 5\nSalida\n1336\nResponder\n1336\ncorrector de registro\nok 1 number(s): \"1336\"\nPrueba: # 13, tiempo: 30ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n12 8\nSalida\n127200\nResponder\n127200\ncorrector de registro\nok 1 number(s): \"127200\"\nPrueba: # 14, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n15 5\nSalida\n9694844\nResponder\n9694844\ncorrector de registro\nok 1 number(s): \"9694844\"\nPrueba: # 15, tiempo: 0ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n19 18\nSalida\n2424832\nResponder\n2424832\ncorrector de registro\nok 1 number(s): \"2424832\"\nPrueba: # 16, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n23 17\nSalida\n19649347584\nResponder\n19649347584\ncorrector de registro\nok 1 number(s): \"19649347584\"\nPrueba: # 17, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n27 15\nSalida\n25162319484928\nResponder\n25162319484928\ncorrector de registro\nok 1 number(s): \"25162319484928\"\nPrueba: # 18, tiempo: 0ms, la memoria:. 0KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n29 14\nSalida\n577801978306560\nResponder\n577801978306560\ncorrector de registro\nok 1 number(s): \"577801978306560\"\nPrueba: # 19, tiempo: 30ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n33 18\nSalida\n54307238601375744\nResponder\n54307238601375744\ncorrector de registro\nok 1 number(s): \"54307238601375744\"\nPrueba: # 20, tiempo: 30ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n7 7\nSalida\n64\nResponder\n64\ncorrector de registro\nok 1 number(s): \"64\"\nPrueba: # 21, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n23 21\nSalida\n275251200\nResponder\n275251200\ncorrector de registro\nok 1 number(s): \"275251200\"\nPrueba: # 22, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n7 3\nSalida\n429\nResponder\n429\ncorrector de registro\nok 1 number(s): \"429\"\nPrueba: # 23, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n21 18\nSalida\n211156992\nResponder\n211156992\ncorrector de registro\nok 1 number(s): \"211156992\"\nPrueba: # 24, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n4 1\nSalida\n14\nResponder\n14\ncorrector de registro\nok 1 number(s): \"14\"\nPrueba: # 25, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n21 12\nSalida\n12153990144\nResponder\n12153990144\ncorrector de registro\nok 1 number(s): \"12153990144\"\nPrueba: # 26, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n35 13\nSalida\n2690352397519398400\nResponder\n2690352397519398400\ncorrector de registro\nok 1 number(s): \"2690352397519398400\"\nPrueba: # 27, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n19 2\nSalida\n1767263190\nResponder\n1767263190\ncorrector de registro\nok 1 number(s): \"1767263190\"\nPrueba: # 28, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n33 26\nSalida\n434871797284864\nResponder\n434871797284864\ncorrector de registro\nok 1 number(s): \"434871797284864\"\nPrueba: # 29, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n16 9\nSalida\n25607552\nResponder\n25607552\ncorrector de registro\nok 1 number(s): \"25607552\"\nPrueba: # 30, tiempo: 0ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n16 14\nSalida\n1032192\nResponder\n1032192\ncorrector de registro\nok 1 number(s): \"1032192\"\nPrueba: # 31, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n10 2\nSalida\n16796\nResponder\n16796\ncorrector de registro\nok 1 number(s): \"16796\"\nPrueba: # 32, tiempo: 30ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n4 4\nSalida\n8\nResponder\n8\ncorrector de registro\nok 1 number(s): \"8\"\nPrueba: # 33, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n33 17\nSalida\n75307983624118272\nResponder\n75307983624118272\ncorrector de registro\nok 1 number(s): \"75307983624118272\"\nPrueba: # 34, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n27 25\nSalida\n6081740800\nResponder\n6081740800\ncorrector de registro\nok 1 number(s): \"6081740800\"\nPrueba: # 35, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n20 14\nSalida\n1094473728\nResponder\n1094473728\ncorrector de registro\nok 1 number(s): \"1094473728\"\nPrueba: # 36, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n16 11\nSalida\n11819008\nResponder\n11819008\ncorrector de registro\nok 1 number(s): \"11819008\"\nPrueba: # 37, tiempo: 30ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n10 10\nSalida\n512\nResponder\n512\ncorrector de registro\nok 1 number(s): \"512\"\nPrueba: # 38, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n4 3\nSalida\n14\nResponder\n14\ncorrector de registro\nok 1 number(s): \"14\"\nPrueba: # 39, tiempo: 0ms, la memoria:. 0KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n33 21\nSalida\n14830955929665536\nResponder\n14830955929665536\ncorrector de registro\nok 1 number(s): \"14830955929665536\"\nPrueba: # 40, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n24 20\nSalida\n8171945984\nResponder\n8171945984\ncorrector de registro\nok 1 number(s): \"8171945984\"\nPrueba: # 41, tiempo: 0ms, la memoria:. 16KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n30 16\nSalida\n1375710400053248\nResponder\n1375710400053248\ncorrector de registro\nok 1 number(s): \"1375710400053248\"\nPrueba: # 42, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n3 2\nSalida\n5\nResponder\n5\ncorrector de registro\nok 1 number(s): \"5\"\nPrueba: # 43, tiempo: 0ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n9 4\nSalida\n4862\nResponder\n4862\ncorrector de registro\nok 1 number(s): \"4862\"\nPrueba: # 44, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n16 5\nSalida\n35357670\nResponder\n35357670\ncorrector de registro\nok 1 number(s): \"35357670\"\nPrueba: # 45, tiempo: 0ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n22 22\nSalida\n2097152\nResponder\n2097152\ncorrector de registro\nok 1 number(s): \"2097152\"\nPrueba: # 46, tiempo: 30ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n28 23\nSalida\n739948625920\nResponder\n739948625920\ncorrector de registro\nok 1 number(s): \"739948625920\"\nPrueba: # 47, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n34 1\nSalida\n812944042149730764\nResponder\n812944042149730764\ncorrector de registro\nok 1 number(s): \"812944042149730764\"\nPrueba: # 48, tiempo: 30ms, la memoria:. 4KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n7 4\nSalida\n428\nResponder\n428\ncorrector de registro\nok 1 number(s): \"428\"\nPrueba: # 49, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n14 11\nSalida\n488448\nResponder\n488448\ncorrector de registro\nok 1 number(s): \"488448\"\nPrueba: # 50, tiempo: 0ms, la memoria:. 12KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n35 1\nSalida\n3116285494907301262\nResponder\n3116285494907301262\ncorrector de registro\nok 1 number(s): \"3116285494907301262\"\nPrueba: # 51, tiempo: 0ms, la memoria:. 8KB, c\u00f3digo de salida: 0, c\u00f3digo de salida corrector: 0, veredicto:OK\nEntrada\n35 35\nSalida\n17179869184\nResponder\n17179869184\ncorrector de registro\nok 1 number(s): \"17179869184\"\nclose", "lang_cluster": "C", "compilation_error": true, "code_uid": "629820d16a2ed6b769ac761e986e7ed4", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\nusing namespace std;\r\n\r\nconst int mxN = 2e5+5;\r\nint n, a[105], dp[105][mxN];\r\nint main() {\r\n\tscanf(\"%d\", &n);\r\n\tint sum = 0;\r\n\tfor(int i=0; i bool {\r\n\t\tfor(int i=1; i<=n; ++i)\r\n\t\t\tfor(int j=0; j<=sum; ++j) {\r\n\t\t\t\tif(a[i-1] > j)\r\n\t\t\t\t\tdp[i][j] = dp[i-1][j];\r\n\t\t\t\telse \r\n\t\t\t\t\tdp[i][j] = max(dp[i-1][j], dp[i-1][j-a[i-1]]+1);\r\n\t\t\t}\r\n\t\treturn dp[n][sum];\r\n\t};\r\n\tif(!check())\r\n\t\tprintf(\"0\\n\");\r\n\telse {\r\n\t\tint tmp=0, ans=1;\r\n\t\tfor(int i=0; i\r\n\r\nint a[128], mem[128][204800];\r\n\r\nint main(void) {\r\n int n, s = 0;\r\n scanf(\"%d\", &n);\r\n for (int i = 1; i <= n; i++) {\r\n scanf(\"%d\", &a[i]);\r\n }\r\n mem[0][0] = 1;\r\n for (int i = 1; i <= n; i++) {\r\n s += a[i];\r\n for (int j = 0; j <= s; j++) {\r\n if (j >= a[i] && mem[i - 1][j - a[i]]) mem[i][j] = 1;\r\n else if (mem[i - 1][j]) mem[i][j] = 1;\r\n }\r\n }\r\n if (s & 1) printf(\"0\");\r\n else if (mem[n][s / 2]) {\r\n printf(\"1\\n\");\r\n for (int i = 1; i <= n; i++) {\r\n if (a[i] & 1) {\r\n printf(\"%d\", i);\r\n return 0;\r\n }\r\n else if (!mem[n][(s - a[i]) / 2]) {\r\n printf(\"%d\", i);\r\n return 0;\r\n }\r\n }\r\n return 1;\r\n }\r\n else printf(\"0\");\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c91f710f5cf9e946b0f406a5b0de5c1f", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "/* Codeforce 1516c: Baby Ehab Partitions Again */\n\n#include \n#include \n#include \n\n#define N_INT 105\n#define MAX_SUM 200005\n#define min(a,b) ((a)<(b)? (a): (b))\n\nchar got [MAX_SUM];\n\nint issumto(int a[], int n, int sum)\n{ int i,j,last;\n\n memset(got, 0, sum+1); got[0]=1; last=0;\n for(i=0; i=0; j--) \n if(got[j]) got[j+a[i]] = 1;\n last = min(last+a[i], sum);\n }\n return got[sum];\n}\n\nint main(int argc, char *argv[])\n{ int i,n, sum, ans;\n int a [N_INT];\n\n scanf(\"%d\", &n);\n for(sum=i=0; i\r\n#include \r\n#include \r\n#include \r\n\r\nbool possible[200100];\r\n\r\nint main(void) {\r\n int n;\r\n int a[110];\r\n scanf(\"%d\", &n);\r\n int sum = 0;\r\n for (int i = 0; i < n; i++) {\r\n scanf(\"%d\", &a[i]);\r\n sum += a[i];\r\n }\r\n if (sum % 2 == 1) {\r\n puts(\"0\");\r\n return 0;\r\n }\r\n int target = sum / 2;\r\n int smallest_power = 10;\r\n possible[0] = true;\r\n for (int i = 0; i < n; i++) {\r\n int ctz = __builtin_ctz(a[i]);\r\n if (ctz < smallest_power) smallest_power = ctz;\r\n for (int j = target; j >= a[i]; j--) {\r\n if (possible[j - a[i]]) possible[j] = true;\r\n }\r\n }\r\n if (!possible[target]) {\r\n puts(\"0\");\r\n return 0;\r\n }\r\n for (int i = 0; i < n; i++) {\r\n if ((a[i] >> smallest_power) % 2 == 1) {\r\n printf(\"1\\n%d\\n\", i + 1);\r\n return 0;\r\n }\r\n }\r\n assert(false);\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9fd75214de910d1dc31c41e3cb59645", "src_uid": "29063ad54712b4911c6bf871969ee147", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nint main(){\r\n int n;\r\n scanf(\"%d\",&n);\r\n int arr[n];\r\n int sum=0;\r\n\r\n for(int j=0;j\nint main()\n{\n\tlong long n;\n\tscanf(\"%lld\", &n);\n\tint a[111], j = 0, sum=0, i = 0;\n\twhile(n>=16)\n\t{\n\t\ta[i] = n %16;\n\t\ti++;\n\t\tn /= 16;\n\t}\n\ta[i] = n;\n\tfor (j = 0; j < i; j++)\n\t{\n\t\tif (a[j] == 0 || a[j] == 4 || a[j] == 6 || a[j] == 9 || a[j] == 10 || a[j] == 13)\n\t\t\tsum += 1;\n\t\tif (a[j] == 8 || a[j] == 11)\n\t\t\tsum += 2;\n\t}\n\tprintf(\"%d\", sum);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8d9ccd60714016f2f24040f24059afe", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nunsigned loopCounts[16] = { 1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 2, 0, 0 };\n\nint main() {\n unsigned n;\n scanf(\"%u\", &n);\n unsigned loopCount = 0;\n while (n) {\n loopCount += loopCounts[n & 0xf];\n n >>= 4;\n }\n printf(\"%u\\n\", loopCount);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "82301048ee2de386a60ee5e5687f463e", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nchar itoc(int c)\n{\n if(c >= 0 && c <= 9)\n return c + '0';\n else\n return c - 10 + 'A';\n}\n\nint main()\n{\n char s[100];\n int num, i = 0;\n scanf(\"%d\", &num);\n\n if(num == 0)\n {\n printf(\"1\\n\");\n return 0;\n }\n\n while(num)\n {\n s[i++] = itoc(num % 16);\n num /= 16;\n }\n s[i] = '\\0';\n\n i = 0;\n int sum = 0;\n while(s[i] != '\\0')\n {\n if(s[i] == '0' || s[i] == '4' || s[i] == '6' || s[i] == '9')\n sum++;\n if(s[i] == 'A' || s[i] == 'D')\n sum++;\n if(s[i] == '8' || s[i] == 'B')\n sum += 2;\n i++;\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a147e409ff9d5d751a2b7bba3226c027", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tlong long n;\n\tscanf(\"%lld\", &n);\n\tint a[111], j = 0, sum=0, i = 1;\n\twhile(n>=16)\n\t{\n\t\ta[i-1] = n %16;\n\t\ti++;\n\t\tn /= 16;\n\t}\n\ta[i-1] = n;\n\tfor (j = 0; j < i; j++)\n\t{\n\t\tif (a[j] == 0 || a[j] == 4 || a[j] == 6 || a[j] == 9 || a[j] == 10 || a[j] == 13)\n\t\t\tsum += 1;\n\t\tif (a[j] == 8 || a[j] == 11)\n\t\t\tsum += 2;\n\t}\n\tprintf(\"%d\", sum);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6d28231cf5ab997ca24d8f47d70093ec", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\nint main(void)\n{\n\tunsigned x, y, result = 0;\n\tscanf(\"%u\", &x);\n\tdo {\n\t\ty = x & 15;\n\t\tx >>= 4;\n\t\tif (y == 0 || y == 4 || y == 6 || y == 9 || y == 10 || y == 13){\n\t\t\tresult++;\n\t\t}\n\t\tif (y == 8 || y == 11){\n\t\t\tresult += 2;\n\t\t}\n\t} while (x);\n\tprintf(\"%d\", result);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "11978f721d95b15d9ade1595b350d5c1", "src_uid": "16a784cb9953bc91cb2e7767b04b76f2", "difficulty": 2000.0} {"lang": "GNU C", "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\\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],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\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 \n\nenum {\n N = 1010\n};\nconst int MOD = 1e9 + 7;\n\nint c[N][N];\n\nint binom(int n, int m) {\n if(m == n || m == 0)\n return 1;\n if(n == 0)\n return 0;\n if(c[n][m] != -1)\n return c[n][m];\n return c[n][m] = (binom(n - 1, m - 1) + binom(n - 1, m)) % MOD;\n}\n\nint main() {\n int n, m, k;\n memset(c, -1, sizeof(c));\n scanf(\"%d %d %d\", &n, &m, &k);\n long long val = binom(n - 1, 2 * k);\n val *= binom(m - 1, 2 * k);\n printf(\"%d\\n\", (int)(val % MOD));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "217aec1d4fb755d8d573ed3d47ba7b9b", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n#define MOD\t1000000007\n\nint power(int a, int b) {\n\tint p;\n\n\tif (b == 0)\n\t\treturn 1;\n\tp = power(a, b / 2);\n\tp = (long long) p * p % MOD;\n\tif (b % 2 == 1)\n\t\tp = (long long) p * a % MOD;\n\treturn p;\n}\n\nint inv(int x) {\n\treturn power(x, MOD - 2);\n}\n\nint fact(int n, int is_inv) {\n\treturn n == 0 ? 1\n\t\t: (long long) fact(n - 1, is_inv) * (is_inv ? inv(n) : n) % MOD;\n}\n\nint choose(int n, int k) {\n\treturn (long long) ((long long) fact(n, 0) * fact(k, 1) % MOD)\n\t\t* fact(n - k, 1) % MOD;\n}\n\nint main() {\n\tint n, m, k;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tprintf(\"%lld\\n\", n - 1 < 2 * k || m - 1 < 2 * k ? 0\n\t\t\t: (long long) choose(n - 1, 2 * k) * choose(m - 1, 2 * k) % MOD);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a297fc0e8a9c8b4142bbbe4fbbc003a3", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nlong long dp[1001][500];\nint mod = 1000000007;\n\nint dfs(int n, int k)\n{\n int i;\n\n if (dp[n][k] >= 0) return dp[n][k];\n\n if (k == 1) {\n\treturn dp[n][k] = (n - 2) * (n - 1) / 2;\n }\n\n dp[n][k] = 0;\n\n for (i = k * 2 - 1; i <= n - 2; i++) {\n\tdp[n][k] = (dp[n][k] + (long long)dfs(i, k - 1) * (n - i - 1)) % mod;\n }\n\n return dp[n][k];\n}\n\nint main()\n{\n int n, m, k, i, j;\n\n scanf(\"%d %d %d\", &n, &m, &k);\n\n if (k * 2 >= n || k * 2 >= m) {\n\tputs(\"0\");\n\n\treturn 0;\n }\n\n for (i = 0; i <= 1000; i++) {\n\tfor (j = 0; j <= k; j++) {\n\t dp[i][j] = -1;\n\t}\n }\n\n printf(\"%d\\n\", (int)((long long)dfs(n, k) * dfs(m, k) % mod));\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d731962f82d0756bc8f1a965983da375", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#include \n#include \n\n#define MOD 1000000007\n\nlong long waysToPlay(int n, int m, int k);\nlong long oldWaysToPlay(int n, int m, int k, long long mult);\nlong long choose(long long a, long long b);\n\nlong long oldWays;\nlong long known[1000][1000][1000];\n\nint main() {\n int n, m, k;\n scanf(\"%d %d %d\", &n, &m, &k);\n\n // n: dimension\n // y: dimension\n // k: amount of moves\n\n printf(\"%I64d\\n\", (choose(n-1, 2*k) * choose(m-1, 2*k)) % MOD);\n\n oldWays = 0;\n //long long ways = waysToPlay(n, m, k) % MOD;\n //printf(\"%lld\\n\")\n //printf(\"%lld\\n\", ways);\n\n // Old\n //oldWaysToPlay(n, m, k, 1);\n //printf(\"%lld\\n\", oldWays);\n\n return EXIT_SUCCESS;\n}\n\nlong long waysToPlay(int n, int m, int k) {\n // 6, 7, 2\n // \n // 4, 4, 1 => 9\n // 6, 7, 2 => 75\n\n // If no more moves\n if (k == 0) {\n return 1;\n } else if (k == 1) {\n //printf(\"%d %d %d %lld\\n\", n, m, k, choose(n-1, 2) * choose(m-1, 2));\n return choose(n-1, 2) * choose(m-1, 2);\n } else {\n // For 5x5 (3x3)\n // Answer = 36\n // k = 1\n // x = 4c2\n // y = 4c2\n\n // 10 * 10 = 100\n\n // Smallest cases\n int n_small = 1 + 2*(k-1);\n int m_small = 1 + 2*(k-1);\n long long ways = 0;\n\n // They must be TWO less\n for (int n_i = n_small; n_i < n-1; n_i++) {\n for (int m_i = m_small; m_i < m-1; m_i++) {\n // The amount of positions that the new rectangle\n // can fit into\n int newMult = (n-n_i-1)*(m-m_i-1);\n\n // Cache the result\n if (known[m_i][n_i][k-1] == 0) {\n known[m_i][n_i][k-1] = waysToPlay(n_i, m_i, k-1);\n }\n\n // Add it to ways\n ways += newMult * known[m_i][n_i][k-1];\n }\n }\n\n //printf(\"%d %d %d %lld\\n\", n, m, k, ways);\n \n return ways;\n }\n\n // Otherwise there are no ways\n return 0;\n}\n\nlong long choose(long long a, long long b) {\n if (b > a) return 0;\n\n //aCb = a!/((a-b)!*b!)\n // = a*(a-1)...(a-b+1)/\n // b*(b-1)...1\n\n // = a*(a-1)...(a-b+1)/\n // 1*2*......b\n\n long long result = 1;\n for (int i = 0; i < b; i++) {\n result = (result * (a-i)) % MOD;\n result = (result / (i+1)) % MOD;\n }\n\n //printf(\"%lldC%lld = %lld\\n\", a, b, result);\n return result % MOD;\n}\n\n\n//OLD method\nlong long oldWaysToPlay(int n, int m, int k, long long mult) {\n // 3x3 in 6x7 (4x5)\n if (k == 0) {\n oldWays = (oldWays+mult) % MOD;\n //printf(\"+ %lld\\n\", mult);\n } else if (k == 1 && n == 1 && m == 1) {\n oldWays = (oldWays+mult) % MOD;\n } else {\n // Smallest cases\n int n_small = 1 + 2*(k-1);\n int m_small = 1 + 2*(k-1);\n\n // How many places it can go X inside solutions\n\n // They must be TWO less\n for (int n_i = n_small; n_i < n-1; n_i++) {\n for (int m_i = m_small; m_i < m-1; m_i++) {\n // Positional permutation (x,y and y,x)\n // int twice = (m_i != n_i) ? 2 : 1;\n\n //printf(\"passing: %d %d %lld\\n\", n_i, m_i, mult);\n oldWaysToPlay(n_i, m_i, k-1, mult*(n-n_i-1)*(m-m_i-1));\n }\n }\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "57a17ce4a56e8647218511f6744aed4e", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f625338dea12c9e971421a363719e486", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "difficulty": 2100.0} {"lang": "GNU C11", "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(n1>nm)\n ans=nm,l=mid+1;\n else\n h=mid-1;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c762feef6802deaa9b90adce41cfb31a", "src_uid": "78d013b01497053b8e321fe7b6ce3760", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tlong long int i,sayi,a,b,n = 0,sonuc,ensonuc = 0;\n\tscanf(\"%lld %lld\",&a,&b);\n\tfor(i = a ; i <= b ; i++){\n\t\tsayi = i;\n\t\tsonuc = 0;\n\t\twhile(sayi>=1){\n\t\t\tif(sayi%2==0)\n\t\t\t\tsonuc++;\n\t\t\tsayi=sayi/2;\n\t\t\tn++;\n\t\t}\n\t\tif(sonuc==1)\n\t\t\tensonuc++;\n\t}\n\tprintf(\"%lld\",ensonuc);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5b36b1da01fd133600ad22183e5f10a0", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tunsigned long long int s, e, cnt=0, curcnt, cn, temp, temp2;\n\tscanf(\"%llu %llu\",&s, &e);\n\tfor(temp=s;temp<=e;temp++){\n\t\t//printf(\"%llu\\n\",temp);\n\t\tfor(cn=temp,curcnt=0;cn>0;cn=cn>>1){\n\t\t\ttemp2=cn&1;\n\t\t\tif(temp2==0)curcnt++;\n\t\t\tif(curcnt==2) break;\n\t\t}\n\t\tif(curcnt==1) cnt++;\n\t}\n\tprintf(\"%llu\\n\",cnt);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "34546b5d3fe4111c0bda1f86ed7c19fe", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\nint weekday_count[8] = {0, 52, 52, 52, 52, 53, 53, 52};\nint month_days[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\nint main()\n{\n int x, running = 1;\n int i, ans = 0;\n scanf(\"%d\", &x);\n while (running) switch (getchar()) {\n case 'w':\n printf(\"%d\\n\", weekday_count[x]);\n running = 0; break;\n case 'm':\n for (i = 1; i <= 12; ++i) if (month_days[i] >= x) ++ans;\n printf(\"%d\\n\", ans);\n running = 0; break;\n default: break;\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "23a64927f0b89aa1b951223deefc844b", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include\nint main(){\n\tlong long int i,sayi,a,b,n = 0,sonuc,ensonuc = 0;\n\tscanf(\"%l64d %l64d\",&a,&b);\n\tfor(i = a ; i <= b ; i++){\n\t\tsayi = i;\n\t\tsonuc = 0;\n\t\twhile(sayi>=1){\n\t\t\tif(sayi%2==0)\n\t\t\t\tsonuc++;\n\t\t\tsayi=sayi/2;\n\t\t\tn++;\n\t\t}\n\t\tif(sonuc==1)\n\t\t\tensonuc++;\n\t}\n\tprintf(\"%l64d\",ensonuc);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "225c7367b25f05131bd24041c36b9ee1", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0} {"lang": "GNU C", "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\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\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 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b9b642b40e6d29fa8d67ec980dad1fb6", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc9aef07e6ae729c14024657acc917b9", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "difficulty": 1700.0} {"lang": "GNU C", "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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f72644e6c1cb18a55ecdbb2d313f628b", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae1b60dbdfb87e01c931da567134e76d", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main()\n{\n//while(1){\n int n=0;int x,j;int i=1;int l=1;unsigned long long s=0;//printf(\"%llu\",s);\n int k=0;char ks[61];\n //printf(\"%d\\t\",n);\n scanf(\"%d\",&n);\n scanf(\"%s\",ks);\n //printf(\"%d\\t\",n);\n //printf(\"%s\\t\",ks);\n s=strlen(ks);\n //printf(\"%d\\n\",s);\n for(j=s-1;j>=0 && j>s-10;j--)\n {\n //printf(\"kd[%d]:%c\\t\",j,ks[j]);printf(\"l:%d\\t\",l);\n k+=(ks[j]-'0')*l;l*=10;\n //printf(\"k:%d\\n\",k);\n }\n l=j;\n //printf(\"k:%d\\t\",k);printf(\"l:%d\\n\",l);\n s=n-1;\n do\n {\n s=s/10;i*=10;\n }while(s>0);\n s=0;int y,m;\n //printf(\"n:%d\\t\",n);\n //printf(\"i:%d\\n\",i);\n unsigned long long b=1;\n while(k>0 || l>0)\n {\n x=k%i;\n //printf(\"%d\\t\",k);\n //printf(\"%d\\n\",x);\n if(x0);\n //printf(\"y:%d\\t\",y);printf(\"m:%d\\n\",m);\n s+=x*b;b*=n;k/=m;\n //printf(\"s:%d\\t\",s);\n //printf(\"b:%llu\\t\",b);//printf(\"k:%d\\n\",k);\n for(j=l;j>=0 && m>1;j--)\n {\n m/=10;\n //printf(\"%d::%c\",j,ks[j]);\n k+=(ks[j]-'0')*(100000000/m);\n //printf(\"k:%d\\n\",k);//printf(\"m:%d\\t\",m);\n }\n l=j;\n //printf(\"<:%llu\\n\",s);\n }\n else\n {\n x=x%(i/10);m=1;y=x;\n do\n {\n y/=10;m*=10;\n }while(y>0);\n s+=x*b;b*=n;k/=m;\n for(j=l;j>=0 && m>1;j--)\n {\n m/=10;k+=(ks[j]-'0')*(100000000/m);\n }\n l=j;\n //printf(\">:%llu\\n\",s);\n\n }\n }\n printf(\"%I64d\\n\",s);\n}\n//}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1ff7f8e924247a13e8e23f3c30d1e04", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n\n\n\nint main()\n{\n\n int n,x,i=1;\n long int k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n long int s=n-1;\n do\n {\n s=s/10;i*=10;\n }while(s>0);\n\n s=0;int j=i/10;int y,m;\n\n int b=1;\n while(k>0)\n {\n x=k%i;\n if(x0);\n s+=x*b;b*=n;k/=m;\n }\n else\n {\n y=x%j;m=1;\n do\n {\n y/=10;m*=10;\n }while(y>0);\n s+=(x%m)*b;b*=n;k/=m;}\n }\n printf(\"%d\\n\",s);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3ff90dd0d508bcefcc593608442bc42", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "/*\n * =====================================================================================\n *\n * Filename: main.c\n *\n * Description: \n *\n * Version: 1.0\n * Created: 19/01/17 19:54:22\n * Revision: none\n * Compiler: gcc\n *\n * Author: YOUR NAME (), \n * Company: \n *\n * =====================================================================================\n */\n\n#include \n#include \n#include \n\nint \nwidth(long x) \n{\n int i = 0;\n while (x > 0) {\n i++;\n x /= 10;\n }\n return i;\n}\n\nint \nconvert(char *beg, char *end) \n{\n long res = 0;\n while ((uintptr_t)beg < (uintptr_t)end) {\n res = res * 10 + (*beg - '0');\n beg++;\n }\n return res;\n}\n\nint \nmin(int i, int j)\n{\n if (i < j)\n return i;\n else\n return j;\n}\n\nint\nmain()\n{\n long n;\n char k[61];\n scanf(\"%ld\", &n);\n scanf(\"%s\", k);\n \n int w = width(n - 1);\n long base[w+2];\n base[1] = -1; base[2] = 9;\n for (int i = 3; i <= w; ++i)\n base[i] = base[i-1] * 10 + 9;\n\n long x = 0;\n long basen = 1;\n for (int i = strlen(k); i > 0; --i) {\n for (int j = min(w, i); j > 0; --j) {\n //printf(\"x: %ld, part: %.*s\\n\", x, j, &k[i-j]);\n long part = convert(&k[i-j], &k[i]);\n if (part < n && part > base[j]) {\n x += basen * part;\n i -= j - 1;\n break;\n }\n }\n basen *= n;\n }\n printf(\"%ld\\n\", x);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "455135a3996b095139f895f65623c830", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n\n\n\nint main()\n{\n\n int n,x,i=1;\n long int k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n int s=n-1;\n do\n {\n s=s/10;i*=10;\n }while(s>0);\n\n s=0;int j=i/10;int y,m;\n\n int b=1;\n while(k>0)\n {\n x=k%i;\n if(x0);\n s+=x*b;b*=n;k/=m;\n }\n else\n {\n y=x%j;m=1;\n do\n {\n y/=10;m*=10;\n }while(y>0);\n s+=(x%m)*b;b*=n;k/=m;}\n }\n printf(\"%d\\n\",s);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b46941ea9a4e73ab252c2ccc6e3b8259", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\n\n\n\nint main()\n{\n int n,k,x,i=1;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n int s=n;\n while(s>0)\n {\n s=s/10;i*=10;\n }\n s=0;int j=i/10;\n\n int b=1;\n while(k!=0)\n {\n x=k%i;\n if(x\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 \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2ed17a2639a67835e8b83fa54a430097", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "df3239a2cd88a54140a04be9a027d942", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "difficulty": 1700.0} {"lang": "GNU C", "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\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\toc[a%7]++;\n\t\ta/=7;\n\t\tsum++;\n\t}\n\t\n\twhile(b)\n\t{\n\t\toc[b%7]++;\n\t\tb/=7;\n\t\tsum++;\n\t}\n\t\n\twhile(i<7)\n\t{\n\t\tif(oc[i]>1) flag=1;\n\t\ti++;\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(i>7) printf(\"0\");\n\t\n\telse\n\t{\n\t\ti=0;\n\t\twhile(i\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "df8bd561d96184ff9415c8b3880cadff", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0eebc4d56430a414258838200b17201d", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "563aa23e52041ca893ae6346617d3979", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "09b997e6a7ebc8bf5014583ff655b4e5", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b0472d85b2214195222c88a8d2b5fdd8", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nint A[99],F,I,T,i,j,r;\nint main(){\n\tchar s[99];\n\tscanf(\"%d%d%d\",&F,&I,&T);\n\tfor(i=0;i=T)r++;\n\tprintf(\"%d\\n\",r);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "00363542334631068059de815e38f20e", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \nint a[20][20]; int main() {long i, j, k, f, t, res; char s[200]; scanf(\"%ld %ld %ld \", &f, &k, &t); for (i = 0; i < f; i++) {scanf(\"%s \", s); for (j = 0; j < k; j++) {a[i][j] = s[j] == 'Y';}} res = 0; for (j = 0; j < k; j++) {long c = 0; for (i = 0; i < f; i++) {if (a[i][j]) c++;} if (c >= t) res++;} printf(\"%ld\\n\", res); return 0;}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "746b3859839d5d249589f86499ab7d2a", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n\n int F, I, T;\n scanf(\"%d %d %d\", &F, &I, &T);\n\n int i = 0;\n int j = 0;\n int count[I];\n for(i=0;i=T)c++;\n }\n printf(\"%d\\n\",c);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "10ba64488ce34795d1f8664fcffd4234", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint a[20][20];\n\nint main()\n{\n long i, j, k, f, t, res;\n char s[200];\n\n scanf(\"%ld %ld %ld \", &f, &k, &t);\n for (i = 0; i < f; i++) {\n scanf(\"%s \", s);\n for (j = 0; j < k; j++) {\n\t a[i][j] = s[j] == 'Y';\n }\n }\n\n res = 0;\n for (j = 0; j < k; j++) {\n long c = 0;\n for (i = 0; i < f; i++) {\n\t if (a[i][j]) c++;\n }\n if (c >= t) res++;\n }\n printf(\"%ld\\n\", res);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c98a0fd03ec114e3beed79453728d2d2", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "II = lambda: int(raw_input())\nIAI = lambda: map(int, raw_input().split())\nIL = lambda: raw_input().strip()\nIAS = lambda: raw_input().split()\n\nf,i,t = IAI()\n\nL=[]\nfor _ in range(f): L += [IL()]\n\no=0\nfor c in xrange(i):\n if sum(l[c]=='Y' for l in L) >= t: o += 1\nprint o\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "7e650735aed4a4b5f0a70f74a0ad889a", "src_uid": "4c978130187e8ae6ca013d3f781b064e", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint x[100100];\nint main()\n{\nlong long i,j,k,n,max,min;\nmax=0;\nmin=-1;\nscanf(\"%I64d\",&n);\nfor(i=1;i<=n;i++)\n for(j=1;j<=n;j++)\n{\n if(i*j>n)\n break;\n for(k=1;k<=n;k++)\n {\n if(i*j*k>n)\n break;\n else if(i*j*k==n)\n {\n if((i+1)*(j+2)*(k+2)>max)\n max=(i+1)*(j+2)*(k+2);\n if(min==-1)\n min=(i+1)*(j+2)*(k+2);\n else if((i+1)*(j+2)*(k+2)\n#include \n#include \n\nint main() {\n long long int i,n;\n long long int min=1000000000,max;\n scanf(\"%lld\",&n);\n //printf(\"%lld\\n\",n);\n //printf(\"%lld\\n\",(long long int)sqrtl(n));\n for (i=1;i<=(long long int)sqrtl(n);i++) {\n if (n%i==0) {\n //printf(\"%lld\\n\",min);\n if ((i+2)*(n/i+2)\nint x[100100];\nint main()\n{\nlong long i,j,k,n,max,min;\nmax=0;\nmin=-1;\nscanf(\"%I64d\",&n);\nfor(i=1;i<=n;i++)\n for(j=1;j<=n;j++)\n{\n\n if(i*j>n)\n break;\n for(k=1;k<=n;k++)\n {\n if(i*j*k>n)\n break;\nif(i*j*k==n)\n{\n\n if(min==-1)\n min=(i+1)*(j+2)*(k+2);\n else if((i+1)*(j+2)*(k+2)\n#include\nint x[100100];\nint main()\n{\nlong long i,j,k,n,max,min;\nmax=0;\nmin=-1;\nscanf(\"%I64d\",&n);\nfor(i=1;i<=n;i++)\n for(j=1;j<=n;j++)\n{\n\nif(i*j*(n/i/j)>n)\n break;\nif(i*j*(n/i/j)==n)\n{\n if(min==-1)\n min=(i+1)*(j+2)*((n/i/j)+2);\n else if(min>(i+1)*(j+2)*((n/i/j)+2))\n min=(i+1)*(j+2)*((n/i/j)+2);\n\n}\n }\nmax=3*3*(n+1);\n\tprintf(\"%I64d %I64d\\n\",min-n,max-n);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "803c60f6702d6edeaabd14d274afc25f", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\ntypedef unsigned long long ull;\n\nint main(void){\n ull n,sq1,sq2,max,min=99999999999999999,i,j,h=0,x,y,z,m,a;\n scanf(\"%I64\",&n);\n max=9*(n+1)-n;\n sq1=sqrt(n);\n for(i=1;i<=sq1;i++){\n if(n%i==0){\n //printf(\"%I64\\n\",n%i);\n z=i;\n m=n/i;\n sq2=sqrt(m);\n for(j=1;j<=sq2;j++){\n\tif(m%j==0){\n\t x=j;\n\t y=m/j;\n\t if(min>(z+1)*(x+2)*(y+2)-n) min=(z+1)*(x+2)*(y+2)-n;\n\t}\n }\n }\n }\t \n printf(\"%I64 %I64\\n\",min,max);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b8f653c460c7abca509c338149776f30", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\nint md;\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\nvoid mult(int aa[][2], int bb[][2], int cc[][2]) {\n\tint i, j, k;\n\n\tfor (i = 0; i < 2; i++)\n\t\tfor (j = 0; j < 2; j++) {\n\t\t\tlong long c = 0;\n\n\t\t\tfor (k = 0; k < 2; k++)\n\t\t\t\tc += (long long) aa[i][k] * bb[k][j];\n\t\t\tcc[i][j] = c % md;\n\t\t}\n}\n\nvoid power_(int aa[][2], int pp[][2], int tt[][2], long long k) {\n\tif (k == 0) {\n\t\tpp[0][0] = pp[1][1] = 1;\n\t\tpp[0][1] = pp[1][0] = 0;\n\t\treturn;\n\t}\n\tif (k % 2 == 0) {\n\t\tpower_(aa, tt, pp, k / 2);\n\t\tmult(tt, tt, pp);\n\t} else {\n\t\tpower_(aa, pp, tt, k / 2);\n\t\tmult(pp, pp, tt);\n\t\tmult(tt, aa, pp);\n\t}\n}\n\nint main() {\n\tstatic int aa[2][2], pp[2][2], tt[2][2];\n\tlong long n, k, x0, x1, ans;\n\tint l, h;\n\n\tscanf(\"%lld%lld%d%d\", &n, &k, &l, &md);\n\tif (l < 63 && k >= 1LL << l) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\taa[0][0] = 1, aa[0][1] = 1;\n\taa[1][0] = 1, aa[1][1] = 0;\n\tpower_(aa, pp, tt, n);\n\tx0 = (pp[0][0] + pp[0][1]) % md;\n\tx1 = (power(2, n) - x0 + md) % md;\n\tans = 1 % md;\n\tfor (h = 0; h < l; h++)\n\t\tans = ans * ((k & 1LL << h) == 0 ? x0 : x1) % md;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c8c9fa8d9ae293402b7b787d2dcfcc83", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\nint md;\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\nvoid mult(int aa[][2], int bb[][2], int cc[][2]) {\n\tint i, j, k;\n\n\tfor (i = 0; i < 2; i++)\n\t\tfor (j = 0; j < 2; j++) {\n\t\t\tlong long c = 0;\n\n\t\t\tfor (k = 0; k < 2; k++)\n\t\t\t\tc += (long long) aa[i][k] * bb[k][j];\n\t\t\tcc[i][j] = c % md;\n\t\t}\n}\n\nvoid power_(int aa[][2], int pp[][2], int tt[][2], long long k) {\n\tif (k == 0) {\n\t\tpp[0][0] = pp[1][1] = 1;\n\t\tpp[0][1] = pp[1][0] = 0;\n\t\treturn;\n\t}\n\tif (k % 2 == 0) {\n\t\tpower_(aa, tt, pp, k / 2);\n\t\tmult(tt, tt, pp);\n\t} else {\n\t\tpower_(aa, pp, tt, k / 2);\n\t\tmult(pp, pp, tt);\n\t\tmult(tt, aa, pp);\n\t}\n}\n\nint main() {\n\tstatic int aa[2][2], pp[2][2], tt[2][2];\n\tlong long n, k, x0, x1, ans;\n\tint l, h;\n\n\tscanf(\"%lld%lld%d%d\", &n, &k, &l, &md);\n\tif (l < 64 && k >= 1LL << l) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\taa[0][0] = 1, aa[0][1] = 1;\n\taa[1][0] = 1, aa[1][1] = 0;\n\tpower_(aa, pp, tt, n);\n\tx0 = (pp[0][0] + pp[0][1]) % md;\n\tx1 = (power(2, n) - x0 + md) % md;\n\tans = 1 % md;\n\tfor (h = 0; h < l; h++)\n\t\tans = ans * ((k & 1LL << h) == 0 ? x0 : x1) % md;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f2c124b779236e7e9c19b7c2cd3bf6f", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n\nlong long int gcd(long long int x, long long int y);\nlong long int max(long long int x, long long int y);\nlong long int min(long long int x, long long int y);\n\nint main(void){\n\n long long int x,y;\n scanf(\"%I64d %I64d\", &x, &y);\n\n long long int count = 0;\n do{\n count++;\n y = y-gcd(x,y);\n } while(y != 0);\n printf(\"%I64d\", count);\n return 0;\n}\n\nlong long int gcd(long long int x, long long int y){\n long long int a = max(x,y);\n long long int b = min(x,y);\n long long int r;\n do{\n r = a%b;\n a = b;\n b = r;\n } while(r != 0);\n return a;\n}\n\nlong long int max(long long int x, long long int y){\n if(x<=y){\n return y;\n } else {\n return x;\n }\n}\n\nlong long int min(long long int x, long long int y){\n if(x<=y){\n return x;\n } else {\n return y;\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9cf1400c0940e10b0424d59993c66a77", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long int gcd(long long int x, long long int y);\nlong long int max(long long int x, long long int y);\nlong long int min(long long int x, long long int y);\n\nint main(void){\n\n long long int x,y;\n scanf(\"%I64d %I64d\", &x, &y);\n long long int func = 0;\n\n long long int tempx = x;\n long long int tempy = y;\n\n tempx = x/gcd(x,y);\n tempy = y/gcd(x,y);\n x = tempx;\n y = tempy;\n if(x==1){\n func=func+y;\n printf(\"%I64d\", y);\n return 0;\n }\n\n long long int primex[40];\n for(int i=0; i<40; i++){\n primex[i] = 0;\n }\n int arraycount = 0;\n if(tempx%2==0){\n while(tempx%2==0){\n primex[arraycount] = 2;\n arraycount++;\n tempx = tempx/2;\n }\n }\n for(int i=3; i<=sqrt(tempx); i=i+2){\n if(tempx%i==0){\n while(tempx%i==0){\n primex[arraycount] = i;\n arraycount++;\n tempx = tempx/i;\n }\n }\n }\n if(tempx>2){\n primex[arraycount] = tempx;\n arraycount++;\n }\n tempx = x;\n\n int remainder[40];\n for(int i=0; i<40; i++){\n remainder[i] = -1;\n }\n\n for(int i=0; iremainder[i]){\n minrem = i;\n }\n }\n\n func = func + remainder[minrem];\n y = y - remainder[minrem];\n\n long long int primegcd[40];\n for(int i=0; i<40; i++){\n primegcd[i] = 0;\n }\n int gcdarraycount = 0;\n int gcdnum;\n int deletecount = 0;\n\n while(y != 0){\n\n gcdarraycount = 0;\n gcdnum = gcd(x,y);\n\n if(gcdnum%2==0){\n while(gcdnum%2==0){\n primegcd[gcdarraycount] = 2;\n gcdarraycount++;\n gcdnum = gcdnum/2;\n }\n }\n for(int i=3; i<=sqrt(gcdnum); i=i+2){\n if(gcdnum%i==0){\n while(gcdnum%i==0){\n primegcd[gcdarraycount] = i;\n gcdarraycount++;\n gcdnum = gcdnum/i;\n }\n }\n }\n if(gcdnum>2){\n primegcd[gcdarraycount] = gcdnum;\n gcdarraycount++;\n }\n\n deletecount = 0;\n while(deletecountremainder[i]){\n minrem = i;\n }\n }\n\n func = func + remainder[minrem];\n y = y - remainder[minrem];\n }\n\n printf(\"%I64d\", func);\n return 0;\n}\n\nlong long int gcd(long long int x, long long int y){\n long long int a = max(x,y);\n long long int b = min(x,y);\n long long int r;\n do{\n r = a%b;\n a = b;\n b = r;\n } while(r != 0);\n return a;\n}\n\nlong long int max(long long int x, long long int y){\n if(x<=y){\n return y;\n } else {\n return x;\n }\n}\n\nlong long int min(long long int x, long long int y){\n if(x<=y){\n return x;\n } else {\n return y;\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "720fb90fc42bb71195a07884e9eb6eaf", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long int gcd(long long int x, long long int y);\nlong long int max(long long int x, long long int y);\nlong long int min(long long int x, long long int y);\n\nint main(void){\n\n long long int x,y;\n scanf(\"%I64d %I64d\", &x, &y);\n long long int func = 0;\n\n long long int tempx = x;\n long long int tempy = y;\n\n tempx = x/gcd(x,y);\n tempy = y/gcd(x,y);\n x = tempx;\n y = tempy;\n if(x==1){\n func=func+y;\n printf(\"%I64d\", y);\n return 0;\n }\n\n long long int primex[40];\n for(int i=0; i<40; i++){\n primex[i] = 0;\n }\n int arraycount = 0;\n if(tempx%2==0){\n while(tempx%2==0){\n primex[arraycount] = 2;\n arraycount++;\n tempx = tempx/2;\n }\n }\n for(int i=3; i<=sqrt(tempx); i=i+2){\n if(tempx%i==0){\n while(tempx%i==0){\n primex[arraycount] = i;\n arraycount++;\n tempx = tempx/i;\n }\n }\n }\n if(tempx>2){\n primex[arraycount] = tempx;\n arraycount++;\n }\n tempx = x;\n\n long long int remainder[40];\n for(int i=0; i<40; i++){\n remainder[i] = -1;\n }\n\n for(int i=0; iremainder[i]){\n minrem = i;\n }\n }\n\n func = func + remainder[minrem];\n y = y - remainder[minrem];\n\n long long int primegcd[40];\n for(int i=0; i<40; i++){\n primegcd[i] = 0;\n }\n int gcdarraycount = 0;\n long long int gcdnum;\n int deletecount = 0;\n\n while(y != 0){\n\n gcdarraycount = 0;\n gcdnum = gcd(x,y);\n\n if(gcdnum%2==0){\n while(gcdnum%2==0){\n primegcd[gcdarraycount] = 2;\n gcdarraycount++;\n gcdnum = gcdnum/2;\n }\n }\n for(int i=3; i<=sqrt(gcdnum); i=i+2){\n if(gcdnum%i==0){\n while(gcdnum%i==0){\n primegcd[gcdarraycount] = i;\n gcdarraycount++;\n gcdnum = gcdnum/i;\n }\n }\n }\n if(gcdnum>2){\n primegcd[gcdarraycount] = gcdnum;\n gcdarraycount++;\n }\n\n deletecount = 0;\n while(deletecountremainder[i]){\n minrem = i;\n }\n }\n\n func = func + remainder[minrem];\n y = y - remainder[minrem];\n }\n\n printf(\"%I64d\", func);\n return 0;\n}\n\nlong long int gcd(long long int x, long long int y){\n long long int a = max(x,y);\n long long int b = min(x,y);\n long long int r;\n do{\n r = a%b;\n a = b;\n b = r;\n } while(r != 0);\n return a;\n}\n\nlong long int max(long long int x, long long int y){\n if(x<=y){\n return y;\n } else {\n return x;\n }\n}\n\nlong long int min(long long int x, long long int y){\n if(x<=y){\n return x;\n } else {\n return y;\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0a72ba0d0e03bd570b2b1ba1e613037", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define MIN(a,b) ((a) < (b)? (a) : (b))\ntypedef unsigned long long ull_t;\ntypedef unsigned long ul_t;\n\n#define MAX_FAC ((size_t)1E2)\nul_t pfac[MAX_FAC];\nul_t new_pfac[MAX_FAC];\nsize_t n;\n\nint\nbuild_pfac(ull_t x)\n{\n\tfor(ull_t i=2; i*i <= x ;i++)\n\t\twhile(x % i == 0) x/=i, pfac[n++]=i;\n\tif(x > 1)\n\t\tpfac[n++] = x;\n\treturn n > 1;\n}\n\nint main(int argc,char *argv[])\n{\n\tull_t a,b;\n\tassert(scanf(\"%I64u%I64u\",&a,&b)==2);\n\tull_t acc=0;\n\n\tif(!build_pfac(a)){\n\t\tacc = b%a + b/a;\n\t\tgoto print_res;\n\t}\n\n\twhile(b){\n\t\tull_t tmp = b;\n\t\tfor(size_t i=0; i\n#include \n#include \n#include \n\n#define MIN(a,b) ((a) < (b)? (a) : (b))\ntypedef unsigned long long ull_t;\ntypedef unsigned long ul_t;\n\n#define MAX_FAC 65\nul_t pfac[MAX_FAC];\nul_t new_pfac[MAX_FAC];\nsize_t n;\n\nint\nbuild_pfac(ull_t x)\n{\n\tfor(ull_t i=2; i*i <= x ;i++)\n\t\twhile(x % i == 0) x/=i, pfac[n++]=i;\n\tif(x > 1)\n\t\tpfac[n++] = x;\n\treturn n > 1;\n}\n\nint main(int argc,char *argv[])\n{\n\tull_t a,b;\n\tassert(scanf(\"%I64u%I64u\",&a,&b)==2);\n\tull_t acc=0;\n\n\tif(!build_pfac(a)){\n\t\tacc = b%a + b/a;\n\t\tgoto print_res;\n\t}\n\n\twhile(b){\n\t\tull_t tmp = b;\n\t\tfor(size_t i=0; i\n#include \n\n#define N\t16\n#define A\t120\t/* N * (N - 1) / 2 */\n\nint main() {\n\tstatic int dp[1 << N][A + 1], rr[N], bb[N];\n\tstatic char cc[N];\n\tint n, i, x, a, rsum, bsum, min;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"\\n%c%d%d\", &cc[i], &rr[i], &bb[i]);\n\tfor (x = 0; x < 1 << n; x++)\n\t\tfor (a = 0; a <= A; a++)\n\t\t\tdp[x][a] = -1;\n\tdp[0][0] = 0;\n\tfor (x = 0; x < 1 << n; x++) {\n\t\tint rcnt, bcnt;\n\n\t\trcnt = bcnt = 0;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif ((x & 1 << i) > 0) {\n\t\t\t\tif (cc[i] == 'R')\n\t\t\t\t\trcnt++;\n\t\t\t\telse\n\t\t\t\t\tbcnt++;\n\t\t\t}\n\t\tfor (a = 0; a <= A; a++)\n\t\t\tif (dp[x][a] >= 0)\n\t\t\t\tfor (i = 0; i < n; i++)\n\t\t\t\t\tif ((x & 1 << i) == 0) {\n\t\t\t\t\t\tint r_ = rr[i] < rcnt ? rr[i] : rcnt;\n\t\t\t\t\t\tint b_ = bb[i] < bcnt ? bb[i] : bcnt;\n\n\t\t\t\t\t\tif (dp[x | 1 << i][a + r_] < dp[x][a] + b_)\n\t\t\t\t\t\t\tdp[x | 1 << i][a + r_] = dp[x][a] + b_;\n\t\t\t\t\t}\n\t}\n\trsum = bsum = 0;\n\tfor (i = 0; i < n; i++) {\n\t\trsum += rr[i];\n\t\tbsum += bb[i];\n\t}\n\tmin = INT_MAX;\n\tfor (a = 0; a <= A; a++)\n\t\tif (dp[(1 << n) - 1][a] >= 0) {\n\t\t\tint max = bsum - dp[(1 << n) - 1][a];\n\n\t\t\tif (max < rsum - a)\n\t\t\t\tmax = rsum - a;\n\t\t\tif (min > max)\n\t\t\t\tmin = max;\n\t\t}\n\tprintf(\"%d\\n\", min + n);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1694ba5c6459ed8c394f76c76c47e617", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#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 INF 1000000000\n\nint n,c[20],r[20],b[20],rcnt[66000],bcnt[66000],dp[66000][2][260];\nint next(int b);\n\nint main(void)\n{\n //freopen(\"cards.in\",\"r\",stdin);\n //freopen(\"cards.out\",\"w\",stdout);\n scanf(\"%d\",&n);\n int i,j,k,r0=0,b0=0;\n for(i=1;i<=n;i++)\n {\n while(isspace(c[i]=getchar()));\n scanf(\"%d%d\",&r[i],&b[i]);\n if(r[i]>n)\n {\n r0+=r[i]-n;\n r[i]=n;\n }\n if(b[i]>n)\n {\n b0+=b[i]-n;\n b[i]=n;\n }\n }\n for(i=0;i<1<=0;k--)\n for(i=(1<tb-j)\n dp[i][0][j]=MIN(dp[i][0][j],tr+dp[i|(1<tr-j)\n dp[i][1][j]=MIN(dp[i][1][j],tb+dp[i|(1<b0)\n printf(\"%d\\n\",r0+dp[0][0][MIN(r0-b0,n*n)]);\n else printf(\"%d\\n\",b0+dp[0][1][MIN(b0-r0,n*n)]);\n return 0;\n}\n\nint next(int b)\n{\n if(!b) return 1<\n#include \n#include \n#include \n\n#define MAX 16\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\nconst double multiplier = 0.97;\n\nchar str[MAX], color[MAX];\nint n, m, last[MAX], order[MAX], R[MAX], B[MAX];\n\ndouble rand_real(){\n return (double)rand() / RAND_MAX;\n}\n\nint solve(){\n int i, j, res = 0, red = 0, blue = 0, rcard = 0, bcard = 0;\n\n for (j = 0; j < n; j++){\n i = order[j];\n int req_red = max(R[i] - rcard, 0);\n int req_blue = max(B[i] - bcard, 0);\n\n int buy_red = max(req_red - red, 0);\n int buy_blue = max(req_blue - blue, 0);\n\n int tokens_bought = max(buy_red, buy_blue);\n\n res += tokens_bought;\n red += tokens_bought, blue += tokens_bought;\n red -= req_red, blue -= req_blue;\n\n if (color[i] == 'R') rcard++;\n else bcard++;\n }\n return res + n;\n}\n\nint main(){\n int t, i, j, k, x, lim, res, cur, next;\n\n while (scanf(\"%d\", &n) != EOF){\n for (i = 0; i < n; i++){\n scanf(\"%s %d %d\", str, &R[i], &B[i]);\n color[i] = str[0];\n }\n for (i = 0; i < n; i++) order[i] = i;\n\n\n double temperature = 2e5;\n cur = res = solve(), lim = 2e5;\n\n for (t = 0; t < lim; t++){\n m = 1;\n for (i = 0; i < n; i++) last[i] = order[i];\n\n while (m--){\n i = rand() % n, j = rand() % n;\n x = order[i], order[i] = order[j], order[j] = x;\n }\n\n next = solve();\n if (next < res) res = next;\n\n if (next < cur) cur = next;\n else{\n double p = exp((double)-(next - cur) / temperature);\n if (rand_real() <= p) cur = next;\n else{\n for (i = 0; i < n; i++) order[i] = last[i];\n }\n }\n\n if (temperature > 1e-20) temperature *= multiplier;\n }\n\n printf(\"%d\\n\", res);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bfbdc03e7bf0b9ed3b48797a62f481e3", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define MAX 16\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\nconst double multiplier = 0.97;\n\nchar str[MAX], color[MAX];\nint n, m, last[MAX], order[MAX], R[MAX], B[MAX];\n\ndouble rand_real(){\n return (double)rand() / RAND_MAX;\n}\n\nint solve(){\n int i, j, res = 0, red = 0, blue = 0, rcard = 0, bcard = 0;\n\n for (j = 0; j < n; j++){\n i = order[j];\n int req_red = max(R[i] - rcard, 0);\n int req_blue = max(B[i] - bcard, 0);\n\n int buy_red = max(req_red - red, 0);\n int buy_blue = max(req_blue - blue, 0);\n\n int tokens_bought = max(buy_red, buy_blue);\n\n res += tokens_bought;\n red += tokens_bought, blue += tokens_bought;\n red -= req_red, blue -= req_blue;\n\n if (color[i] == 'R') rcard++;\n else bcard++;\n }\n return res + n;\n}\n\nint main(){\n int t, i, j, k, x, lim, res, cur, next;\n\n while (scanf(\"%d\", &n) != EOF){\n for (i = 0; i < n; i++){\n scanf(\"%s %d %d\", str, &R[i], &B[i]);\n color[i] = str[0];\n }\n for (i = 0; i < n; i++) order[i] = i;\n\n\n double temperature = 3e5;\n cur = res = solve(), lim = 3e5;\n\n for (t = 0; t < lim; t++){\n m = 1;\n for (i = 0; i < n; i++) last[i] = order[i];\n\n while (m--){\n i = rand() % n, j = rand() % n;\n x = order[i], order[i] = order[j], order[j] = x;\n }\n\n next = solve();\n if (next < res) res = next;\n\n if (next < cur) cur = next;\n else{\n double p = exp((double)-(next - cur) / temperature);\n if (rand_real() <= p) cur = next;\n else{\n for (i = 0; i < n; i++) order[i] = last[i];\n }\n }\n\n if (temperature > 1e-20) temperature *= multiplier;\n }\n\n printf(\"%d\\n\", res);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a988ec2c899e3f1cabf95c80b0b10f1c", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define MAX 16\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\nconst double multiplier = 0.97;\n\nchar str[MAX], color[MAX];\nint n, m, last[MAX], order[MAX], R[MAX], B[MAX];\n\ndouble rand_real(){\n return (double)rand() / RAND_MAX;\n}\n\nint solve(){\n int i, j, res = 0, red = 0, blue = 0, rcard = 0, bcard = 0;\n\n for (j = 0; j < n; j++){\n i = order[j];\n int req_red = max(R[i] - rcard, 0);\n int req_blue = max(B[i] - bcard, 0);\n\n int buy_red = max(req_red - red, 0);\n int buy_blue = max(req_blue - blue, 0);\n\n int tokens_bought = max(buy_red, buy_blue);\n\n res += tokens_bought;\n red += tokens_bought, blue += tokens_bought;\n red -= req_red, blue -= req_blue;\n\n if (color[i] == 'R') rcard++;\n else bcard++;\n }\n return res + n;\n}\n\nint main(){\n int t, i, j, k, x, lim, res, cur, next;\n\n while (scanf(\"%d\", &n) != EOF){\n for (i = 0; i < n; i++){\n scanf(\"%s %d %d\", str, &R[i], &B[i]);\n color[i] = str[0];\n }\n for (i = 0; i < n; i++) order[i] = i;\n\n\n double temperature = 1666667;\n cur = res = solve(), lim = 166667;\n\n for (t = 0; t < lim; t++){\n m = (rand() & 1) + 1;\n for (i = 0; i < n; i++) last[i] = order[i];\n\n while (m--){\n i = rand() % n, j = rand() % n;\n x = order[i], order[i] = order[j], order[j] = x;\n }\n\n next = solve();\n if (next < res) res = next;\n\n if (next < cur) cur = next;\n else{\n double p = exp((double)-(next - cur) / temperature);\n if (rand_real() <= p) cur = next;\n else{\n for (i = 0; i < n; i++) order[i] = last[i];\n }\n }\n\n if (temperature > 1e-20) temperature *= multiplier;\n }\n\n printf(\"%d\\n\", res);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5870abc44f828625584f5e097571108b", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "difficulty": 2400.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "000b4992dd957182ae38e155b1eb0639", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a8591ac94b73b68d4afe466885360a2b", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "GNU C11", "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#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", "lang_cluster": "C", "compilation_error": false, "code_uid": "83af558f1c212af32f1c99581305e290", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0} {"lang": "GNU C11", "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\nint main()\n{\n int a,b,c,k;\n long long int l1=1,l2=1,l3=1,t;\n //int64_t t;\n scanf(\"%d %d %d %d\",&a,&b,&c,&k);\n while(1)\n {\n if(a==1&&c==1&&b==1||k==0)\n break;\n if(a>1)\n {\n a=a-1;\n k=k-1;\n l1++;\n if(k==0)\n break;\n //printf(\"%d--a\\n\",a);\n }\n if(b>1)\n {\n\n b=b-1;\n k=k-1;\n l2++;\n if(k==0)\n break;\n //printf(\"%d--b\\n\",b);\n }\n if(c>1)\n {\n c-=1;\n k-=1;\n l3++;\n if(k==0)\n break;\n //printf(\"%d--c\\n\",c);\n }\n\n }\n t=l1*l2*l3;\n printf(\"%\"PRId64\"\",t);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7810e787ce7962a3828cada548f51622", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nlong long int a[3],k;\nvoid quicksort(long long int a[],int start,int end)\n{\n long long int pivot=a[start],temp;\n int i=start+1,j=end;\n while(i<=j)\n {\n while(i<=j)\n {\n if(a[i]<=pivot)\n i++;\n else\n break;\n }\n while(i<=j)\n {\n if(a[j]>pivot)\n j--;\n else\n break;\n }\n if(i<=j)\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n a[start]=a[i-1];\n a[i-1]=pivot;\n \n if(start1)\n\t\t\t{\n\t\t\t\tif(a[i]<=k)\n\t\t\t\t{\n\t\t\t\t\tans=ans*a[i];\n\t\t\t\t\tk=k-a[i]+1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tans=ans*(k+1);\n\t\t\t\t\tk=0;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t\treturn 0;\n\t}*/\n\t\nreturn 0;\n}\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\n\t\t\t\n\t\n\t\n\t\t\t\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "edf3c386ff7d4d7c506768136f692ee3", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int x,y,z,k,temp;\n long long int ans;\n scanf(\"%d %d %d %d\",&x,&y,&z,&k);\n x--;\n y--;\n z--;\n if(x>y)\n {\n temp=x;\n x=y;\n y=temp;\n }\n if(y>z)\n {\n temp=y;\n y=z;\n z=temp;\n }\n if(x>y)\n {\n temp=x;\n x=y;\n y=temp;\n }\n // printf(\"%d %d %d\\n\",x,y,z);\n temp=x>k/3?k/3:x;\n ans=temp+1;\n k-=temp;\n temp=y>k/2?k/2:y;\n ans*=(temp+1);\n k-=temp;\n ans*=((z>k?k:z)+1);\n printf(\"%I64d\\n\",ans);\n //system(\"pause\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1263e4b590cdd1407314e30f73cd1fa4", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nint main(void)\n{\n long long x, y, z, k;\n\n scanf(\"%I64d%I64d%I64d%I64d\", &x, &y, &z, &k);\n\n long long a = 1, b = 1, c = 1;\n int i = 0;\n while(i < k)\n {\n if(i < k && x > 1)\n {\n x--;\n a++;\n i++;\n }\n if(i < k && y > 1)\n {\n y--;\n b++;\n i++;\n }\n if(i < k && z > 1)\n {\n z--;\n c++;\n i++;\n }\n if(x == 1 && y == 1 && z == 1)\n i = k;\n }\n\n printf(\"%I64d\", a * b * c);\n\n\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "df0b38653f5ea4e4fd38268ea37a739a", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n\nint main() {\n\tint x, y, z, k;\n\tscanf(\"%d%d%d%d\", &x, &y, &z, &k);\n\n\tint a = 1, b = 1, c = 1;\n\n\twhile (a < x && b < y && c < z && k >= 3) {\n\t\ta++; b++; c++; k -= 3;\n\t}\n\n\twhile (a < x && b < y && k >= 2) {\n\t\ta++; b++; k -= 2;\n\t}\n\n\twhile (b < y && c < z && k >= 2) {\n\t\tb++; c++; k -= 2;\n\t}\n\n\twhile (a < x && c < z && k >= 2) {\n\t\ta++; c++; k -= 2;\n\t}\n\n\twhile (a < x && k > 0) {\n\t\ta++; k--;\n\t}\n\n\twhile (b < y && k > 0) {\n\t\tb++; k--;\n\t}\n\n\twhile (c < z && k > 0) {\n\t\tc++; k--;\n\t}\n\n\tlong long v = 1LL * a * b * c;\n\tprintf(\"%I64d\\n\", v);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1857a0a401acf53d7a03097d2c59e8da", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "1420ff51533a4feb69c3e7b874a84f13", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "33e5f8071521606b04bbece90f75ed58", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0} {"lang": "GNU C", "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 \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "02388a45dd221a555b3a108eb44a86b8", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fd396d706be9e0dac826ad6eaa2a433d", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint a[1000000001];\nint count(int n,int x)\n{\n\tif(n==1)return 2;\n\tif(a[n])return a[n];\n\t a[n]=(3*count(n-1,x)%x+2)%x;\n\t return a[n];\n}\nint main()\n{\n\tint n,x;\n\tscanf(\"%d%d\",&n,&x);\n\tprintf(\"%d\",count(n,x)%x);\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5b98df7e462f42bdd64056e8756588f9", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nchar maxChar (char *str)\n{\n char c = str[0];\n\n for ( int i = 1; str[i] != '\\0'; i++)\n {\n if (c < str[i])\n {\n c = str[i];\n }\n }\n return c;\n}\n\nvoid search (char *str, char max, int pos)\n{\n if (max == 'a')\n return;\n else if (str[pos] == '\\0')\n {\n return search(str,max-1,0);\n }\n else if (str[pos] != max)\n {\n return search(str, max, pos + 1);\n }\n else if (str[pos] == max)\n {\n while ((str[pos] == (str[pos+1] + 1) || str[pos] == (str[pos-1] + 1)) && str[pos] == max)\n {\n for ( int i = pos; str[i] != '\\0'; i++)\n str[i] = str[i+1];\n pos = pos - 1;\n }\n return search(str,max,pos+1);\n }\n else\n {\n return search(str,max,pos+1);\n }\n}\n\nint main ()\n{\n int size;\n scanf(\"%d\", &size);\n char str[size];\n scanf(\"%s\", str);\n char lel;\n lel = maxChar(str);\n search(str,maxChar(str),0);\n printf(\"%d\\n\", (size - strlen(str)));\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0bb2e81573a507e18607cb0e96822774", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \nint main()\n{\n\tint i,j,k,n,m;\n\tscanf(\"%d\",&n);\n\tm=n;\n\tchar s[n+1];\n\tint a[n+1],b[n+1];\n\tscanf(\"%s\",&s);\n\tfor(i=0;i1;i--)\n\t{\n\t\tint k1=0;\n\t\twhile(k1<100)\n\t\t{\n\t\tfor(j=0;j\n#include \n\nchar maxChar (char *str)\n{\n char c = str[0];\n\n for ( int i = 1; str[i] != '\\0'; i++)\n {\n if (c < str[i])\n {\n c = str[i];\n }\n }\n return c;\n}\nint testRoutine (char *str)\n{\n for (int i = 0; str[i] != '\\0'; i++)\n {\n if (str[i] == (str[i+1] - 1) || str[i] == (str[i-1] - 1))\n {\n return 1;\n }\n }\n return 0;\n}\n\nvoid search (char *str, char max, int pos)\n{\n if (max == 'a')\n return;\n else if (str[pos] == '\\0')\n {\n return search(str,max-1,0);\n }\n else if (str[pos] != max)\n {\n return search(str, max, pos + 1);\n }\n else if (str[pos] == max)\n {\n while ((str[pos] == (str[pos+1] + 1) || str[pos] == (str[pos-1] + 1)) && str[pos] == max)\n {\n for ( int i = pos; str[i] != '\\0'; i++)\n str[i] = str[i+1];\n pos = pos - 1;\n }\n return search(str,max,pos+1);\n }\n else\n {\n return search(str,max,pos+1);\n }\n}\n\nint main ()\n{\n int size;\n scanf(\"%d\", &size);\n char str[size];\n scanf(\"%s\", str);\n char lel;\n\n while (testRoutine(str))\n {\n lel = maxChar(str);\n search(str,lel,0);\n \n }\n printf(\"%d\\n\", (size - strlen(str)));\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dea497fbd2a341e295100e67fd150a1d", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \nvoid gogo(char a[], int j, int s, int r)\n{\n for (int k = 0; k < r; k++)\n for (int i = j; i < s; i++)\n {\n a[i] = a[i + 1];\n }\n}\nint main(void)\n{\n int s, counts = 0;\n char a[105] = {0};\n scanf(\"%d\", &s);\n for (int i = 0; i < s; i++)\n {\n scanf(\" %c\", &a[i]);\n }\n for (int i = 'z'; i >= 'a'; i--)\n {\n for (int j = 0; j < strlen(a); j++)\n {\n int num = 0;\n if (a[j] == i)\n {\n if (a[j - 1] == i + 1)\n {\n for (int k = j - 1; k >= 0; k--)\n {\n if (a[k] == a[j - 1])\n {\n num++;\n }\n else\n break;\n }\n gogo(a, j - num, strlen(a), num);\n counts += num;\n if (num != 0)\n {\n j = 0;\n num = 0;\n }\n }\n if (a[j + 1] == i + 1)\n {\n for (int k = j + 1; k < strlen(a); k++)\n {\n if (a[k] == a[j + 1])\n {\n num++;\n }\n else\n break;\n }\n gogo(a, j + 1, strlen(a), num);\n counts += num;\n if (num != 0)\n {\n j = 0;\n num = 0;\n }\n }\n }\n }\n }\n printf(\"%d\\n\", counts);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "242280365a04c65762c4bec6111135ed", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \nint n=0;\nchar s[105]={'\\0'};\nchar s1[105]={'\\0'};\nchar s2[105]={'\\0'};\nchar c='b';\nint main()\n{\n int i=0,j=0,k=0,l=0;\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0;i<=n-1;i++)\n {\n s1[i]=s[i];\n s2[i]=s[i];\n }\n while(c<='z')\n {\n int start=1,last=1;\n for(i=0;i<=n-1;i++)\n {\n if(s1[i]==c)\n {\n start=i-1;\n last=i+1;\n while(s1[start]=='\\0'&&start>=0)\n {\n start--;\n }\n while(s1[last]=='\\0'&&last<=n-1)\n {\n last++;\n }\n if((start>=0)&&(s1[start]==c-1&&c-1>='a')&&(s1[i]!='\\0'))\n {\n s1[i]='\\0';\n k++;\n i=-1;\n continue;\n }\n if(last<=n-1&&(s1[last]==c-1&&c-1>='a'))\n {\n s1[i]='\\0';\n k++;\n i=-1;\n }\n }\n }\n c++;\n }\n c='z';\n while(c>='b')\n {\n int start=1,last=1;\n for(i=0;i<=n-1;i++)\n {\n if(s2[i]==c)\n {\n start=i-1;\n last=i+1;\n while(s2[start]=='\\0'&&start>=0)\n {\n start--;\n }\n while(s2[last]=='\\0'&&last<=n-1)\n {\n last++;\n }\n if((start>=0)&&(s2[start]==c-1&&c-1>='a')&&(s2[i]!='\\0'))\n {\n s2[i]='\\0';\n l++;\n i=-1;\n continue;\n }\n if(last<=n-1&&(s2[last]==c-1&&c-1>='a'))\n {\n s2[i]='\\0';\n l++;\n i=-1;\n }\n }\n }\n c--;\n }\n if(k>=l)\n printf(\"%d\\n\",k);\n else printf(\"%d\\n\",l);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dfb7c60ded9dd6264f994187d8353840", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define MD 1000000007\n\nint f[11][10], g[11][10];\n\nint a[10];\nint n;\n\nint P(int k) {\n\tint i, j = 1;\n\tfor (i = 0; i < 6; ++i) j = (long long)j * (k - i) % MD;\n\treturn j;\n}\n\nint main() {\n\tint i, j, k, l;\n\tscanf(\"%d\", &n);\n\tfor (i = 0, j = n; i < 10; ++i, j /= 10) a[i] = j % 10;\n\n\tmemset(f, 0, sizeof f), f[10][0] = 1;\n\tmemset(g, 0, sizeof g);\n\tfor (i = 9; i >= 0; --i) {\n\t\t// f -> f =\n\t\t// f -> g <\n\t\t// g -> g (any)\n\t\tk = a[i] == 4 || a[i] == 7;\n\t\tfor (j = k; j <= 9; ++j) f[i][j] = f[i + 1][j - k];\n\n\t\tfor (k = 0; k < a[i]; ++k) {\n\t\t\tl = k == 4 || k == 7;\n\t\t\tfor (j = l; j <= 9; ++j) g[i][j] += f[i + 1][j - l];\n\t\t}\n\n\t\tfor (k = 0; k <= 9; ++k) {\n\t\t\tl = k == 4 || k == 7;\n\t\t\tfor (j = l; j <= 9; ++j) g[i][j] += g[i + 1][j - l];\n\t\t}\n\t}\n\t--g[0][0]; // 0\u4e0d\u5408\u6cd5\n\n\tk = 0;\n\tfor (i = 0, l = 0; i <= 9; l += g[0][i++]) {\n\t\tg[0][i] += f[0][i];\n\t\tk += (long long)g[0][i] * P(l) % MD;\n\t\tif (k >= MD) k -= MD;\n\t}\n\tprintf(\"%d\", k);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a3e9bfe1cad72e65526cbaf14b2c036d", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nconst int mod = (int)1e9 + 7;\n\nlong long choose(long long n, int k) {\n if (k > n) {\n return 0;\n }\n \n long long p = 1;\n for (long long i = n; i > n - k; i--) {\n p *= i;\n p %= mod;\n }\n \n return p;\n}\n\nint main(void) {\n int m;\n scanf(\"%i\", &m);\n \n char s[50];\n sprintf(s, \"%i\", m);\n \n int len = strlen(s);\n long long f[len+1][len+1][2];\n\n memset(f, 0, sizeof(f));\n\n f[0][0][1] = 1;\n for (int i = 0; i < len; i++) {\n for (int j = 0; j <= len; j++) {\n for (int eq = 0; eq <= 1; eq++) {\n long long cur = f[i][j][eq];\n for (char d = '0'; d <= '9'; d++) {\n if (eq && d > s[i]) {\n continue;\n } \n int n_eq = eq && (d == s[i]);\n int is_lucky = (d == '4' || d == '7') ? 1 : 0;\n f[i+1][j+is_lucky][n_eq] += cur;\n f[i+1][j+is_lucky][n_eq] %= mod;\n }\n }\n }\n }\n\n long long counts[len+1];\n for (int i = 0; i <= len; i++) {\n counts[i] = f[len][i][0] + f[len][i][1];\n counts[i] %= mod;\n }\n counts[0] = (counts[0] + mod - 1) % mod;\n \n long long ans = 0;\n for (int i = 1; i <= len; i++) {\n long long tot = 0;\n for (int j = 0; j < i; j++) {\n tot += counts[j];\n }\n long long nways = counts[i] * choose(tot, 6) % mod;\n ans += nways;\n ans %= mod;\n }\n \n printf(\"%lld\\n\", ans);\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1694fe8fab35f0738470fb51cd44359a", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i0){\n q=r0/r1; r2=r0%r1; a2=a0-q*a1; b2=b0-q*b1;\n r0=r1; r1=r2; a0=a1; a1=a2; b0=b1; b1=b2;\n }\n *c=r0; *a=a0; *b=b0;\n}\n\nll get_inv(ll n, ll p){\n ll a,b,c;\n extended_euclid(n,p,&c,&a,&b);\n if(a= 0) return dp[depth][used][fg];\n\n d = (m / pw[depth])%10;\n ed = d;\n if(fg) ed = 9;\n\n rep(i,ed+1){\n nused = used;\n nfg = fg;\n if(i < ed) nfg = 1;\n if(i==4||i==7) nused--;\n\n res += solve(depth-1, nused, nfg);\n }\n\n return dp[depth][used][fg] = res;\n}\n\nll get_p(int a, int b){\n int i; ll res = 1;\n rep(i,b){\n res = (res * (a-i))%M;\n }\n return res;\n}\n\nll dp2[100];\n\nint main(){\n int i,j,k,l,n;\n int a,b,c,d,e,f;\n int cnt[11];\n ll res = 0, add, sum;\n\n scanf(\"%d\",&m);\n\n REP(i,1,30) inv[i] = get_inv(i, M);\n pw[0] = 1;\n REP(i,1,30) pw[i] = pw[i-1] * 10;\n\n rep(i,11) rep(j,11) rep(k,2) dp[i][j][k] = -1;\n rep(i,11) num[i] = solve(10, i, 0);\n num[0]--;\n\n rep(i,100) dp2[i] = 0;\n rep(a,10) rep(b,10) rep(c,10) if(a+b+c<=11) rep(d,10) rep(e,10) if(a+b+c+d+e<=11) rep(f,10){\n k = a+b+c+d+e+f;\n if(k > 11) continue;\n \n rep(i,10) cnt[i] = 0;\n cnt[a]++; cnt[b]++; cnt[c]++; cnt[d]++; cnt[e]++; cnt[f++];\n\n add = 1;\n rep(i,10) add = (add * get_p(num[i], cnt[i]))%M;\n dp2[k] = (dp2[k] + add)%M;\n }\n \n REP(i,1,11){\n add = num[i];\n sum = 0;\n rep(j,i) sum += dp2[j];\n sum %= M;\n res += sum * add;\n res %= M;\n }\n\n if(res < 0) res += M;\n printf(\"%d\\n\",(int)res);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "85da6d980aa6a8af57c0f7548cefa097", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint dp[11][2][11];\nlong long dp2[7][11][11];\n\nint main()\n{\n int m, n = 0, mod = 1000000007, i, j, k, l, r, p;\n long long sum = 1;\n int a[11];\n int b[11];\n \n scanf(\"%d\", &m);\n \n if (m == 7) {\n puts(\"0\");\n \n return 0;\n }\n \n while (m) {\n a[n++] = m % 10;\n m /= 10;\n }\n \n dp[n][1][0] = 1;\n \n for (i = n; i > 0; i--) {\n for (j = 0; j < 2; j++) {\n for (k = 0; k <= n; k++) {\n if (dp[i][j][k] == 0) continue;\n \n for (l = 0; l < 10; l++) {\n int c = 0;\n \n if (l == 4 || l == 7) c++;\n \n if (l < a[i - 1]) {\n dp[i - 1][0][k + c] += dp[i][j][k];\n } else if (l == a[i - 1]) {\n dp[i - 1][j][k + c] += dp[i][j][k];\n } else {\n if (j == 0) dp[i - 1][0][k + c] += dp[i][j][k];\n }\n }\n }\n }\n }\n \n dp[0][0][0]--;\n \n for (i = 0; i <= n; i++) b[i] = dp[0][0][i] + dp[0][1][i];\n \n for (i = n; i > 0; i--) {\n long long x = 0;\n \n if (b[i] == 0) continue;\n \n sum = sum * b[i] % mod;\n \n for (j = 0; j <= 6; j++) {\n for (k = 0; k <= n; k++) {\n for (l = 0; l <= n; l++) {\n dp2[j][k][l] = 0;\n }\n }\n }\n \n dp2[0][0][0] = 1;\n \n for (j = 0; j < 6; j++) {\n for (k = 0; k <= n; k++) {\n for (l = 0; l <= n; l++) {\n if (dp2[j][k][l] == 0) continue;\n \n for (r = 0; r <= 6 - j; r++) {\n long long y = 1;\n \n if (r * k + l > n) continue;\n \n if (b[k] < r) continue;\n \n for (p = 0; p < r; p++) y = y * (b[k] - p) % mod;\n \n dp2[j + r][k + 1][l + r * k] = (dp2[j + r][k + 1][l + r * k] + dp2[j][k][l] * y % mod) % mod;\n }\n }\n }\n }\n \n for (j = 0; j <= n; j++) {\n for (k = 0; k < i; k++) {\n x = (x + dp2[6][j][k]) % mod;\n }\n }\n \n sum = sum * x % mod;\n }\n \n printf(\"%d\\n\", (int)sum);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3355a0990dbd8997a14c0559038fb9c6", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint dp[11][2][11];\nlong long dp2[7][11][11];\nlong long comb[7][7];\n\nint main()\n{\n int m, n = 0, mod = 1000000007, i, j, k, l, r, p;\n long long sum = 0;\n int a[11];\n int b[11];\n \n for (i = 0; i <= 6; i++) {\n comb[i][0] = comb[i][i] = 1;\n \n for (j = 1; j < i; j++) comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;\n }\n \n scanf(\"%d\", &m);\n \n while (m) {\n a[n++] = m % 10;\n m /= 10;\n }\n \n dp[n][1][0] = 1;\n \n for (i = n; i > 0; i--) {\n for (j = 0; j < 2; j++) {\n for (k = 0; k <= n; k++) {\n if (dp[i][j][k] == 0) continue;\n \n for (l = 0; l < 10; l++) {\n int c = 0;\n \n if (l == 4 || l == 7) c++;\n \n if (l < a[i - 1]) {\n dp[i - 1][0][k + c] += dp[i][j][k];\n } else if (l == a[i - 1]) {\n dp[i - 1][j][k + c] += dp[i][j][k];\n } else {\n if (j == 0) dp[i - 1][0][k + c] += dp[i][j][k];\n }\n }\n }\n }\n }\n \n dp[0][0][0]--;\n \n for (i = 0; i <= n; i++) b[i] = dp[0][0][i] + dp[0][1][i];\n \n for (i = n; i > 0; i--) {\n long long x = 0;\n \n if (b[i] == 0) continue;\n \n for (j = 0; j <= 6; j++) {\n for (k = 0; k <= n; k++) {\n for (l = 0; l <= n; l++) {\n dp2[j][k][l] = 0;\n }\n }\n }\n \n dp2[0][0][0] = 1;\n \n for (j = 0; j < 6; j++) {\n for (k = 0; k <= n; k++) {\n for (l = 0; l <= n; l++) {\n if (dp2[j][k][l] == 0) continue;\n \n for (r = 0; r <= 6 - j; r++) {\n long long y = 1;\n \n if (r * k + l > n) continue;\n \n if (b[k] < r) continue;\n \n for (p = 0; p < r; p++) y = y * (b[k] - p) % mod;\n \n y = y * comb[6][r] % mod;\n \n dp2[j + r][k + 1][l + r * k] = (dp2[j + r][k + 1][l + r * k] + dp2[j][k][l] * y % mod) % mod;\n }\n }\n }\n }\n \n for (j = 0; j <= n; j++) {\n for (k = 0; k < i; k++) {\n x = (x + dp2[6][j][k]) % mod;\n }\n }\n \n sum = (sum + b[i] * x % mod) % mod;\n }\n \n printf(\"%d\\n\", (int)sum);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "25ed0633af05ca045db64c7c76d6c796", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "e10857837857ddc4443bea56ae12b2e6", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "01487af8d8db43f14350f75a7df8e12a", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\nint ma#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 { 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(\"%I64d\",max);\n return 0;\n }\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "c1aa2a1a4a269fb6ab830ecd11260349", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "GNU C", "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, m = 0;\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 if (r / d >= 5 && r / d <= 8) {\n\t l = max(l, reverse(r));\n } else {\n\t l = max(l, d);\n }\n\n if (l / d < 5) r = min(r, d * 5);\n\n for (i = l; i <= r; i++) {\n\t m = max(m, (long long)i * reverse(i));\n }\n\n printf(\"%I64d\\n\", m);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a39195899069712c409b6792f3eaa071", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#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 { 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(\"%I64d\",max);\n return 0;\n }\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "733e9deac6af8ee577ba3b5ff90a150c", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n\nvoid magic(int x)\n{\nif (x == -50)\nprintf(\"f(-50) = -624992.93\");\nif (x == -49)\nprintf(\"f(-49) = -588238.00\");\nif (x == -48)\nprintf(\"f(-48) = -552953.07\");\nif (x == -47)\nprintf(\"f(-47) = -519108.14\");\nif (x == -46)\nprintf(\"f(-46) = -486673.22\");\nif (x == -45)\nprintf(\"f(-45) = -455618.29\");\nif (x == -44)\nprintf(\"f(-44) = -425913.37\");\nif (x == -43)\nprintf(\"f(-43) = -397528.44\");\nif (x == -42)\nprintf(\"f(-42) = -370433.52\");\nif (x == -41)\nprintf(\"f(-41) = -344598.60\");\nif (x == -40)\nprintf(\"f(-40) = -319993.68\");\nif (x == -39)\nprintf(\"f(-39) = -296588.76\");\nif (x == -38)\nprintf(\"f(-38) = -274353.84\");\nif (x == -37)\nprintf(\"f(-37) = -253258.92\");\nif (x == -36)\nprintf(\"f(-36) = -233274.00\");\nif (x == -35)\nprintf(\"f(-35) = -214369.08\");\nif (x == -34)\nprintf(\"f(-34) = -196514.17\");\nif (x == -33)\nprintf(\"f(-33) = -179679.26\");\nif (x == -32)\nprintf(\"f(-32) = -163834.34\");\nif (x == -31)\nprintf(\"f(-31) = -148949.43\");\nif (x == -30)\nprintf(\"f(-30) = -134994.52\");\nif (x == -29)\nprintf(\"f(-29) = -121939.61\");\nif (x == -28)\nprintf(\"f(-28) = -109754.71\");\nif (x == -27)\nprintf(\"f(-27) = -98409.80\");\nif (x == -26)\nprintf(\"f(-26) = -87874.90\");\nif (x == -25)\nprintf(\"f(-25) = -78120.00\");\nif (x == -24)\nprintf(\"f(-24) = -69115.10\");\nif (x == -23)\nprintf(\"f(-23) = -60830.20\");\nif (x == -22)\nprintf(\"f(-22) = -53235.31\");\nif (x == -21)\nprintf(\"f(-21) = -46300.42\");\nif (x == -20)\nprintf(\"f(-20) = -39995.53\");\nif (x == -19)\nprintf(\"f(-19) = -34290.64\");\nif (x == -18)\nprintf(\"f(-18) = -29155.76\");\nif (x == -17)\nprintf(\"f(-17) = -24560.88\");\nif (x == -16)\nprintf(\"f(-16) = -20476.00\");\nif (x == -15)\nprintf(\"f(-15) = -16871.13\");\nif (x == -14)\nprintf(\"f(-14) = -13716.26\");\nif (x == -13)\nprintf(\"f(-13) = -10981.39\");\nif (x == -12)\nprintf(\"f(-12) = -8636.54\");\nif (x == -11)\nprintf(\"f(-11) = -6651.68\");\nif (x == -10)\nprintf(\"f(-10) = -4996.84\");\nif (x == -9)\nprintf(\"f(-9) = -3642.00\");\nif (x == -8)\nprintf(\"f(-8) = -2557.17\");\nif (x == -7)\nprintf(\"f(-7) = -1712.35\");\nif (x == -6)\nprintf(\"f(-6) = -1077.55\");\nif (x == -5)\nprintf(\"f(-5) = -622.76\");\nif (x == -4)\nprintf(\"f(-4) = -318.00\");\nif (x == -3)\nprintf(\"f(-3) = -133.27\");\nif (x == -2)\nprintf(\"f(-2) = -38.59\");\nif (x == -1)\nprintf(\"f(-1) = -4.00\");\nif (x == 0)\nprintf(\"f(0) = 0.00\");\nif (x == 1)\nprintf(\"f(1) = 6.00\");\nif (x == 2)\nprintf(\"f(2) = 41.41\");\nif (x == 3)\nprintf(\"f(3) = 136.73\");\nif (x == 4)\nprintf(\"f(4) = 322.00\");\nif (x == 5)\nprintf(\"f(5) = MAGNA NIMIS!\");\nif (x == 6)\nprintf(\"f(6) = MAGNA NIMIS!\");\nif (x == 7)\nprintf(\"f(7) = MAGNA NIMIS!\");\nif (x == 8)\nprintf(\"f(8) = MAGNA NIMIS!\");\nif (x == 9)\nprintf(\"f(9) = MAGNA NIMIS!\");\nif (x == 10)\nprintf(\"f(10) = MAGNA NIMIS!\");\nif (x == 11)\nprintf(\"f(11) = MAGNA NIMIS!\");\nif (x == 12)\nprintf(\"f(12) = MAGNA NIMIS!\");\nif (x == 13)\nprintf(\"f(13) = MAGNA NIMIS!\");\nif (x == 14)\nprintf(\"f(14) = MAGNA NIMIS!\");\nif (x == 15)\nprintf(\"f(15) = MAGNA NIMIS!\");\nif (x == 16)\nprintf(\"f(16) = MAGNA NIMIS!\");\nif (x == 17)\nprintf(\"f(17) = MAGNA NIMIS!\");\nif (x == 18)\nprintf(\"f(18) = MAGNA NIMIS!\");\nif (x == 19)\nprintf(\"f(19) = MAGNA NIMIS!\");\nif (x == 20)\nprintf(\"f(20) = MAGNA NIMIS!\");\nif (x == 21)\nprintf(\"f(21) = MAGNA NIMIS!\");\nif (x == 22)\nprintf(\"f(22) = MAGNA NIMIS!\");\nif (x == 23)\nprintf(\"f(23) = MAGNA NIMIS!\");\nif (x == 24)\nprintf(\"f(24) = MAGNA NIMIS!\");\nif (x == 25)\nprintf(\"f(25) = MAGNA NIMIS!\");\nif (x == 26)\nprintf(\"f(26) = MAGNA NIMIS!\");\nif (x == 27)\nprintf(\"f(27) = MAGNA NIMIS!\");\nif (x == 28)\nprintf(\"f(28) = MAGNA NIMIS!\");\nif (x == 29)\nprintf(\"f(29) = MAGNA NIMIS!\");\nif (x == 30)\nprintf(\"f(30) = MAGNA NIMIS!\");\nif (x == 31)\nprintf(\"f(31) = MAGNA NIMIS!\");\nif (x == 32)\nprintf(\"f(32) = MAGNA NIMIS!\");\nif (x == 33)\nprintf(\"f(33) = MAGNA NIMIS!\");\nif (x == 34)\nprintf(\"f(34) = MAGNA NIMIS!\");\nif (x == 35)\nprintf(\"f(35) = MAGNA NIMIS!\");\nif (x == 36)\nprintf(\"f(36) = MAGNA NIMIS!\");\nif (x == 37)\nprintf(\"f(37) = MAGNA NIMIS!\");\nif (x == 38)\nprintf(\"f(38) = MAGNA NIMIS!\");\nif (x == 39)\nprintf(\"f(39) = MAGNA NIMIS!\");\nif (x == 40)\nprintf(\"f(40) = MAGNA NIMIS!\");\nif (x == 41)\nprintf(\"f(41) = MAGNA NIMIS!\");\nif (x == 42)\nprintf(\"f(42) = MAGNA NIMIS!\");\nif (x == 43)\nprintf(\"f(43) = MAGNA NIMIS!\");\nif (x == 44)\nprintf(\"f(44) = MAGNA NIMIS!\");\nif (x == 45)\nprintf(\"f(45) = MAGNA NIMIS!\");\nif (x == 46)\nprintf(\"f(46) = MAGNA NIMIS!\");\nif (x == 47)\nprintf(\"f(47) = MAGNA NIMIS!\");\nif (x == 48)\nprintf(\"f(48) = MAGNA NIMIS!\");\nif (x == 49)\nprintf(\"f(49) = MAGNA NIMIS!\");\nif (x == 50)\nprintf(\"f(50) = MAGNA NIMIS!\");\nprintf(\"\\n\");\n}\n\nint main()\n{\n\tint a[11];\n\tfor (int i=0; i<11; i++)\n\t\tscanf(\"%d\",a+i);\n\tfor (int i=10; i>=0; i--)\n\t\tmagic(a[i]);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c3307f166c2a96c570de42911b21229e", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\ndouble f(double t)\n{\n return sqrt(fabs(t))+5*pow(t,3);\n}\nint main(void)\n{\n double a[11],y;\n int i,k;\n for(i=0;i<11;i++)\n scanf(\"%lf\",&a[i]);\n for(i=10;i>=0;i--)\n {\n k=a[i];\n y=f(a[i]);\n if(y>400)\n printf(\"f(%d) = MAGNA NIMIS!\\n\",k);\n else\n printf(\"f(%d) = %.2f\\n\",k,y);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cd39bd947e3ff592e7b5f16c6c4809dc", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\ndouble f(int a)\n{\n\tif(a>=0)\n\t{\n\t\treturn sqrt(a)+5*pow(a,3);\n\t}\n\telse\n\t{\n\t\treturn sqrt(-a)+5*pow(a,3);\n\t}\n}\nint main()\n{\n\tdouble b;\n\tint i,j,arr[11];\n\tfor(i=0;i<11;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tfor(i=10;i>=0;i--)\n\t{\n\t\tj=arr[i];\n\t\tb=f(arr[i]);\n\t\tif(b>400)\n\t\t{\n\t\t\tprintf(\"f(%d) = MAGNA NIMIS!\\n\",j);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"f(%d) = %0.2f\\n\",j,b);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "04e8daa6cc198767751c8e985880d42a", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\ndouble f(double a)\n{\n\tif(a>=0)\n\t{\n\t\treturn sqrt(a)+5*pow(a,3);\n\t}\n\telse\n\t{\n\t\treturn sqrt(-a)+5*pow(a,3);\n\t}\n}\nint main()\n{\n\tdouble b,arr[11];\n\tint i,j;\n\tfor(i=0;i<11;i++)\n\t{\n\t\tscanf(\"%lf\",arr[i]);\n\t}\n\tfor(i=10;i>=0;i--)\n\t{\n\t\tj=arr[i];\n\t\tb=f(arr[i]);\n\t\tif(b>400)\n\t\t{\n\t\t\tprintf(\"f(%d)=MAGNA NIMIS!\\n\",j);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"f(%d)=%0.2f\\n\",j,b);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e24c5832948db288e966da788d60a29", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n#include\ndouble f(int a)\n{\n\tif(a>=0)\n\t{\n\t\treturn sqrt(a)+5*pow(a,3);\n\t}\n\telse\n\t{\n\t\treturn sqrt(-a)+5*pow(a,3);\n\t}\n}\nint main()\n{\n\tdouble b;\n\tint i,j,arr[11];\n\tfor(i=0;i<11;i++)\n\t{\n\t\tscanf(\"%d\",arr[i]);\n\t}\n\tfor(i=10;i>=0;i--)\n\t{\n\t\tj=arr[i];\n\t\tb=f(arr[i]);\n\t\tif(b>400)\n\t\t{\n\t\t\tprintf(\"f(%d)=MAGNA NIMIS!\\n\",j);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"f(%d)=%0.2f\\n\",j,b);\n\t\t}\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "734a589df885d108f51078325501b1c7", "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\n#define cL while (getchar() != '\\n') //clear line\r\n#define fi(x) for (i = 0; i < x; i++)\r\n#define fj(x) for (j = 0; j < x; j++)\r\n#define FOR(a, b, c) for (int(a) = (b); (b) < (c) ? (a) <= (c) : (a) >= (c); (b) < (c) ? (a)++ : (a)--)\r\n#define LL long long\r\n#define min(a, b) (a > b ? b : a)\r\n#define max(a, b) (a < b ? b : a)\r\n#define pf printf\r\n#define sf scanf\r\n\r\nint main() {\r\n LL i, j;\r\n scanf(\"%lld%lld\", &i, &j);\r\n char a[2000], b[2000];\r\n memset(b, 0, sizeof(b));\r\n memset(a, 0, sizeof(a));\r\n LL p1 = 0, p2 = 0, k = 0, a1 = i, a2 = j;\r\n if (i == j) {\r\n printf(\"YES\");\r\n return 0;\r\n }\r\n if (i == 0 || j % 2 == 0) {\r\n printf(\"NO\");\r\n return 0;\r\n }\r\n while (i) {\r\n a[++p1] = i % 2 + 97, k -= i % 2;\r\n i /= 2;\r\n }\r\n while (j) {\r\n b[++p2] = j % 2 + 97, k += j % 2;\r\n j /= 2;\r\n }\r\n int k1 = strstr(b + 1, a + 1);\r\n if (k1) {\r\n if (p2 - p1 == k) {\r\n printf(\"YES\");\r\n return 0;\r\n }\r\n }\r\n FOR(i, 1, p1 / 2) {\r\n char tmp;\r\n tmp = a[i], a[i] = a[p1 + 1 - i], a[p1 + 1 - i] = tmp;\r\n }\r\n k1 = strstr(b + 1, a + 1);\r\n if (k1) {\r\n if (p2 - p1 == k) {\r\n printf(\"YES\");\r\n return 0;\r\n }\r\n }\r\n\r\n p1 = 0, p2 = 0, k = 0;\r\n i = a1, j = a2;\r\n memset(b, 0, sizeof(b));\r\n memset(a, 0, sizeof(a));\r\n\r\n while (i % 2 == 0)\r\n i /= 2;\r\n while (i) {\r\n a[++p1] = i % 2 + 97, k -= i % 2;\r\n i /= 2;\r\n }\r\n while (j) {\r\n b[++p2] = j % 2 + 97, k += j % 2;\r\n j /= 2;\r\n }\r\n k1 = strstr(b + 1, a + 1);\r\n if (k1) {\r\n if (p2 - p1 == k) {\r\n printf(\"YES\");\r\n return 0;\r\n }\r\n }\r\n FOR(i, 1, p1 / 2) {\r\n char tmp;\r\n tmp = a[i], a[i] = a[p1 + 1 - i], a[p1 + 1 - i] = tmp;\r\n }\r\n k1 = strstr(b + 1, a + 1);\r\n if (k1) {\r\n if (p2 - p1 == k) {\r\n printf(\"YES\");\r\n return 0;\r\n }\r\n }\r\n printf(\"NO\");\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "489e35277e7412f26dd9718b5dd1f035", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t62\n\nlong long rev(long long x) {\n\tlong long y = 0;\n\n\twhile (x) {\n\t\ty = y << 1 | (x & 1);\n\t\tx >>= 1;\n\t}\n\treturn y;\n}\n\nlong long padded(long long a, long long b) {\n\treturn a % b == 0 && ((a / b) & (a / b - 1)) == 0;\n}\n\nint main() {\n\tstatic int yy[N];\n\tlong long x, y, z;\n\tint n, l, r, i;\n\n\tscanf(\"%lld%lld\", &x, &y);\n\tif (x == y) {\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tif ((y & 1) == 0) {\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tn = 0;\n\twhile (y)\n\t\tyy[n++] = y & 1, y >>= 1;\n\tfor (l = 0; l < n; l++) {\n\t\tfor (r = n - 1; r >= l; r--) {\n\t\t\tif (yy[l] == 0 && yy[r] == 0)\n\t\t\t\tbreak;\n\t\t\telse if (yy[l] == 0) {\n\t\t\t\tz = 0;\n\t\t\t\tfor (i = r; i >= l; i--)\n\t\t\t\t\tz = z << 1 | yy[i];\n\t\t\t\tif (x == z) {\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t} else if (yy[r] == 0) {\n\t\t\t\tz = 0;\n\t\t\t\tfor (i = l; i <= r; i++)\n\t\t\t\t\tz = z << 1 | yy[i];\n\t\t\t\tif (x == z) {\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tz = 0;\n\t\t\t\tfor (i = l; i <= r; i++)\n\t\t\t\t\tz = z << 1 | yy[i];\n\t\t\t\tif (padded(x, z) || padded(x, rev(z))) {\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\tif (yy[l] == 0)\n\t\t\tbreak;\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6e43caf96a37e74d16dd17af46a94ea3", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nchar *reverse(char *px) {\r\n int n = strlen(px);\r\n char *perm = malloc(sizeof(char) * (n+1));\r\n for (int i = 0; i < n; i++)\r\n perm[i] = px[n-1-i];\r\n perm[n] = '\\0';\r\n return perm;\r\n}\r\n\r\nchar *gen(long long a) {\r\n char *perm = malloc(sizeof(char) * 100);\r\n int i = 0;\r\n while (a) {\r\n if (a & 1) perm[i++] = '1';\r\n else perm[i++] = '0';\r\n a >>= 1;\r\n }\r\n perm[i] = '\\0';\r\n return reverse(perm);\r\n}\r\n\r\nint check(char *y, char *x) {\r\n char *yy = malloc(sizeof(char) * 100), *xx = malloc(sizeof(char) * 100), one[100], temp[100];\r\n strcpy(xx, x), strcpy(yy, y);\r\n for (int i = 0; i < 100; i++) one[i] = '1';\r\n\r\n char *str = strstr(yy, xx);\r\n int len = strlen(xx), i;\r\n if (str != NULL) {\r\n strncpy(temp, str, len);\r\n strncpy(str, one, len);\r\n for (i = 0; yy[i] != '\\0'; i++)\r\n if (yy[i] != '1') break;\r\n strncpy(str, temp, len);\r\n\r\n if (yy[i] == '\\0') return 1;\r\n }\r\n\r\n xx = reverse(xx);\r\n\r\n str = strstr(yy, xx);\r\n if (str != NULL) {\r\n strncpy(temp, str, len);\r\n strncpy(str, one, len);\r\n for (i = 0; yy[i] != '\\0'; i++)\r\n if (yy[i] != '1') break;\r\n strncpy(str, temp, len);\r\n\r\n if (yy[i] == '\\0') return 1;\r\n }\r\n\r\n return 0;\r\n}\r\n\r\nint main() {\r\n long long x, y;\r\n scanf(\"%\"PRId64\"%\"PRId64\"\", &x, &y);\r\n int found = (x == y);\r\n char *permX = gen(x), *permY = gen(y);\r\n x = strlen(permX), y = strlen(permY);\r\n\r\n if (permX[x-1] == '1') {\r\n found |= check(permY, permX);\r\n }\r\n else {\r\n permX[x] = '1', permX[x+1] = '\\0';\r\n found |= check(permY, permX);\r\n while (permX[x-1] == '0') permX[--x] = '\\0';\r\n found |= check(permY, permX);\r\n }\r\n\r\n puts(found ? \"YES\" : \"NO\");\r\n\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "34fb3be2e8ec50c04c6b214029119912", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#define __USE_MINGW_ANSI_STDIO 0\r\n#include \r\n#include \r\n#include \r\n\r\n#define maxN 65\r\n\r\nchar str[maxN];\r\nchar tmpstr[maxN];\r\nchar tgt[maxN];\r\n\r\nint zeroCnt(char *str) {\r\n int ctr = 0;\r\n for (int i = strlen(str) - 1; i >= 0; --i) {\r\n if (str[i] == '0') ++ctr;\r\n }\r\n return ctr;\r\n}\r\n\r\nvoid trim(char *str) {\r\n for (int i = strlen(str) - 1; i >= 0; --i) {\r\n if (str[i] == '1') break;\r\n else str[i] = '\\0';\r\n }\r\n}\r\n\r\nstatic inline void cswap(char *a, char *b) {\r\n char tmp = *a;\r\n *a = *b;\r\n *b = tmp;\r\n return;\r\n}\r\n\r\nvoid reverse(char *str) {\r\n int p = 0, q = strlen(str) - 1;\r\n for (; p < q; ++p, --q) {\r\n cswap(&str[p], &str[q]);\r\n }\r\n}\r\n\r\n// bin\r\n#define lltoa(a, b) _lltoa(a, b)\r\nvoid _lltoa(long long num, char *dest) {\r\n int len = 0;\r\n while (num) {\r\n if (num % 2 == 0) dest[len++] = '0';\r\n else dest[len++] = '1';\r\n num /= 2;\r\n }\r\n dest[len] = '\\0';\r\n reverse(dest);\r\n}\r\n\r\nvoid testcase() {\r\n long long a, b;\r\n scanf(\"%lld%lld\", &a, &b);\r\n lltoa(a, str);\r\n lltoa(b, tgt);\r\n // Orig string: Either equal, or at least a 1 on the right, and any amount of 1s on the left and right after.\r\n if (strcmp(tgt, str) == 0) { printf(\"YES\\n\"); return; }\r\n // Make sure at least one 1 is on the right.\r\n strcpy(tmpstr, str);\r\n int len = strlen(tmpstr);\r\n if (tmpstr[len - 1] == '0') {\r\n tmpstr[len++] = '1';\r\n tmpstr[len] = '\\0';\r\n }\r\n if (strstr(tgt, tmpstr) && zeroCnt(tgt) == zeroCnt(tmpstr)) { printf(\"YES\\n\"); return; }\r\n // This flipped +1 string must also be used to match.\r\n reverse(tmpstr);\r\n if (strstr(tgt, tmpstr) && zeroCnt(tgt) == zeroCnt(tmpstr)) { printf(\"YES\\n\"); return; }\r\n\r\n // 2 flips performed: Completely trimmed. Add any amount of 1s to the left or right.\r\n trim(str);\r\n if (strstr(tgt, str) && zeroCnt(tgt) == zeroCnt(str)) { printf(\"YES\\n\"); return; }\r\n\r\n // 1 flip performed. Both sides start and end with a 1. Add any amounts of 1 left and right.\r\n reverse(str);\r\n trim(str);\r\n if (strstr(tgt, str) && zeroCnt(tgt) == zeroCnt(str)) { printf(\"YES\\n\"); return; }\r\n printf(\"NO\\n\");\r\n\r\n return;\r\n}\r\n\r\nint main() {\r\n testcase();\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d43575ed5a42e87a3015685d07a12c1d", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\n#include \r\n\r\nint count(long long a) {\r\n int n = 0;\r\n while (a) {\r\n n += !!(a&1);\r\n a >>= 1;\r\n }\r\n return n;\r\n}\r\n\r\nchar *gen(long long a) {\r\n char *perm = malloc(sizeof(char) * count(a));\r\n int i = 0;\r\n perm[i] = '0';\r\n while (a) {\r\n if (a & 1) perm[++i] = '0';\r\n else perm[i]++;\r\n a >>= 1;\r\n }\r\n perm[i] = '\\0';\r\n return perm;\r\n}\r\n\r\nchar *reverse(char *px) {\r\n char *perm = malloc(sizeof(char) * px[0]);\r\n int n = strlen(px);\r\n for (int i = 0; i < n; i++)\r\n perm[i] = px[n-1-i];\r\n perm[n] = '\\0';\r\n return perm;\r\n}\r\n\r\nint check(char *y, char *x) {\r\n char *str = strstr(y, x);\r\n if (str == NULL) return 0;\r\n char a[28] = \"000000000000000000000000000\", temp[27];\r\n int len = strlen(x);\r\n strncpy(temp, str, len);\r\n strncpy(str, a, len);\r\n for (int i = 0; y[i] != '\\0'; i++)\r\n if (y[i] != '0' && y[i] != '1') return 0;\r\n\r\n strncpy(str, temp, len);\r\n return 1;\r\n}\r\n\r\nint main() {\r\n long long x, y;\r\n scanf(\"%\"PRId64\"%\"PRId64\"\", &x, &y);\r\n char *permX = gen(x), *permY = gen(y);\r\n int found = check(permY, permX);\r\n found |= check(permY, permX+1);\r\n permX = reverse(permX);\r\n found |= check(permY, permX);\r\n puts(found ? \"YES\" : \"NO\");\r\n\r\n return 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e105740d6b4461f852a3efe11e3581c3", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nlong long K=998244353;\n\nlong long min(long long a, long long b){\n if(a > b)\n return b;\n return a;\n}\n\nlong long pmod(long long a, long long n, long long b){\n long long c = 1, i, pows[40], prod;\n\n prod = 1;\n pows[0]=a;\n\n for( i =1; i < 40; i++ )\n pows[i] = (pows[i-1] * pows[i-1])%b;\n \n i = 0;\n while(n > 0){\n if( n % 2 == 1)\n prod = (prod*pows[i])%b;\n\n n=n/2;\n i++;\n }\n return prod % b;\n}\n\nlong long binom(long long n, long long k){\n long long prod1, i, prod2;\n k = min(k, n-k);\n prod1 = 1;\n prod2 = 1;\n for( i = 1; i <= k; i++ ) {\n prod1 = (prod1 * i)%K;\n prod2 = (prod2 * (i + n-k ) )%K;\n }\n return (prod2 * pmod(prod1, K-2, K)) % K;\n}\n\n\n\nvoid solve(int n, int k){\n long long sum, i;\n if( k > n ){\n printf(\"0\\n\");\n return;\n }\n if( k == n ){\n printf(\"1\\n\");\n return;\n }\n if( k == 1 ){\n printf(\"%lld\\n\", n% K);\n return;\n }\n sum = binom(n-1,k-1 )%K;\n for( i = 2; i <= n/k; i++ )\n sum = (sum + binom(n/i - 1, k-1))%K;\n\n printf(\"%lld\\n\", sum % K );\n}\n\n\n\nint main(){\n long long n, k;\n scanf(\"%lld\", &n);\n scanf(\"%lld\", &k);\n solve(n,k);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "130a0d0a0b94a28fffe15347c4885fdc", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nlong long int fact[500005];\nlong long int modpow(long long int a, long long int n, long long int p)\n{\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\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, k;\n\tscanf(\"%lld %lld\", &n, &k);\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 <= n; i++)\n\t\tfact[i] = fact[i - 1] * i % p;\n\tfor (i = 1; n / i >= k; i++)\n\t\tans = (ans + comb(n / i - 1, k - 1, p)) % p;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c35202318ac6cdf9dc6a7f5622be896d", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \"stdbool.h\"\n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"ctype.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#define PI 3.14159265358979323846264338327950288\n#define ll long long\n#define MOD 998244353\n#define N 500100\n#define MAX1 101\n#define rep(i,n) for (int i=0; ib?a:b;}\nint min(int a,int b) {return ab?a:b;}\n\nint t, n, m;\nll a[N], b[N];\n\nll _pow(int i, int p) {\n\n ll ans = 1, x = i;\n for (; p; p>>=1) {\n if (p&1) ans = mul(ans, x);\n x = mul(x, x);\n }\n return ans;\n}\n\nint main() {\n scanf(\"%d%d\", &n, &m);\n a[0] = b[0] = 1;\n for (int i=1; i<=n; i++) {\n a[i] = mul(a[i-1], i);\n b[i] = mul(b[i-1], _pow(i,MOD-2));\n }\n ll ans = 0;\n for (int i=1; n/i>=m; i++) {\n ans += mul(mul(a[n / i - 1], b[m - 1]), b[n / i - m]);\n if (ans >= MOD) ans -= MOD;\n }\n printf(\"%lld\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "937eb82355e9c6e72b8e7e026b32071f", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#define mod 1000000007\n\nint f[1001],c[1001][1001],r1[1001],r2[2001];\n\nint mi(int a,long long b)\n{\n int t;\n if (!b)\n return 1;\n t=mi(a,b>>1);\n t=(long long)t*t%mod;\n if (b&1)\n t=(long long)t*a%mod;\n return t;\n}\n\nint main()\n{\n int i,j,n,m,k,x,s=0,t=1;\n scanf(\"%d%d%d\",&n,&m,&k);\n if (m==1)\n s=mi(k,n);\n else\n {\n for (i=0;i<=n;i++)\n {\n c[i][0]=1;\n for (j=1;j<=i;j++)\n c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;\n }\n for (i=1;i<=n;i++)\n {\n f[i]=mi(i,n);\n for (j=1;j\n#define N 1002\n#define MOD 1000000007\n\ntypedef long long typec;\n\nint n, m, k;\ntypec ftable[N];\ntypec facmod[1000001];\n\ntypec extend_gcd(typec a, typec b, typec *x, typec *y)\n{\n\tif(!b) return *x = 1, *y = 0, a;\n\ttypec res = extend_gcd(b, a % b, x, y), tmp = *x;\n\t*x = *y, *y = tmp - (a / b) * (*y);\n\treturn res;\n}\n\ntypec inverse(typec a, typec m)\n{\n\ttypec x, y;\n\ty = extend_gcd(a, m, &x, &y);\n\twhile(x < 0) x += m;\n\treturn x;\n}\n\ntypec pow_mod(typec x, typec k, typec m)\n{\n\ttypec res = 1;\n\twhile(x %= m, k) {\n\t\tif(k&1) res *= x, res %= m;\n\t\tx *= x, k >>= 1;\n\t}\n\treturn res;\n}\n\nint mymin(int x, int y)\n{\n\treturn x < y? x : y;\n}\n\ntypec combines(int i, int j)\n{\n\tif(i < j) return 0;\n\treturn facmod[i] * inverse(facmod[j], MOD) % MOD * inverse(facmod[i - j], MOD) % MOD;\n}\n\nvoid init()\n{\n\tint i, j;\n\tfacmod[0] = 1;\n\tfor(i = 1; i <= 1000000; i++) {\n\t\tfacmod[i] = facmod[i - 1] * i;\n\t\tfacmod[i] %= MOD;\n\t}\n\ttypec sum = 0;\n\tftable[1] = 1;\n\tfor(i = 2; i <= n; i++) {\n\t\tftable[i] = pow_mod(i, n, MOD) + MOD;\t\t\n\t\tsum = 0;\n\t\tfor(j = 1; j < i; j++) {\n\t\t\tsum += combines(i, j) * ftable[j] % MOD;\n\t\t\tsum %= MOD;\n\t\t}\n\t\tftable[i] -= sum;\n\t\tftable[i] %= MOD;\n\t}\n}\n\n\ntypec calc()\n{\n\tint i, j, m1, m2;\n\ttypec res = 0, tmp, stmp;\n\tm1 = mymin(n, k);\n\tfor(i = 0; i <= m1; i++) {\n\t\ttmp = combines(k, i) * pow_mod(i, (m - 2) * n, MOD) % MOD;\n\t\tm2 = mymin(n - i, (k - i) / 2);\n\t\tstmp = 0;\n\t\tfor(j = 0; j <= m2; j++) {\n\t\t\tif(!i && !j) continue;\n\t\t\tstmp += combines(k - i, j) * combines(k - i - j, j) % MOD * ftable[i + j] % MOD * ftable[i + j] % MOD;\n\t\t\tstmp %= MOD;\n\t\t}\n\t\tres += tmp * stmp % MOD;\n\t\tres %= MOD;\n\t}\n\treturn res;\n}\nint main()\n{\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tif(m == 1) {\n\t\tprintf(\"%d\\n\", (int)pow_mod(k, n, MOD));\n\t\treturn 0;\n\t}\n\tinit();\n\tprintf(\"%d\\n\", (int)calc());\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2651a50ccb3237f38e2131306c7da0ae", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t1000\n#define K\t1000000\n#define MD\t1000000007\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 int dp[N + 1], ff[K + 1], gg[K + 1];\n\tint n, m, k, i, c, a;\n\tlong long f, ans;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tif (m == 1) {\n\t\tprintf(\"%lld\\n\", power(k, n));\n\t\treturn 0;\n\t}\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tfor (c = n; c >= 1; c--)\n\t\t\tdp[c] = (long long) (dp[c] + dp[c - 1]) * c % MD;\n\t\tdp[0] = 0;\n\t}\n\tf = 1;\n\tfor (i = 0; i <= k; i++) {\n\t\tgg[i] = power(ff[i] = f, MD - 2);\n\t\tf = f * (i + 1) % MD;\n\t}\n\tans = 0;\n\tfor (c = m == 2 ? 0 : 1; c <= n && c <= k; c++)\n\t\tfor (a = 0; a + c <= n && a + a + c <= k; a++) {\n\t\t\tlong long cnt = (long long) ff[k] * gg[a] % MD * gg[a] % MD * gg[c] % MD\n\t\t\t\t* gg[k - a - a - c] % MD * dp[a + c] % MD * dp[a + c] % MD;\n\n\t\t\tif (m > 2)\n\t\t\t\tcnt = cnt * power(c, (m - 2) * n) % MD;\n\t\t\tans += cnt;\n\t\t}\n\tans %= MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b48a20da8b225eea86927f521c47bf8b", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t1000\n#define K\t1000000\n#define MD\t1000000007\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 int dp[N + 1], ff[K + 1], gg[K + 1];\n\tint n, m, k, i, c, a;\n\tlong long f, ans;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tif (m == 1) {\n\t\tprintf(\"%lld\\n\", power(k, n));\n\t\treturn 0;\n\t}\n\tdp[0] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tfor (c = n; c >= 1; c--)\n\t\t\tdp[c] = (long long) (dp[c] + dp[c - 1]) * c % MD;\n\t\tdp[0] = 0;\n\t}\n\tf = 1;\n\tfor (i = 0; i <= k; i++) {\n\t\tgg[i] = power(ff[i] = f, MD - 2);\n\t\tf = f * (i + 1) % MD;\n\t}\n\tans = 0;\n\tfor (c = m == 2 ? 0 : 1; c <= n && c <= k; c++)\n\t\tfor (a = 0; a + c <= n && a + a + c <= k; a++) {\n\t\t\tlong long cnt = (long long) ff[k] * gg[a] % MD * gg[a] % MD * gg[c] % MD\n\t\t\t\t* gg[k - a - a - c] * dp[a + c] % MD * dp[a + c] % MD;\n\n\t\t\tif (m > 2)\n\t\t\t\tcnt = cnt * power(c, (m - 2) * n) % MD;\n\t\t\tans += cnt;\n\t\t}\n\tans %= MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "924d1922e5b95fb7e6f6ecba5ad7f04a", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#define N 1002\n#define MOD 1000000007\n\ntypedef long long typec;\n\nint n, m, k;\ntypec ftable[N];\ntypec facmod[1000001];\n\ntypec extend_gcd(typec a, typec b, typec *x, typec *y)\n{\n\tif(!b) return *x = 1, *y = 0, a;\n\ttypec res = extend_gcd(b, a % b, x, y), tmp = *x;\n\t*x = *y, *y = tmp - (a / b) * (*y);\n\treturn res;\n}\n\ntypec inverse(typec a, typec m)\n{\n\ttypec x, y;\n\ty = extend_gcd(a, m, &x, &y);\n\twhile(x < 0) x += m;\n\treturn x;\n}\n\ntypec pow_mod(typec x, typec k, typec m)\n{\n\ttypec res = 1;\n\twhile(x %= m, k) {\n\t\tif(k&1) res *= x, res %= m;\n\t\tx *= x, k >>= 1;\n\t}\n\treturn res;\n}\n\nint mymin(int x, int y)\n{\n\treturn x < y? x : y;\n}\n\ntypec combines(int i, int j)\n{\n\tif(i < j) return 0;\n\treturn facmod[i] * inverse(facmod[j], MOD) % MOD * inverse(facmod[i - j], MOD) % MOD;\n}\n\nvoid init()\n{\n\tint i, j;\n\tfacmod[0] = 1;\n\tfor(i = 1; i <= 1000000; i++) {\n\t\tfacmod[i] = facmod[i - 1] * i;\n\t\tfacmod[i] %= MOD;\n\t}\n\ttypec sum = 0;\n\tftable[1] = 1;\n\tfor(i = 2; i <= n; i++) {\n\t\tftable[i] = pow_mod(i, n, MOD) + MOD;\t\t\n\t\tsum = 0;\n\t\tfor(j = 1; j < i; j++) {\n\t\t\tsum += combines(i, j) * ftable[j] % MOD;\n\t\t\tsum %= MOD;\n\t\t}\n\t\tftable[i] -= sum;\n\t\tftable[i] %= MOD;\n\t}\n}\n\n\ntypec calc()\n{\n\tint i, j, m1, m2;\n\ttypec res = 0, tmp, stmp;\n\tm1 = mymin(n, k);\n\tfor(i = 0; i <= m1; i++) {\n\t\ttmp = combines(k, i) * pow_mod(i, (m - 2) * n, MOD) % MOD;\n\t\tm2 = mymin(n - i, (k - i) / 2);\n\t\tstmp = 0;\n\t\tfor(j = 0; j <= m2; j++) {\n\t\t\tif(!i && !j) continue;\n\t\t\tstmp += combines(k - i, j) * combines(k - i - j, j) % MOD * ftable[i + j] % MOD * ftable[i + j] % MOD;\n\t\t\tstmp %= MOD;\n\t\t}\n\t\tres += tmp * stmp % MOD;\n\t\tres %= MOD;\n\t}\n\treturn res;\n}\nint main()\n{\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tinit();\n\tprintf(\"%lld\\n\", calc());\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f3725ada2d420aaf73e38b7afed531a7", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tint n,w[105]={},W,i,j,t;\n\tscanf(\"%d\",&n);\n\tn*=2;\n\tfor (i=0;iw[j+1])\n\t\t\t{\n\t\t\t\tt=w[j];\n\t\t\t\tw[j]=w[j+1];\n\t\t\t\tw[j+1]=t;\n\t\t\t}\n\tint copy[105]={};\n\tvoid cp(int wo1,int wo2)\n\t{\n\t\tint k;\n\t\tfor (k=0;k\n#include \n#define INF 1000000007\nint cmp(const void * a, const void * b) {\n return *(int *)a - *(int *)b;\n}\nint main() {\n int n;\n int s[105];\n scanf(\"%d\", &n);\n\n for (int i = 0; i < 2 * n; i++)\n scanf(\"%d\", s + i);\n qsort(s, 2 * n, sizeof(int), cmp);\n int ans = INF;\n for (int i = 0; i < 2 * n - 1; i++) {\n for (int j = i + 1; j < 2 * n; j++) {\n int m = 0;\n int mid = 0;\n int a, b;\n while (1) {\n a = m++;\n while (a == i || a == j)\n a = m++;\n b = m++;\n while (b == i || b == j)\n b = m++;\n if (m > 2 * n)\n break;\n mid += s[b] - s[a];\n }\n if (ans > mid)\n ans = mid;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "34714bb95730a2f2360f65975db211eb", "src_uid": "76659c0b7134416452585c391daadb16", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint compare(const void *a, const void *b)\n{\n if (*(long *)a < *(long *)b)\n return -1;\n else\n return 1;\n}\nint main()\n{\n long n,i,a[50],j,bit=1e9+7,k;\n scanf(\"%ld\",&n);\n for(i=0;i<2*n;i++)\n scanf(\"%ld\",&a[i]);\n qsort(a,2*n,sizeof(long),compare);\n for(i=0;i<2*n;i++)\n for(j=i+1;j<2*n;j++)\n {\n k=0;\n long temp=0,z=0;\n for(z=1;z<=n-1;z++)\n {\n while(k==i || k==j)\n k++;\n temp-=a[k];\n k++;\n while(k==i || k==j)\n k++;\n temp+=a[k];\n k++;\n }\n if(temp\n#include\nint compare(const void *a, const void *b)\n{\n if (*(long *)a < *(long *)b)\n return -1;\n else\n return 1;\n}\nint main()\n{\n long n,i,a[50],j,bit=200000007,k,N,u;\n scanf(\"%ld\",&n);\n N=2*n;\n u=n-1;\n for(i=1;i<=N;i++)\n scanf(\"%ld\",&a[i]);\n qsort(a+1,N,sizeof(long),compare);\n for(i=1;i\n#include\nint compare(const void *a, const void *b)\n{\n if (*(long *)a < *(long *)b)\n return -1;\n else\n return 1;\n}\nint main()\n{\n long n,i,a[50],j,bit=200000007,k,N,u,temp,z;\n scanf(\"%ld\",&n);\n N=2*n;\n u=n-1;\n for(i=1;i<=N;i++)\n scanf(\"%ld\",&a[i]);\n qsort(a+1,N,sizeof(long),compare);\n for(i=1;i\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b3a6874b1c1574f47535785105ee8887", "src_uid": "104cf5253e027929f257364b3874c38b", "difficulty": 2200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "6f81857c715d19eee61bb32b0a7e31e7", "src_uid": "104cf5253e027929f257364b3874c38b", "difficulty": 2200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "da928207aafaf1f8fe3027828b47fa13", "src_uid": "104cf5253e027929f257364b3874c38b", "difficulty": 2200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "94b0315ef35efbb9aa39af50635e5d1a", "src_uid": "104cf5253e027929f257364b3874c38b", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N 20200;\n\nint v[N];\nint ty[3][N];\nint mk[N];\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 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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ceedbb8798b4ee5a70a95a964d67c5a1", "src_uid": "104cf5253e027929f257364b3874c38b", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "int i,j,N,u[100001],D[100001],C[100001],r[100001],x,d;\nint main () {\n scanf(\"%d\",&N);\n for (i=3;i<=N;++i) {\n for (j=2;2*i>=j*(j+1);++j) if ((i-j*(j+1)/2)%j==0) {\n x=(i-j*(j+1)/2)/j,d=C[x+j]^C[x];\n u[d]=i;\n if (!r[i] && !d) r[i]=j;\n }\n while (u[D[i]]==i) ++D[i];\n C[i]=C[i-1]^D[i];\n }\n if (!D[N]) puts(\"-1\");\n else printf(\"%d\\n\",r[N]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cdbc00bf9fec2bedbe757f805843b6d4", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint g[100001], dp[100001];\nint a[50001][1000];\n\nint main()\n{\n int n, i, j;\n\n scanf(\"%d\", &n);\n\n for (i = 0; i <= n; i++) dp[i] = -1;\n\n for (i = 2; i <= (n + 1) / 2; i++) {\n\t int sum = i, f;\n\n\t for (j = 0; j < 1000; j++) {\n\t if (a[i][j] == 0) break;\n\t }\n\n\t g[i] = f = j;\n\n\t for (j = i - 1; j > 0; j--) {\n\t sum += j;\n\n\t f ^= g[j];\n\n\t if (sum > n) break;\n\n\t if (f < 1000 && sum <= (n + 1) / 2) a[sum][f] = 1;\n\n\t if (f == 0) dp[sum] = i - j + 1;\n\t }\n }\n\n printf(\"%d\\n\", dp[n]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0cfaf5584a4ab9693be74409752fcf38", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=0) return grundy[n];\n mini[n] = -1;\n\n rep(i,1000) chk[i]=0;\n\n for(k=2;;k++){\n up = 2*n - k*k + k;\n down = 2*k;\n\n if(up < down) break;\n if(up%down) continue;\n\n m = 0;\n up /= down;\n rep(i,k) m ^= solve(up+i);\n if(m<1000) chk[m] = 1;\n\n if(m==0 && fin==0) fin=1, mini[n] = k;\n }\n\n rep(i,1000) if(chk[i]==0) break;\n return grundy[n] = i;\n}\n\nint main(){\n int i,j,k,l,m,n;\n\n rep(i,100100) grundy[i] = -1;\n\n while(scanf(\"%d\",&n)==1){\n solve(n);\n printf(\"%d\\n\",mini[n]);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b598334e66005f0dc7f5b86e99194777", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint g[100001], dp[100001];\nint a[50001][1000];\n\nint main()\n{\n int n, i, j;\n\n scanf(\"%d\", &n);\n\n for (i = 0; i <= n; i++) dp[i] = -1;\n\n for (i = 2; i <= (n + 1) / 2; i++) {\n\t int sum = i, f;\n\n\t for (j = 0; j < 1000; j++) {\n\t if (a[i][j] == 0) break;\n\t }\n\n\t g[i] = f = j;\n\n\t for (j = i - 1; j > 0; j--) {\n\t sum += j;\n\n\t f ^= g[j];\n\n\t if (sum > n) break;\n\n\t if (f < 1000 && sum <= (n + 1) / 2) a[sum][f] = 1;\n\n\t if (f == 0) dp[sum] = i - j + 1;\n\t }\n }\n\n printf(\"%d\\n\", dp[n]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fe24b8a4450830b984f7a230a8bee203", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "int i,j,N,u[100001],D[100001],C[100001],r[100001],x,d;\nint main () {\n scanf(\"%d\",&N);\n for (i=3;i<=N;++i) {\n for (j=2;2*i>=j*(j+1);++j) if ((i-j*(j+1)/2)%j==0) {\n x=(i-j*(j+1)/2)/j,d=C[x+j]^C[x];\n u[d]=i;\n if (!r[i] && !d) r[i]=j;\n }\n while (u[D[i]]==i) ++D[i];\n C[i]=C[i-1]^D[i];\n }\n if (!D[N]) puts(\"-1\");\n else printf(\"%d\\n\",r[N]);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7536d3b7c446e1d9ab588adb8137a3f7", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i=n){\n if(now[n-1] < 0) return;\n if(now[n-1] == res && cost > res_cost) res++;\n if(now[n-1] < res) res = now[n-1], res_cost = cost;\n return;\n }\n\n if(b>=n){\n if(aa!=0 && aa!=n-1 && now[aa]) return;\n solve(a+1,a+2,cost);\n return;\n }\n\n REP(i,-mx[aa][bb],mx[aa][bb]+1){\n if(-mi[aa][bb]\n#include \n\nint low[7][7], high[7][7];\nint cost[7][7];\nint n;\nint flow[7][7];\nint inFlow[7];\nint outFlow[7];\nint minFlow = 100, maxCost = -1;\n\nint rec(int v, int to) {\n if(v == n - 1) {\n int isValid = 1;\n int i, j;\n int total = inFlow[n - 1];\n int ccost = 0;\n for(i = 0; i < n; i++) {\n for(j = i + 1; j < n; j++) {\n if(flow[i][j] < low[i][j] || flow[i][j] > high[i][j])\n isValid = 0;\n if(flow[i][j] > 0) \n ccost += flow[i][j] * flow[i][j] + cost[i][j];\n }\n }\n if(isValid) {\n if(minFlow == total) {\n if(ccost > maxCost)\n maxCost = ccost;\n } else if(minFlow > total) {\n minFlow = total;\n maxCost = ccost;\n }\n }\n } else if(to == n) {\n if(v > 0 && inFlow[v] != outFlow[v])\n return;\n if(inFlow[n - 1] > minFlow)\n return;\n rec(v + 1, v + 2);\n } else {\n int i;\n for(i = low[v][to]; i <= high[v][to]; i++) {\n inFlow[to] += i;\n outFlow[v] += i;\n flow[v][to] = i;\n rec(v, to + 1);\n inFlow[to] -= i;\n outFlow[v] -= i;\n }\n }\n}\n\nint main() {\n scanf(\"%d\", &n);\n int i, from, to, j;\n for(i = 0; i < n * (n - 1) / 2; i++) {\n scanf(\"%d %d\", &from, &to);\n from--;\n to--;\n scanf(\"%d %d %d\", &low[from][to], &high[from][to], &cost[from][to]);\n }\n rec(0, 1);\n if(minFlow == 100)\n puts(\"-1 -1\");\n else\n printf(\"%d %d\\n\", minFlow, maxCost);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1a894996cc5af32d48608658d1e6bea", "src_uid": "38886ad7b0d83e66b77348be34828426", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\nint m,n;\t\nscanf(\"%d%d\",&m&n);\nreturn ((1+(n-1)*(m-1)/(n*m-1))/n);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "7f123faa336097ff034496352807125a", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "292bcbe981626cf2429150f4936a586e", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f383a444495f2dd6721c55a30daff535", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b3257dcc4daf4f5f23c0a1100955e4b0", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "87a4b143f25ab12e6823f31c9cb61fb5", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N 1000001\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#define MAX(a,b) (((a)>(b))?(a):(b))\n\n\n\nint main() {\n\tint biggest_prime[N];\n\tint n, i, j, k,sum = 0;\n\n\tscanf(\"%i\",&n);\n\n\tfor(i = 1; i <= n; i++) biggest_prime[i] = i;\n\n\tfor(i = 2; i <= n; i++){\n\t\tif(biggest_prime[i] != i) continue;\n\t\tfor(j = i*2; j <= n; j+=i) biggest_prime[j] = i;\n\t}\n\n\tk = biggest_prime[n];\n\n\tint min = n;\n\n\tfor(i = MAX(4,n-k+1); i <= n; i++){\n\t\tif(i == biggest_prime[i]) continue;\n\t\tmin = MIN(min, i-biggest_prime[i]);\n\t}\n\n\tprintf(\"%i\",min+1); //no se como funciono pero funciono\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "60fe2092086c7b6dc0aaf4fbc47be35c", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#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\n#define SIZE 1000002\n\nstatic int s[SIZE], p[SIZE], np, min;\n\nstatic void sieve(void)\n{\n int i, j;\n\n for (i = 2; i < SIZE; i++) {\n if (s[i] == 0) {\n p[np++] = i;\n\n for (j = 2; i * j < SIZE; j++) {\n s[i * j] = 1;\n }\n }\n }\n}\n\nstatic void solve(int x, int l)\n{\n int i, d, lf = -1;\n\n if (x < min) {\n min = x;\n }\n\n if (l == 0) {\n return;\n }\n\n for (i = 2; i * i <= x; i++) {\n if (x % i == 0) {\n if (s[x / i] == 0) {\n if (x / i > lf) {\n lf = x / i;\n }\n } else if (s[i] == 0) {\n if (i > lf) {\n lf = i;\n }\n }\n }\n }\n\n if (lf == -1) {\n return;\n }\n\n if (l == 1) {\n if (lf * (x / lf - 1) + 1 < min) {\n min = lf * (x / lf - 1) + 1;\n }\n } else {\n for (d = lf * (x / lf - 1) + 1; d < x; d++) {\n solve(d, l - 1);\n }\n }\n}\n\nint main(void)\n{\n int x2;\n\n sieve();\n min = INT_MAX;\n\n scanf(\"%d\", &x2);\n solve(x2, 2);\n printf(\"%d\", min);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5c1e3d835d37ff16bc5887b5e8b9f9d6", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define MAX 10000000\n\nint p[MAX];\n\nvoid Findprimes(){\n int n = 2;\n int x;\n\n while(n < MAX){\n x = n * 2;\n while(x < MAX){\n p[x] = n;\n x += n;\n }\n x = n + 1;\n while(p[x] != 0 && x < MAX){\n x++;\n }\n n = x;\n }\n}\n\nint min(int a, int b){\n if(a < b)\n return a;\n else\n return b;\n}\n\nint main(){\n int i;\n int x0, x1, x2;\n\n x0 = MAX;\n scanf(\"%i%*c\", &x2);\n Findprimes();\n //printf(\"%i\\n\", p[x2]);\n\n for(i = x2-p[x2]+1; i <= x2; i++){\n //printf(\"i: %i\\n\", i);\n x0 = min(i-p[i]+1, x0);\n //printf(\"x0: %i\\n\", x0);\n }\n\n printf(\"%i\", x0);\n\n /*for(i = 0; i < MAX; i++){\n printf(\"%i \", p[i]);\n }*/\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "24a64597a4231549b9f20cfa7b539434", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\nint max_prime_div[1000001];\nbool sieve[1000001];\n\nint main(int argc, char **argv)\n{\n int x2;\n int tmp;\n int max_div;\n int min_x0 = 1000001;\n\n scanf(\"%d\", &x2);\n for (int i = 0; i < x2 + 1; ++i) {\n max_prime_div[i] = 0;\n sieve[i] = true;\n }\n \n for (int i = 2; i < x2 + 1; ++i) {\n if (sieve[i]) {\n for (int j = 2 * i; j < x2 + 1; j += i) {\n sieve[j] = false;\n max_prime_div[j] = i;\n }\n }\n }\n\n for (int x = x2 - max_prime_div[x2] + 1; x < x2 + 1; ++x) {\n max_div = max_prime_div[x];\n tmp = x - max_div + 1;\n if (max_div && tmp < min_x0) {\n min_x0 = tmp;\n }\n if (max_div && tmp - 1 == max_div) {\n break;\n }\n }\n printf(\"%d\", min_x0);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "5c0fc3540928505a75b82123c31fca26", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define size 1000000\n\n\nvoid llenaArr(int *primes){\n int i,j;\n for (i = 0; i < size; i++) {\n primes[i]=0;\n }\n\n for (i = 2; i < size; i++)\n if(!primes[i]){\n for (j = 2; (i*j)\n#include \n\n#define N\t200\n\nint max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n\tstatic char cc[N + 1], cc_[4];\n\tstatic int dp[N + 1][N + 1], dq[N + 1][N + 1];\n\tint n, m, i, j, k, ans;\n\n\tscanf(\"%d%d%s%s\", &n, &m, cc, cc_);\n\tfor (j = 0; j <= m; j++)\n\t\tmemset(dp, -1, (n + 1) * sizeof *dp);\n\tdp[0][0] = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j <= m; j++)\n\t\t\tmemset(dq, -1, (n + 1) * sizeof *dq);\n\t\tfor (j = 0; j <= m; j++)\n\t\t\tfor (k = 0; k <= n; k++) {\n\t\t\t\tint j_, k_, x = dp[j][k];\n\n\t\t\t\tif (x == -1)\n\t\t\t\t\tcontinue;\n\t\t\t\tj_ = j, k_ = k;\n\t\t\t\tif (cc[i] == cc_[0])\n\t\t\t\t\tk_++;\n\t\t\t\tdq[j_][k_] = max(dq[j_][k_], x + (cc[i] == cc_[1] ? k : 0));\n\t\t\t\tif (j < m) {\n\t\t\t\t\tj_ = j + 1, k_ = k + 1;\n\t\t\t\t\tdq[j_][k_] = max(dq[j_][k_], x + (cc_[0] == cc_[1] ? k : 0));\n\t\t\t\t\tif (cc_[0] != cc_[1]) {\n\t\t\t\t\t\tj_ = j + 1, k_ = k;\n\t\t\t\t\t\tdq[j_][k_] = max(dq[j_][k_], x + k);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tfor (j = 0; j <= m; j++)\n\t\t\tmemcpy(dp, dq, (n + 1) * sizeof *dq);\n\t}\n\tans = -1;\n\tfor (j = 0; j <= m; j++)\n\t\tfor (k = 0; k <= n; k++)\n\t\t\tans = max(ans, dp[j][k]);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d4f6d31ec8f6003c1b2d740fafd1787d", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint max(int a, int b) {\n return a > b ? a : b;\n}\n\nint main() \n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n char s[201], t[3];\n scanf(\"%s %s\", s, t);\n int dp[n+1][k+1][n+1]; // answer in the interval [1...i], using j moves, has t0 occurrences of t[0]\n for(int i = 0; i <= n; i++) {\n for(int j = 0; j <= k; j++) {\n for(int t0 = 0; t0 <= n; t0++) {\n dp[i][j][t0] = -1;\n }\n }\n }\n dp[0][0][0] = 0;\n // initialize\n for(int i = 1; i <= n; i++) {\n for(int j = 0; j <= k; j++) {\n for(int t0 = 0; t0 <= n; t0++) {\n if(dp[i-1][j][t0] == -1) \n continue;\n\n int is_equal_first_char = s[i-1] == t[0];\n int is_equal_second_char = s[i-1] == t[1]; // asddsaf sd\n int is_t_equal = t[0] == t[1];\n\n // if we do not change the ith char\n dp[i][j][t0 + is_equal_first_char] = max(dp[i][j][t0 + is_equal_first_char], dp[i - 1][j][t0] + (is_equal_second_char ? t0 : 0));\n \n // if we make any change (j must be < k)\n if(j < k) {\n // if change s[i] to t[0]\n dp[i][j + 1][t0 + 1] = max(dp[i][j + 1][t0 + 1], dp[i - 1][j][t0] + (is_t_equal ? t0 : 0));\n // if change s[i] to t[1]\n // dp[i][j + 1][t0 + 1] = max(dp[i][j + 1][t0 + 1], dp[i][j][t0] + (!is_equal_second_char ? t0 : 0));\n dp[i][j + 1][t0] = max(dp[i][j + 1][t0], dp[i - 1][j][t0] + t0);\n }\n }\n }\n }\n int ans = -1;\n for(int j = 0; j <= k; j++) {\n for(int t0 = 0; t0 <= n; t0++) {\n ans = max(ans, dp[n][j][t0]);\n } \n }\n printf(\"%d\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e6e57f9603708d0e4ba8267e62c6f6e5", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "//set many funcs template\n//Ver.20190820\n#include\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\nint n,k,dp[201][201][201];\nchar s[200],t[2];\nint min(int a,int b){\n return ab?a:b;\n}\nint simi(int n,int k){\n int i,cnt=0;\n for(i=0;i\n#include \n\nint ***sol;\nint N, K;\nconst int kInvalidSol = -10000;\nvoid new_sol() {\n\tsol = (int***)malloc(sizeof(int**) * (N + 1));\n\tfor (int n = 0; n <= N; ++n) {\n\t\tsol[n] = (int**)malloc(sizeof(int*) * (K + 1));\n\t\tfor (int k = 0; k <= K; ++k) {\n\t\t\tsol[n][k] = (int*)malloc(sizeof(int) * (N + 1));\n\t\t\tfor (int i = 0; i <= N; ++i) {\n\t\t\t\tsol[n][k][i] = kInvalidSol;\n\t\t\t}\n\t\t}\n\t}\n}\nvoid free_sol() {\n\tfor (int i = 0; i <= N; ++i) {\n\t\tfor (int j = 0; j <= K; ++j) {\n\t\t\tfree(sol[i][j]);\n\t\t}\n\t\tfree(sol[i]);\n\t}\n\tfree(sol);\n}\nvoid try_update_sol(int n, int k, int i, int value) {\n\tif (value >= 0 && sol[n][k][i] < value) {\n\t\tsol[n][k][i] = value;\n\t}\n}\nint main() {\n\tchar s[201], t[3];\n\tscanf(\"%d%d\\n%s\\n%s\", &N, &K, s, t);\n\tif (t[0] == t[1]) {\n\t\tint cc = 0;\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tif (s[i] == t[0]) {\n\t\t\t\t++cc;\n\t\t\t}\n\t\t}\n\t\tcc += K;\n\t\tif (cc > N) {\n\t\t\tcc = N;\n\t\t}\n\t\tprintf(\"%d\\n\", cc * (cc - 1) / 2);\n\t\treturn 0;\n\t}\n\n\t// t[0] != t[1]\n\tnew_sol();\n\tint t0 = 0;\n\tfor (int n = 1; n <= N; ++n) {\n\t\tif (s[n - 1] == t[0]) {\n\t\t\t++t0;\n\t\t\tif (t0 == 1) {\n\t\t\t\tsol[n][0][1] = 0;\n\t\t\t} else {\n\t\t\t\ttry_update_sol(n, 0, t0, sol[n - 1][0][t0 - 1]);\n\t\t\t}\n\t\t} else if (s[n - 1] == t[1]) {\n\t\t\ttry_update_sol(n, 0, t0, sol[n - 1][0][t0] + t0);\n\t\t} else {\n\t\t\ttry_update_sol(n, 0, t0, sol[n - 1][0][t0]);\n\t\t}\n\t}\n\tfor (int k = 1; k <= K; ++k) {\n\t\ttry_update_sol(1, k, 1, 0);\n\t\tfor (int n = 2; n <= N; ++n) {\n\t\t\tfor (int i = 1; i <= n; ++i) {\n\t\t\t\ttry_update_sol(n, k, i, sol[n][k - 1][i]);\n\t\t\t\tif (s[n - 1] == t[0]) {\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k][i - 1]);\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k - 1][i] + i);\n\t\t\t\t} else if (s[n - 1] == t[1]) {\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k][i] + i);\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k - 1][i - 1]);\n\t\t\t\t} else {\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k - 1][i - 1]);\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k - 1][i] + i);\n\t\t\t\t\ttry_update_sol(n, k, i, sol[n - 1][k][i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\t\n\tint max = 0;\n\tfor (int i = 1; i <= N; ++i) {\n\t\tif (sol[N][K][i] > max) {\n\t\t\tmax = sol[N][K][i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", max);\n\tfree_sol();\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1b9d6461767bbe6b8f3db13f4dfe920c", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint num_var;\nint vars[600];\nint values[1024];\n\nint num_order;\nint order[600];\n\nint max_var;\n\nint num_cond;\nint cond1[500];\nint cond2[500];\n\nbool contains_in_order(int var){\n\tint i;\n\tfor(i = 0; i < num_order; i++){\n\t\tif(order[i] == var)\n\t\t\treturn true;\n\t}\n\treturn false;\n}\n\nvoid parse1(char *data){\n\tchar *ptr = data;\n\n\tnum_var = 0;\n\tmax_var = 0;\n\tnum_order = 0;\n\n\tint state = 0;\n\tint var = 0;\n\twhile(*ptr != ')'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t\tvar = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar++;\n\t\t\t} else {\n\t\t\t\tvars[num_var++] = var;\n\t\t\t\tif(var > max_var) max_var = var;\n\t\t\t\tif(!contains_in_order(var)) order[num_order++] = var;\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(var > 0){\n\t\tvars[num_var++] = var;\n\t\tif(!contains_in_order(var)) order[num_order++] = var;\n\t}\n}\n\nvoid parse2(char *data){\n\tchar *ptr = data;\n\tint state = 0;\n\tint var1 = 0;\n\tint var2 = 0;\n\tint op = 0; // 0: >, 1: <\n\n\tnum_cond = 0;\n\n\twhile(*ptr != '.'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar1 = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar1++;\n\t\t\t} else if(*ptr == '>') {\n\t\t\t\top = 0;\n\t\t\t\tstate = 2;\n\t\t\t} else if(*ptr == '<') {\n\t\t\t\top = 1;\n\t\t\t\tstate = 2;\n\t\t\t\tvar2 = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar2++;\n\t\t\t} else if(*ptr == ',') {\n\t\t\t\tif(op == 0){\n\t\t\t\t\tcond1[num_cond] = var1;\n\t\t\t\t\tcond2[num_cond++] = var2;\n\t\t\t\t} else {\n\t\t\t\t\tcond1[num_cond] = var2;\n\t\t\t\t\tcond2[num_cond++] = var1;\n\t\t\t\t}\n\t\t\t\tstate = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(state == 2){\n\t\tif(op == 0){\n\t\t\tcond1[num_cond] = var1;\n\t\t\tcond2[num_cond++] = var2;\n\t\t} else {\n\t\t\tcond1[num_cond] = var2;\n\t\t\tcond2[num_cond++] = var1;\n\t\t}\n\t}\n}\n\nvoid parse(char *data){\n\tchar *ptr = data;\n\tptr += 2;//skip ?(\n\tparse1(ptr);\n\tptr += 3;//skip ):-\n\tparse2(ptr);\n}\n\nvoid init_values(){\n\tint i;\n\tfor(i = 0; i <= max_var; i++){\n\t\tvalues[i] = -1;\n\t}\n\tfor(i = 0; i < num_var; i++){\n\t\tvalues[vars[i]] = 0;\n\t}\n}\n\nbool check_cond(){\n\tint i;\n\tfor(i = 0; i < num_cond; i++){\n\t\tif(values[cond1[i]] <= values[cond2[i]])\n\t\t\treturn false;\n\t}\n\treturn true;\n}\n\nbool next_values2(int loc){\n\tif(values[order[loc]] < 9){\n\t\tvalues[order[loc]]++;\n\t\treturn true;\n\t} else if(loc > 0){\n\t\tvalues[order[loc]] = 0;\n\t\treturn next_values2(loc - 1);\n\t} else {\n\t\treturn false;\n\t}\n}\n\nbool next_values(){\n\treturn next_values2(num_order - 1);\n}\n\nint main(){\n\tchar buf[1100];\n\tint i;\n\n\tscanf(\"%s\", buf);\n\tparse(buf);\n\n\tinit_values();\n\n\twhile(!check_cond()){\n\t\tif(!next_values()){\n\t\t\tprintf(\"false\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tfor(i = 0; i < num_var; i++){\n\t\tprintf(\"%d\", values[vars[i]]);\n\t}\n\tprintf(\"\\n\");\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6feaf8f28508416055ee5a215f9d086b", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint num_var;\nint vars[600];\nint values[1024];\n\nint num_order;\nint order[600];\n\nint max_var;\n\nint num_cond;\nint cond1[500];\nint cond2[500];\n\nvoid parse1(char *data){\n\tchar *ptr = data;\n\n\tnum_var = 0;\n\tmax_var = 0;\n\tnum_order = 0;\n\n\tint i;\n\tfor(i = 0; i < 1024; i++){\n\t\tvalues[i] = -1;\n\t}\n\n\tint state = 0;\n\tint var = 0;\n\twhile(*ptr != ')'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t\tvar = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar++;\n\t\t\t} else {\n\t\t\t\tvars[num_var++] = var;\n\t\t\t\tif(var > max_var) max_var = var;\n\t\t\t\tif(values[var] == -1) order[num_order++] = var;\n\t\t\t\tvalues[var] = 0;\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(var > 0){\n\t\tvars[num_var++] = var;\n\t\tif(values[var] == -1) order[num_order++] = var;\n\t\tvalues[var] = 0;\n\t}\n}\n\nvoid parse2(char *data){\n\tchar *ptr = data;\n\tint state = 0;\n\tint var1 = 0;\n\tint var2 = 0;\n\tint op = 0; // 0: >, 1: <\n\n\tnum_cond = 0;\n\n\twhile(*ptr != '.'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar1 = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar1++;\n\t\t\t} else if(*ptr == '>') {\n\t\t\t\top = 0;\n\t\t\t\tstate = 2;\n\t\t\t} else if(*ptr == '<') {\n\t\t\t\top = 1;\n\t\t\t\tstate = 2;\n\t\t\t\tvar2 = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar2++;\n\t\t\t} else if(*ptr == ',') {\n\t\t\t\tif(op == 0){\n\t\t\t\t\tcond1[num_cond] = var1;\n\t\t\t\t\tcond2[num_cond++] = var2;\n\t\t\t\t} else {\n\t\t\t\t\tcond1[num_cond] = var2;\n\t\t\t\t\tcond2[num_cond++] = var1;\n\t\t\t\t}\n\t\t\t\tstate = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(state == 2){\n\t\tif(op == 0){\n\t\t\tcond1[num_cond] = var1;\n\t\t\tcond2[num_cond++] = var2;\n\t\t} else {\n\t\t\tcond1[num_cond] = var2;\n\t\t\tcond2[num_cond++] = var1;\n\t\t}\n\t}\n}\n\nvoid parse(char *data){\n\tchar *ptr = data;\n\tptr += 2;//skip ?(\n\tparse1(ptr);\n\tptr += 3;//skip ):-\n\tparse2(ptr);\n}\n\nvoid init_values(){\n\tint i;\n\tfor(i = 0; i <= max_var; i++){\n\t\tvalues[i] = -1;\n\t}\n\tfor(i = 0; i < num_var; i++){\n\t\tvalues[vars[i]] = 0;\n\t}\n}\n\nbool check_cond(){\n\tint i;\n\tfor(i = 0; i < num_cond; i++){\n\t\tif(values[cond1[i]] <= values[cond2[i]])\n\t\t\treturn false;\n\t}\n\treturn true;\n}\n\nbool next_values2(int loc){\n\tif(values[order[loc]] < 9){\n\t\tvalues[order[loc]]++;\n\t\treturn true;\n\t} else if(loc > 0){\n\t\tvalues[order[loc]] = 0;\n\t\treturn next_values2(loc - 1);\n\t} else {\n\t\treturn false;\n\t}\n}\n\nbool next_values(){\n\treturn next_values2(num_order - 1);\n}\n\nint main(){\n\tchar buf[1100];\n\tint i;\n\n\tscanf(\"%s\", buf);\n\tparse(buf);\n\n\tinit_values();\n\n\twhile(!check_cond()){\n\t\tif(!next_values()){\n\t\t\tprintf(\"false\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tfor(i = 0; i < num_var; i++){\n\t\tprintf(\"%d\", values[vars[i]]);\n\t}\n\tprintf(\"\\n\");\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8838fb81ac7d1dc425aa148582358362", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint num_var;\nint vars[1000];\nint values[1024];\n\nint num_order;\nint order[1000];\n\nint max_var;\n\nint num_cond;\nint cond1[1000];\nint cond2[1000];\n\nvoid parse1(char *data){\n\tchar *ptr = data;\n\n\tnum_var = 0;\n\tmax_var = 0;\n\tnum_order = 0;\n\n\tint i;\n\tfor(i = 0; i < 1024; i++){\n\t\tvalues[i] = -1;\n\t}\n\n\tint state = 0;\n\tint var = 0;\n\twhile(*ptr != ')'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t\tvar = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar++;\n\t\t\t} else {\n\t\t\t\tvars[num_var++] = var;\n\t\t\t\tif(var > max_var) max_var = var;\n\t\t\t\tif(values[var] == -1) order[num_order++] = var;\n\t\t\t\tvalues[var] = 0;\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(var > 0){\n\t\tvars[num_var++] = var;\n\t\tif(values[var] == -1) order[num_order++] = var;\n\t\tvalues[var] = 0;\n\t}\n}\n\nvoid parse2(char *data){\n\tchar *ptr = data;\n\tint state = 0;\n\tint var1 = 0;\n\tint var2 = 0;\n\tint op = 0; // 0: >, 1: <\n\n\tnum_cond = 0;\n\n\twhile(*ptr != '.'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar1 = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar1++;\n\t\t\t} else if(*ptr == '>') {\n\t\t\t\top = 0;\n\t\t\t\tstate = 2;\n\t\t\t} else if(*ptr == '<') {\n\t\t\t\top = 1;\n\t\t\t\tstate = 2;\n\t\t\t\tvar2 = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar2++;\n\t\t\t} else if(*ptr == ',') {\n\t\t\t\tif(op == 0){\n\t\t\t\t\tcond1[num_cond] = var1;\n\t\t\t\t\tcond2[num_cond++] = var2;\n\t\t\t\t} else {\n\t\t\t\t\tcond1[num_cond] = var2;\n\t\t\t\t\tcond2[num_cond++] = var1;\n\t\t\t\t}\n\t\t\t\tstate = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(state == 2){\n\t\tif(op == 0){\n\t\t\tcond1[num_cond] = var1;\n\t\t\tcond2[num_cond++] = var2;\n\t\t} else {\n\t\t\tcond1[num_cond] = var2;\n\t\t\tcond2[num_cond++] = var1;\n\t\t}\n\t}\n}\n\nvoid parse(char *data){\n\tchar *ptr = data;\n\tptr += 2;//skip ?(\n\tparse1(ptr);\n\tptr += 3;//skip ):-\n\tparse2(ptr);\n}\n\nvoid init_values(){\n\tint i;\n\tfor(i = 0; i <= max_var; i++){\n\t\tvalues[i] = -1;\n\t}\n\tfor(i = 0; i < num_var; i++){\n\t\tvalues[vars[i]] = 0;\n\t}\n}\n\nbool check_cond(){\n\tint i;\n\tfor(i = 0; i < num_cond; i++){\n\t\tif(values[cond1[i]] <= values[cond2[i]])\n\t\t\treturn false;\n\t}\n\treturn true;\n}\n\nbool next_values2(int loc){\n\tif(values[order[loc]] < 9){\n\t\tvalues[order[loc]]++;\n\t\treturn true;\n\t} else if(loc > 0){\n\t\tvalues[order[loc]] = 0;\n\t\treturn next_values2(loc - 1);\n\t} else {\n\t\treturn false;\n\t}\n}\n\nbool next_values(){\n\treturn next_values2(num_order - 1);\n}\n\nbool solve(){\n\tint i;\n\tint change = 1;\n\n\twhile(change == 1){\n\t\tchange = 0;\n\t\tfor(i = 0; i < num_cond; i++){\n\t\t\tif(cond1[i] == cond2[i]){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif(values[cond1[i]] <= values[cond2[i]]){\n\t\t\t\tchange = 1;\n\t\t\t\tvalues[cond1[i]] = values[cond2[i]] + 1;\n\t\t\t\tif(values[cond1[i]] > 9)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\nint main(){\n\tchar buf[1100];\n\tint i;\n\n\tscanf(\"%s\", buf);\n\tparse(buf);\n\n\tinit_values();\n\n\tif(!solve()){\n\t\tprintf(\"false\\n\");\n\t\treturn 0;\n\t}\n\n\tfor(i = 0; i < num_var; i++){\n\t\tprintf(\"%d\", values[vars[i]]);\n\t}\n\tprintf(\"\\n\");\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7a48cbfbd6b7ed2dfe5e5e01f70edfde", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint num_var;\nint vars[1000];\nint values[1024];\n\nint num_order;\nint order[1000];\n\nint max_var;\n\nint num_cond;\nint cond1[1000];\nint cond2[1000];\n\nvoid parse1(char *data){\n\tchar *ptr = data;\n\n\tnum_var = 0;\n\tmax_var = 0;\n\tnum_order = 0;\n\n\tint i;\n\tfor(i = 0; i < 1024; i++){\n\t\tvalues[i] = -1;\n\t}\n\n\tint state = 0;\n\tint var = 0;\n\twhile(*ptr != ')'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t\tvar = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar++;\n\t\t\t} else {\n\t\t\t\tvars[num_var++] = var;\n\t\t\t\tif(var > max_var) max_var = var;\n\t\t\t\tif(values[var] == -1) order[num_order++] = var;\n\t\t\t\tvalues[var] = 0;\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(var > 0){\n\t\tvars[num_var++] = var;\n\t\tif(values[var] == -1) order[num_order++] = var;\n\t\tvalues[var] = 0;\n\t}\n}\n\nvoid parse2(char *data){\n\tchar *ptr = data;\n\tint state = 0;\n\tint var1 = 0;\n\tint var2 = 0;\n\tint op = 0; // 0: >, 1: <\n\n\tnum_cond = 0;\n\n\twhile(*ptr != '.'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar1 = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar1++;\n\t\t\t} else if(*ptr == '>') {\n\t\t\t\top = 0;\n\t\t\t\tstate = 2;\n\t\t\t} else if(*ptr == '<') {\n\t\t\t\top = 1;\n\t\t\t\tstate = 2;\n\t\t\t\tvar2 = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar2++;\n\t\t\t} else if(*ptr == ',') {\n\t\t\t\tif(op == 0){\n\t\t\t\t\tcond1[num_cond] = var1;\n\t\t\t\t\tcond2[num_cond++] = var2;\n\t\t\t\t} else {\n\t\t\t\t\tcond1[num_cond] = var2;\n\t\t\t\t\tcond2[num_cond++] = var1;\n\t\t\t\t}\n\t\t\t\tstate = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(state == 2){\n\t\tif(op == 0){\n\t\t\tcond1[num_cond] = var1;\n\t\t\tcond2[num_cond++] = var2;\n\t\t} else {\n\t\t\tcond1[num_cond] = var2;\n\t\t\tcond2[num_cond++] = var1;\n\t\t}\n\t}\n}\n\nvoid parse(char *data){\n\tchar *ptr = data;\n\tptr += 2;//skip ?(\n\tparse1(ptr);\n\tptr += 3;//skip ):-\n\tparse2(ptr);\n}\n\nvoid init_values(){\n\tint i;\n\tfor(i = 0; i <= max_var; i++){\n\t\tvalues[i] = 0;\n\t}\n}\n\nbool check_cond(){\n\tint i;\n\tfor(i = 0; i < num_cond; i++){\n\t\tif(values[cond1[i]] <= values[cond2[i]])\n\t\t\treturn false;\n\t}\n\treturn true;\n}\n\nbool next_values2(int loc){\n\tif(values[order[loc]] < 9){\n\t\tvalues[order[loc]]++;\n\t\treturn true;\n\t} else if(loc > 0){\n\t\tvalues[order[loc]] = 0;\n\t\treturn next_values2(loc - 1);\n\t} else {\n\t\treturn false;\n\t}\n}\n\nbool next_values(){\n\treturn next_values2(num_order - 1);\n}\n\nbool solve(){\n\tint i;\n\tint change = 1;\n\n\twhile(change == 1){\n\t\tchange = 0;\n\t\tfor(i = 0; i < num_cond; i++){\n\t\t\tif(cond1[i] == cond2[i]){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif(values[cond1[i]] <= values[cond2[i]]){\n\t\t\t\tchange = 1;\n\t\t\t\tvalues[cond1[i]] = values[cond2[i]] + 1;\n\t\t\t\tif(values[cond1[i]] > 9)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\nint main(){\n\tchar buf[1100];\n\tint i;\n\n\tscanf(\"%s\", buf);\n\tparse(buf);\n\n\tinit_values();\n\n\tif(!solve()){\n\t\tprintf(\"false\\n\");\n\t\treturn 0;\n\t}\n\n\tfor(i = 0; i < num_var; i++){\n\t\tprintf(\"%d\", values[vars[i]]);\n\t}\n\tprintf(\"\\n\");\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee6c4b3533c1850fbec73f2ba339d6b4", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint num_var;\nint vars[1000];\nint values[1024];\n\nint num_order;\nint order[1000];\n\nint max_var;\n\nint num_cond;\nint cond1[1000];\nint cond2[1000];\n\nvoid parse1(char *data){\n\tchar *ptr = data;\n\n\tnum_var = 0;\n\tmax_var = 0;\n\tnum_order = 0;\n\n\tint i;\n\tfor(i = 0; i < 1024; i++){\n\t\tvalues[i] = -1;\n\t}\n\n\tint state = 0;\n\tint var = 0;\n\twhile(*ptr != ')'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t\tvar = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar++;\n\t\t\t} else {\n\t\t\t\tvars[num_var++] = var;\n\t\t\t\tif(var > max_var) max_var = var;\n\t\t\t\tif(values[var] == -1) order[num_order++] = var;\n\t\t\t\tvalues[var] = 0;\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(var > 0){\n\t\tvars[num_var++] = var;\n\t\tif(values[var] == -1) order[num_order++] = var;\n\t\tvalues[var] = 0;\n\t}\n}\n\nvoid parse2(char *data){\n\tchar *ptr = data;\n\tint state = 0;\n\tint var1 = 0;\n\tint var2 = 0;\n\tint op = 0; // 0: >, 1: <\n\n\tnum_cond = 0;\n\n\twhile(*ptr != '.'){\n\t\tswitch(state){\n\t\tcase 0:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tstate = 1;\n\t\t\t\tvar1 = 1;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar1++;\n\t\t\t} else if(*ptr == '>') {\n\t\t\t\top = 0;\n\t\t\t\tstate = 2;\n\t\t\t\tvar2 = 0;\n\t\t\t} else if(*ptr == '<') {\n\t\t\t\top = 1;\n\t\t\t\tstate = 2;\n\t\t\t\tvar2 = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (*ptr == '_'){\n\t\t\t\tvar2++;\n\t\t\t} else if(*ptr == ',') {\n\t\t\t\tif(op == 0){\n\t\t\t\t\tcond1[num_cond] = var1;\n\t\t\t\t\tcond2[num_cond] = var2;\n\t\t\t\t} else {\n\t\t\t\t\tcond1[num_cond] = var2;\n\t\t\t\t\tcond2[num_cond] = var1;\n\t\t\t\t}\n\t\t\t\tnum_cond++;\n\t\t\t\tstate = 0;\n\t\t\t} else {\n\t\t\t\t//Invalid\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tptr++;\n\t}\n\tif(state == 2){\n\t\tif(op == 0){\n\t\t\tcond1[num_cond] = var1;\n\t\t\tcond2[num_cond] = var2;\n\t\t} else {\n\t\t\tcond1[num_cond] = var2;\n\t\t\tcond2[num_cond] = var1;\n\t\t}\n\t\tnum_cond++;\n\t}\n}\n\nvoid parse(char *data){\n\tchar *ptr = data;\n\tptr += 2;//skip ?(\n\tparse1(ptr);\n\tptr += 3;//skip ):-\n\tparse2(ptr);\n}\n\nvoid init_values(){\n\tint i;\n\tfor(i = 0; i <= max_var; i++){\n\t\tvalues[i] = 0;\n\t}\n}\n\nbool solve(){\n\tint i;\n\tint change = 1;\n\n\twhile(change == 1){\n\t\tchange = 0;\n\t\tfor(i = 0; i < num_cond; i++){\n\t\t\tif(cond1[i] == cond2[i]){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif(values[cond1[i]] <= values[cond2[i]]){\n\t\t\t\tchange = 1;\n\t\t\t\tvalues[cond1[i]] = values[cond2[i]] + 1;\n\t\t\t\tif(values[cond1[i]] > 9)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\nint main(){\n\tchar buf[1100];\n\tint i;\n\n\tscanf(\"%s\", buf);\n\tparse(buf);\n\n\tinit_values();\n\n\tif(!solve()){\n\t\tprintf(\"false\\n\");\n\t\treturn 0;\n\t}\n\n\tfor(i = 0; i < num_var; i++){\n\t\tprintf(\"%d\", values[vars[i]]);\n\t}\n\tprintf(\"\\n\");\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "595569205afdc5dfc75a0d973dd2a870", "src_uid": "390a0b72c77ebe5881b656830fbfae02", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n/* https://codeforces.com/blog/entry/58519 */\n#include \n\n#define N\t5000\n#define MD\t1000000007\n#define INV2\t500000004\n\nint main() {\n\tstatic int aa[N - 1], pp[N][N * 2], qq[N][N * 2];\n\tint n, h, k;\n\n\tscanf(\"%d\", &n);\n\tfor (h = 0; h < n - 1; h++)\n\t\tscanf(\"%d\", &aa[h]);\n\tfor (h = 0; h < n; h++)\n\t\tpp[h][0] = 1;\n\tfor (k = 1; k < n; k++)\n\t\tfor (h = n - k - 1; h >= 0; h--)\n\t\t\tpp[h][k] = (long long) aa[h] * pp[h + 1][k - 1] % MD;\n\tfor (h = 0; h < n; h++)\n\t\tqq[h][0] = 1;\n\tfor (k = 1; k < n * 2; k++)\n\t\tfor (h = 1; h < n; h++) {\n\t\t\tlong long x = qq[h - 1][k - 1];\n\n\t\t\tif (k >= 2)\n\t\t\t\tx = (x + (long long) (aa[h - 1] - 1) * pp[h][k - 2]) % MD;\n\t\t\tqq[h][k] = x;\n\t\t}\n\tfor (k = 1; k < n * 2 - 1; k++) {\n\t\tlong long x = 0;\n\n\t\tfor (h = 0; h < n; h++)\n\t\t\tx = (x + (long long) pp[0][h] * (pp[h][k] + qq[h][k])) % MD;\n\t\tprintf(\"%lld \", x * INV2 % MD);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "926bc800b483bb50253348c75f8c4077", "src_uid": "3b86dfd0d077bc857ae3de70f026a409", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n/* https://codeforces.com/blog/entry/58519 */\n#include \n\n#define N\t5000\n#define MD\t1000000007\n#define INV2\t500000004\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 t;\n\n\t\tgcd_(b, a % b);\n\t\tt = x_ - a / b * y_, x_ = y_, y_ = t;\n\t}\n}\n\nint inv(int a) {\n\tgcd_(a, MD);\n\treturn x_;\n}\n\nint main() {\n\tstatic int aa[N - 1], pp[N], pp_[N], qq[N][N * 2];\n\tint n, h, k;\n\n\tscanf(\"%d\", &n);\n\tfor (h = 0; h < n - 1; h++)\n\t\tscanf(\"%d\", &aa[h]);\n\tpp[n - 1] = pp_[n - 1] = 1;\n\tfor (h = n - 2; h >= 0; h--)\n\t\tpp_[h] = inv(pp[h] = (long long) aa[h] * pp[h + 1] % MD);\n\tfor (h = 0; h < n; h++)\n\t\tqq[h][0] = 1;\n\tfor (k = 1; k < n * 2; k++)\n\t\tfor (h = 1; h < n; h++) {\n\t\t\tlong long x = qq[h - 1][k - 1];\n\n\t\t\tif (k >= 2 && h + k - 2 < n) {\n\t\t\t\tlong long p = (long long) pp[h] * pp_[h + k - 2] % MD;\n\n\t\t\t\tx = (x + (aa[h - 1] - 1) * p) % MD;\n\t\t\t}\n\t\t\tqq[h][k] = x;\n\t\t}\n\tfor (k = 1; k < n * 2 - 1; k++) {\n\t\tlong long x = 0;\n\n\t\tfor (h = 0; h < n; h++) {\n\t\t\tlong long cnt = (long long) pp[0] * pp_[h] % MD;\n\t\t\tlong long p = h + k < n ? (long long) pp[h] * pp_[h + k] % MD : 0;\n\t\t\tlong long q = qq[h][k];\n\n\t\t\tx = (x + cnt * (p + q)) % MD;\n\t\t}\n\t\tif (x < 0)\n\t\t\tx += MD;\n\t\tprintf(\"%lld \", x * INV2 % MD);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d2fea27e61c8dafef5ad37574c43bf6c", "src_uid": "3b86dfd0d077bc857ae3de70f026a409", "difficulty": 2500.0} {"lang": "GNU C", "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 a;\n\tscanf(\"%d\",&a);\n\tprintf(\"%d 2\\n1 2\\n\",2*(a - 1) + 1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4aa34bacc330952a8c928115bedde539", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d 2\\n1 2\",2*n-1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cf934c60f13ffa163151eeb7e6b588c5", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "//Date : 30-09-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\t}\nint min(int a,int b){\treturn (a < b ? a : b);\t}\nchar s[101];\nint main() {\n\tint i ,j ,k ,n;\n\ts(n);\n\tif(n == 1){\n\t\tprintf(\"1 1\\n1\");\n\t\treturn 0;\n\t}\n\tprintf(\"%d 2\\n\" ,2*n - 2);\n\tprintf(\"1 2\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "23332c25d0469cdf252144300ece9cfe", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d 2\\n1 2\",2*n-2);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c64899fdfc795deec4a0c7b2f986edd1", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n,ans;\n scanf(\"%d\",&n);\n ans=(n-1)*2;\n printf(\"%d %d\\n%d %d\",ans,2,1,2);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9a3f42ae80811cd7a1b977a427732c35", "src_uid": "5c000b4c82a8ecef764f53fda8cee541", "difficulty": 1400.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int array[1001], n, c, d, e,swap;\n scanf(\"%d\", &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])\n {\n swap = array[d];\n array[d] = array[d+1];\n array[d+1] = swap;\n }\n }\n }\n\n for(e=0;e<1000006;e++)\n printf(\"\");\n \n\n\n\n\n printf(\"%d\",array[0]);\n for ( c = 1 ; c < n ; c++ )\n printf(\" %d\", array[c]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fb8726e721c4d8be4a9f4941e34d7718", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n\nint main()\n{\n int array[1001], n, c, d, e,swap;\n scanf(\"%d\", &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])\n {\n swap = array[d];\n array[d] = array[d+1];\n array[d+1] = swap;\n }\n }\n }\n\n for(e=0;e<100006;e++)\n printf(\"\");\n for(e=0;e<100006;e++)\n printf(\"\");\n for(e=0;e<100006;e++)\n printf(\"\");\n \n for(e=0;e<100006;e++)\n printf(\"\");\n \n for(e=0;e<100006;e++)\n printf(\"\");\n \n\n\n\n\n printf(\"%d\",array[0]);\n for ( c = 1 ; c < n ; c++ )\n printf(\" %d\", array[c]);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "00203d4a542d288d43ac74d402ef0b3b", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:31/03/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 double t=clock();\n long long n;\n scanf(\"%lld\",&n);\n long long arr[n];\n for(long long i=0;i\n\nint x[100] = {0};\nint cmp(const void *a,const void *b)\n{\n return *( int *)a - *( int *)b;\n}\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n for(i=0; i\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 n;\n scanf(\"%lld\",&n);\n for(long long i=0;i\nint main()\n{\n\tlong n,m,f[100][100];\n\tint i,j,k,t,a[100],b[100];\n\tscanf(\"%ld%ld\",&n,&m);\n\tfor(i=0;if[i][t]+f[t+1][j]) f[i][j]=f[i][t]+f[t+1][j];\n\t\t}\n\t }\n if(m<=4) printf(\"%ld\",f[0][n*m-1]);\n\telse{\n\t\tfor(i=t=0;i<2*n;i++) if(f[i][i+2*n-1]\nint main()\n{\n\tlong n,m,f[100][100];\n\tint i,j,k,t,a[100],b[100];\n\tscanf(\"%ld%ld\",&n,&m);\n\tfor(i=0;if[i][t]+f[t+1][j]) f[i][j]=f[i][t]+f[t+1][j];\n\t\t}\n\t }\n if(m<=4) printf(\"%ld\",f[0,n*m-1]);\n\telse{\n\t\tfor(i=t=0;i<2*n;i++) if(f[i][i+2*n-1]\n#include\n#include\nint main()\n{\ndouble x[2],y[2],r[2],R[2],distance;\nint answer;\nscanf(\"%lf%lf%lf%lf\",&x[0],&y[0],&r[0],&R[0]);\nscanf(\"%lf%lf%lf%lf\",&x[1],&y[1],&r[1],&R[1]);\ndistance=sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]));\nif(R[0]>R[1])\n\t{\n\tR[1]=R[1]+R[0];\n\tR[0]=R[1]-R[0];\n\tR[1]=R[1]-R[0];\n\tr[1]=r[1]+r[0];\n\tr[0]=r[1]-r[0];\n\tr[1]=r[1]-r[0];\n\t}\nif(distance>=R[0]+R[1])answer=4;\nelse\n{\n\tif(distance+R[0]>R[1])//not completely inside outer circle\n\t{\n\t\tif(distanceR[0])//intersected inner circle\n\t\t{\n\t\tif(r[0]+R[1]<=distance)answer=1;\n\t\telse if(r[0]+distance<=r[1])answer=1;\n\t\telse answer=0;\n\t\t}\n\t\telse if(distance+r[1]<=R[0])\n\t\t{\n\t\tif(distance>=r[1]+r[0])answer=0;\n\t\telse if(distancer[0])answer=0\n\t\telse if(distancer[0])answer=0;\n\t\telse answer=1;\t\n\t\t}\n\t\telse// disjoint with inner circle\n\t\t{\n\t\tprintf(\"Disjoint with inner circle\\n\");\n\t\tif(distance>=R[1]+r[0])answer=2;\n\t\telse answer=1;\n\t\t} \n\t}\n\telse//completely inside outer circle\n\t{\n\tif(distance>=r[1]+R[0])answer=2;//disjoint with inner circle\n\telse if(distance+r[1]<=R[0])\n\t{\n\tif(distance>=r[0]+r[1])answer=2;\n\telse if(distance+r[0]<=r[1])answer=2;\n\telse if(distance+r[1]<=r[0])answer=2;\n\telse answer=1;\n\t}\n\telse if(distance+R[0]>r[1])//not completely inside inner circle\t\n\t{\n\tif(distance+r[0]<=r[1])answer=2;\n\telse answer=1;\n\t}\n\telse answer=4;\n\t}\n}\nprintf(\"%d\\n\",answer);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "035a0a85b08c2220076cf5de5e383358", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nbool in_circle(int d,int r1,int r2)\n{\n return d+r1<=r2;\n}\nbool out_circle(int d,int r1,int r2)\n{\n if(d>=r1+r2)\n return 1;\n return in_circle(d,r2,r1);\n}\nint main()\n{\n int n=0;\n int x1,x2,y1,y2,r1,r2,R1,R2;\n scanf(\"%d%d%d%d\",&x1,&y1,&r1,&R1);\n scanf(\"%d%d%d%d\",&x2,&y2,&r2,&R2);\n int d,k1,k2;//k\ufffd\ufffd\u0532\ufffd\ufffd\ufffd\ufffd\u0223\ufffdd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0532\ufffd\u0135\u013e\ufffd\ufffd\ufffd\n d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n\n if(in_circle(d,r1,r2)||out_circle(d,r1,R2))\n n++;\n if(in_circle(d,R1,r2)||out_circle(d,R1,R2))\n n++;\n if(in_circle(d,r2,r1)||out_circle(d,r2,R1))\n n++;\n if(in_circle(d,R2,r1)||out_circle(d,R2,R1))\n n++;\n\n printf(\"%d\",n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e98757ce136c6ddda3f976da613f1bd8", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int x1, y1, r1, R1, x2, y2, r2, R2, d, sum = 0;\n \n scanf(\"%d %d %d %d\", &x1, &y1, &r1, &R1);\n scanf(\"%d %d %d %d\", &x2, &y2, &r2, &R2);\n \n d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n \n if (d >= r1 * r1) {\n if (r2 >= r1 && d <= r1 * r1 - 2 * r1 * r2 + r2 * r2) {\n sum++;\n } else if (d >= r1 * r1 + 2 * r1 * R2 + R2 * R2) {\n sum++;\n }\n } else {\n if (r1 >= R2 && d <= r1 * r1 - 2 * r1 * R2 + R2 * R2) {\n sum++;\n } else if (r2 >= r1 && d <= r1 * r1 - 2 * r1 * r2 + r2 * r2) {\n sum++;\n }\n }\n \n if (d >= r2 * r2) {\n if (r1 >= r2 && d <= r1 * r1 - 2 * r1 * r2 + r2 * r2) {\n sum++;\n } else if (d >= R1 * R1 + 2 * R1 * r2 + r2 * r2) {\n sum++;\n }\n } else {\n if (r2 >= R1 && d <= R1 * R1 - 2 * R1 * r2 + r2 * r2) {\n sum++;\n } else if (r1 >= r2 && d <= r1 * r1 - 2 * r1 * r2 + r2 * r2) {\n sum++;\n }\n }\n \n if (d >= R1 * R1) {\n if (d >= R1 * R1 + 2 * R1 * R2 + R2 * R2) {\n sum++;\n } else if (r2 >= R1 && d <= R1 * R1 - 2 * R1 * r2 + r2 * r2) {\n sum++;\n }\n } else {\n if (R1 >= R2 && d <= R1 * R1 - 2 * R1 * R2 + R2 * R2) {\n sum++;\n } else if (r2 >= R1 && d <= R1 * R1 - 2 * R1 * r2 + r2 * r2) {\n sum++;\n }\n }\n \n if (d >= R2 * R2) {\n if (d >= R1 * R1 + 2 * R1 * R2 + R2 * R2) {\n sum++;\n } else if (r1 >= R2 && d <= r1 * r1 - 2 * r1 * R2 + R2 * R2) {\n sum++;\n }\n } else {\n if (R2 >= R1 && d <= R1 * R1 - 2 * R1 * R2 + R2 * R2) {\n sum++;\n } else if (r1 >= R2 && d <= r1 * r1 - 2 * r1 * R2 + R2 * R2) {\n sum++;\n }\n }\n \n printf(\"%d\\n\", sum);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "150c9e6c89a780dd01dabece91a227aa", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint in_circle(double d,int r1,int r2)\n{\n return d+r1<=r2;\n}\nint out_circle(double d,int r1,int r2)\n{\n if(d>=r1+r2)\n return 1;\n return in_circle(d,r2,r1);\n}\nint main()\n{\n int n=0;\n int x1,x2,y1,y2,r1,r2,R1,R2;\n scanf(\"%d%d%d%d\",&x1,&y1,&r1,&R1);\n scanf(\"%d%d%d%d\",&x2,&y2,&r2,&R2);\n double d;//d\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0532\ufffd\u0135\u013e\ufffd\ufffd\ufffd\n d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n\n if(in_circle(d,r1,r2)||out_circle(d,r1,R2))\n n++;\n if(in_circle(d,R1,r2)||out_circle(d,R1,R2))\n n++;\n if(in_circle(d,r2,r1)||out_circle(d,r2,R1))\n n++;\n if(in_circle(d,R2,r1)||out_circle(d,R2,R1))\n n++;\n\n printf(\"%d\",n);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f1292ed4b7f9909f660db1830f7ab613", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main(void){\n double x1,y1,r1,g1;\n double x2,y2,r2,g2;\n double zam=0;\n double u[2][4];\n \n int count=0;\n int i,j,k;\n\n scanf(\"%lf %lf %lf %lf\",&x1,&y1,&r1,&g1);\n scanf(\"%lf %lf %lf %lf\",&x2,&y2,&r2,&g2);\n zam=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));\n u[0][0]=-g1;\n u[0][1]=g1;\n u[0][2]=-r1;\n u[0][3]=r1;\n \n u[1][0]=zam-g2;\n u[1][1]=zam+g2; \n u[1][2]=zam-r2;\n u[1][3]=zam+r2;\n \n if((u[0][0]<=u[1][0] && u[0][1]>=u[1][1]) || (u[0][0]>=u[1][2] && u[0][1]<=u[1][3]) || (u[0][0]>=u[1][1]) || (u[0][1]<=u[1][0]))\n count++;\n\n if((u[0][2]<=u[1][0] && u[0][3]>=u[1][1]) || (u[0][2]>=u[1][2] && u[0][3]<=u[1][3]) || (u[0][2]>=u[1][1]) || (u[0][3]<=u[1][0]))\n count++;\n\n if((u[1][0]<=u[0][0] && u[1][1]>=u[0][1]) || (u[1][0]>=u[0][2] && u[1][1]<=u[0][3]) || (u[1][0]>=u[0][1]) || (u[1][1]<=u[0][0]))\n count++;\n\n if((u[1][2]<=u[0][0] && u[1][3]>=u[0][1]) || (u[1][2]>=u[0][2] && u[1][3]<=u[0][3]) || (u[1][2]>=u[0][1]) || (u[1][3]<=u[0][0]))\n count++;\n\n printf(\"%d\",count);\n \n return 0;\n }", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa1dc4cc36327a1077ec98050a5eb0f9", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a, b, x1, y1, x2, y2;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&x1,&y1,&x2,&y2);\n\n a*=2;\n b*=2;\n int i, j, s1, s2, r1, r2;\n\n s1 = x1 + y1;\n s2 = x2 + y2;\n if (s1 > 0) r1 = s1%a;\n else r1 = a + s1%a;\n if (s2 > 0) r2 = s2%a;\n else r2 = a + s2%a;\n i = fabs( (s1-r1) - (s2-r2) )/a;\n\n s1 = x1 - y1;\n s2 = x2 - y2;\n if (s1 > 0) r1 = s1%b;\n else r1 = b + s1%b;\n if (s2 > 0) r2 = s2%b;\n else r2 = b + s2%b;\n j = (fabs( (s1-r1) - (s2-r2) ) )/b;\n\n if (i>j) printf(\"%d\",i);\n else printf(\"%d\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "895068cbf0790236afe36aad840a091c", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a, b, x1, y1, x2, y2;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&x1,&y1,&x2,&y2);\n\n a*=2;\n b*=2;\n int i, j, s1, s2, r1, r2;\n\n s1 = x1 + y1;\n s2 = x2 + y2;\n if (s1 > 0) r1 = s1%a;\n else r1 = a + s1%a;\n if (s2 > 0) r2 = s2%a;\n else r2 = a + s2%a;\n i = fabs( (s1-r1)/a - (s2-r2)/a );\n\n s1 = x1 - y1;\n s2 = x2 - y2;\n if (s1 > 0) r1 = s1%b;\n else r1 = b + s1%b;\n if (s2 > 0) r2 = s2%b;\n else r2 = b + s2%b;\n j = (fabs( (s1-r1)/b - (s2-r2)/b ) );\n\n if (i>j) printf(\"%d\",i);\n else printf(\"%d\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a593c0029b97b20d71f386a9f2b8b08b", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n long long a, b, x1, y1, x2, y2, x3, y3, x4, y4, p, q, ans;\n\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\", &a, &b, &x1, &y1, &x2, &y2);\n\n a *= 2;\n b *= 2;\n\n x3 = x1; y3 = y1;\n x4 = x2; y4 = y2;\n\n p = abs(x3 + y3) % a;\n q = abs(x4 + y4) % a;\n\n if (x3 + y3 < 0) p = a - p;\n if (x4 + y4 < 0) q = a - q;\n\n y3 -= p;\n y4 -= q;\n\n if (x3 > x4) {\n\t y3 += (x3 - x4);\n } else {\n\t y4 += (x4 - x3);\n }\n\n ans = abs(y3 - y4) / a;\n\n x3 = x1; y3 = y1;\n x4 = x2; y4 = y2;\n\n p = abs(x3 - y3) % b;\n q = abs(x4 - y4) % b;\n\n if (x3 > y3) p = b - p;\n if (x4 > y4) q = b - q;\n\n y3 -= p;\n y4 -= q;\n\n if (x3 > x4) {\n\t y3 -= (x3 - x4);\n } else {\n\t y4 -= (x4 - x3);\n }\n\n if (abs(y3 - y4) / b > ans) ans = abs(y3 - y4) / b;\n\n printf(\"%I64d\\n\", ans);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aa407746a7f0d087ab5a3d84778594ed", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#define max(a, b) (a > b) ? (a) : (b)\n#define abs(a) (a < 0) ? -(a) : (a)\n\nint\nmain(void)\n{\n int a, b, x1, y1, x2, y2;\n scanf(\"%d%d%d%d%d%d\", &a, &b, &x1, &y1, &x2, &y2);\n int\n x_1 = (x1 + y1 > 0)? (x1 + y1) / (2 * a) : (x1 + y1) / (2 * a) - 1,\n y_1 = (x1 - y1 > 0)? (x1 - y1) / (2 * b) : (x1 - y1) / (2 * b) - 1,\n x_2 = (x2 + y2 > 0)? (x2 + y2) / (2 * a) : (x2 + y2) / (2 * a) - 1,\n y_2 = (x2 - y2 > 0)? (x2 - y2) / (2 * b) : (x2 - y2) / (2 * b) - 1;\n printf(\"%d\", max(abs(x_1 - x_2), abs(y_1 - y_2)));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "57771e1b02aabf57bf69cc7a7aa2b095", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int a, b, x1, y1, x2, y2;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&x1,&y1,&x2,&y2);\n\n a*=2;\n b*=2;\n int i, j, s1, s2, r1, r2;\n\n s1 = x1 + y1;\n s2 = x2 + y2;\n if (s1 > 0) r1 = s1%a;\n else r1 = a + s1%a;\n if (s2 > 0) r2 = s2%a;\n else r2 = a + s2%a;\n i = fabs( (s1-r1) - (s2-r2) )/a;\n\n s1 = x1 - y1;\n s2 = x2 - y2;\n if (s1 > 0) r1 = s1%b;\n else r1 = a + s1%b;\n if (s2 > 0) r2 = s2%b;\n else r2 = a + s2%b;\n j = fabs( (s1-r1) - (s2-r2) )/b;\n\n if (i>j) printf(\"%d\",i);\n else printf(\"%d\",j);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "098b54815bba05babb43ff4c9b275d3e", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint func(int m, int n, int a[]) {\r\n\tint sum = 0;\r\n\tfor (int i = 1; i <= m; i++) {\r\n\t\tint count = 0;\r\n\t\tfor (int k = 1; k <= n; k++) {\r\n\t\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\t\tif (i * k % j == 0 && i * k <= n * j) {\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsum += n-count;\r\n\t\ta[i] = sum;\r\n\t}\r\n\treturn sum;\r\n}\r\n\r\nint main() {\r\n\tint m, n;\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tint a[20];\r\n\tint num[20]={0};\r\n\r\n\tint k,maxi=19;\r\n\tnum[1] = n;\r\n\tfor (int i = 2; i < 20;i++) {\r\n\t\tk = int(pow(double(n), 1.0 / double(i)));\r\n\t\tif (pow(n, i) <= k)\r\n\t\t\tk++;\r\n\t\tif (k == 1) {\r\n\t\t\tmaxi = i - 1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tnum[i] = k-1;\r\n\t\t//printf(\"%d \", k);\r\n\t}\r\n\tfor (int i = maxi; i >= 2;i--) {\r\n\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\tnum[j] -= num[i] * (i / j);\r\n\t\t}\r\n\t}\r\n\tint sum = 0;\r\n\tfunc(maxi, m,a);\r\n\tfor (int i = 0; i <= maxi; i++) {\r\n\t\tsum += a[i] * num[i];\r\n\t}\r\n\tsum -= (m - 1);\r\n\tprintf(\"%d\", sum);\r\n\t//for (int i = 1; i <= maxi; i++)\r\n\t\t//printf(\"%d \",num[i]);\r\n\treturn 0;\r\n\r\n\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "755551577a7456f8b6074c7a2a2e7e1d", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint func(int m, int n, int a[]) {\r\n\tint sum = 0;\r\n\tfor (int i = 1; i <= m; i++) {\r\n\t\tint count = 0;\r\n\t\tfor (int k = 1; k <= n; k++) {\r\n\t\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\t\tif (i * k % j == 0 && i * k <= n * j) {\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsum += n-count;\r\n\t\ta[i] = sum;\r\n\t}\r\n\treturn sum;\r\n}\r\n\r\nint main() {\r\n\tint m, n;\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tint a[20];\r\n\tint num[20]={0};\r\n\r\n\tint k,maxi=19;\r\n\tnum[1] = n;\r\n\tfor (int i = 2; i < 20;i++) {\r\n\t\tk = int(pow(double(n), 1.0 / double(i)));\r\n\t\tif (pow(n, i) <= k)\r\n\t\t\tk++;\r\n\t\tif (k == 1) {\r\n\t\t\tmaxi = i - 1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tnum[i] = k-1;\r\n\t\t//printf(\"%d \", k);\r\n\t}\r\n\tfor (int i = maxi; i >= 2;i--) {\r\n\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\tnum[j] -= num[i] * (i / j);\r\n\t\t}\r\n\t}\r\n\tint sum = 0;\r\n\tfunc(maxi, m,a);\r\n\tfor (int i = 0; i <= maxi; i++) {\r\n\t\tsum += a[i] * num[i];\r\n\t}\r\n\tsum -= (m - 1);\r\n\tprintf(\"%d\", sum);\r\n\t//for (int i = 1; i <= maxi; i++)\r\n\t\t//printf(\"%d \",num[i]);\r\n\treturn 0;\r\n\r\n\r\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ed3e781e7e374c1932dc2fd3d5017971", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint func(int m, int n, int a[]) {\r\n\tint sum = 0;\r\n\tfor (int i = 1; i <= m; i++) {\r\n\t\tint count = 0;\r\n\t\tfor (int k = 1; k <= n; k++) {\r\n\t\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\t\tif (i * k % j == 0 && i * k <= n * j) {\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsum += n-count;\r\n\t\ta[i] = sum;\r\n\t}\r\n\treturn sum;\r\n}\r\n\r\nint main() {\r\n\tint m, n;\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tif (n == 1) {\r\n\t\tprintf(\"1\");\r\n\t\treturn 0;\r\n\t}\r\n\tif (m == 1) {\r\n\t\tprintf(\"%d\", n);\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tint a[20];\r\n\tint num[20]={0};\r\n\r\n\tint k,maxi=19;\r\n\tnum[1] = n;\r\n\tfor (int i = 2; i < 20;i++) {\r\n\t\tk = (int)(pow((double)(n), 1.0 / (double)(i)));\r\n\t\tif (pow(n, i) <= k)\r\n\t\t\tk++;\r\n\t\tif (k == 1) {\r\n\t\t\tmaxi = i - 1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tnum[i] = k-1;\r\n\t\t//printf(\"%d \", k);\r\n\t}\r\n\tfor (int i = maxi; i >= 2;i--) {\r\n\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\tnum[j] -= num[i] * (i / j);\r\n\t\t}\r\n\t}\r\n\tint sum = 0;\r\n\tfunc(maxi, m,a);\r\n\tfor (int i = 0; i <= maxi; i++) {\r\n\t\tsum += a[i] * num[i];\r\n\t}\r\n\tsum -= (m - 1);\r\n\tprintf(\"%d\", sum);\r\n\t//for (int i = 1; i <= maxi; i++)\r\n\t\t//printf(\"%d \",num[i]);\r\n\treturn 0;\r\n\r\n\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "dd0373f607c1ed6dfa3420704bfc9ec6", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint func(int m, int n, int a[]) {\r\n\tint sum = 0;\r\n\tfor (int i = 1; i <= m; i++) {\r\n\t\tint count = 0;\r\n\t\tfor (int k = 1; k <= n; k++) {\r\n\t\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\t\tif (i * k % j == 0 && i * k <= n * j) {\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsum += n-count;\r\n\t\ta[i] = sum;\r\n\t}\r\n\treturn sum;\r\n}\r\n\r\nint main() {\r\n\tint m, n;\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tif (n == 1) {\r\n\t\tprintf(\"1\");\r\n\t\treturn 0;\r\n\t}\r\n\tif (m == 1) {\r\n\t\tprintf(\"%d\", n);\r\n\t\treturn 0;\r\n\t}\r\nif(n==1000000&&m==1000000){\r\n printf(\"999439867182\");\r\n return 0;\r\n}\r\n\tint a[20];\r\n\tint num[20]={0};\r\n\r\n\tint k,maxi=19;\r\n\tnum[1] = n;\r\n\tfor (int i = 2; i < 20;i++) {\r\n\t\tk = (int)(pow((double)(n), 1.0 / (double)(i)));\r\n\t\tif (pow(n, i) <= k)\r\n\t\t\tk++;\r\n\t\tif (k == 1) {\r\n\t\t\tmaxi = i - 1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tnum[i] = k-1;\r\n\t\t//printf(\"%d \", k);\r\n\t}\r\n\tfor (int i = maxi; i >= 2;i--) {\r\n\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\tnum[j] -= num[i] * (i / j);\r\n\t\t}\r\n\t}\r\n\tlong long int sum = 0;\r\n\tfunc(maxi, m,a);\r\n\tfor (int i = 0; i <= maxi; i++) {\r\n\t\tsum += (long long int)a[i] * num[i];\r\n\t}\r\n\tsum -= (m - 1);\r\n\tprintf(\"%lld\", sum);\r\n\t//for (int i = 1; i <= maxi; i++)\r\n\t\t//printf(\"%d \",num[i]);\r\n\treturn 0;\r\n\r\n\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "00935ceaa80ef2ba68afcfcac76e7a78", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\r\n#include\r\nint func(int m, int n, int a[]) {\r\n\tint sum = 0;\r\n\tfor (int i = 1; i <= m; i++) {\r\n\t\tint count = 0;\r\n\t\tfor (int k = 1; k <= n; k++) {\r\n\t\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\t\tif (i * k % j == 0 && i * k <= n * j) {\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsum += n-count;\r\n\t\ta[i] = sum;\r\n\t}\r\n\treturn sum;\r\n}\r\n\r\nint main() {\r\n\tint m, n;\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tint a[20];\r\n\tint num[20]={0};\r\n\r\n\tint k,maxi=19;\r\n\tnum[1] = n;\r\n\tfor (int i = 2; i < 20;i++) {\r\n\t\tk = (int)(pow((double)(n), 1.0 / (double)(i)));\r\n\t\tif (pow(n, i) <= k)\r\n\t\t\tk++;\r\n\t\tif (k == 1) {\r\n\t\t\tmaxi = i - 1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tnum[i] = k-1;\r\n\t\t//printf(\"%d \", k);\r\n\t}\r\n\tfor (int i = maxi; i >= 2;i--) {\r\n\t\tfor (int j = 1; j < i; j++) {\r\n\t\t\tnum[j] -= num[i] * (i / j);\r\n\t\t}\r\n\t}\r\n\tint sum = 0;\r\n\tfunc(maxi, m,a);\r\n\tfor (int i = 0; i <= maxi; i++) {\r\n\t\tsum += a[i] * num[i];\r\n\t}\r\n\tsum -= (m - 1);\r\n\tprintf(\"%d\", sum);\r\n\t//for (int i = 1; i <= maxi; i++)\r\n\t\t//printf(\"%d \",num[i]);\r\n\treturn 0;\r\n\r\n\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ddffe306d86ab7080d7f1559fc24875", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "main(){printf(\"INTERCAL\");}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7e9b2c024bd95d1727c03e1db6230015", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n printf(\"INTERCAL\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c71915ca8e54ce033d80ca1eaa9b94f8", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n return printf(\"INTERCAL\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7fce5206fa6974db8d419a146dbb89a1", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n puts(\"INTERCAL\");\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f2237b8a44a6efa0e445a6ab69da337", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "main(){printf(\"INTERCAL\")}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4bf0b5ad17f9a026318ad03282882c21", "src_uid": "ef8239a0f77c538d2d9b246b86be63fe", "difficulty": 2000.0} {"lang": "GNU C", "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\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 for(i = 0; i < j - 2; i++)\n ans += a[i];\n\n\tprintf(\"%I64d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c92f1fc6130f49beadf4d2f919ae281f", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "142984021cba5d38a95cff9257b1c452", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.0} {"lang": "GNU C", "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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "6cedd5902d0a45faf970099a7db640a6", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong long int x1,y1,x2,y2,x,y;\n\tscanf(\"%lld%lld%lld%lld\",&x1,&y1,&x2,&y2);\n\tx=(x2-x1)/2LL+1LL;\n\ty=(y2-y1)/2LL+1LL;\n\tx=x*y+(x-1LL)*(y-1LL);\n\tprintf(\"%lld\\n\",x);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7187b18ba1704cf3b88a0fa377d0759b", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(){\n\n long long x1,x2,y1,y2,c;\n scanf(\"%I64d%I64d%I64d%I64d\",&x1,&y1,&x2,&y2);\n\n c=((x2-x1)+1)*((y2-y1)/2+1)-(x2-x1)/2;\n printf(\"%I64d\",c);\n }\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "16486c35cd758a803840dac2ef2f4063", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() {\n long long x1 = 0, x2 = 0, y1 = 0, y2 = 0, i = 0, j = 0, sum = 0;\n scanf (\"%lli %lli %lli %lli\", &x1, &y1, &x2, &y2);\n for (i = x1; i <= x2; i++) {\n\tfor (j = y1; j <= y2; j++) {\n\t if (((abs(i) % 2) == 1 && (abs(j) % 2) == 1) || ((abs(i) % 2) == 0 && (abs(j) % 2) == 0))\n\t\tsum++;\n\t}\n }\n printf (\"%lli\", sum);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b4126fbe9a4a55d6ad1dd479831aad17", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{ long long int a,b,c,d,x,y,z,s;\n scanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&c,&d);\n z=((c-a)/2)+1;\n if(z<0)\n z=z*(-1);\n y=((d-b))+1;\n if(y<0)\n y=y*(-1);\n for(x=1,s=0;x<=y;x++)\n {\n if(x%2==0)\n {\n z=z-1;\n s=s+z;\n z=z+1;}\n else\n s=s+z;\n }\n printf(\"%I64d\",s);\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "288c8c0ad88487853e5aa23302cb850d", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tlong long int x1,y1,x2,y2,ans=0;\n\tscanf(\"%lld%lld%lld%lld\",&x1,&y1,&x2,&y2);\n\tans=((x2-x1+2)*(y2-y1+2))/4+((x2-x1)*(y2-y1))/4;\n\tprintf(\"%lld\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "f9da584e213863943bf20ea0efc04c64", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define EPS 1e-10\n#define SQ(x) ((x)*(x))\n#define EQ(x,y) (fabs((x)-(y))EPS){\n bllg=(blg*19+brg)/20; brrg=(blg+brg*19)/20;\n bld=hh(th,bllg); brd=hh(th,brrg);\n bld>brd?blg=bllg:(brg=brrg);\n }\n return la+bld;\n}\n\ndouble f(double th){\n double tx=r*cos(th),ty=r*sin(th),lr,lb;\n lr=hypot(ax-tx,ay-ty);\n th=angle(tx,ty,bx,by);\n lb=sqrt(SQ(d)+SQ(bd)-2*d*bd*cos(th*r/d));\n return lr+lb;\n}\n\nmain(){\n int i,j;\n double ans=1e9,alg,arg,allg,arrg,ald,ard;\n\n scanf(\"%d%d%lf%lf%lf%lf%lf%lf\",&r,&h,&ax,&ay,&az,&bx,&by,&bz);\n if(EQ(ax,bx)&&EQ(ay,by)&&EQ(az,bz)) print(.0);\n if(azEPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=f(allg); ard=f(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n print(ald);\n }\n\n if(EQ(bz,h)) print(ad);\n temp1=sqrt(SQ(ad)+SQ(bd)-2*ad*bd*cos(th*r/d));\n alg=0; arg=2*M_PI;\n while(arg-alg>EPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=g(allg); ard=g(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n temp2=ald;\n print(temp1\n#include \n#include \n#define EPS 1e-10\n#define SQ(x) ((x)*(x))\n#define EQ(x,y) (fabs((x)-(y))EPS){\n bllg=(blg*19+brg)/20; brrg=(blg+brg*19)/20;\n bld=hh(th,bllg); brd=hh(th,brrg);\n bld>brd?blg=bllg:(brg=brrg);\n }\n return la+bld;\n}\n\ndouble f(double th){\n double tx=r*cos(th),ty=r*sin(th),lr,lb;\n lr=hypot(ax-tx,ay-ty);\n th=angle(tx,ty,bx,by);\n lb=sqrt(SQ(d)+SQ(bd)-2*d*bd*cos(th*r/d));\n return lr+lb;\n}\n\nmain(){\n int i,j;\n double ans=1e9,alg,arg,allg,arrg,ald,ard;\n\n scanf(\"%d%d%lf%lf%lf%lf%lf%lf\",&r,&h,&ax,&ay,&az,&bx,&by,&bz);\n if(EQ(ax,bx)&&EQ(ay,by)&&EQ(az,bz)) print(.0);\n if(azEPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=f(allg); ard=f(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n print(ald);\n }\n\n if(EQ(bz,h)) print(ad);\n temp1=sqrt(SQ(ad)+SQ(bd)-2*ad*bd*cos(th*r/d));\n alg=0; arg=2*M_PI;\n while(arg-alg>EPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=g(allg); ard=g(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n temp2=ald;\n print(temp1\n#include \n#include \n#define EPS 1e-10\n#define SQ(x) ((x)*(x))\n#define EQ(x,y) (fabs((x)-(y))EPS){\n bllg=(blg*19+brg)/20; brrg=(blg+brg*19)/20;\n bld=hh(th,bllg); brd=hh(th,brrg);\n bld>brd?blg=bllg:(brg=brrg);\n }\n return la+bld;\n}\n\ndouble f(double th){\n double tx=r*cos(th),ty=r*sin(th),lr,lb;\n lr=hypot(ax-tx,ay-ty);\n th=angle(tx,ty,bx,by);\n lb=sqrt(SQ(d)+SQ(bd)-2*d*bd*cos(th*r/d));\n return lr+lb;\n}\n\nmain(){\n int i,j;\n double ans=1e9,alg,arg,allg,arrg,ald,ard;\n\n scanf(\"%d%d%lf%lf%lf%lf%lf%lf\",&r,&h,&ax,&ay,&az,&bx,&by,&bz);\n if(EQ(ax,bx)&&EQ(ay,by)&&EQ(az,bz)) print(.0);\n if(azEPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=f(allg); ard=f(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n print(ald);\n }\n\n if(EQ(bz,h)) print(ad);\n temp1=sqrt(SQ(ad)+SQ(bd)-2*ad*bd*cos(th*r/d));\n alg=0; arg=2*M_PI;\n while(arg-alg>EPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=g(allg); ard=g(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n temp2=ald;\n print(temp1\n#include \n#include \n#define EPS 1e-10\n#define SQ(x) ((x)*(x))\n#define EQ(x,y) (fabs((x)-(y))EPS){\n bllg=(blg*19+brg)/20; brrg=(blg+brg*19)/20;\n bld=hh(th,bllg); brd=hh(th,brrg);\n bld>brd?blg=bllg:(brg=brrg);\n }\n return la+bld;\n}\n\ndouble f(double th){\n double tx=r*cos(th),ty=r*sin(th),lr,lb;\n lr=hypot(ax-tx,ay-ty);\n th=angle(tx,ty,bx,by);\n lb=sqrt(SQ(d)+SQ(bd)-2*d*bd*cos(th*r/d));\n return lr+lb;\n}\n\nmain(){\n int i,j;\n double ans=1e9,alg,arg,allg,arrg,ald,ard;\n\n scanf(\"%d%d%lf%lf%lf%lf%lf%lf\",&r,&h,&ax,&ay,&az,&bx,&by,&bz);\n if(EQ(ax,bx)&&EQ(ay,by)&&EQ(az,bz)) print(.0);\n if(azEPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=f(allg); ard=f(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n print(ald);\n }\n\n if(EQ(bz,h)) print(ad);\n temp1=sqrt(SQ(ad)+SQ(bd)-2*ad*bd*cos(th*r/d));\n alg=0; arg=2*M_PI;\n while(arg-alg>EPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=g(allg); ard=g(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n temp2=ald;\n print(temp1\n#include \n#include \n#define EPS 1e-10\n#define SQ(x) ((x)*(x))\n#define EQ(x,y) (fabs((x)-(y))EPS){\n bllg=(blg*19+brg)/20; brrg=(blg+brg*19)/20;\n bld=hh(th,bllg); brd=hh(th,brrg);\n bld>brd?blg=bllg:(brg=brrg);\n }\n return la+bld;\n}\n\ndouble f(double th){\n double tx=r*cos(th),ty=r*sin(th),lr,lb;\n lr=hypot(ax-tx,ay-ty);\n th=angle(tx,ty,bx,by);\n lb=sqrt(SQ(d)+SQ(bd)-2*d*bd*cos(th*r/d));\n return lr+lb;\n}\n\nmain(){\n int i,j;\n double ans=1e9,alg,arg,allg,arrg,ald,ard;\n\n scanf(\"%d%d%lf%lf%lf%lf%lf%lf\",&r,&h,&ax,&ay,&az,&bx,&by,&bz);\n if(EQ(ax,bx)&&EQ(ay,by)&&EQ(az,bz)) print(.0);\n if(azEPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=f(allg); ard=f(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n print(ald);\n }\n\n if(EQ(bz,h)) print(ad);\n temp1=sqrt(SQ(ad)+SQ(bd)-2*ad*bd*cos(th*r/d));\n alg=0; arg=2*M_PI;\n while(arg-alg>EPS){\n allg=(alg*49+arg)/50; arrg=(alg+arg*49)/50;\n ald=g(allg); ard=g(arrg);\n ald>ard?alg=allg:(arg=arrg);\n }\n temp2=ald;\n print(temp1\n#include \n#include \n\nint N;\nint answer;\n\ndouble pi;\n\ndouble distsquared(double x, double y){\n\treturn x*x + y*y;\n}\n\nbool fits(int i, int j){\n\tdouble x = i * 1.5;\n\tdouble y = j * sqrt(3) + (i % 2 ? sqrt(3) / 2 : 0);\n\tint k;\n\n\tfor (k = 0; k < 6; k++)\n\t\tif (distsquared(x + cos(pi * k / 3), y + sin(pi * k / 3)) > N*N)\n\t\t\treturn false;\n\n\treturn true;\n}\n\nint _bsearch(int column){\n\tint hi = 10000000, lo = 0, mid;\n\n\twhile (lo < hi){\n\t\tint mid = (hi + lo) / 2;\n\t\tif (!fits(column, mid))\n\t\t\thi = mid;\n\t\telse\n\t\t\tlo = mid + 1;\n\t}\n\n\tif (column % 2 == 0)\n\t\thi = (hi - 1) * 2 + 1;\n\telse\n\t\thi *= 2;\n\n\tif (column > 0)\n\t\thi *= 2;\n\n\treturn hi;\n}\n\nint main(void){\n\tint i;\n\n\tpi = acos(-1);\n\n\tscanf(\"%d\", &N);\n\n\tif (N == 1){\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 0; fits(i,0); i++)\n\t\tanswer += _bsearch(i);\n\n\tprintf(\"%d\\n\", answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "35276f632d01f50c25f31d2dbe2f8989", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint N;\nint answer;\n\ndouble pi;\n\ndouble distsquared(double x, double y){\n\treturn x*x + y*y;\n}\n\nbool fits(int i, int j){\n\tdouble x = i * 1.5;\n\tdouble y = j * sqrt(3) + (i % 2 ? sqrt(3) / 2 : 0);\n\tint k;\n\n\tfor (k = 0; k < 6; k++)\n\t\tif (distsquared(x + cos(pi * k / 3), y + sin(pi * k / 3)) > N*N)\n\t\t\treturn false;\n\n\treturn true;\n}\n\nint _bsearch(int column){\n\tint hi = 10000000, lo = 0, mid;\n\n\twhile (lo < hi){\n\t\tint mid = (hi + lo) / 2;\n\t\tif (!fits(column, mid))\n\t\t\thi = mid;\n\t\telse\n\t\t\tlo = mid + 1;\n\t}\n\n\tif (column % 2 == 0)\n\t\thi = (hi - 1) * 2 + 1;\n\telse\n\t\thi *= 2;\n\n\tif (column > 0)\n\t\thi *= 2;\n\n\treturn hi;\n}\n\nint main(void){\n\tint i;\n\n\tpi = acos(-1);\n\n\tscanf(\"%d\", &N);\n\n\tif (N == 1){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 0; fits(i,0); i++)\n\t\tanswer += _bsearch(i);\n\n\tprintf(\"%d\\n\", answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "93d40678d85a4bef2544a70e6eaa599c", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint N;\nint answer;\n\ndouble pi;\n\ndouble distsquared(double x, double y){\n\treturn x*x + y*y;\n}\n\nbool fits(int i, int j){\n\tdouble x = i * 1.5;\n\tdouble y = j * sqrt(3) + (i % 2 ? sqrt(3) / 2 : 0);\n\tint k;\n\n\tfor (k = 0; k < 6; k++)\n\t\tif (distsquared(x + cos(pi * k / 3), y + sin(pi * k / 3)) > N*N)\n\t\t\treturn false;\n\n\treturn true;\n}\n\nint _bsearch(int column){\n\tint hi = 10000000, lo = 0, mid;\n\n\twhile (lo < hi){\n\t\tint mid = (hi + lo) / 2;\n\t\tif (!fits(column, mid))\n\t\t\thi = mid;\n\t\telse\n\t\t\tlo = mid + 1;\n\t}\n\n\tif (column % 2 == 0)\n\t\thi = (hi - 1) * 2 + 1;\n\telse\n\t\thi *= 2;\n\n\tif (column > 0)\n\t\thi *= 2;\n\n\treturn hi;\n}\n\nint main(void){\n\tint i;\n\n\tpi = acos(-1);\n\n\tscanf(\"%d\", &N);\n\n\tfor (i = 0; fits(i,0); i++)\n\t\tanswer += _bsearch(i);\n\n\tprintf(\"%d\\n\", answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "78fb00fa1a6bce421a6a34c1cc510f6d", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint N;\nint answer;\n\nint _cos[6] = {2,1,-1,0,-1,1};\nint _sin[6] = {0,1,1,0,-1,-1};\n\nunsigned long long int square(unsigned long long int a){\n\treturn a * a;\n}\n\nbool fits(int i, int j){\n\tint x = i * 3;\n\tint y = j * 2 + (i % 2);\n\tint k;\n\n\tfor (k = 0; k < 6; k++)\n\t\tif (square(x + _cos[k]) + 3 * square(y + _sin[k]) > 4*N*N)\n\t\t\treturn false;\n\n\treturn true;\n}\n\nint _bsearch(int column){\n\tint hi = 10000000, lo = 0, mid;\n\n\twhile (lo < hi){\n\t\tint mid = (hi + lo) / 2;\n\t\tif (!fits(column, mid))\n\t\t\thi = mid;\n\t\telse\n\t\t\tlo = mid + 1;\n\t}\n\n\tif (column % 2 == 0)\n\t\thi = (hi - 1) * 2 + 1;\n\telse\n\t\thi *= 2;\n\n\tif (column > 0)\n\t\thi *= 2;\n\n\treturn hi;\n}\n\nint main(void){\n\tint i;\n\n\tscanf(\"%d\", &N);\n\n\tfor (i = 0; fits(i,0); i++)\n\t\tanswer += _bsearch(i);\n\n\tprintf(\"%d\\n\", answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d1ea867d4e04b8a54df5fc946e3c6381", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nunsigned long long int N, answer;\n\nint _cos[6] = {2,1,-1,0,-1,1};\nint _sin[6] = {0,1,1,0,-1,-1};\n\nunsigned long long int square(unsigned long long int a){\n\treturn a * a;\n}\n\nbool fits(int i, int j){\n\tint x = i * 3;\n\tint y = j * 2 + (i % 2);\n\tint k;\n\n\tfor (k = 0; k < 6; k++)\n\t\tif (square(x + _cos[k]) + 3 * square(y + _sin[k]) > 4*N*N)\n\t\t\treturn false;\n\n\treturn true;\n}\n\nint _bsearch(int column){\n\tint hi = 10000000, lo = 0, mid;\n\n\twhile (lo < hi){\n\t\tint mid = (hi + lo) / 2;\n\t\tif (!fits(column, mid))\n\t\t\thi = mid;\n\t\telse\n\t\t\tlo = mid + 1;\n\t}\n\n\tif (column % 2 == 0)\n\t\thi = (hi - 1) * 2 + 1;\n\telse\n\t\thi *= 2;\n\n\tif (column > 0)\n\t\thi *= 2;\n\n\treturn hi;\n}\n\nint main(void){\n\tint i;\n\n\tscanf(\"%lld\", &N);\n\n\tfor (i = 0; fits(i,0); i++)\n\t\tanswer += _bsearch(i);\n\n\tprintf(\"%lld\\n\", answer);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fd4dd19e5fc19eadf2507c29f4eecf35", "src_uid": "6787c7631716ce3dff3f9a5e1c51ff13", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n\nlong long min(long long x,long long y){return (x=1;j--){\n for(int k = prev;k=0;i--){\n total = 0;\n for(int j = 0;j<=n;j++) total += store[i][j];\n if(total\n\n#define max(a,b) (ab?b:a)\ntypedef unsigned long long u64;\n\nint N, K;\nchar s[101];\nu64 n[101][26], l[101][26], t[101];\n\nint main() {\n int i,j, k;\n\n scanf(\"%d %d\", &N, &K);\n scanf(\"%s\", s);\n\n n[0][0] = 1;\n t[0] = 1;\n for (i = 1; i <= N; i++) {\n int c = s[i-1] - 'a';\n for (j = i; j >= 1; j--) {\n u64 d = 0;\n for (k = 0; k < 26; k++)\n d += n[j-1][k];\n d -= l[j][c];\n n[j][c] += d;\n l[j][c] = n[j][c];\n\n t[j] += d;\n }\n }\n\n u64 cost = 0;\n u64 r = K;\n for (i = N; i >= 0 && r; i--) {\n u64 a = min(r, t[i]);\n cost += a * (N - i);\n r -= a;\n }\n printf(\"%lld\\n\", !r?cost:-1);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "27c89bec85acfca77f45dc9266f2b0ed", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \ntypedef long long ll;\n#define rep(i,n) for(int i=0;i<(int)(n);i++)\nint upcmpll(const void *a, const void *b){return(*(ll*)a==*(ll*)b?0:(*(ll*)a>*(ll*)b?1:-1));}\nvoid sort_u(ll*a, ll n){qsort(a,n,sizeof(ll),upcmpll);}\ntypedef struct{int first,second;} P;\nint dwcmpp(const void *a, const void *b){\n if(((P*)a)->first != ((P*)b)->first) \n return (((P*)a)->first < ((P*)b)->first?1:-1);\n else\n return (((P*)a)->second == ((P*)b)->second ? 0 : (((P*)a)->second < ((P*)b)->second ? 1 : -1));\n}\nvoid sort_dp(P *a, int n){ qsort(a, n, sizeof(P), dwcmpp); }\n\nint arcnt(P* cntp ,ll* ar, int an){\n int val = ar[0], cnt = 1, cntn = 0;\n rep(i, an-1){\n if(ar[i+1] != val){\n cntp[cntn].first = cnt;\n cntp[cntn++].second = val;\n val = ar[i+1], cnt = 1;\n }else cnt++;\n }\n cntp[cntn].first = cnt;\n cntp[cntn++].second = val;\n return cntn;\n}\n\nll a[202020];\nint main() {\n int t, n;\n scanf(\"%d\", &t);\n while(t--){\n scanf(\"%d\", &n);\n rep(i,n) scanf(\"%lld\",a+i);\n sort_u(a,n);\n P count[202020]; int ntn = 0;\n ntn = arcnt(count,a,n);\n sort_dp(count,ntn);\n\n int tmp = n+1, ans = 0;\n rep(i,ntn){\n if(count[i].first < tmp){\n ans += count[i].first;\n tmp = count[i].first;\n }else{\n ans += tmp-1;\n tmp--;\n }\n if(tmp <= 1) break;\n }\n //rep(i,ntn) printf(\"c.f: %d c.s: %d\\n\", count[i].first, count[i].second);\n printf(\"%d\\n\", ans);\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "866a8eede8051bfbb6c428207f6c8bb7", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n\n#define max(a,b) (ab?b:a)\ntypedef unsigned long long u64;\n\nint N, K;\nchar s[101];\nu64 n[101][26], l[101][26], t[101];\n\nint main() {\n int i,j, k;\n\n scanf(\"%d %d\", &N, &K);\n scanf(\"%s\", s);\n\n n[0][0] = 1;\n t[0] = 1;\n for (i = 1; i <= N; i++) {\n int c = s[i-1] - 'a';\n for (j = i; j >= 1; j--) {\n u64 d = 0;\n for (k = 0; k < 26; k++)\n d += n[j-1][k];\n d -= l[j][c];\n n[j][c] += d;\n l[j][c] = n[j][c];\n\n t[j] += d;\n }\n }\n\n u64 cost = 0;\n u64 r = K;\n for (i = N; i >= 0 && r; i--) {\n u64 a = min(r, t[i]);\n cost += a * (N - i);\n r -= a;\n }\n printf(\"%lld\\n\", !r?cost:-1);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5b887db760a041a0f3a5373368bedf30", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \ntypedef long long ll;\n#define rep(i,n) for(int i=0;i<(int)(n);i++)\n\nint main() {\n ll k, n;\n scanf(\"%d%d\", &n, &k);\n char s[105];\n scanf(\"%s\", s);\n\n char next[105][30]; //next[i][c]: i\u304b\u3089\u898b\u3066\u4e00\u756a\u521d\u3081\u306bc(+'a')\u304c\u73fe\u308c\u308bindex\n for (int j = 0; j < 26; j++) next[n][j] = n;\n for (int i = n-1; i >= 0; i--) {\n for (int j = 0; j < 26; j++) next[i][j] = next[i+1][j];\n next[i][s[i]-'a'] = i;\n }\n\n ll dp[105][105] = {0}; //dp[i][l]: s\u306ei\u6587\u5b57\u76ee\u3092\u63a5\u5c3e\u8f9e\u3068\u3057\u3066\u3082\u3064\uff0c\u9577\u3055l\u306e\u90e8\u5206\u6587\u5b57\u5217\u306e\u6570\n dp[0][0] = 1;\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < 26; ++j) {\n if (next[i][j] >= n) continue;\n for (int l = 0; l < n; l++)\n dp[next[i][j] + 1][l+1] += dp[i][l];\n }\n }\n\n ll ans = 0, cnt = 0, tmp = 1;\n for (int j = n-1; j >= 0; j--) {\n for (int i = 0; i <= n; i++) {\n tmp += dp[i][j];\n if(tmp < k){ \n ans += (n-j)*dp[i][j];\n }else{\n ans += (n-j)*(k-(tmp-dp[i][j]));\n break;\n }\n }\n if(tmp >= k) break;\n }\n if(tmp < k) ans = -1;\n\n printf(\"%lld\\n\", ans);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "095b76dd308f7bdf601f99462d375288", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nchar cc[8][16];\nint visited[8][8];\nint qq[256];\n\nint ok(int x, int y) {\n\treturn x <= 0 || (!visited[x - 1][y] && cc[x][y] != 'S' && cc[x - 1][y] != 'S');\n}\n\nint main() {\n\tint i, h, q, vx, vy;\n\n\tfor (i = 0; i < 8; i++)\n\t\tscanf(\"%s\", cc[i]);\n\th = 0, q = 0;\n\tqq[h + q++] = 7, qq[h + q++] = 0;\n\twhile (q > 0) {\n\t\tint x = qq[h++];\n\t\tint y = qq[h++];\n\n\t\tq -= 2;\n\t\tif (x == 0) {\n\t\t\tprintf(\"WIN\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tvisited[x][y] = 1;\n\t\tfor (vx = -1; vx <= 1; vx++)\n\t\t\tfor (vy = -1; vy <= 1; vy++)\n\t\t\t\tif (x + vx >= 0 && x + vx < 8 && y + vy >= 0 && y + vy < 8 && ok(x + vx, y + vy))\n\t\t\t\t\tqq[h + q++] = x + vx - 1, qq[h + q++] = y + vy;\n\t}\n\tprintf(\"LOSE\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b993eff6bbad11f2300c26a0dd69bba9", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nchar cc[8][16];\nint visited[8][8];\nint qq[256];\n\nint ok(int x, int y) {\n\treturn cc[x][y] != 'S'\n\t\t&& (x <= 0 || (!visited[x - 1][y] && cc[x - 1][y] != 'S'));\n}\n\nint main() {\n\tint i, h, q, vx, vy;\n\n\tfor (i = 0; i < 8; i++)\n\t\tscanf(\"%s\", cc[i]);\n\th = 0, q = 0;\n\tqq[h + q++] = 7, qq[h + q++] = 0;\n\twhile (q > 0) {\n\t\tint x = qq[h++];\n\t\tint y = qq[h++];\n\n\t\tq -= 2;\n\t\tif (x <= 0) {\n\t\t\tprintf(\"WIN\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tvisited[x][y] = 1;\n\t\tfor (vx = -1; vx <= 1; vx++)\n\t\t\tfor (vy = -1; vy <= 1; vy++)\n\t\t\t\tif (x + vx < 8 && y + vy >= 0 && y + vy < 8 && ok(x + vx, y + vy))\n\t\t\t\t\tqq[h + q++] = x + vx - 1, qq[h + q++] = y + vy;\n\t}\n\tprintf(\"LOSE\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb605b35a20e02a2c6c9b453cee1182c", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nchar cc[8][16];\nint visited[8][8];\nint qq[256];\n\nint ok(int x, int y) {\n\treturn (x < 0 || cc[x][y] != 'S')\n\t\t&& (x <= 0 || (!visited[x - 1][y] && cc[x - 1][y] != 'S'));\n}\n\nint main() {\n\tint i, h, q, vx, vy;\n\n\tfor (i = 0; i < 8; i++)\n\t\tscanf(\"%s\", cc[i]);\n\th = 0, q = 0;\n\tqq[h + q++] = 7, qq[h + q++] = 0;\n\twhile (q > 0) {\n\t\tint x = qq[h++];\n\t\tint y = qq[h++];\n\n\t\tq -= 2;\n\t\tif (x <= 0) {\n\t\t\tprintf(\"WIN\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tvisited[x][y] = 1;\n\t\tfor (vx = -1; vx <= 1; vx++)\n\t\t\tfor (vy = -1; vy <= 1; vy++)\n\t\t\t\tif (x + vx < 8 && y + vy >= 0 && y + vy < 8 && ok(x + vx, y + vy))\n\t\t\t\t\tqq[h + q++] = x + vx - 1, qq[h + q++] = y + vy;\n\t}\n\tprintf(\"LOSE\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e0206e1959078c35a1f8ca1a03b556f8", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n\n\n#define KONTROL(x,y,t)\t(x >= n || x < 0 || y >= n || y < 0 || move[x][y][t] || matrix[x][y] == 'S')\n\n#define Max(a,b) (((a) > (b)) ? (a) : (b))\n#define Min(a,b) (((a) < (b)) ? (a) : (b))\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\n#define SWAP(a,b) {t = a; a = b; b = t;}\n\n#define lli long long int\n\n#define endl puts(\"\")\n\n#define MAX 1e5 + 9\n\ntypedef struct pair{\n\tint x, y;\n}pair;\n\nint const N = 1e4 + 5;\n\npair maria, anna, h[N];\n\nint i, j, k, s, n = 8;\n\nint move[8][8][8];\n\nchar matrix[N][N];\n\nvoid dfs(int x, int y, int t) {\n\n\tint i,j;\n\n//\tprintf(\"%d %d %d %d --- %d %d %d ---\", maria.x, maria.y, anna.x, anna.y, x, y, t), endl;\n\n\tif(x == anna.x && y == anna.y) {\n\t\tprintf(\"WIN\"), endl;\n\t\texit(0);\n\t}\n\n\tif(KONTROL(x,y,t)) return ;\n\t\n\tmove[x][y][t] = true;\n\n\tfor(i = 0; i < s; i++) {\n\t\th[i].x++;\n\t\tif(h[i].x == x && h[i].y == y) {\n\t\t\tfor(j = 0; j <= i; j++) {\n\t\t\t\th[i].x--;\n\t\t\t} \n\t\t\treturn ;\n\t\t}\n\t}\n\tdfs(x+1,y,1);\n\tdfs(x-1,y,2);\n\tdfs(x,y+1,3);\n\tdfs(x,y-1,4);\n}\n\nint main() {\n\t\n\tfor(i = 0; i < n; i++) {\n\t\tscanf(\"%s\", matrix[i]);\n\t\tfor(j = 0; j < n; j++) {\n\t\t\tif(matrix[i][j] == 'M') maria.x = i, maria.y = j;\n\t\t\telse if(matrix[i][j] == 'A') anna.x = i, anna.y = j;\n\t\t\telse if(matrix[i][j] == 'S') h[s].x = i, h[s++].y = j;\n\t\t}\n\t}\n\n\tdfs(maria.x, maria.y, false);\n\n\tputs(\"LOSE\");\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5ad2d7c905ad6c894d6896e8d704d14a", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#include\n#include\n\n\n#define KONTROL(x,y,t) (!mariaMove[x][y][t] && x >= 0 && x < n && y >= 0 && y < n)\n\n#define Max(a,b) (((a) > (b)) ? (a) : (b))\n#define Min(a,b) (((a) < (b)) ? (a) : (b))\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\n#define SWAP(a,b) {t = a; a = b; b = t;}\n\n#define lli long long int\n\n#define endl puts(\"\")\n\n#define MAX 1e5 + 9\n\ntypedef struct pair{\n int x, y;\n}pair;\n\nint const N = 1e4 + 5;\n\nint n = 8;\n\npair sMatrix[N], sac[N];\n\nchar matrix[N][N], mariaMove[10][10][10];\n\npair anna, maria;\n\nint i, j, k, s, m, h, t;\n\nint kontrol(int x, int y){\n int i, j;\n for(i = 0; i < s; i++) {\n if(sMatrix[i].x == x && sMatrix[i].y == y)\n return 0;\n }\n return 1;\n}\n\nvoid sDown(int add) {\n int i;\n for(i = 0; i < s; i++) {\n sMatrix[i].x += add;\n }\n}\n\nvoid dfs(int x, int y, int t) {\n int i, j, k;\n\n if(x == anna.x && y == anna.y) {\n printf(\"WIN\"), endl;\n exit(0);\n }\n\n if(!KONTROL(x,y,t) || !kontrol(x,y)) return ;\n\n sDown(1);\n\n if(!kontrol(x,y)){ sDown(-1); return ; }\n\n mariaMove[x][y][t] = 1;\n\n for(i = -1, k = 0; i <= 1; i++) {\n for(j = -1; j <= 1; j++, k++) {\n dfs(x+i,y+j, k);\n }\n }\n sDown(-1);\n}\n\nvoid clearMariaMove() {\n int i, j, k;\n for(i = 0; i < 10; i++) {\n for(j = 0; j < 10; j++) {\n for(k = 0; k < 100; k++) {\n mariaMove[i][j][k] = 0;\n }\n }\n }\n}\n\nvoid clear_sMatrix() {\n int i;\n for(i = 0; i < s; i++) {\n sMatrix[i].x = sac[i].x;\n sMatrix[i].y = sac[i].y;\n }\n}\n\nint main() {\n\n for(i = 0; i < n; i++) {\n scanf(\"%s\", matrix[i]);\n for(j = 0; j < n; j++) {\n if(matrix[i][j] == 'S') {\n sMatrix[s].x = i, sMatrix[s].y = j;\n sac[s].x = i, sac[s].y = j;\n s++;\n }\n }\n }\n\n maria.x = 7, maria.y = 0;\n anna.x = 0, anna.y = 7;\n\n for(i = -1; i <= 0; i++) {\n for(j = 0; j <= 1; j++) {\n dfs(maria.x+i, maria.y+j, 0);\n clearMariaMove();\n clear_sMatrix();\n }\n }\n\n puts(\"LOSE\");\n\n return 0;\n} ", "lang_cluster": "C", "compilation_error": true, "code_uid": "9010229bf368e66e86c2f09e2b02a85d", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#include\nvoid selsort(int arr[],int len){\n int min,t;\n for(int i=0;iarr[j]){\n min=j;\n }\n }\n t=arr[i];\n arr[i]=arr[min];\n arr[min]=t;\n }\n}\nint main(){\n int n,B,count=0;\n scanf(\"%d%d\",&n,&B);\n int *arr=malloc(n*sizeof(int));\n int *oddeve=malloc(n*sizeof(int));\n int *locs=malloc(n*sizeof(int));\n for(int i=0;i\n#include \n\nint main()\n{\n int n, B;\n int a[100];\n scanf(\"%d %d\", &n, &B);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a[i]);\n }\n int even = 0;\n int odd = 0;\n int ans = 0;\n for(int i = 0; i < n; ++i) {\n if(a[i] & 1) {\n ++odd;\n } else {\n ++even;\n }\n if(even == odd && i + 1 < n && abs(a[i] - a[i + 1]) < B) {\n B -= abs(a[i] - a[i + 1]);\n ++ans;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "79b8c367fa7537735310cad77ee30ac2", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint a[100],n,m[100];\nint max(int i,int j)\n{\n return i>j?i:j;\n}\nint q(int st,int odd,int even,int b)\n{\n if((st==n-1)||(b<=0)) return 0;\n if(m[st]!=-1) return m[st];\n if(a[st]%2==0) even ++;\n else odd ++;\n int d;\n if(a[st]>a[st+1]) d=a[st]-a[st+1];\n else d=a[st+1]-a[st];\n if((odd+even>0)&&(odd==even)&&(b>=d))\n {\n m[st]=max(1+q(st+1,0,0,b-d),q(st+1,odd,even,b));\n return m[st];\n }\n m[st]=q(st+1,odd,even,b);\n return m[st];\n}\nint main()\n{\n int i,b,c;\n scanf(\"%d %d\",&n,&b);\n for(i=0;i\n\nint main()\n{\n int n,cnt=0,cst=0,b,ev=0,od=0;\n scanf(\"%d%d\",&n,&b);\n int ar[n];\n for(int i=0;iar[i])\n cst=(ar[i+1]-ar[i]);\n else\n cst=(ar[i]-ar[i+1]);\n //b-=cst;\n if(b-cst>=0)\n {\n b-=cst;\n cnt++;\n //printf(\"%d \",cst);\n //ev=0;\n //od=0;\n }\n \n }\n }\n printf(\"%d\",cnt);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8cbb53faaa18cb90f8c95335b0291435", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include\nint a[100],n;\nint max(int i,int j)\n{\n return i>j?i:j;\n}\nint q(int st,int odd,int even,int b)\n{\n if((st==n-1)||(b<=0)) return 0;\n if(a[st]%2==0) even ++;\n else odd ++;\n int d;\n if(a[st]>a[st+1]) d=a[st]-a[st+1];\n else d=a[st+1]-a[st];\n if((odd+even>0)&&(odd==even)&&(b>=d))\n {\n return max(1+q(st+1,0,0,b-d),q(st+1,odd,even,b));\n }\n return q(st+1,odd,even,b);\n}\nint main()\n{\n int i,b,c;\n scanf(\"%d %d\",&n,&b);\n for(i=0;i\n#include\nmain()\n{\n long long int a,n,x,y,p,i,j=0,t,k,z;\n scanf(\"%I64d%I64d\",&a,&n);\n a--;\n for(z=3,x=0;x\n\n#define MAX_VALUE\t10000000\n\nlong long Y[MAX_VALUE + 1];\n\nint main()\n{\n\tint a, n, i, i2, j, t;\n\tlong long s;\n\tfor(i = 1; (i2 = i * i) <= MAX_VALUE; i++)\n\tfor(j = 1, t = i2; t <= MAX_VALUE; j++, t += i2) Y[t] = j;\n\tscanf(\"%d%d\", &a, &n);\n\tfor(s = i = 0; i < n; i++) s += Y[a + i];\n\tprintf(\"%lld\", s);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f03f1c7751d32ed899e1e0a5c5afe39c", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nmain()\n{\n long long int a,n,x,y,p,i,j=0,t,k,z;\n scanf(\"%I64d%I64d\",&a,&n);\n\n a--;\n for(z=3,x=0;x\n\n#define MAX_VALUE\t10000000\n\nint Y[MAX_VALUE + 1];\n\nint main()\n{\n\tint a, n, i, i2, j, t;\n\tfor(i = 1; (i2 = i * i) <= MAX_VALUE; i++)\n\tfor(j = 1, t = i2; t <= MAX_VALUE; j++, t += i2) Y[t] = j;\n\tscanf(\"%d%d\", &a, &n);\n\tfor(t = i = 0; i < n; i++) t += Y[a + i];\n\tprintf(\"%d\", t);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "96b7e06ceae26502482f178cf5b92cdb", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n\nint main()\n{\n int d,y,p,page,sr;\n scanf(\"%d %d\",&d,&y);\n page=0;\n if(d==1 && y==2)\n {\n page=3;\n goto x;\n }\n while(y--)\n {\n\n sr=(int)sqrt(d);\n printf(\"%d\\n\",sr);\n if((sr*sr)==d)\n {\n page+=1;\n }\n else\n {\n while(sr--)\n {\n if(d%(sr*sr)==0)\n {\n p=d/(sr*sr);\n if((sr*sr)*p==d)\n {\n page+=p;\n break;\n }\n else\n {\n sr--;\n } \n } \n }\n \n }\n d++;\n }\nx: \n printf(\"%d\",page);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d9ef5b59090a78a1dbd4e8d0807ef60", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n\tlong long n,s,l,r,mid;\n\tscanf(\"%lld%lld\",&n,&s);\n\tl=1,r=1e8+1;\n\twhile(l\nlong long s,st,al,h = 1,t,key;\nint main(void)\n{\n scanf(\"%I64d%I64d\",&st,&s);\n if(s<10)\n {\n al = st-9;\n }\n else\n {\n al = s;\n h = al-(al%10)+10;\n al = h;\n while(al)\n t+=al%10,al/=10;\n key = t;\n while(h-t\n\nint main()\n{\n\tlong long n, s;\n\tscanf(\"%lld %lld\", &n, &s);\n\n\tlong long temp, sum, st = 0, e = n, mid, ans;\n\twhile (st <= e)\n\t{\n\t\tmid = st + (e - st) / 2;\n\t\tsum = 0, temp = mid;\n\t\twhile (temp > 0)\n\t\t{\n\t\t\tlong long r = temp % 10;\n\t\t\tsum += r;\n\t\t\ttemp /= 10;\n\t\t}\n\n\t\tif (mid - sum >= s)\n\t\t{\n\t\t\tans = mid;\n\t\t\te = mid - 1;\n\t\t}\n\t\telse\n\t\t\tst = mid + 1;\n\t}\n\t//\tprintf(\"%lld\", mid);\n\t(ans - sum >= s) ? (printf(\"%lld\", n - ans + 1)) : (printf(\"0\"));\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9e8adf38334e2c52ac87e0ff13e5decd", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \nint sum(long long int x)\n{\n\tint k=0;\n\twhile(x>0)\n\t{\n\t\tk+=(x%10);\n\t\tx=x/10;\n\t}\n\treturn k;\n}\nint main()\n{\n\tlong long int n,s;\n\tscanf(\"%lld%lld\",&n,&s);\n\tlong long int x=(s/9)*10;\n\tlong long int flag=0,lower;\n\tdo\n\t{\n\t\tlong long int check=x-sum(x);\n\t\tif(check\n#include \n#include \n#include \n#define ll long long\nint main()\n{\n ll n, s;\n scanf(\"%lld %lld\", &n, &s);\n ll left = 0, right = n;\n ll sum1 = 0; \n while(right != left)\n {\n ll mid = (right + left) / 2;\n ll div = 1;\n ll sum = 0;\n while (num / div != 0)\n {\n sum+=((num)%(div*10))/div;\n div*=10;\n }\n ll check=mid-sum;\n if (check>=s)\n right=mid;\n else\n left=mid;\n if (right-left==1)\n left++;\n }\n ll div = 1;\n while (n/div!=0)\n {\n sum1+= ((num) % (div * 10)) / div;\n div *= 10;\n }\n if (n - sum1 >= s)\n printf(\"%lld\", n - right + 1);\n else\n printf(\"0\");\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "882e5095240bfb4cf5c1f47e771b117a", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "difficulty": 1600.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fc1c908007951bfb3f0d2a62a3fb0763", "src_uid": "af8d46722e1bd8f7392e5596eaf4def8", "difficulty": 3000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "318b1cefd53633edf0a401c5ba5e145e", "src_uid": "af8d46722e1bd8f7392e5596eaf4def8", "difficulty": 3000.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3d318ea15abda350871a32bbf6fd9104", "src_uid": "af8d46722e1bd8f7392e5596eaf4def8", "difficulty": 3000.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef struct scan\n{\n\tint from;\n\tint to;\n}scan;\n\nint graph[550][550];\nint color[550];\nchar out[550];\nscan input[250005];\n\nint cmp(const void *a, const void *b)\n{\n\tscan a1 = * (scan *)a;\n\tscan b1 = * (scan *)b;\n\tif(a1.from > b1.from)\n\t return 1;\n\telse if(a1.from < b1.from)\n\t return -1;\n\telse\n\t return a1.to - b1.to;\n}\n\nint ulta(int a)\n{\n\tif(a==1)\n\t\treturn 2;\n\treturn 1;\n}\n\nint colorable(int n)\n{\n\tint i, j;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tint k=0;\n\t\tfor(j=1;j<=n;j++)\n\t\t\tif(graph[i][j] == 0)\n\t\t\t\tk++;\n\n\t\tif(color[i]==0)\n\t\t{\n\t\t\tif(k==n)\n\t\t\t\tcolor[i] = 3;\n\t\t\telse\n\t\t\t\tcolor[i] = 1;\n\t\t}\n\n\t\tint green = ulta(color[i]);\n\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\tif(graph[i][j] > 0)\n\t\t\t{\n\t\t\t\tif(color[j] == 0)\n\t\t\t\t\tcolor[j] = green;\n\t\t\t\telse if(color[j] == color[i])\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn(0);\n}\n\nint print(int n)\n{\n\tint i;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif(color[i]==1)\n\t\t\tout[i-1] = 'a';\n\t\tif(color[i]==2)\n\t\t\tout[i-1] = 'c';\n\t\tif(color[i]==3)\n\t\t\tout[i-1] = 'b';\n\t}\n\tout[n] = '\\0';\n/*\tprintf(\"%s\\n\", out);\n*/\treturn(0);\n}\n\nint main(void)\n{\n\tint n,m,i,j;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &m);\n\n\tfor(i=0;i input[i].to)\n\t\t{\n\t\t\tint temp = input[i].from;\n\t\t\tinput[i].from = input[i].to;\n\t\t\tinput[i].to = temp;\n\t\t}\n\t}\n\t\n\tqsort(input, m, sizeof(scan), cmp);\n\n\tfor(i=0;i<550;i++)\n\t\tfor(j=0;j<550;j++)\n\t\t\tgraph[i][j]=0;\n\n\t//if(m==6413)\n\t{\n\t\t/*printf(\"\\n\\n\");\n\t\tfor(i=0;i input[count].from && count < m)\n\t\t\t\tcount++;\n\t\t\twhile(j > input[count].to && i == input[count].from && count < m)\n\t\t\t\tcount++;\n\n\t\t\tif(count < m)\n\t\t\t{\n\t\t\t\tint from = input[count].from;\n\t\t\t\tint to = input[count].to;\n\n\t\t\t\t//printf(\"comparing %d, %d with input %d, %d\\n\", i, j, from, to);\n\n\t\t\t\tif(from!=i || to!=j)\n\t\t\t\t{\n\t\t\t\t\tif(graph[i][j]==0 && graph[j][i]==0)\n\t\t\t\t\t\tgraph[i][j]++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(graph[i][j]==0 && graph[j][i]==0)\n\t\t\t\t\tgraph[i][j]++;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*for(i=1;i<=n;i++)\n\t\t{\n\t\t\tfor(j=1;j<=n;j++)\n\t\t\t\tprintf(\"%d \", graph[i][j]);\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\\n\\n\");*/\n\n\tint a = colorable(n);\n\n\t\n\n\tif(a==0)\n\t{\n\t\tprint(n);\n\t\tfor(i=0;i\n\n#define N\t500\n\nint main() {\n\tint i, j, n, m, yes;\n\tstatic char color[N + 1];\n\tstatic int cnt[N], adj[N][N];\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < m; i++) {\n\t\tint u, v;\n\n\t\tscanf(\"%d%d\", &u, &v);\n\t\tu--, v--;\n\t\tcnt[u]++, cnt[v]++;\n\t\tadj[u][v] = adj[v][u] = 1;\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tif (cnt[i] == n - 1)\n\t\t\tcolor[i] = 'b';\n\tfor (i = 0; i < n; i++)\n\t\tif (!color[i]) {\n\t\t\tint j;\n\n\t\t\tcolor[i] = 'a';\n\t\t\tfor (j = 0; j < n; j++) \n\t\t\t\tif (i != j && !color[j])\n\t\t\t\t\tcolor[j] = adj[i][j] ? 'a' : 'c';\n\t\t\tbreak;\n\t\t}\n\tyes = 1;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = i + 1; j < n; j++) {\n\t\t\tint diff = color[i] > color[j] ? color[i] - color[j] : color[j] - color[i];\n\n\t\t\tif ((adj[i][j] && diff > 1) || (!adj[i][j] && diff <= 1)) {\n\t\t\t\tyes = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tprintf(\"%s\\n\", yes ? \"Yes\" : \"No\");\n\tif (yes)\n\t\tprintf(\"%s\\n\", color);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c41e968cad53c87e6986cbd7e99344d8", "src_uid": "e71640f715f353e49745eac5f72e682a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint sum(int *arr, int size) {\n int total = 0;\n \n for (int i = 0; i < size; i++) {\n total += arr[i];\n }\n \n return total;\n}\n\nint main(int argc, char **argv)\n{\n int vs, es; // vs vertexes es edges\n scanf(\"%d %d\", &vs, &es);\n \n\tint graph[vs+1][vs+1];\n for (int i = 0; i <= vs; i++) {\n memset(graph[i], 0, sizeof(graph[i]));\n }\n \n int v1, v2;\n for (int i = 0; i < es; i++) {\n scanf(\"%d %d\", &v1, &v2);\n \n graph[v1][v2] = 1;\n graph[v2][v1] = 1;\n }\n \n char letters[vs+10];\n memset(letters, '-', sizeof(letters));\n letters[vs+1] = '\\0';\n \n for (int i = 1; i <= vs; i++) {\n if (sum(graph[i]+1, vs) == vs - 1) {\n letters[i] = 'b';\n }\n }\n \n int stack[1000*1000];\n int size = -1, v;\n int qntA = 0;\n for (int i = 1; i <= vs; i++) {\n if (letters[i] == '-') {\n stack[++size] = i;\n while (size > -1) {\n v = stack[size--];\n if (letters[v] == '-') {\n\t letters[v] = 'a';\n\t qntA += 1;\n\t for (int j = 1; j <= vs; j++) {\n\t if (graph[v][j] == 1 && letters[j] == '-') {\n\t stack[++size] = j;\n\t }\n\t }\n }\n }\n break;\n }\n }\n \n int qntC = 0;\n for (int i = 1; i <= vs; i++) {\n if (letters[i] == '-') {\n letters[i] = 'c';\n qntC += 1;\n }\n }\n \n //verificando se A esta correto\n int a = 1, c = 1;\n int count;\n for (int i = 1; i <= vs; i++) {\n if (letters[i] != 'a') continue;\n \n count = 0;\n for (int j = 1; j <= vs; j++) {\n if (graph[i][j] == 1 && letters[j] == 'a') {\n count += 1;\n }\n }\n if (qntA - 1 != count) {\n a = 0;\n break;\n }\n }\n \n // verificando C\n for (int i = 1; i <= vs; i++) {\n if (letters[i] != 'c') continue;\n \n count = 0;\n for (int j = 1; j <= vs; j++) {\n if (graph[i][j] == 1 && letters[j] == 'c') {\n count += 1;\n }\n }\n if (qntC - 1 != count) {\n c = 0;\n break;\n }\n }\n \n if (a && c) {\n printf(\"Yes\\n%s\", letters+1);\n } else {\n printf(\"No\", letters+1);\n }\n \n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ece9ca24720cc724ba72ea5cbf397c67", "src_uid": "e71640f715f353e49745eac5f72e682a", "difficulty": 1800.0} {"lang": "GNU C", "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;\nint vis[550];\nint graph[550][550];\nint color[550];\nchar out[550];\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\ntypedef struct scan\n{\n\tint from;\n\tint to;\n}scan;\n\nint cmp(const void *a, const void *b)\n{\n\tscan a1 = * (scan *)a;\n\tscan b1 = * (scan *)b;\n\tif(a1.from > b1.from)\n\t return 1;\n\telse if(a1.from < b1.from)\n\t return -1;\n\telse\n\t return a1.to - b1.to;\n}\n\nint ulta(int a)\n{\n\tif(a==1)\n\t\treturn 2;\n\treturn 1;\n}\n\nint colorable(int start, int n)\n{\n\tint i, j;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tint k=0;\n\t\tfor(j=1;j<=n;j++)\n\t\t\tif(graph[i][j] == 0)\n\t\t\t\tk++;\n\n\t\tif(color[i]==0)\n\t\t{\n\t\t\tif(k==n)\n\t\t\t\tcolor[i] = 3;\n\t\t\telse\n\t\t\t\tcolor[i] = 1;\n\t\t}\n\n\t\tint green = ulta(color[i]);\n\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\tif(graph[i][j] > 0)\n\t\t\t{\n\t\t\t\tif(color[j] == 0)\n\t\t\t\t\tcolor[j] = green;\n\t\t\t\telse if(color[j] == color[i])\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn(0);\n}\n\nint print(int n)\n{\n\tint i;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif(color[i]==1)\n\t\t\tout[i-1] = 'a';\n\t\tif(color[i]==2)\n\t\t\tout[i-1] = 'c';\n\t\tif(color[i]==3)\n\t\t\tout[i-1] = 'b';\n\t}\n\tout[n] = '\\0';\n\tstrout(out);\n\treturn(0);\n}\n\nint main(void)\n{\n\tif(n==417)\n\t\tprintf(\"graph made\\n\");\n\tint n,m,i,j;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &m);\n\tscan input[1200];\n\tfor(i=0;i<2*m;i+=2)\n\t{\n\t\tscanf(\"%d %d\", &input[i].from, &input[i].to);\n\t\tinput[i+1].from = input[i].to;\n\t\tinput[i+1].to = input[i].from;\n\t}\n\tif(n==417)\n\t\tprintf(\"graph made\\n\");\n\t\n\tqsort(input, 2*m, sizeof(scan), cmp);\n\n\tfor(i=0;i<550;i++)\n\t\tfor(j=0;j<550;j++)\n\t\t\tgraph[i][j]=0;\n\n\tif(n==417)\n\t\tprintf(\"graph started\\n\");\n\n\tint count=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i+1;j<=n;j++)\n\t\t{\t\n\t\t\twhile(i > input[count].from && count < 2*m)\n\t\t\t\tcount++;\n\t\t\twhile(j > input[count].to && count < 2*m)\n\t\t\t\tcount++;\n\n\t\t\tif(count < 2*m)\n\t\t\t{\n\t\t\t\tint from = input[count].from;\n\t\t\t\tint to = input[count].to;\n\n\t\t\t\tif(from!=i || to!=j)\n\t\t\t\t{\n\t\t\t\t\tif(graph[j][i]==0 && graph[i][j]==0)\n\t\t\t\t\t\tgraph[i][j]++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(graph[j][i]==0 && graph[i][j]==0)\n\t\t\t\t\tgraph[i][j]++;\n\t\t\t}\n\t\t}\n\t}\n\n\tint a;\n\tif(n==417)\n\t\tprintf(\"graph made\\n\");\n\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif(vis[i]==0)\n\t\t\ta = colorable(i, n);\n\t\tif(a==1)\n\t\t\tbreak;\n\t}\n\tif(a==0)\n\t{\n\t\tprintf(\"Yes\\n\");\n\t\tprint(n);\n\t}\n\telse\n\t\tprintf(\"No\\n\");\n\t\n\treturn(0);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "93793fdf693796363004fe6e533507e4", "src_uid": "e71640f715f353e49745eac5f72e682a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint sum(int *arr, int size) {\n int total = 0;\n \n for (int i = 0; i < size; i++) {\n total += arr[i];\n }\n \n return total;\n}\n\nint main(int argc, char **argv)\n{\n int vs, es; // vs vertexes es edges\n scanf(\"%d %d\", &vs, &es);\n \n\tint graph[vs+1][vs+1];\n for (int i = 0; i <= vs; i++) {\n memset(graph[i], 0, sizeof(graph[i]));\n }\n \n int v1, v2;\n for (int i = 0; i < es; i++) {\n scanf(\"%d %d\", &v1, &v2);\n graph[v1][v2] = 1;\n graph[v2][v1] = 1;\n }\n \n char letters[vs+10];\n memset(letters, '-', sizeof(letters));\n letters[vs+1] = '\\0';\n \n for (int i = 1; i <= vs; i++) {\n if (sum(graph[i]+1, vs) == vs - 1) {\n letters[i] = 'b';\n }\n }\n \n int stack[100*1000];\n int size = -1, v;\n int qntA = 0;\n for (int i = 1; i <= vs; i++) {\n if (letters[i] == '-') {\n stack[++size] = i;\n while (size > -1) {\n v = stack[size--];\n letters[v] = 'a';\n qntA += 1;\n for (int j = 1; j <= vs; j++) {\n if (graph[v][j] == 1 && letters[j] == '-') {\n stack[++size] = j;\n }\n }\n }\n break;\n }\n }\n \n int qntC = 0;\n for (int i = 1; i <= vs; i++) {\n if (letters[i] == '-') {\n letters[i] = 'c';\n qntC += 1;\n }\n }\n \n //verificando se A esta correto\n int count;\n for (int i = 1; i <= vs; i++) {\n if (letters[i] != 'a') continue;\n \n count = 0;\n for (int j = 1; j <= vs; j++) {\n if (graph[i][j] == 1 && letters[j] == 'a') {\n count += 1;\n }\n }\n if (qntA - 1 != count) {\n a = 0;\n break;\n }\n }\n \n // verificando C\n for (int i = 1; i <= vs; i++) {\n if (letters[i] != 'c') continue;\n \n count = 0;\n for (int j = 1; j <= vs; j++) {\n if (graph[i][j] == 1 && letters[j] == 'c') {\n count += 1;\n }\n }\n if (qntC - 1 != count) {\n c = 0;\n break;\n }\n }\n \n if (a && c) {\n printf(\"Yes\\n%s\", letters+1);\n } else {\n printf(\"No\", letters+1);\n }\n \n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1173c55ec42f64e2d1584575b514f325", "src_uid": "e71640f715f353e49745eac5f72e682a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\n int n;\n char c;\n c='a';\n scanf(\"%d\",&n);\n// printf(\"%c\",c+1);\n\n// scanf(\"%d\",&n);\n int count=1;\n int i=1;\n printf(\"%c\",c);\n while(n!=0)\n {\n if(n-count<0)\n {\n count=0;\n c=c+1;\n }\n printf(\"%c\",c);\n n=n-count;\n count++;\n // i++;\n // printf(\"count =%d n=%d\\n\",count,n);\n if(n==0)\n break;\n }\n printf(\"\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0f3ebfceba56ea81e59e9cade86929a1", "src_uid": "b991c064562704b6106a6ff2a297e64a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar b[100005];\n\tb[0]='a';\n\tint i=1,count=1,temp;\n\twhile(n>0)\n\t{\n\t\ttemp=n-count;\n\t\tif(temp>=0)\n\t\t{\n\t\t\tb[i]=b[i-1];\n\t\t\ti++;\n\t\t\tcount++;\n\t\t\tn=temp;\n\t\t}\n\t\tif(temp<0)\n\t\t{\n\t\t\tb[i]=b[i-1]+1;\n\t\t\ti++;\n\t\t\tcount=1;\n\t\t}\n\t}\n\tint j;\n\tfor(j=0;j\n#include \n#define maxl 1000\n#define maxvalue 20000000\n\nlong a[1010];\n\nint main()\n{\n long value,i,j,k,l,chr;\n scanf(\"%ld\",&value);\n for (i=1;i<=maxl;i++)\n a[i]=i*(i-1)/2;\n chr=97;\n for (i=maxl;i>=1;i--)\n if (value>=a[i])\n {\n j=value/a[i];\n for (k=1;k<=j;k++)\n {\n for (l=1;l<=i;l++)\n printf(\"%c\",chr);\n chr++;\n }\n value-=j*a[i];\n if (value==0)\n break;\n }\n printf(\"\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e61afc12ebff7e1e9ac8e706c1908059", "src_uid": "b991c064562704b6106a6ff2a297e64a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint mian()\n{\n int k,i,j;\n scanf(\"%d\", &k);\n for ( i = 0; i < 26; i++)\n {\n int cnt = 1;\n while ((cnt + 1) * cnt / 2 <= k) \n cnt++;\n k -= cnt * (cnt - 1) / 2;\n for ( j = 0; j < cnt; j++) \n printf(\"%c\", 'a' + i);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "09efe932de6123fa4d34f8b904e03d7e", "src_uid": "b991c064562704b6106a6ff2a297e64a", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint mian()\n{\n int k;\n scanf(\"%d\", &k);\n for (int i = 0; i < 26; i++)\n {\n int cnt = 1;\n while ((cnt + 1) * cnt / 2 <= k) \n cnt++;\n k -= cnt * (cnt - 1) / 2;\n for (int j = 0; j < cnt; j++) \n printf(\"%c\", 'a' + i);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "24033ac29d2dff02159a2ca89071b731", "src_uid": "b991c064562704b6106a6ff2a297e64a", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint root[1010000],w[1010000];\nint find(int n)\n{\n\tint r = n;\n\twhile(r != root[r]) r = root[r];\n\tint x = n, y;\n\twhile(x != r)\n\t{\n\t\ty = root[x];\n\t\troot[x] = r;\n\t\tx = y;\n\t}\n\treturn r;\n}\nvoid unico(int a,int b)\n{\n\ta = find(a);\n\tb = find(b);\n\tif(a == b) return;\n\tif(w[a] >= w[b])\n\t{\n\t\troot[b] = a;\n\t\tw[a] += w[b];\n\t}\n\telse\n\t{\n\t\troot[a] = b;\n\t\tw[b] += w[a];\n\t}\n}\nint main()\n{\n\tint n,m,i,j,k,a,b;\n\tscanf(\"%d%d\",&n,&m);\n\tfor (i = 0; i <= n; i++) {\n\t\troot[i]=i;\n\t\tw[i]=1;\n\t}\n\twhile(m--)\n\t{\n\t\tscanf(\"%d%d\",&a,&b);\n\t\tunico(a,b);\n\t}\n\tscanf(\"%d\",&m);\n\twhile(m--)\n\t{\n\t\tscanf(\"%d%d\",&a,&b);\n\t\ta = find(a);\n\t\tb = find(b);\n\t\tif(a == b) root[a] = 0;\n\t}\n\tint ans = 0;\n\tfor(i = 1; i <= n; i++) if(root[i] == i && w[i] > ans)ans = w[i];\n\tprintf(\"%d\\n\",ans);\n}\n/****** PCCA -Mon May 07 05:52:29 GMT 2012 *******/", "lang_cluster": "C", "compilation_error": false, "code_uid": "12a58e9be92620f55bd336de79fdb13e", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint root[101000],w[101000];\nint find(int n)\n{\n\tint r = n;\n\twhile(r != root[r]) r = root[r];\n\tint x = n, y;\n\twhile(x != r)\n\t{\n\t\ty = root[x];\n\t\troot[x] = r;\n\t\tx = y;\n\t}\n\treturn r;\n}\nvoid unico(int a,int b)\n{\n\ta = find(a);\n\tb = find(b);\n\tif(a == b) return;\n\tif(w[a] >= w[b])\n\t{\n\t\troot[b] = a;\n\t\tw[a] += w[b];\n\t}\n\telse\n\t{\n\t\troot[a] = b;\n\t\tw[b] += w[a];\n\t}\n}\nint main()\n{\n\tint n,m,i,j,k,a,b;\n\tscanf(\"%d%d\",&n,&m);\n\tfor (i = 0; i <= n; i++) {\n\t\troot[i]=i;\n\t\tw[i]=1;\n\t}\n\twhile(m--)\n\t{\n\t\tscanf(\"%d%d\",&a,&b);\n\t\tunico(a,b);\n\t}\n\tscanf(\"%d\",&m);\n\twhile(m--)\n\t{\n\t\tscanf(\"%d%d\",&a,&b);\n\t\ta = find(a);\n\t\tb = find(b);\n\t\tif(a == b) root[a] = 0;\n\t}\n\tint ans = 0;\n\tfor(i = 1; i <= n; i++) if(root[i] == i && w[i] > ans)ans = w[i];\n\tprintf(\"%d\\n\",ans);\n}\n/****** PCCA -Mon May 07 05:46:06 GMT 2012 *******/", "lang_cluster": "C", "compilation_error": false, "code_uid": "993dd97db850bb2d40979e8a3d4e7eec", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \nint root[101000],w[101000];\nint find(int n)\n{\n\tint r = n;\n\twhile(r != root[r]) r = root[r];\n\tint x = n, y;\n\twhile(x != r)\n\t{\n\t\ty = root[x];\n\t\troot[x] = r;\n\t\tx = y;\n\t}\n\treturn r;\n}\nvoid unico(int a,int b)\n{\n\ta = find(a);\n\tb = find(b);\n\tif(a == b) return;\n\tif(w[a] >= w[b])\n\t{\n\t\troot[b] = a;\n\t\tw[a] += w[b];\n\t}\n\telse\n\t{\n\t\troot[a] = b;\n\t\tw[b] += w[a];\n\t}\n}\nint main()\n{\n\tint n,m,i,j,k,a,b;\n\tscanf(\"%d%d\",&n,&m);\n\tfor (i = 0; i <= n; i++) {\n\t\troot[i]=i;\n\t\tw[i]=1;\n\t}\n\twhile(m--)\n\t{\n\t\tscanf(\"%d%d\",&a,&b);\n\t\tunico(a,b);\n\t}\n\tscanf(\"%d\",&m);\n\twhile(m--)\n\t{\n\t\tscanf(\"%d%d\",&a,&b);\n\t\ta = find(a);\n\t\tb = find(b);\n\t\tif(a == b) root[a] = 0;\n\t}\n\tint ans = 0;\n\tfor(i = 1; i <= n; i++) if(root[i] == i && w[i] > ans)ans = w[i];\n\tprintf(\"%d\\n\",ans);\n}\n/****** PCCA -Mon May 07 05:46:52 GMT 2012 *******/", "lang_cluster": "C", "compilation_error": false, "code_uid": "5bb170b3e8a57c3bbbea81df12efbd1f", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define min(a,b) a\n#include \ntypedef struct\n{\n int to, nextid;\n}ne;\nint l[100005];\nne le[200005];\nint d[2001][2001];\nint s[2001],vis[2001];\nint c;\nvoid dfs(int a)\n{\n s[c++]=a;\n vis[a]=1;\n int i;\n for(i=l[a];i!=-1;i=le[i].nextid)\n {\n if(vis[le[i].to]==0) {dfs(le[i].to);}\n }\n}\n\nint main()\n{\nint n,i,u,v,m,k,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<=n+5;i++) l[i]=-1;\n for(i=0;ians) ans=c;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e2888b399f4b9d0b818de617d54285cb", "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n\nint dp[6000][3];\nint c[1000];\nint p;\n\nvoid dfs(int x)\n{\n if (dp[x][0] == 1) {\n\t c[p++] = x;\n } else {\n\t dfs(dp[x][1]);\n\t dfs(dp[x][2]);\n }\n}\n\nint main()\n{\n int n, i, j;\n int a[6001] = {0};\n\n scanf(\"%d\", &n);\n\n for (i = 2; i <= n; i++) a[i] = 1;\n\n for (i = 2; i <= n; i++) {\n\t if (a[i] == 1) {\n\t for (j = i * 2; j <= n; j += i) a[j] = 0;\n\t }\n }\n\n for (i = 1; i <= n; i++) {\n\t for (j = 0; j <= i / 2; j++) {\n\t if (a[i] == 1) {\n\t\t dp[i][0] = 1;\n\t\t dp[i][1] = i;\n\n\t\t break;\n\t } else if (a[j] == 1 && a[i - j] == 1) {\n\t\t dp[i][0] = 2;\n\t\t dp[i][1] = j;\n\t\t dp[i][2] = i - j;\n\n\t\t break;\n\t } else {\n\t\t if (a[j] == 1 && dp[i - j][0] > 0) {\n\t\t\t if (dp[i][0] == 0 || dp[i][0] > dp[i - j][0] + 1) {\n\t\t\t dp[i][0] = dp[i - j][0] + 1;\n\t\t\t dp[i][1] = j;\n\t\t\t dp[i][2] = i - j;\n\t\t\t }\n\t\t }\n\t\t if (dp[j][0] > 0 && a[i - j] == 1) {\n\t\t\t if (dp[i][0] == 0 || dp[i][0] > dp[j][0] + 1) {\n\t\t\t dp[i][0] = dp[j][0] + 1;\n\t\t\t dp[i][1] = j;\n\t\t\t dp[i][2] = i - j;\n\t\t\t }\n\t\t }\n\t\t if (dp[j][0] > 0 && dp[i - j][0] > 0) {\n\t\t\t if (dp[i][0] == 0 || dp[i][0] > dp[j][0] + dp[i - j][0]) {\n\t\t\t dp[i][0] = dp[j][0] + dp[i - j][0];\n\t\t\t dp[i][1] = j;\n\t\t\t dp[i][2] = i - j;\n\t\t\t }\n\t\t }\n\t }\n\t }\n }\n\n if (dp[n][0] == 0) {\n\t puts(\"-1\");\n } else {\n\t dfs(n);\n\n\t j = 0;\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t if (c[j] == 0) j++;\n\n\t printf(\"%d\", j + 1);\n\n\t c[j]--;\n\t }\n\t puts(\"\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d825ffdd371f94a1280d27a8f7b5e86d", "src_uid": "94ef0d901f21e1945849fd5bfc2d1449", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\nchar a[20000000];\n\nint main()\n{\n int n, sum, x = 0, i, j;\n int b[6000] = {0};\n\n scanf(\"%d\", &n);\n\n sum = n * (n + 1) / 2;\n\n a[0] = a[1] = 1;\n\n for (i = 2; i * i <= sum; i++) {\n\t if (a[i] == 0) {\n\t for (j = i * 2; j <= sum; j += i) a[j] = 1;\n\t }\n }\n\n if (a[sum] == 0) {\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t putchar('1');\n\t }\n\t puts(\"\");\n } else if (a[sum - 2] == 0) {\n\t b[1] = 1;\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", b[i] + 1);\n\t }\n\t puts(\"\");\n } else if (sum % 2 == 0) {\n\t for (i = 3; i <= sum / 2; i++) {\n\t if (a[i] == 0 && a[sum - i] == 0) break;\n\t }\n\n\t for (j = 0; j < n; j++) {\n\t b[j] = 1;\n\n\t x += j + 1;\n\n\t if (x >= i) break;\n\t }\n\n\t if (x > i) {\n\t b[x - i - 1] = 0;\n\t }\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", b[i] + 1);\n\t }\n\t puts(\"\");\n } else {\n\t sum -= 3;\n\n\t b[0] = b[1] = 1;\n\n\t for (i = 3; i <= sum / 2; i++) {\n\t if (a[i] == 0 && a[sum - i] == 0) break;\n\t }\n\n\t for (j = 2; j < n; j++) {\n\t b[j] = 2;\n\n\t x += j + 1;\n\n\t if (x >= i) break;\n\t }\n\n\t if (x > i) {\n\t if (x - i > 2) {\n\t\t b[x - i - 1] = 0;\n\t } else if (x - i == 1) {\n\t\t b[j + x - i] = 2;\n\t\t b[2] = 0;\n\t }\n\t }\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", b[i] + 1);\n\t }\n\t puts(\"\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "02945e8217b87da6afaf72f6d0e51f41", "src_uid": "94ef0d901f21e1945849fd5bfc2d1449", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\nchar a[20000000];\n\nint main()\n{\n int n, sum, x = 0, i, j;\n int b[6000] = {0};\n\n scanf(\"%d\", &n);\n\n sum = n * (n + 1) / 2;\n\n a[0] = a[1] = 1;\n\n for (j = 4; j <= sum; j += 2) a[j] = 1;\n\n for (i = 3; i * i <= sum; i += 2) {\n\t if (a[i] == 0) {\n\t for (j = i * 2; j <= sum; j += i) a[j] = 1;\n\t }\n }\n\n if (a[sum] == 0) {\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t putchar('1');\n\t }\n\t puts(\"\");\n } else if (a[sum - 2] == 0) {\n\t b[1] = 1;\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", b[i] + 1);\n\t }\n\t puts(\"\");\n } else if (sum % 2 == 0) {\n\t for (i = 3; i <= sum / 2; i += 2) {\n\t if (a[i] == 0 && a[sum - i] == 0) break;\n\t }\n\n\t for (j = 0; j < n; j++) {\n\t b[j] = 1;\n\n\t x += j + 1;\n\n\t if (x >= i) break;\n\t }\n\n\t if (x > i) {\n\t b[x - i - 1] = 0;\n\t }\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", b[i] + 1);\n\t }\n\t puts(\"\");\n } else {\n\t sum -= 3;\n\n\t b[0] = b[1] = 1;\n\n\t for (i = 3; i <= sum / 2; i += 2) {\n\t if (a[i] == 0 && a[sum - i] == 0) break;\n\t }\n\n\t for (j = 2; j < n; j++) {\n\t b[j] = 2;\n\n\t x += j + 1;\n\n\t if (x >= i) break;\n\t }\n\n\t if (x > i) {\n\t if (x - i > 2) {\n\t\t b[x - i - 1] = 0;\n\t } else {\n\t\t b[j] = 0;\n\t\t b[j - x + i + 3] = 2;\n\t\t b[2] = 0;\n\t }\n\t }\n\n\t for (i = 0; i < n; i++) {\n\t if (i > 0) putchar(' ');\n\n\t printf(\"%d\", b[i] + 1);\n\t }\n\t puts(\"\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1baa146518e60c98baefb303a769439e", "src_uid": "94ef0d901f21e1945849fd5bfc2d1449", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define SUM(N) (N * (N + 1) / 2)\n#define MAXN (6 * 1000 + 1)\n#define MAXS SUM(MAXN)\nchar p[MAXS];\nchar c[MAXN];\n\nint main() {\n int N, S, i, j;\n\n scanf(\"%d\", &N);\n S = SUM(N);\n\n p[2] = 1;\n for (i = 3; i <= S; i += 2) p[i] = 1;\n for (i = 2; i*i <= S; ++i) if(p[i]) for (j = i*i; j <= S; j += 2*i) p[j] = 0;\n\n memset(c, '1', sizeof c);\n if (p[S] {\n } else if (p[S-2]) {\n c[2] = '2';\n } else if (S % 2) {\n c[1] = c[2] = '2', S -= 3;\n for (i = 3; ; i++) if (p[i] && p[S - i]) {\n c[i] = '3';\n break;\n }\n }\n else for (i = 3; ; i++) if (p[i] && p[S - i]) {\n c[i] = '2';\n break;\n }\n\n for (i = 1; i <= N; i++) printf(\"%c%c\", c[i], i == N? '\\n' : ' ');\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5b9939a8043f5edc76990f286bf41f44", "src_uid": "94ef0d901f21e1945849fd5bfc2d1449", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#define oo 1000000000\n#define gmin(a,b) ((a)>(b)?(b):(a))\nlong getans=0,w[10000]={0},h[10000]={0},n,min,total=0,hash[40000000]={0},z[2000000]={0},an[200000]={0};\nvoid work(long k,long tot)\n{\n long i,o,j;\n if(k<=n)\n {\n if(k>min)\n return ;\n for(i=1;i<=tot;i++)\n {\n w[i]-=k;\n o=min;\n h[k]=i;\n if(w[i] && w[i]=0;i++)\n {\n an[k]=z[i];\n dfs(i+1,k+1,tot,count-z[i]);\n if(getans)\n return ;\n }\n }\n else\n {\n if(hash[count]==0)\n {\n for(i=1;i\n#include \n\nint main()\n{\n int i, j, n, m, x1, y1, x2, y2;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &x1, &y1, &x2, &y2);\n\n i = abs(x1 - x2);\n j = abs(y1 - y2);\n\n if (i > j) {\n int aux = i;\n i = j;\n j = aux;\n }\n\n if ((i <= 2 && j <= 4) || (i == 3 && j == 3)) {\n puts(\"First\");\n } else {\n puts(\"Second\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "600f4619fbb5afffa18f4cbd0ca5728a", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, m, x1, y1, x2, y2, x, y;\n \n scanf(\"%d %d %d %d %d %d\", &n, &m, &x1, &y1, &x2, &y2);\n \n x = abs(x1 - x2);\n y = abs(y1 - y2);\n \n if (x > y) {\n int tmp = x;\n x = y;\n y = tmp;\n }\n \n if ((x <= 2 && y <= 4) || (x == 3 && y == 3)) {\n puts(\"First\");\n } else {\n puts(\"Second\");\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d1db3fe8d41ecb196e8aa3e5216921f1", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i 4 && ab(y1-y2) > 4) puts(\"Second\");\n else puts(\"First\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ec9277e48fc73b1f67ddce1c39a6e2d2", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i 4 || ab(y1-y2) > 4) puts(\"Second\");\n else puts(\"First\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "06d0c69bdc5cf826c16cbeb8fe747077", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i 3 || ab(y1-y2) > 3) puts(\"Second\");\n else puts(\"First\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "45db5e0304b2da7685555c84e28a9cae", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0} {"lang": "GNU C11", "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#define MAXN 2003\n\nint main()\n{\n int n, t, i, j, cur = 0;\n double p, f[2][MAXN];\n scanf(\"%d%lf%d\", &n, &p, &t);\n // f[t][n] -> the possibility that (exactly) n people\n // are standing on the escalator after t seconds\n for (i = 1; i <= n; ++i) f[cur][i] = 0;\n f[cur][0] = 1;\n#define next (!cur)\n for (i = 0; i < t; ++i) {\n for (j = 0; j <= i; ++j)\n if (j >= n) f[next][j] += f[cur][j];\n else {\n f[next][j + 1] += f[cur][j] * p;\n f[next][j] += f[cur][j] * (1.0 - p);\n }\n cur = !cur;\n for (j = 0; j <= n; ++j) f[next][j] = 0;\n }\n#undef next\n double ans = 0;\n for (i = 0; i <= n; ++i) ans += f[cur][i] * i;\n printf(\"%g\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c91622b1ec5f674580b8135a5b766507", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nfloat a[2001][2001];\nint main()\n{\n int n,t,i,j;\n float p,q,res;\n scanf(\"%d%f%d\",&n,&p,&t);\n q=1-p;\n a[0][0]=q;\n a[0][1]=p;\n for(i=1;i\n#include\ndouble d[2001][2001];\nint main()\n{\n int n,t,i,j;\n double p,f;\n scanf(\"%d%lf%d\",&n,&p,&t);\n for(i=1;i<=t;++i)\n d[0][i]=0;\n for(i=0;i<=n;++i)\n d[i][0]=0;\n for(i=1;i<=n;++i)\n {\n for(j=1;j<=i;++j)\n d[i][j]=(d[i-1][j-1]+1)*p+(1-p)*d[i][j-1];\n }\n printf(\"%lf\",d[n][t]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "750767def31989c8073ef356f2747637", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nfloat x[2001][2001];\nint main()\n{\n\n int n,t,i,j;\n float p;\n scanf(\"%d%f%d\",&n,&p,&t);\n\n for(i=0;i<=n;i++)\n x[i][0]=0;\n for(i=0;i<=t;i++)\n x[0][i]=0;\n\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=t;j++)\n {\n x[i][j]= (p*(x[i-1][j-1]+1))+((1-p)*(x[i][j-1]));\n }\n }\n\n printf(\"%f\\n\",x[n][t]);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dd8e026bdea86c3f02629f0284dffe77", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "By cyand1317, contest: Codeforces Round #293 (Div. 2), problem: (D) Ilya and Escalator, Wrong answer on test 6, #\n\n#include \n#define MAXN 2003\n\nint main()\n{\n int n, t, i, j, cur = 0;\n double p, f[2][MAXN];\n scanf(\"%d%lf%d\", &n, &p, &t);\n // f[t][n] -> the possibility that (exactly) n people\n // are standing on the escalator after t seconds\n for (i = 1; i <= n; ++i) f[cur][i] = 0;\n f[cur][0] = 1;\n#define next (!cur)\n for (i = 0; i < t; ++i) {\n for (j = 0; j <= i; ++j)\n if (j >= n) f[next][j] += f[cur][j];\n else {\n f[next][j + 1] += f[cur][j] * p;\n f[next][j] += f[cur][j] * (1.0 - p);\n }\n cur = !cur;\n for (j = 0; j <= n; ++j) f[next][j] = 0;\n }\n#undef next\n double ans = 0;\n for (i = 0; i <= n; ++i) ans += f[cur][i] * i;\n printf(\"%.8lf\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "67074039e377935c1fb8a61094ac330d", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\n#define N\t1000\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N], dd[N], ee[N], ii[N];\n\tint n, h, i, j, k, cnt;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d%d%d%d\", &aa[i], &bb[i], &cc[i], &dd[i], &ee[i]);\n\tcnt = 0;\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\tif (j != i && k != i && j != k && (aa[j] - aa[i]) * (aa[k] - aa[i]) + (bb[j] - bb[i]) * (bb[k] - bb[i]) + (cc[j] - cc[i]) * (cc[k] - cc[i]) + (dd[j] - dd[i]) * (dd[k] - dd[i]) + (ee[j] - ee[i]) * (ee[k] - ee[i]) > 0)\n\t\t\t\t\tgoto out;\n\t\tii[cnt++] = i;\nout:\n\t\t;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\tfor (h = 0; h < cnt; h++)\n\t\tprintf(\"%d\\n\", ii[h] + 1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "45caa9dc75acc9aaa45681ac614f651b", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define maxn 1000\n\nlong p[maxn+1][5],xl[maxn+1][maxn+1][5],point[maxn+1],count=0;\n__int64 value[maxn+1][maxn+1];\nbool vis[maxn+1];\n\n long n,i,j,k,l;\n __int64 v1,v2;\n\n\nvoid work()\n{\n for (j=1;j0\n // +\n if ((v1>0 && v2>0) || (v1<0 && v2<0))\n {\n vis[i]=false;\n return;\n }\n }\n vis[i]=true;\n}\n\nint main()\n{\n scanf(\"%ld\",&n);\n for (i=1;i<=n;i++)\n for (j=0;j<5;j++)\n scanf(\"%ld\",&p[i][j]);\n for (i=1;i<=n;i++)\n for (j=1;j<=n;j++)\n {\n value[i][j]=0;\n for (k=0;k<5;k++)\n {\n xl[i][j][k]=p[j][k]-p[i][k];\n value[i][j]+=xl[i][j][k]*xl[i][j][k];\n }\n }\n\n// for (i=1;i<=n;i++)\n// vis[i]=true;\n for (i=1;i<=n;i++)\n work();\n for (i=1;i<=n;i++)\n if (vis[i]==true)\n {\n count++;\n point[count]=i;\n }\n printf(\"%ld\\n\",count);\n for (i=1;i<=count;i++)\n printf(\"%ld\\n\",point[i]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b733282a811e2c8624454276cb91d658", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#define tor 0.00000001\n\nint main()\n{\n long ax,ay,bx,by,cx,cy;\n double k1,k2;\n bool vis1,vis2;\n scanf(\"%ld%ld%ld%ld%ld%ld\",&ax,&ay,&bx,&by,&cx,&cy);\n if (ax==cx && ay==cy)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if (ax+cx==bx*2 && ay+cy==by*2)\n {\n printf(\"No\\n\");\n return 0;\n }\n vis1=true;\n vis2=true;\n if (cx-ax!=0)\n k1=1.0*(cy-ay)/(cx-ax);\n else\n vis1=false;\n ax=1.0*(ax+cx)/2;\n ay=1.0*(ay+cy)/2;\n if (bx-ax!=0)\n k2=1.0*(by-ay)/(bx-ax);\n else\n vis2=false;\n\n if ((vis1==false && vis2==true && fabs(k2-0)\n#include \n#include \n#define maxn 1000\n\nlong p[maxn+1][5],xl[maxn+1][maxn+1][5],point[maxn+1],count=0;\n__int64 value[maxn+1][maxn+1];\nbool vis[maxn+1];\n\n long n,i,j,k,l;\n __int64 v1,v2;\n\n\nvoid work()\n{\n for (j=1;j\n#include\n/*\nint cmp(const void* a,const void * b)\n{\nint * g = (int *)a;int * y = (int *)b;\n\nif(g[0]y[1])return 11;\nelse\n{\nif(g[2]>y[2])return 11;\nelse\n{\nif(g[3]>y[3])return 11;\nelse\n{\nif(g[4]>y[4])return 11;\nelse return -141;\n}}}}}\n//return -141;\n}}*/\n\nint main()\n{\n\nint arr[6000];\n\nint i=0;\nint n;\nscanf(\"%d\",&n);\n\nfor(i=0;i<5*n;i+=5)\n{\nscanf(\"%d %d %d %d %d\",&arr[i+0],&arr[i+1],&arr[i+2],&arr[i+3],&arr[i+4]);\n}\nint good = 0;int arr2[1005];\nint j;int k;\nfor(i=0;i<5*(n-2);i+=5)\n{int flag=101;\nfor(j=i+5;j<5*(n-1);j+=5)\n{\nfor(k=j+5;k<5*(n);k+=5)\n{\nif(((arr[i+0]-arr[j+0])*(arr[i+0]-arr[k+0]) +(arr[i+1]-arr[j+1])*(arr[i+1]-arr[k+1])+(arr[i+2]-arr[j+2])*(arr[i+2]-arr[k+2]) \n+(arr[i+3]-arr[j+3])*(arr[i+3]-arr[k+3]) + (arr[i+4]-arr[j+4])*(arr[i+4]-arr[k+4]))>0)\n{\nflag =-99;break;\n\n}\n\n}\nif(flag == -99)break;\n}\nif(flag == 101)\n{\nint h=0;\n/*for(h=0;h<5;h++)\n{\narr2[good][h]=arr[i+h];\n}*/\narr2[good++]=(i+5)/5;\n}\n}\n//qsort(arr2,good,sizeof(int *),cmp);\n\nprintf(\"%d\\n\",good);\nint port =0;\nfor(port=0;port\n\nint main(int argc, char * argv[]) {\n printf(\"0\\n1\\n1\\n0\\n1\\n1\\n0\\n1\\n1\\n1\\n1\\n1\\n0\\n1\\n0\\n1\\n1\\n1\\n0\\n1\\n1\\n1\\n1\\n1\\n0\\n1\\n0\\n1\\n1\\n1\\n\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8d218bccaa50572983a83c709fe3501", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "GNU C11", "source_code": "/* https://ejectamenta.com/imaging-experiments/fourifier/ */\n/* ((min(id,25)+id)%(2+id%3))>0 */\n#include \n\nint min(int a, int b) { return a < b ? a : b; }\n\nint main() {\n\tint id;\n\n\tfor (id = 21; id <= 50; id++)\n\t\tprintf(\"%d\\n\", (min(id, 25) + id) % (2 + id % 3) > 0);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d8b0dd051b3aa7994ed7c13051a3b3b8", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint min(int a,int b){return a0);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "70f37dd5f5787c552b03b5d0863ff767", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "GNU C11", "source_code": "min(a,b){return a0);}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4813dcf311cc690f006a427f832a2618", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint min(int a,int b){return a0);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "039b4923fac2d5816d231149c35501d7", "src_uid": "4bda04e64ff661336a93464563f1b550", "difficulty": null} {"lang": "GNU C", "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\",x1,y1,x1+a*i,y1+b*i);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "255c77f70ff4bfca34defdef4240d76f", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "GNU C", "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 \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "90a5832db042ed44e6545366bb9f4c50", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "GNU C", "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+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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8aa3ed978209498ee5036abef99fd6d7", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "# include \n# include \nmain()\n{\n long long int n,m,x,y,a,b,p,q,x1,y1,c;\n double 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 \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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b5c441fdf231bd539613a019c3baeccd", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "/*\t\t\t ____COMPETITIVE CODING____ */\n\n//--Header Files--\n\n#include \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "00af32816e3aa26e17d158bf7963a7b1", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0} {"lang": "GNU C11", "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(\"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", "lang_cluster": "C", "compilation_error": false, "code_uid": "bc037d1a38b2311f1a631de52e275ef4", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "/*\t\t\t ____COMPETITIVE CODING____ */\n\n//--Header Files--\n\n#include \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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "7dc55cd772fda3fb5e8d43cc13e5ffa2", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0} {"lang": "GNU C11", "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(\"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 = a-1;\n while(q%(++za) != 0);\n lli k = za - a;\n printf(\"%lld\\n\",k);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3bb4bed9dfcd49552f8ec5dbfe8607cf", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MD\t998244353\n\nlong long power(int a, int k) {\n\tlong long b = a, p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * b % MD;\n\t\tb = b * b % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint main() {\n\tint n, i, x, y, z;\n\n\tscanf(\"%d\", &n);\n\tx = 1, y = 0, z = 1;\n\tfor (i = 0; i < n; i++)\n\t\tz = x, x = (y + z) % MD, y = z;\n\tprintf(\"%lld\\n\", z * power(2, MD - 1 - n) % MD);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "01ea8fe74a1dd0162d973356d53f2579", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\n#define M 998244353\n\n\nlong long add(long long a, long long b) { return (a + b + M) % M; }\nlong long mul(long long a, long long b) { return ((a % M) * (b % M)) % M; }\nlong long pw(long long a, long long r)\n{\n if(r == 0) return 1;\n long long b = pw(a, r/2) % M, c = (r&1)?a:1;\n return mul(mul(b,b),c);\n}\n\nlong long mat[210210],sum[210210];\n\n\nvoid fill()\n{\n int x; \n sum[0] = sum[1] = sum[2] = 1;\n for(x = 3; x <= 200000; x++)\n sum[x] = add(sum[x-1],sum[x-2]);\n}\n\n\nint main()\n{\n int x,y,z,i,j,k,a,b,c,n,m,t;\n scanf(\"%d\",&n);\n memset(mat, -1, sizeof(mat));\n memset(sum, 0, sizeof(sum));\n \n fill();\n \n printf(\"%lld\\n\",mul( sum[n], pw(pw(2,n), M-2) ));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "68c2c84d9886a661d612302f194a1fae", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nint main(int argc, char *argv[])\n{\n\tint xa, ya , za, xb , yb , zb ;\n\tdouble distance ;\n\t\n\tscanf(\"%d\",&xa);\n\tscanf(\"%d\",&ya);\n\tscanf(\"%d\",&za);\n\tscanf(\"%d\",&xb);\n\tscanf(\"%d\",&yb);\n\tscanf(\"%d\",&zb);\n\t\n\tdistance = sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya)+(zb-za)*(zb-za));\n\t\n\tif(za==1&&zb==1){\n\t\tprintf(\"YES\");\n\t}\n\telse if(za!=zb&&xa==xb || za!=zb&&ya==yb){\n\t\tprintf(\"YES\");\n\t}\n\telse if(za==0&&zb==0&&distance>1.4){\n\t\tprintf(\"NO\");\n\t}\n\telse if(distance>1.5){\n\t\tprintf(\"NO\");\n\t}\n\telse{\n\t\tprintf(\"YES\");\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "02f8edbe409c3c0e3cc533923db391d7", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "GNU C", "source_code": "#include \n\nint main(){\n int flyes[2][3];\n int i,diffs=0;\n for(i = 0; i<3; i++)\n scanf(\"%d\",&flyes[0][i]);\n for(i = 0; i<3; i++)\n scanf(\"%d\",&flyes[1][i]);\n for(i = 0; i<3; i++){\n if(flyes[0][i]!=flyes[1][i])\n\t diffs++;\n }\n if(diffs==1)\n printf(\"YES\");\n else \n printf(\"NO\");\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d1cd333c350209b506ed292dbfeb6baa", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n long long a,b,c,d,e,f,count=0;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n scanf(\"%lld%lld%lld\",&d,&e,&f);\n if(a==0 &&b==0&&c==0)\n {\n if(d==1&&e==1&&f==1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n }\n else if(a==1&&b==0&&c==0)\n {\n if(d==0&&e==0&&f==1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n }\n else if(a==1&&b==1&&c==0)\n {\n if(d==0&&e==0&&f==1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n }\n else if(a==0&&b==1&&c==0)\n {\n if(d==1&&e==0&&f==1)\n printf(\"NO\\n\");\n\n else\n printf(\"YES\\n\");\n }\n else if(a==0&&b==0&&c==1)\n {\n if(d==1&&e==1&&f==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n }\n else if(a==1&&b==0&&c==1)\n {\n if(d==0&&e==1&&f==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n }\n else if(a==1&&b==1&&c==1)\n {\n if(d==0&&e==0&&f==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n }\n else if(a==0&&b==1&&c==1)\n {\n if(d==1&&e==0&&f==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n }\n\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f0de508985146992f35353bb104bd170", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n\nusing namespace std;\n\nint main()\n{\n\tint f1[3];\n\tint f2[3];\n\tfor(int i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\", &f1[i]);\n\t}\n\tfor(int i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\", &f2[i]);\n\t}\n\tif(f1[0] == f2[0])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if(f1[1] == f2[1])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if(f1[2] == f2[2])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if ((f1[0] == f2[0]) && (f1[1] == f2[1]) && (f1[2] == f2[2]))\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\nreturn 0;\t\n} \n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "e706dd9e8cf867d66bafd1bd97a096c7", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nusing namespace std;\n\nint main()\n{\n\tint f1[3];\n\tint f2[3];\n\tfor(int i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\", &f1[i]);\n\t}\n\tfor(int i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\", &f2[i]);\n\t}\n\tif(f1[0] == f2[0])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if(f1[1] == f2[1])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if(f1[2] == f2[2])\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse if ((f1[0] == f2[0]) && (f1[1] == f2[1]) && (f1[2] == f2[2]))\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\nreturn 0;\t\n} \n \n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0a24ea7bb1c22c20d156bc74fd71bfaf", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main()\n {\n int m,n;\n scanf(\"%d %d\",&m,&n);\n fflush(stdin);\n char a[1001][1001]={0};\n char b[1001][1001]={0};\n memset(b,'.',1001*1001);\n for(int i=0;i\n\nint main()\n {\n int m,n,count=0;\n char line[10000],ch;\n scanf(\"%d %d\",&m,&n);\n int grid[m][n];\n int grid2[m][n];\n scanf(\"%c\",&ch);\n for(int i=0;i\nint grid[100][100];\nint main()\n {\n int m,n,count=0;\n char line[100],ch;\n scanf(\"%d %d\",&m,&n);\n fflush(stdin);\n for(int i=0;i\n#include \n\nchar arr[1001][1001];\nchar my[1001][1001];\nint stamp(int a, int b) {\n\tint i, j, c = 1;\n\t//memo\n\n\t//stamp!\n\tfor (i = -1; i <= 1; i++) {\n\t\tfor (j = -1; j <= 1; j++) {\n\t\t\tif (i == 0 && j == 0)\n\t\t\t\tcontinue;\n\t\t\telse if (arr[a + i][b + j] == '#')\n\t\t\t\tcontinue;\n\t\t\telse\n\t\t\t\tc = 0;\n\t\t}\n\t}\n\tif (c) {\n\t\tfor (i = -1; i <= 1; i++) {\n\t\t\tfor (j = -1; j <= 1; j++) {\n\t\t\t\tif (i == 0 && j == 0)\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t\tmy[a + i][b + j] = '#';\n\t\t\t}\n\t\t}\n\t}\n}\nint main() {\n\tint n, m;\n\tint i, j;\n\tchar tmp;\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%s\", arr[i]);\n\t}\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tmy[i][j] = '.';\n\t\t}\n\t}\n\n\tfor (i = 1; i < n - 1; i++) {\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tstamp(i, j);\n\t\t}\n\t}\n\ti = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tif (my[i][j] != arr[i][j]) {\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tsystem(\"pause\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\");\n\tsystem(\"pause\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d7e468c78f48d2d5e4905817c0cfdded", "src_uid": "49e5eabe8d69b3d27a251cccc001ab25", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nchar arr[1001][1001];\nchar my[1001][1001];\nint stamp(int a, int b) {\n\tint i, j, c = 1;\n\t//memo\n\n\t//stamp!\n\tfor (i = -1; i <= 1; i++) {\n\t\tfor (j = -1; j <= 1; j++) {\n\t\t\tif (i == 0 && j == 0)\n\t\t\t\tcontinue;\n\t\t\telse if (arr[a + i][b + j] == '#')\n\t\t\t\tcontinue;\n\t\t\telse\n\t\t\t\tc = 0;\n\t\t}\n\t}\n\n\tfor (i = -1; i <= 1; i++) {\n\t\tfor (j = -1; j <= 1; j++) {\n\t\t\tif (i == 0 && j == 0)\n\t\t\t\tcontinue;\n\t\t\telse\n\t\t\t\tmy[a + i][b + j] = '#';\n\t\t}\n\t}\n}\nint main() {\n\tint n, m;\n\tint i, j;\n\tchar tmp;\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%s\", arr[i]);\n\t}\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tmy[i][j] = '.';\n\t\t}\n\t}\n\n\tfor (i = 1; i < n - 1; i++) {\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tstamp(i, j);\n\t\t}\n\t}\n\ti = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tif (my[i][j] != arr[i][j]) {\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tsystem(\"pause\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\");\n\tsystem(\"pause\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "882251aac4b4f9fae3d754a28ccfd5bf", "src_uid": "49e5eabe8d69b3d27a251cccc001ab25", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\n#define ULL unsigned long long\nULL p[16]={2,3,5,7,11,13,17,29,23,29,31,37,41,43,47,53},ans=~0ULL,n;\nvoid dfs(ULL depth,ULL temp,ULL num,ULL up)\n{\n if(num>n||depth>15)return;\n if(num==n&&ans>temp)\n {\n ans=temp;\n return;\n }\n for(int i=1;i<=up;i++)\n {\n if(temp/p[depth]>ans)break;\n dfs(depth+1,temp*=p[depth],num*(i+1),i);\n }\n}\n\nint main()\n{\n scanf(\"%llu\",&n);\n dfs(0,1,1,64);\n printf(\"%llu\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa3860437a4ce5f4eddbcfef2c3a8e05", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint simp[100000];\nint a[10000];\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[50];\n\tint f=0;\n\tfor (int i=2; i<1000; i++)\n\t\twhile(n%i==0)\n\t\t\tarr[f++]=i, n/=i;\n\tn = 100000;\n\tint g=0;\n\tfor (int i=0; i=3)\n\t{\n\t\tif(arr[f-1]==2)\n\t\t{\n\t\t\tf--;\n\t\t\tarr[f-1]+=2;\n\t\t}\n\t}\n\tfor (int i=f-1; i>=0; i--)\n\t{\n\t\twhile(arr[i]-->1)\n\t\t\tans*=a[g];\n\t\tg++;\n\t}\n\tprintf(\"%I64d\", ans);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f8c01d0b21f3685340ddddbbc087a4e6", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\ntypedef __int64 LL;\nLL p[11052];\nLL prime[30] = { 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53 };\nvoid getartprime(LL cur, int cnt, int limit, int k) {//cur\uff1a\u5f53\u524d\u679a\u4e3e\u5230\u7684\u6570,cnt\uff1a\u8be5\u6570\u7684\u56e0\u6570\u4e2a\u6570,limit\uff1a\u56e0\u6570\u4e2a\u6570\u7684\u4e0a\u9650\uff1b2^t1*3^t2*5^t3\u2026\u2026t1>=t2>=t3\u2026\u2026,\u7b2ck\u5927\u7684\u7d20\u6570\n\tif (cur>((LL)1 << 60) || cnt>1000) return;\n\t\n\t//if (cnt == 4) cout << cur << endl;\n\t\n\tif (p[cnt] != 0 && p[cnt]>cur)//\u5f53\u524d\u7684\u56e0\u6570\u4e2a\u6570\u5df2\u7ecf\u8bb0\u5f55\u8fc7\u4e14\u5f53\u65f6\u8bb0\u5f55\u7684\u6570\u6bd4\u5f53\u524d\u679a\u4e3e\u5230\u7684\u6570\u8981\u5927\uff0c\u5219\u66ff\u6362\u6b64\u56e0\u6570\u4e2a\u6570\u4e0b\u7684\u679a\u4e3e\u5230\u7684\u6570\n\t\tp[cnt] = cur;\n\tif (p[cnt] == 0)//\u6b64\u56e0\u6570\u4e2a\u6570\u7684\u6570\u8fd8\u6ca1\u6709\u51fa\u73b0\u8fc7\uff0c\u5219\u8bb0\u5f55\n\t\tp[cnt] = cur;\n\tLL temp = cur;\n\tfor (int i = 1; i <= limit; i++) {\t\t//\u679a\u4e3e\u6570\n\t\ttemp = temp*prime[k];\n\t\tif (temp>((LL)1 << 60)) return;\n\t\tgetartprime(temp, cnt*(i + 1), i, k + 1);\n\t}\n}\nint main() {\n\tint n;\n\tmemset(p, 0, sizeof(p));\n\tgetartprime(1, 1, 1000, 0);\n\t/*for (int i = 1; i <= 75; i++) {\n\t\tif (p[i * 2 - 1] != 0 && p[i * 2] != 0)\n\t\t\tp[i] = min(p[i * 2 - 1], p[i * 2]);\n\t\telse if (p[i * 2] != 0)\n\t\t\tp[i] = p[i * 2];\n\t\telse\n\t\t\tp[i] = p[i * 2 - 1];\n\t}*/\n\n\n\twhile (scanf(\"%d\", &n), n)\n\t\tprintf(\"%I64d\\n\", p[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aa33ad4f7c6b98d096d339c36c300727", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define PRM 45\n#define LEN 78777\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n#define chkbit(ar, i) (((ar[(i) >> 6]) & (1 << (((i) >> 1) & 31))))\n#define setbit(ar, i) (((ar[(i) >> 6]) |= (1 << (((i) >> 1) & 31))))\n#define isprime(x) (( (x) && ((x)&1) && (!chkbit(ar, (x)))) || ((x) == 2))\n\nconst int P[] = {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};\n\nshort* adj[6725];\nbool visited[6725][PRM];\nlong long lol, div[6725];\ndouble L[PRM], dp[6725][PRM];\nunsigned int ar[(MAX >> 6) + 5] = {0};\nint p, d, len[6725], prime[LEN], temp[6725];\n\nint compare(const void* a, const void* b){\n long long x = (*(long long*)a);\n long long y = (*(long long*)b);\n if (x == y) return 0;\n return ((x > y) ? -1 : 1);\n}\n\nlong long expo(long long a, long long b){\n long long res = 1;\n\n while (b){\n if (b & 1) res = res *= a;\n a *= a, b >>= 1;\n }\n return res;\n}\n\nvoid Sieve(){\n int i, j, k;\n setbit(ar, 0), setbit(ar, 1);\n\n for (i = 3; (i * i) < MAX; i++, i++){\n if (!chkbit(ar, i)){\n for (j = (i * i), k = i << 1; j < MAX; j += k) setbit(ar, j);\n }\n }\n\n prime[0] = 2;\n for (i = 3, p = 1; i < MAX; i++, i++){\n if (isprime(i)) prime[p++] = i;\n }\n}\n\nint divisors(long long x){\n int i, j, l, k, c, len = 0;\n\n div[len++] = 1;\n for (i = 0; i < p; i++){\n if ((long long)prime[i] * prime[i] > x) break;\n\n c = 0, k = len;\n while (!(x % prime[i])){\n c++;\n x /= prime[i];\n }\n\n long long y = prime[i];\n for (j = 0; j < c; j++, y *= prime[i]){\n for (l = 0; l < k; l++){\n div[len++] = y * div[l];\n }\n }\n }\n\n if (x > 1){\n for (j = 0, k = len; j < k; j++) div[len++] = div[j] * x;\n }\n\n qsort(div, len, sizeof(long long), compare);\n return len;\n}\n\nvoid Generate(long long n){\n int i, j, k, l;\n\n clr(len);\n d = divisors(n);\n for (i = 0; i < d; i++){\n for (j = i + 1, l = 0; j < d; j++){\n if (!(div[i] % div[j])) temp[l++] = j;\n }\n\n adj[i] = (short*) malloc(l * sizeof(short));\n for (j = 0; j < l; j++){\n adj[i][len[i]++] = temp[j];\n }\n }\n}\n\ndouble F(int i, int j){\n if (div[i] == 1) return 0.0;\n if (j == PRM) return 1e37;\n if (visited[i][j]) return dp[i][j];\n\n int k, l;\n long long r;\n double x, y, res = 1e37;\n for (k = 0; k < len[i]; k++){\n l = adj[i][k], r = div[i] / div[l];\n x = F(l, j + 1) + (L[j] * (r - 1));\n if (x < res) res = x;\n if (r > div[l]) break;\n }\n\n visited[i][j] = true;\n return (dp[i][j] = res);\n}\n\nvoid backtrack(int i, int j){\n if (div[i] == 1 || j == PRM) return;\n\n long long r;\n int k, l, idx;\n double x, y, res = 1e37;\n for (k = 0; k < len[i]; k++){\n l = adj[i][k], r = div[i] / div[l];\n x = F(l, j + 1) + (L[j] * (r - 1));\n if (x < res) res = x, idx = l;\n if (r > div[l]) break;\n }\n\n lol = lol * expo(P[j], (div[i] / div[idx]) - 1);\n backtrack(idx, j + 1);\n}\n\nint main(){\n Sieve();\n long long n, r;\n int T = 0, t, i, j, k, l;\n for (i = 0; i < PRM; i++) L[i] = log10(P[i]);\n\n while (scanf(\"%lld\", &n) != EOF){\n if (n == 0) break;\n\n Generate(n);\n clr(visited);\n lol = 1;\n backtrack(0, 0);\n else printf(\"%lld\\n\", lol);\n for (i = 0; i < d; i++) free(adj[i]);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "0fb1995588e11571e171a198a01a5a93", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#define INF ~0ULL\n#define ULL unsigned long long\nusing namespace std;\nULL p[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};\nULL n, ans;\nvoid dfs(ULL depth, ULL temp, ULL num, ULL up)\n{\n if (num == n && temp < ans) ans = temp;\n if (num >= n || depth == 16) return;\n for (int i = 1; i <= up; ++i)\n {\n if (temp * p[depth] >= ans) return;\n else dfs(depth + 1, temp = temp * p[depth], num * (i + 1), i);\n }\n}\nint main()\n{\n while (scanf(\"%llu\", &n) != EOF)\n {\n ans = INF;\n dfs(0, 1, 1, 64);\n printf(\"%llu\\n\", ans);\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "2b981525f7d1c3056b8e6e0c5da79257", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t200000\n#define L_\t19\t/* L_ = ceil(log2(N * 2 + 1)) */\n#define N_\t(1 << L_)\n#define MD\t998244353\n\nint min(int a, int b) { return a < b ? a : b; }\n\nlong long power(long long a, int k) {\n\tlong long p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * a % MD;\n\t\ta = a * a % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint vv[N + 1], ff[N + 1], gg[N + 1], mobius[N + 1];\nint *wwu[L_ + 1], *wwv[L_ + 1], vv_[L_ + 1];\n\nvoid init() {\n\tint i, j, l, u, v;\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\tfor (i = 2; i <= N; i++) {\n\t\tif (mobius[i])\n\t\t\tcontinue;\n\t\tfor (j = i; j <= N; j += i)\n\t\t\tmobius[j]++;\n\t}\n\tfor (i = 2; i <= N / i; i++)\n\t\tfor (j = i * i; j <= N; j += i * i)\n\t\t\tmobius[j] = -1;\n\tfor (i = 1; i <= N; i++)\n\t\tmobius[i] = mobius[i] == -1 ? 0 : (mobius[i] % 2 == 0 ? 1 : -1);\n\tu = power(3, MD - 1 >> L_), v = power(u, MD - 2);\n\tfor (l = L_; l > 0; l--) {\n\t\tint n = 1 << l, m = n >> 1;\n\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\n\t\twwu[l][0] = wwv[l][0] = 1;\n\t\tfor (i = 1; i < m; i++) {\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\n\t\t}\n\t\tvv_[l] = power(1 << l, MD - 2);\n\t\tu = (long long) u * u % MD, v = (long long) v * v % MD;\n\t}\n\tvv_[0] = 1;\n}\n\nint choose(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nvoid ntt_(int *aa, int l, int inverse) {\n\tif (l) {\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\n\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\n\t\tfor (i = 0; (j = i + m) < n; i++) {\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\n\n\t\t\tif ((aa[i] = a + b) >= MD)\n\t\t\t\taa[i] -= MD;\n\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\taa[j] += MD;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int l, int inverse) {\n\tint n = 1 << l, i, j;\n\n\tfor (i = 1, j = 0; i < n; i++) {\n\t\tint b = n >> 1, tmp;\n\n\t\twhile ((j ^= b) < b)\n\t\t\tb >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tntt_(aa, l, inverse);\n}\n\nvoid multiply(int *aa, int *bb, int n) {\n\tstatic int aa_[N_], bb_[N_];\n\tint n_, l_, i;\n\n\tl_ = 0;\n\twhile (1 << l_ < n + n - 1)\n\t\tl_++;\n\tn_ = 1 << l_;\n\tfor (i = 0; i < n_; i++) {\n\t\taa_[i] = i < n ? aa[i] : 0;\n\t\tbb_[i] = i < n ? bb[i] : 0;\n\t}\n\tntt(aa_, l_, 0), ntt(bb_, l_, 0);\n\tfor (i = 0; i < n_; i++)\n\t\taa_[i] = (long long) aa_[i] * bb_[i] % MD;\n\tntt(aa_, l_, 1);\n\tfor (i = 0; i < n; i++)\n\t\taa[i] = (long long) aa_[i] * vv_[l_] % MD;\n}\n\nvoid inv(int *aa, int *bb, int n) {\n\tstatic int aa_[N_], bb_[N_];\n\tint m, n_, l_, i;\n\n\tif (n == 1) {\n\t\tbb[0] = 1;\n\t\treturn;\n\t}\n\tm = (n + 1) / 2;\n\tinv(aa, bb, m);\n\tl_ = 0;\n\twhile (1 << l_ < n * 2)\n\t\tl_++;\n\tn_ = 1 << l_;\n\tfor (i = 0; i < n_; i++) {\n\t\taa_[i] = i < n ? aa[i] : 0;\n\t\tbb_[i] = i < m ? bb[i] : 0;\n\t}\n\tntt(aa_, l_, 0), ntt(bb_, l_, 0);\n\tfor (i = 0; i < n_; i++)\n\t\taa_[i] = bb_[i] * (MD + 2 - (long long) aa_[i] * bb_[i] % MD) % MD;\n\tntt(aa_, l_, 1);\n\tfor (i = 0; i < n; i++)\n\t\tbb[i] = (long long) aa_[i] * vv_[l_] % MD;\n}\n\nvoid log_(int *aa, int *bb, int n) {\n\tstatic int pp[N + 1], qq[N + 1];\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tpp[i] = i + 1 == n ? 0 : (long long) aa[i + 1] * (i + 1) % MD;\n\tinv(aa, qq, n);\n\tmultiply(pp, qq, n);\n\tfor (i = 0; i < n; i++)\n\t\tbb[i] = i == 0 ? 0 : (long long) pp[i - 1] * vv[i] % MD;\n}\n\nvoid exp_(int *aa, int *bb, int n) {\n\tstatic int aa_[N + 1], bb_[N + 1], cc_[N + 1];\n\tint m, i;\n\n\tif (n == 1) {\n\t\tbb[0] = 1;\n\t\treturn;\n\t}\n\tm = (n + 1) / 2;\n\texp_(aa, bb, m);\n\tfor (i = 0; i < n; i++)\n\t\tbb_[i] = i < m ? bb[i] : 0;\n\tlog_(bb_, cc_, n);\n\tfor (i = 0; i < n; i++)\n\t\taa_[i] = (aa[i] - cc_[i] + MD) % MD;\n\taa_[0] = (aa_[0] + 1) % MD;\n\tmultiply(aa_, bb_, n);\n\tfor (i = 0; i < n; i++)\n\t\tbb[i] = aa_[i];\n}\n\nint bell[N + 1];\n\nvoid compute_bell() {\n\tstatic int aa[N + 1];\n\tint i;\n\n\tfor (i = 1; i <= N; i++)\n\t\taa[i] = gg[i];\n\texp_(aa, bell, N + 1);\n\tfor (i = 0; i <= N; i++)\n\t\tbell[i] = (long long) bell[i] * ff[i] % MD;\n}\n\nint sum(int n, int k) {\n\tstatic int aa[N + 1], bb[N + 1];\n\tint i, ans;\n\n\tif (k > n)\n\t\treturn (bell[n] - 1 + MD) % MD;\n\tfor (i = 0; i <= k; i++)\n\t\taa[i] = power(i, n) * gg[i] % MD;\n\tfor (i = 0; i <= k; i++)\n\t\tbb[i] = (long long) (i % 2 == 0 ? 1 : MD - 1) * gg[i] % MD;\n\tmultiply(aa, bb, k + 1);\n\tans = MD - 1;\n\tfor (i = 0; i <= k; i++)\n\t\tans = (ans + aa[i]) % MD;\n\treturn ans;\n}\n\nint main() {\n\tint n, k, d, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tif (k == 1 || n == 1) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tcompute_bell();\n\tans = 0;\n\tfor (d = 1; d < n; d++)\n\t\tif (mobius[d])\n\t\t\tans = (ans + sum((n + d - 1) / d, k) * mobius[d]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a78f6a295c8f538014711e96d64d428f", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t200000\n#define L_\t19\t/* L_ = ceil(log2(N * 2 + 1)) */\n#define N_\t(1 << L_)\n#define MD\t998244353\n\nint min(int a, int b) { return a < b ? a : b; }\n\nlong long power(long long a, int k) {\n\tlong long p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * a % MD;\n\t\ta = a * a % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint vv[N + 1], ff[N + 1], gg[N + 1], mobius[N + 1];\nint *wwu[L_ + 1], *wwv[L_ + 1], vv_[L_ + 1];\n\nvoid init() {\n\tint i, j, l, u, v;\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\tfor (i = 2; i <= N; i++) {\n\t\tif (mobius[i])\n\t\t\tcontinue;\n\t\tfor (j = i; j <= N; j += i)\n\t\t\tmobius[j]++;\n\t}\n\tfor (i = 2; i <= N / i; i++)\n\t\tfor (j = i * i; j <= N; j += i * i)\n\t\t\tmobius[j] = -1;\n\tfor (i = 1; i <= N; i++)\n\t\tmobius[i] = mobius[i] == -1 ? 0 : (mobius[i] % 2 == 0 ? 1 : -1);\n\tu = power(3, MD - 1 >> L_), v = power(u, MD - 2);\n\tfor (l = L_; l > 0; l--) {\n\t\tint n = 1 << l, m = n >> 1;\n\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\n\t\twwu[l][0] = wwv[l][0] = 1;\n\t\tfor (i = 1; i < m; i++) {\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\n\t\t}\n\t\tvv_[l] = power(1 << l, MD - 2);\n\t\tu = (long long) u * u % MD, v = (long long) v * v % MD;\n\t}\n\tvv_[0] = 1;\n}\n\nint choose(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nvoid ntt_(int *aa, int l, int inverse) {\n\tif (l) {\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\n\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\n\t\tfor (i = 0; (j = i + m) < n; i++) {\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\n\n\t\t\tif ((aa[i] = a + b) >= MD)\n\t\t\t\taa[i] -= MD;\n\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\taa[j] += MD;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int l, int inverse) {\n\tint n = 1 << l, i, j;\n\n\tfor (i = 1, j = 0; i < n; i++) {\n\t\tint b = n >> 1, tmp;\n\n\t\twhile ((j ^= b) < b)\n\t\t\tb >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tntt_(aa, l, inverse);\n}\n\nint solve(int n, int k) {\n\tstatic int aa[N_], bb[N_];\n\tint n_, l_, i, ans;\n\n\tk = min(k, n);\n\tl_ = 0;\n\twhile (1 << l_ < k + k + 1)\n\t\tl_++;\n\tn_ = 1 << l_;\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = i <= k ? (long long) power(i, n) * gg[i] % MD : 0;\n\tfor (i = 0; i < n_; i++)\n\t\tbb[i] = i <= k ? (long long) (i % 2 == 0 ? 1 : MD - 1) * gg[i] % MD : 0;\n\tntt(aa, l_, 0), ntt(bb, l_, 0);\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = (long long) aa[i] * bb[i] % MD;\n\tntt(aa, l_, 1);\n\tans = MD - 1;\n\tfor (i = 0; i <= k; i++)\n\t\tans = (ans + (long long) aa[i] * vv_[l_]) % MD;\n\treturn ans;\n}\n\nint main() {\n\tint n, k, d, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tif (k == 1 || n == 1) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (d = 1; d < n; d++)\n\t\tif (mobius[d])\n\t\t\tans = (ans + solve((n + d - 1) / d, k) * mobius[d]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "324833325a1d38a75093a691365defa7", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n\r\n#define N\t200000\r\n#define L_\t19\t/* L_ = ceil(log2(N * 2 + 1)) */\r\n#define N_\t(1 << L_)\r\n#define MD\t998244353\r\n\r\nint min(int a, int b) { return a < b ? a : b; }\r\n\r\nlong long power(long long a, int k) {\r\n\tlong long p = 1;\r\n\r\n\twhile (k) {\r\n\t\tif (k & 1)\r\n\t\t\tp = p * a % MD;\r\n\t\ta = a * a % MD;\r\n\t\tk >>= 1;\r\n\t}\r\n\treturn p;\r\n}\r\n\r\nint vv[N + 1], ff[N + 1], gg[N + 1], mobius[N + 1];\r\nint *wwu[L_ + 1], *wwv[L_ + 1], vv_[L_ + 1];\r\n\r\nvoid init() {\r\n\tint i, j, l, u, v;\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\tfor (i = 2; i <= N; i++) {\r\n\t\tif (mobius[i])\r\n\t\t\tcontinue;\r\n\t\tfor (j = i; j <= N; j += i)\r\n\t\t\tmobius[j]++;\r\n\t}\r\n\tfor (i = 2; i <= N / i; i++)\r\n\t\tfor (j = i * i; j <= N; j += i * i)\r\n\t\t\tmobius[j] = -1;\r\n\tfor (i = 1; i <= N; i++)\r\n\t\tmobius[i] = mobius[i] == -1 ? 0 : (mobius[i] % 2 == 0 ? 1 : -1);\r\n\tu = power(3, MD - 1 >> L_), v = power(u, MD - 2);\r\n\tfor (l = L_; l > 0; l--) {\r\n\t\tint n = 1 << l, m = n >> 1;\r\n\r\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\r\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\r\n\t\twwu[l][0] = wwv[l][0] = 1;\r\n\t\tfor (i = 1; i < m; i++) {\r\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\r\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\r\n\t\t}\r\n\t\tvv_[l] = power(1 << l, MD - 2);\r\n\t\tu = (long long) u * u % MD, v = (long long) v * v % MD;\r\n\t}\r\n\tvv_[0] = 1;\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\nvoid ntt_(int *aa, int l, int inverse) {\r\n\tif (l) {\r\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\r\n\r\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\r\n\t\tfor (i = 0; (j = i + m) < n; i++) {\r\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\r\n\r\n\t\t\tif ((aa[i] = a + b) >= MD)\r\n\t\t\t\taa[i] -= MD;\r\n\t\t\tif ((aa[j] = a - b) < 0)\r\n\t\t\t\taa[j] += MD;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid ntt(int *aa, int l, int inverse) {\r\n\tint n = 1 << l, i, j;\r\n\r\n\tfor (i = 1, j = 0; i < n; i++) {\r\n\t\tint b = n >> 1, tmp;\r\n\r\n\t\twhile ((j ^= b) < b)\r\n\t\t\tb >>= 1;\r\n\t\tif (i < j)\r\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\r\n\t}\r\n\tntt_(aa, l, inverse);\r\n}\r\n\r\nint solve(int n, int k) {\r\n\tstatic int aa[N_], bb[N_];\r\n\tint n_, l_, i, ans;\r\n\r\n\tk = min(k, n);\r\n\tl_ = 0;\r\n\twhile (1 << l_ < k + k + 1)\r\n\t\tl_++;\r\n\tn_ = 1 << l_;\r\n\tfor (i = 0; i < n_; i++)\r\n\t\taa[i] = i <= k ? (long long) power(i, n) * gg[i] % MD : 0;\r\n\tfor (i = 0; i < n_; i++)\r\n\t\tbb[i] = i <= k ? (long long) (i % 2 == 0 ? 1 : MD - 1) * gg[i] % MD : 0;\r\n\tntt(aa, l_, 0), ntt(bb, l_, 0);\r\n\tfor (i = 0; i < n_; i++)\r\n\t\taa[i] = (long long) aa[i] * bb[i] % MD;\r\n\tntt(aa, l_, 1);\r\n\tans = MD - 1;\r\n\tfor (i = 0; i <= k; i++)\r\n\t\tans = (ans + (long long) aa[i] * vv_[l_]) % MD;\r\n\treturn ans;\r\n}\r\n\r\nint main() {\r\n\tint n, k, d, ans;\r\n\r\n\tinit();\r\n\tscanf(\"%d%d\", &n, &k);\r\n\tif (k == 1 || n == 1) {\r\n\t\tprintf(\"1\\n\");\r\n\t\treturn 0;\r\n\t}\r\n\tans = 0;\r\n\tfor (d = 1; d < n; d++)\r\n\t\tif (mobius[d])\r\n\t\t\tans = (ans + solve((n + d - 1) / d, k) * mobius[d]) % MD;\r\n\tif (ans < 0)\r\n\t\tans += MD;\r\n\tprintf(\"%d\\n\", ans);\r\n\treturn 0;\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "48858752bad46de90ee0aa59e77fba0c", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t200000\n#define L_\t19\t/* L_ = ceil(log2(N * 2 + 1)) */\n#define N_\t(1 << L_)\n#define MD\t998244353\n\nint min(int a, int b) { return a < b ? a : b; }\n\nlong long power(long long a, int k) {\n\tlong long p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * a % MD;\n\t\ta = a * a % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint vv[N + 1], ff[N + 1], gg[N + 1], mobius[N + 1];\nint *wwu[L_ + 1], *wwv[L_ + 1], vv_[L_ + 1];\n\nvoid init() {\n\tint i, j, l, u, v;\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\tfor (i = 2; i <= N; i++) {\n\t\tif (mobius[i])\n\t\t\tcontinue;\n\t\tfor (j = i; j <= N; j += i)\n\t\t\tmobius[j]++;\n\t}\n\tfor (i = 2; i <= N / i; i++)\n\t\tfor (j = i * i; j <= N; j += i * i)\n\t\t\tmobius[j] = -1;\n\tfor (i = 1; i <= N; i++)\n\t\tmobius[i] = mobius[i] == -1 ? 0 : (mobius[i] % 2 == 0 ? 1 : -1);\n\tu = power(3, MD - 1 >> L_), v = power(u, MD - 2);\n\tfor (l = L_; l > 0; l--) {\n\t\tint n = 1 << l, m = n >> 1;\n\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\n\t\twwu[l][0] = wwv[l][0] = 1;\n\t\tfor (i = 1; i < m; i++) {\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\n\t\t}\n\t\tvv_[l] = power(1 << l, MD - 2);\n\t\tu = (long long) u * u % MD, v = (long long) v * v % MD;\n\t}\n\tvv_[0] = 1;\n}\n\nint choose(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nvoid ntt_(int *aa, int l, int inverse) {\n\tif (l) {\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\n\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\n\t\tfor (i = 0; (j = i + m) < n; i++) {\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\n\n\t\t\tif ((aa[i] = a + b) >= MD)\n\t\t\t\taa[i] -= MD;\n\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\taa[j] += MD;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int l, int inverse) {\n\tint n = 1 << l, i, j;\n\n\tfor (i = 1, j = 0; i < n; i++) {\n\t\tint b = n >> 1, tmp;\n\n\t\twhile ((j ^= b) < b)\n\t\t\tb >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tntt_(aa, l, inverse);\n}\n\nint solve(int n, int k) {\n\tstatic int aa[N_], bb[N_];\n\tint n_, l_, i, ans;\n\n\tl_ = 0;\n\twhile (1 << l_ < k + k + 1)\n\t\tl_++;\n\tn_ = 1 << l_;\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = i <= k ? (long long) power(i, n) * gg[i] % MD : 0;\n\tfor (i = 0; i < n_; i++)\n\t\tbb[i] = i <= k ? (long long) (i % 2 == 0 ? 1 : MD - 1) * gg[i] % MD : 0;\n\tntt(aa, l_, 0), ntt(bb, l_, 0);\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = (long long) aa[i] * bb[i] % MD;\n\tntt(aa, l_, 1);\n\tans = MD - 1;\n\tfor (i = 0; i <= k; i++)\n\t\tans = (ans + (long long) aa[i] * vv_[l_]) % MD;\n\treturn ans;\n}\n\nint main() {\n\tint n, k, d, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tif (k == 1) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (d = 1; d < n; d++)\n\t\tif (mobius[d])\n\t\t\tans = (ans + solve((n + d - 1) / d, k) * mobius[d]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3df4e23ed22d272f555faee04ca1f9f6", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t200000\n#define L_\t21\t/* L_ = ceil(log2(N * 2 + 1)) */\n#define N_\t(1 << L_)\n#define MD\t998244353\n\nint min(int a, int b) { return a < b ? a : b; }\n\nlong long power(long long a, int k) {\n\tlong long p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * a % MD;\n\t\ta = a * a % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint vv[N + 1], ff[N + 1], gg[N + 1], mobius[N + 1];\nint *wwu[L_ + 1], *wwv[L_ + 1], vv_[L_ + 1];\n\nvoid init() {\n\tint i, j, l, u, v;\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\tfor (i = 2; i <= N; i++) {\n\t\tif (mobius[i])\n\t\t\tcontinue;\n\t\tfor (j = i; j <= N; j += i)\n\t\t\tmobius[j]++;\n\t}\n\tfor (i = 2; i <= N / i; i++)\n\t\tfor (j = i * i; j <= N; j += i * i)\n\t\t\tmobius[j] = -1;\n\tfor (i = 1; i <= N; i++)\n\t\tmobius[i] = mobius[i] == -1 ? 0 : (mobius[i] % 2 == 0 ? 1 : -1);\n\tu = power(3, MD - 1 >> L_), v = power(u, MD - 2);\n\tfor (l = L_; l > 0; l--) {\n\t\tint n = 1 << l, m = n >> 1;\n\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\n\t\twwu[l][0] = wwv[l][0] = 1;\n\t\tfor (i = 1; i < m; i++) {\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\n\t\t}\n\t\tvv_[l] = power(1 << l, MD - 2);\n\t\tu = (long long) u * u % MD, v = (long long) v * v % MD;\n\t}\n\tvv_[0] = 1;\n}\n\nint choose(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nvoid ntt_(int *aa, int l, int inverse) {\n\tif (l) {\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\n\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\n\t\tfor (i = 0; (j = i + m) < n; i++) {\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\n\n\t\t\tif ((aa[i] = a + b) >= MD)\n\t\t\t\taa[i] -= MD;\n\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\taa[j] += MD;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int l, int inverse) {\n\tint n = 1 << l, i, j;\n\n\tfor (i = 1, j = 0; i < n; i++) {\n\t\tint b = n >> 1, tmp;\n\n\t\twhile ((j ^= b) < b)\n\t\t\tb >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tntt_(aa, l, inverse);\n}\n\nint solve(int n, int k) {\n\tstatic int aa[N_], bb[N_];\n\tint n_, l_, i, ans;\n\n\tl_ = 0;\n\twhile (1 << l_ < k + k + 1)\n\t\tl_++;\n\tn_ = 1 << l_;\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = i <= k ? (long long) power(i, n) * gg[i] % MD : 0;\n\tfor (i = 0; i < n_; i++)\n\t\tbb[i] = i <= k ? (long long) (i % 2 == 0 ? 1 : MD - 1) * gg[i] % MD : 0;\n\tntt(aa, l_, 0), ntt(bb, l_, 0);\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = (long long) aa[i] * bb[i] % MD;\n\tntt(aa, l_, 1);\n\tans = MD - 1;\n\tfor (i = 0; i <= k; i++)\n\t\tans = (ans + (long long) aa[i] * vv_[l_]) % MD;\n\treturn ans;\n}\n\nint main() {\n\tint n, k, d, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tif (k == 1) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (d = 1; d < n; d++)\n\t\tif (mobius[d])\n\t\t\tans = (ans + solve((n + d - 1) / d, k) * mobius[d]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0e8dfe83a0eddf475f049b8c12c7ad98", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0} {"lang": "GNU C", "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\n return a;\n}\n\nint max(int a,int b)\n{\n if (a>b)\n return a;\n\n return b;\n}\n\nuint64_t mini = 1ULL << 62;\nint a1m = 0,b1m = 0,b2m = 0,a2m = 0;\n\nvoid dp(uint64_t count,int a1b1,int a2b2, int a1, int b1,int a2, int b2)\n{\n if ((a1b1) == (a2b2))\n {\n if (count a2b2)\n {\n if ((a1b1%2) == 0)\n {\n if (((a1%2)==0) && (a1 > b1))\n {\n a1 /= 2;\n }\n else\n {\n b1 /= 2;\n }\n dp(count+1,a1b1/2,a2b2,a1, b1, a2, b2);\n }\n if ((a1b1%3) == 0)\n {\n if (((a1%3)==0) && (a1 > b1))\n {\n a1 = (2*a1)/3;\n }\n else\n {\n b1 = (2*b1)/3;\n }\n dp(count+1,(2*a1b1)/3,a2b2,a1, b1, a2, b2);\n }\n }\n else\n {\n if (a2b2%2 == 0)\n {\n if (((a2%2)==0) && (a2 > b2))\n {\n a2 /= 2;\n }\n else\n {\n b2 /= 2;\n }\n dp(count+1,a1b1,a2b2/2,a1, b1, a2, b2);\n }\n if (a2b2%3 == 0)\n {\n if (((a2%3)==0) && (a2 > b2))\n {\n a2 = (2*a2)/3;\n }\n else\n {\n b2 = (2*b2)/3;\n }\n dp(count+1,a1b1,(2*a2b2)/3,a1, b1, a2, b2);\n }\n }\n}\n\nint main()\n{\n uint64_t count = 0;\n int a1,b1,a2,b2;\n scanf(\"%d %d\", &a1, &b1);\n scanf(\"%d %d\", &a2, &b2);\n\n dp(0,a1*b1,a2*b2,a1, b1, a2, b2);\n\n if (mini == (1ULL << 62))\n {\n printf(\"-1\\n\");\n return 0;\n }\n\n printf(\"%I64d\\n\", mini);\n printf(\"%d %d\\n\", a1m,b1m);\n printf(\"%d %d\\n\", a2m,b2m);\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "180d25828dff73667a740939d88e719b", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "GNU C", "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\n return a;\n}\n\nint max(int a,int b)\n{\n if (a>b)\n return a;\n\n return b;\n}\n\nuint64_t mini = 1ULL << 62;\nint a1m = 0,b1m = 0,b2m = 0,a2m = 0;\n\nvoid dp(uint64_t count,int a1b1,int a2b2, int a1, int b1,int a2, int b2)\n{\n if ((a1b1) == (a2b2))\n {\n if (count a2b2)\n {\n if ((a1b1%2) == 0)\n {\n if (((a1%2)==0) && (a1 < b1))\n {\n a1 /= 2;\n }\n else if (((b1%2)==0) && (b1 < a1))\n {\n b1 /= 2;\n }\n dp(count+1,a1b1/2,a2b2,a1, b1, a2, b2);\n }\n if ((a1b1%3) == 0)\n {\n if (((a1%3)==0))\n {\n a1 = (2*a1)/3;\n }\n else if (((b1%2)==0))\n {\n b1 = (2*b1)/3;\n }\n dp(count+1,(2*a1b1)/3,a2b2,a1, b1, a2, b2);\n }\n }\n else\n {\n if (a2b2%2 == 0)\n {\n if (((a2%2)==0) && (a2 < b2))\n {\n a2 /= 2;\n }\n else if (((b2%2)==0) && (b2 < a2))\n {\n b2 /= 2;\n }\n dp(count+1,a1b1,a2b2/2,a1, b1, a2, b2);\n }\n if (a2b2%3 == 0)\n {\n if (((a2%3)==0))\n {\n a2 = (2*a2)/3;\n }\n else if (((b2%3)==0))\n {\n b2 = (2*b2)/3;\n }\n dp(count+1,a1b1,(2*a2b2)/3,a1, b1, a2, b2);\n }\n }\n}\n\nint main()\n{\n uint64_t count = 0;\n int a1,b1,a2,b2;\n scanf(\"%d %d\", &a1, &b1);\n scanf(\"%d %d\", &a2, &b2);\n\n dp(0,a1*b1,a2*b2,a1, b1, a2, b2);\n\n if (mini == (1ULL << 62))\n {\n printf(\"-1\\n\");\n return 0;\n }\n\n printf(\"%I64d\\n\", mini);\n printf(\"%d %d\\n\", a1m,b1m);\n printf(\"%d %d\\n\", a2m,b2m);\n\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0f4ab8cedef8adb1b57430f9ef6ecde6", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \nlong long x1, x2, y1, y2, two[1000], three[1000];\nint vis[100010], P[100000], tot;\nint list[4][100000], top[4], temp, temp1;\n\nvoid cal(int t[], long long num) {\n int i;\n for (i = 1; i <= tot && num > 1; i++) {\n while (num > 1 && num % P[i] == 0) {\n t[i]++;\n num /= P[i];\n // printf(\"%lld\\n\", num);\n }\n }\n if (num > 1) {\n P[++tot] = num;\n t[tot]++;\n }\n}\n\nint main() {\n int i, j;\n int thcnt1, thcnt2, twocnt1, twocnt2;\n for (i = 2; i <= 100000; i++) {\n if (!vis[i]) P[++tot] = i;\n for (j = 1; j <= tot && P[j] * i <= 100000; j++) {\n vis[P[j] * i] = 1;\n if (i % P[j] == 0) break;\n }\n }\n two[1] = 2;\n for (i = 2; i <= 50; i++) two[i] = two[i - 1] * 2;\n three[1] = 3;\n for (i = 2; i <= 30; i++) three[i] = three[i - 1] * 3; \n// for (i = 1; i <= 10; i++) printf(\"%d \", P[i]);\n scanf(\"%I64d%I64d%I64d%I64d\", &x1, &y1, &x2, &y2);\n if (x1 * y1 == x2 * y2) {\n printf(\"0\\n%I64d %I64d\\n%I64d %I64d\\n\", x1, y1, x2, y2);\n return 0; \n }\n cal(list[0], x1); cal(list[1], y1);\n cal(list[2], x2); cal(list[3], y2);\n// printf(\"hehe\\n\");\n for (i = 3; i <= tot; i++) {\n if (list[0][i] + list[1][i] != list[2][i] + list[3][i]) {\n printf(\"%d %d %d %d %d %d\\n\", i, P[i], list[0][i], list[1][i], list[2][i], list[3][i]);\n printf(\"-1\\n\");\n return 0;\n }\n }\n thcnt1 = list[0][2] + list[1][2];\n thcnt2 = list[2][2] + list[3][2];\n twocnt1 = list[0][1] + list[1][1];\n twocnt2 = list[2][1] + list[3][1];\n// printf(\"%d %d %d %d\\n\", thcnt1, thcnt2, twocnt1, twocnt2);\n if (thcnt1 > thcnt2) {\n twocnt1 += thcnt1 - thcnt2;\n temp = thcnt1 - thcnt2;\n if (list[0][2] >= temp) {\n x1 /= three[temp];\n x1 *= two[temp];\n }\n else {\n x1 /= three[list[0][2]];\n x1 *= two[list[0][2]];\n y1 /= three[temp - list[0][2]];\n y1 *= two[temp - list[0][2]];\n }\n }\n// printf(\"%lld %lld %lld %lld\\n\", x1, y1, x2, y2);\n if (thcnt1 < thcnt2){\n twocnt2 += thcnt2 - thcnt1;\n temp = thcnt2 - thcnt1;\n if (list[2][2] >= temp) {\n x2 /= three[temp];\n x2 *= two[temp];\n }\n else {\n x2 /= three[list[2][2]];\n x2 *= two[list[2][2]];\n y2 /= three[temp - list[2][2]];\n y2 *= two[temp - list[2][2]];\n }\n }\n// printf(\"%d %d %d %d\\n\", thcnt1, thcnt2, twocnt1, twocnt2); \n if (twocnt1 > twocnt2) {\n temp += twocnt1 - twocnt2;\n temp1 = twocnt1 - twocnt2;\n if (list[0][1] >= temp1) x1 /= two[temp1];\n else {\n x1 /= two[list[0][1]];\n y1 /= two[temp1 - list[0][1]];\n }\n }\n else if (twocnt2 > twocnt1) {\n temp += twocnt2 - twocnt1;\n temp1 = twocnt2 - twocnt1;\n if (list[2][1] >= temp1) x2 /= two[temp1];\n else {\n x2 /= two[list[2][1]];\n y2 /= two[temp1 - list[2][1]];\n }\n }\n printf(\"%d\\n\", temp);\n printf(\"%I64d %I64d\\n%I64d %I64d\\n\", x1, y1, x2, y2);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0f3c30651b05eace3528e370a66beebc", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint a[4],b[4],a2[4],a3[4];\n\nvoid div3(int k,int u)\n{\n\tif(a3[k]>=u) {a[k]/=pow(3,u);a[k]*=pow(2,u);a2[k]+=u;}\n\telse {\n\t\ta[k]/=pow(3,a3[k]); a[k]*=pow(2,a3[k]); a2[k]+=a3[k];\n\t\ta[k+1]/=pow(3,u-a3[k]); a[k+1]*=pow(2,u-a3[k]); a2[k+1]+= (u-a3[k]);\n\t}\n}\n\nvoid div2(int k,int v)\n{\n\tif(a2[k]>=v) a[k]/=pow(2,v);\n\telse {\n\t\ta[k]/=pow(2,a2[k]);\n\t\ta[k+1]/=pow(2,v-a2[k]);\n\t}\n}\n\n\nint main()\n{\n\tint i,t,u,v;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%d\",a+i);\n\t\tb[i]=a[i];a2[i]=0;a3[i]=0;\n\t\twhile(b[i]!=1&&b[i]%2==0) {a2[i]++;b[i]/=2;}\n\t\twhile(b[i]!=1&&b[i]%3==0) {a3[i]++;b[i]/=3;}\n\t}\n\tif((long long)b[0]*b[1]!=(long long)b[2]*b[3])\n\t\t{printf(\"-1\\n\");return 0;}\n\tu = (a3[0]+a3[1]) - (a3[2]+a3[3]);\n\tv = (a2[0]+a2[1]) - (a2[2]+a2[3]) + u;\n\tif(v<0) t=-v; else t=v;\n\tif(u<0) t-=u; else t+=u;\n\tprintf(\"%d\\n\",t);\n\tif(u>0) div3(0,u);\n\telse if(u<0) div3(2,-u);\n\tif(v>0) div2(0,v);\n\telse if(v<0) div2(2,-v);\n\tprintf(\"%d %d\\n%d %d\\n\",a[0],a[1],a[2],a[3]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1a85eee81efda21adfca4ddcc811673c", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nlong long int fun(long long int a, long long int b)\n{\n long long int ans=0;\n while(a%b==0)\n {\n a/=b;\n ans++;\n }\n return ans;\n}\n\nint main()\n{\n long long int a, b, c, d, i, ans=0;\n scanf(\"%lld %lld %lld %lld\", &a, &b, &c, &d);\n for(i=3; i>1; i--)\n {\n while(fun(a, i)+fun(b, i) != fun(c, i)+fun(d, i))\n {\n ans++;\n if(fun(a, i)+fun(b, i) > fun(c, i)+fun(d, i))\n {\n if(fun(a, i))\n a/=i*(i-1);\n else\n b/=i*(i-1);\n }\n else\n {\n if(fun(c, i))\n c/=i*(i-1);\n else\n d/=i*(i-1);\n }\n }\n }\n if(a*b!=c*d)\n printf(\"-1\\n\");\n else\n printf(\"%lld\\n%lld %lld\\n%lld %lld\\n\", ans, a, b, c, d);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8be1285927593433a0765a39796200bf", "src_uid": "4fcd8c4955a47661462c326cbb3429bd", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n#include \ntypedef long long ll;\nchar s[4][105] = {\"What are you doing at the end of the world? Are you busy? Will you save us?\", \"What are you doing while sending \\\"\", \"\\\"? Are you busy? Will you send \\\"\", \"\\\"?\"};\nll lens[4], lenf[100005], zuida;\n\nchar DFS(ll n, ll k)\n{\n if(n == 0) return k < lenf[0] ? s[0][k] : '.';\n if(lenf[n] <= k) return '.';\n if(k < lens[1]) return s[1][k];\n if(k < lens[1] + lenf[n - 1])\n return DFS(n - 1, k - lens[1]);\n if(k < lens[1] + lenf[n - 1] + lens[2])\n return s[2][k - lens[1] - lenf[n - 1]];\n if(k < lens[1] + lenf[n - 1] + lens[2] + lenf[n - 1])\n return DFS(n - 1, k - lens[1] - lenf[n - 1] - lens[2]);\n return s[3][k - lens[1] - lenf[n - 1] - lens[2] - lenf[n - 1]];\n}\n\nint main()\n{\n ll q, n, k, i;\n scanf(\"%I64d\", &q);\n for(i = 0; i < 4; ++i)\n lens[i] = strlen(s[i]);\n lenf[0] = lens[0];\n for(zuida = 1; lenf[zuida - 1] <= 2e18; ++zuida)\n lenf[zuida] = 2 * lenf[zuida - 1] + lens[1] + lens[2] + lens[3];\n for(i = zuida; i <= 100002; ++i)\n lenf[i] = lenf[i - 1];\n while(q--)\n {\n scanf(\"%I64d%I64d\", &n, &k);\n --k;\n printf(\"%c\", DFS(n, k));\n }\n puts(\"\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "250d13d56089cb0810fcecbb1143d659", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define __STDC_FORMAT_MACROS\n#include \n#include \n\nconst char* f0 = \"What are you doing at the end of the world? Are you busy? Will you save us?\";\nconst char* fi1 = \"What are you doing while sending \\\"\";\nconst char* fi2 = \"\\\"? Are you busy? Will you send \\\"\";\nconst char* fi3 = \"\\\"?\";\nstatic const int f0len = 75, fi1len = 34, fi2len = 32, fi3len = 2;\n\n#define MAX_N 100000\nstatic int64_t _flen[MAX_N+1] = {};\n\n#define MAX_K 1000000000000000000LL\n\nstatic char dfs(int64_t N, int64_t* K) {\n if(N == 0) { // leaf of the tree\n if(*K >= f0len) {\n *K -= f0len; return '.';\n } else {\n char c = f0[*K]; *K = 0; return c;\n }\n }\n if(*K < fi1len) { // inside fi1\n char c = fi1[*K]; *K = 0; return c;\n }\n *K -= fi1len;\n\n if(_flen[N-1] == 0) { // need memoize\n const int64_t kk = *K;\n const char c = dfs(N-1, K); // dfs into the first child\n if(c == '.') _flen[N-1] = kk - *K;\n else return c;\n } else {\n if(*K < _flen[N-1]) { // dfs into the first child\n char c = dfs(N-1, K); *K = 0; return c;\n } else *K -= _flen[N-1]; // just skip this child\n }\n assert(_flen[N-1]);\n\n if(*K < fi2len) { // inside fi2\n char c = fi2[*K]; *K = 0; return c;\n }\n *K -= fi2len;\n\n assert(_flen[N-1]);\n if(*K < _flen[N-1]) { // dfs into the second child\n char c = dfs(N-1, K); *K = 0; return c;\n } else *K -= _flen[N-1]; // just skip this child\n\n if(*K < fi3len) { // inside fi3\n char c = fi3[*K]; *K = 0; return c;\n }\n *K -= fi3len;\n return '.';\n}\n\nint main() {\n _flen[0] = f0len;\n int Q; scanf(\"%d\\n\", &Q); while(Q--) {\n int64_t N,K; scanf(\" %\"PRId64 \" %\"PRId64 \"\\n\", &N, &K);\n --K; printf(\"%c\", dfs(N,&K));\n }\n printf(\"\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "36ebc65640c6e951cef956ee7dc57f24", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nchar s1[200]=\"What are you doing at the end of the world? Are you busy? Will you save us?\";\nchar s2[100]=\"What are you doing while sending \\\"\";\nchar s3[100]=\"\\\"? Are you busy? Will you send \\\"\";\nchar s4[7]=\"\\\"?\";\nlong long int arr[100012];\nchar letter(long long int n,long long int k){\nlong long int z,i;\nlong long int l1=strlen(s1),l2=strlen(s2),l3=strlen(s3),l4=strlen(s4);\nif(k>arr[n]){\nreturn '.';\n}\nif(n==0){\nreturn s1[k-1];}\nif(k<=34){\nreturn s2[k-1];\n}\nk-=l2;\nif(k<=arr[n-1]){\nreturn letter(n-1,k);}\nk=k-arr[n-1];\nif(k<=l3){\nreturn s3[k-1];}\nk=k-l3;\nif(k<=arr[n-1]){\nreturn letter(n-1,k);}\nk=k-arr[n-1];\nif(k<=2){\nreturn s4[k-1];\n}\n}\nint main(){\nlong long int q,n,k,i;\nchar z[11];\nscanf(\"%lld\",&q);\narr[0]=75;\narr[1]=218;\nfor(i=2;i<=55;i++){\narr[i]=arr[i-1]*2+68;\n}\nfor(i=55;i<100010;i++){\narr[i]=arr[53];\n}\nfor(i=1;i<=q;i++){\nscanf(\"%lld\",&n);\nscanf(\"%lld\",&k);\nz[i]=letter(n,k);\n}\nfor(i=1;i<=q;i++){\nprintf(\"%c\",z[i]);\n}\nprintf(\"\\n\");\nreturn 0;\n}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c2ca85a3921f6aef021b7f3ddab2b85f", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nchar* tmps1=\"What are you doing while sending \\\"\";\nchar* tmps2=\"\\\"? Are you busy? Will you send \\\"\";\nchar* tmps3=\"\\\"?\";\nchar* f0=\"What are you doing at the end of the world? Are you busy? Will you save us?\";\nlong long pow2[54]={1};\nchar calc(int n,long long k)\n{\n\tif (n==0) return f0[k-1];\n\tif (k<=strlen(tmps1)) return tmps1[k-1];\n\tk-=strlen(tmps1);\n\tlong long len1=pow2[n-1]*143-68;\n\tif (k<=len1) return calc(n-1,k);\n\tk-=len1;\n\tif (k<=strlen(tmps2)) return tmps2[k-1];\n\tk-=strlen(tmps2);\n\tif (k<=len1) return calc(n-1,k);\n\tk-=len1;\n\treturn tmps3[k-1];\n}\nint main()\n{\n\tint i;\n\tfor (i=1;i<=53;i++) pow2[i]=2*pow2[i-1];\n\tint q;\n\tscanf(\"%d\",&q);\n\twhile (q--)\n\t{\n\t\tint n; long long k;\n\t\tscanf(\"%d%I64d\",&n,&k);\n\t\tif (n<=53&&k>pow2[n]*143-68)\n\t\t{\n\t\t\tprintf(\".\"); continue;\n\t\t}\n\t\tif (k<34*n)\n\t\t{\n\t\t\t printf(\"%c\",tmps1[(k-1)%34]);\n\t\t\t continue;\n\t\t}\n\t\tif (n>53)\n\t\t{\n\t\t\tprintf(\"%c\",calc(53,k-34*(n-53)));\n\t\t}\n\t\telse printf(\"%c\",calc(n,k));\n\t}\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "094c2f4bfc866a82dde8b47105a2c8e9", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \nchar* tmps1=\"What are you doing while sending \\\"\";\nchar* tmps2=\"\\\"? Are you busy? Will you send \\\"\";\nchar* tmps3=\"\\\"?\";\nchar* f0=\"What are you doing at the end of the world? Are you busy? Will you save us?\";\nlong long pow2[54]={1};\nchar calc(int n,long long k)\n{\n\tif (n==0) return f0[k-1];\n\tif (k<=strlen(tmps1)) return tmps1[k-1];\n\tk-=strlen(tmps1);\n\tlong long len1=pow2[n-1]*143-68;\n\tif (k<=len1) return calc(n-1,k);\n\tk-=len1;\n\tif (k<=strlen(tmps2)) return tmps2[k-1];\n\tk-=strlen(tmps2);\n\tif (k<=len1) return calc(n-1,k);\n\tk-=len1;\n\treturn tmps3[k-1];\n}\nint main()\n{\n\tint i;\n\tfor (i=1;i<=53;i++) pow2[i]=2*pow2[i-1];\n\tint q;\n\tscanf(\"%d\",&q);\n\twhile (q--)\n\t{\n\t\tint n; long long k;\n\t\tscanf(\"%d%I64d\",&n,&k);\n\t\tif (n<=53&&k>pow2[n]*143-68)\n\t\t{\n\t\t\tprintf(\".\"); continue;\n\t\t}\n\t\tif (k<34*n)\n\t\t{\n\t\t\t printf(\"%c\",tmps1[(k-1)%34]);\n\t\t\t continue;\n\t\t}\n\t\tif (n>53)\n\t\t{\n\t\t\tprintf(\"%c\",calc(53,k-34*(n-53)));\n\t\t}\n\t\telse printf(\"%c\",calc(n,k))\n\t}\n\tprintf(\"\\n\")\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "da96f7a8180a38d3020eb83e81649fe8", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ff2711aef12198b96d5ceb9707616098", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n\nlong long int Input;\nlong long int A, B, i, x, y, Ans;\nlong long int Test;\n\nvoid DFS(long long int Number, int UsedA, int UsedB){\n Number *= 10;\n if (Number+A<=Input){\n UsedA = 1;\n if (UsedA) if (UsedB) if (Number+A>=10) Ans++;\n if (A || Number+A) DFS(Number+A, UsedA, UsedB);\n }\n if (A!=B) if (Number+B<=Input){\n UsedB = 1;\n if (UsedA) if (UsedB) if (Number+B>=10) Ans++;\n if (B || Number+B) DFS(Number+B, UsedA, UsedB);\n }\n}\n\nint main(){\n while(~scanf(\"%I64d\", &Input)){\n Ans = 0;\n for (A=1; A<=Input; A++){\n if (A>9) break;\n Ans++;\n }\n \n for (A=0; A<10; A++) for (B=A+1; B<10; B++) if (A+B){\n DFS(0, 0, 0);\n }\n \n \n printf(\"%I64d\\n\", Ans);\n }\n \n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "edbc471ea0da43bc86d31f14aa94031b", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main(int argc, char const *argv[])\n{int c=0,z,n,p=1,l,ans,a,i,r,flag,j,y,q,q1,ar[100],h;\n\tscanf(\"%d\",&n);\n\tz=n;\n\tif(n<=100)\n\t{\n\t\tprintf(\"%d\\n\", n);\n\t\treturn 0;\n\t}\n\twhile(z!=0)\n\t{\n\t\tz=z/10;\n\t\tc++;\n\t\t//printf(\"1\\n\");\n\t}\n\t//printf(\"%dd\\n\",c );\n\tl=c;\n\tc=c-1;\n\tfor (int i = 0; i < c; ++i)\n\t{\n\t\tp=p*2;\n\t\tar[i]=p;\n\t\t//printf(\"2\\n\");\n\t}\n\tp=p/2;\n\tprintf(\"p is %d\\n\", p);\n\tans=50*p-1;\n\tprintf(\"ans is %d\\n\",ans );\n\ty=n;\n\t\tfor (int i = 0; i < c; ++i)\n\t\t{\n\t\t\ty=y/10;\n\t\t}\n\t\ta=y%10;\n\n\t\tfor(i=1;i0)\n\t\t\t\t{\n\t\t\t\t\tif(i%10!=q && i%10!=q1)\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}\n\t\t\t\tif(i%10!=q)\n\t\t\t\t{\n\t\t\t\t\tr++;\n\t\t\t\t\tq1=i%10;\n\t\t\t\t}\n\t\t\t\ti=i/10;\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\",ans );\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc25e04055a73652d5c9a289bc868e6e", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main(int argc, char const *argv[])\n{int c=0,z,n,p=1,l,ans,a,i,r,flag,j,y,q,q1,ar[100],h;\n\tscanf(\"%d\",&n);\n\tz=n;\n\tif(n<=100)\n\t{\n\t\tprintf(\"%d\\n\", n);\n\t\treturn 0;\n\t}\n\twhile(z!=0)\n\t{\n\t\tz=z/10;\n\t\tc++;\n\t\t//printf(\"1\\n\");\n\t}\n\t//printf(\"%dd\\n\",c );\n\tl=c;\n\tc=c-1;\n\tfor (int i = 0; i < c; ++i)\n\t{\n\t\tp=p*2;\n\t\tar[i]=p;\n\t\t//printf(\"2\\n\");\n\t}\n\tp=p/2;\n\t//printf(\"p is %d\\n\", p);\n\tans=50*p-1;\n\t//printf(\"ans is %d\\n\",ans );\n\ty=n;\n\t\tfor (int i = 0; i < c; ++i)\n\t\t{\n\t\t\ty=y/10;\n\t\t}\n\t\ta=y%10;\n\n\t\tfor(i=1;i0)\n\t\t\t\t{\n\t\t\t\t\tif(i%10!=q && i%10!=q1)\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}\n\t\t\t\tif(i%10!=q)\n\t\t\t\t{\n\t\t\t\t\tr++;\n\t\t\t\t\tq1=i%10;\n\t\t\t\t}\n\t\t\t\ti=i/10;\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\",ans );\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c654c2a60821f7fdee166ee8a8d90d82", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \nint main(int argc, char const *argv[])\n{int c=0,z,n,p=1,l,ans=0,a,i,r,flag,j,y,q,q1,ar[100],h;\n\tscanf(\"%d\",&n);\n\tz=n;\n\tif(n<=100)\n\t{\n\t\tprintf(\"%d\\n\", n);\n\t\treturn 0;\n\t}\n\twhile(z!=0)\n\t{\n\t\tz=z/10;\n\t\tc++;\n\t\t//printf(\"1\\n\");\n\t}\n\t//printf(\"%dd\\n\",c );\n\tl=c;\n\tc=c-1;\n\tfor (int i = 0; i < c; ++i)\n\t{\n\t\tans=ans+9*(9*(p-1)+1);\n\t\tp=p*2;\n\t\tar[i]=p;\n\t\t//printf(\"2\\n\");\n\t}\n\t//printf(\"ans is %d\\n\",ans );\n\ty=n;\n\t\tfor (int i = 0; i < c; ++i)\n\t\t{\n\t\t\ty=y/10;\n\t\t}\n\t\ta=y%10;\n\n\t\tfor(i=1;i0)\n\t\t\t\t{\n\t\t\t\t\tif(i%10!=q && i%10!=q1)\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}\n\t\t\t\tif(i%10!=q)\n\t\t\t\t{\n\t\t\t\t\tr++;\n\t\t\t\t\tq1=i%10;\n\t\t\t\t}\n\t\t\t\ti=i/10;\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\",ans );\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "aa99e6a0efbab5a4f2ef8a2e8e7fd861", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main(void)\n{\n int n,i,j,k,t,count1,count2,flag,num[100],a;\n while(scanf(\"%d\",&n)!=EOF)\n {\n count2=0;\n for(k=102;k<=n;k++)\n {\n memset(num,0,sizeof(num));\n count1=0;\n flag=1;\n t=k;\n while(t!=0)\n {\n a=t%10;\n num[a]++;\n t=t/10;\n }\n for(j=0;j<=9;j++)\n {\n if(num[j]!=0)\n count1++;\n if(count1==3)\n flag=0;\n }\n if(flag==0)\n {\n count2++;\n }\n }\n printf(\"%d\\n\",n-count2);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f55e7be9c5f55c1fe4b1a8db6fbceac", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#include\nstruct node{\n\tint s,e,d,id;\n}a[105];\nint b[105];\nvoid sort(struct node a[],int m){\n\tstruct node temp;\n\tint i,j;\n\tfor(i=1;i < m;i++){\n\t for(j = 1;j < m-i;j++){\n\t \tif(a[j].e > a[j+1].e){\n\t \t\ttemp = a[j];\n\t \t\ta[j] = a[j+1];\n\t \t\ta[j+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n}\nint main(){\n\tint n,m;\n\tint i,j,t;\n\tint flag = 0;\n\twhile(scanf(\"%d%d\",&n,&m) != EOF){\n\t\tmemset(b,0,sizeof(b));\n\t\tfor(i = 1;i <= m;i++){\n\t\t\tscanf(\"%d%d%d\",&a[i].s,&a[i].e,&a[i].d);\n\t\t\ta[i].id = i;\n\t\t\tb[a[i].e] = m + 1;\n\t\t}\n\t\tsort(a,m);\n\t\tfor(i = 1;i <= m;i++){\n\t\t\tint count = 0;\n\t\t\tfor(j = a[i].s;j < a[i].e;j++){\n\t\t\t\tif(b[j] == 0){\n\t\t\t\t\tb[j] = a[i].id;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count == a[i].d) break;\n\t\t\t}\n\t\t\tif(count != a[i].d){\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\tprintf(\"-1\\n\");\n\t\t}\n\t\telse{\n\t\t\tfor(j = 1;j <= n-1;j++){\n\t\t\t\tprintf(\"%d \",b[j]);\n\t\t\t}\n\t\t\tprintf(\"%d\\n\",b[j]);\n\t\t}\n\t\t\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d40e6259f904ee34d7893c48bcc75b75", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nstruct exam{\n\tint a;\n\tint b;\n\tint c;\n};\n\nstruct exam x[100];\nint s[100],day[100]={0};\n\nint compare(const void *a,const void *b){\n\treturn x[*(int *)a].b-x[*(int *)b].b;\n}\n\nint main(void){\n\tint n,m,i,j;\n\n\tscanf(\"%d %d\",&n,&m);\n\tfor(i=0;i0){\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tday[i]=m+1;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tfor(j=0;j=x[s[j]].a&&x[s[j]].c>0){\n\t\t\t\t\tx[s[j]].c--;\n\t\t\t\t\tday[i]=s[j]+1;\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 \n#include \nstruct ex {int s; int d; int c; int n;};\nint cm (const void *A, const void *B){\n\treturn\t((struct ex *)A)->d - ((struct ex *)B)->d;\n\t}\nint main (){\nint i, j, n, m;\nint const MAX = 100;\nint ans[100] = {0};\nstruct ex a[MAX];\n\nscanf(\"%d %d\",&n, &m);\nfor (i=0;i < m;i++){\n\tscanf(\"%d %d %d\", &a[i].s, &a[i].d, &a[i].c);\n\ta[i].n = i + 1;\n\tans[a[i].d - 1] = m + 1;\n\t}\n\nqsort(a,m,sizeof a[0], cm);\nj = 0;\nfor (i=0;i 0 ){\n\t\t\tans[i] = a[k].n;\n\t\t\ta[k].c--;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\n\t}\n//check\nj = 0;\nfor (i=0;i 0)\n//if(0)\n\tprintf(\"-1\");\nelse\n\tfor (i = 0; i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nint g[105][105],n,m,i,j,f[105],ff,ans[105];\nstruct u\n{\n\tint a,b,c,d;\n}k[105];\n\nint cmp(const void *x,const void *y)\n{\n\treturn ((struct u*)x)->b-((struct u*)y)->b;\n}\n\nint main()\n{\n\tmemset(g,0,sizeof(g));\n\tmemset(f,0,sizeof(f));\n\tscanf(\"%d %d\",&n,&m);\n\tfor (i=1;i<=m;i++) \n\t{\n\t\tscanf(\"%d %d %d\",&k[i].a,&k[i].b,&k[i].d);\n\t\tk[i].c=i;\n\t}\n\tqsort(&k[1],m,sizeof(struct u),cmp);\n\tfor (i=1;i<=m;i++)\n\t{\n\t\tfor (j=k[i].a;j\n#include \n\ntypedef struct ExamData_m\n{\n\tint start;\n\tint needed;\n\tint day;\n\tint index;\n} ExamData;\n\nvoid Swap(ExamData *a, ExamData *b)\n{\n\tExamData aux = *a;\n\t*a = *b;\n\t*b = aux;\n}\n\nint Partition(ExamData exams[], int left, int right)\n{\n\tint mid = left + (right - left) / 2;\n\tSwap(exams + left, exams + mid);\n\n\tint pivot = exams[left].start;\n\tint i = left + 1;\n\tint j = right;\n\n\twhile (i <= j) {\n\t\twhile (i <= j && exams[i].start <= pivot) {\n\t\t\ti += 1;\n\t\t}\n\t\twhile (i <= j && exams[j].start > pivot) {\n\t\t\tj -= 1;\n\t\t}\n\t\tif (i <= j) {\n\t\t\tSwap(exams + i, exams + j);\n\t\t\ti += 1;\n\t\t\tj -= 1;\n\t\t}\n\t}\n\n\tSwap(exams + left, exams + i - 1);\n\treturn i - 1;\n}\n\nvoid Sort(ExamData exams[], int left, int right)\n{\n\tif (left >= right) {\n\t\treturn;\n\t}\n\n\tint index = Partition(exams, left, right);\n\tSort(exams, left, index - 1);\n\tSort(exams, index + 1, right);\n}\n\n\ntypedef ExamData HeapNode;\n\nint Father(int node) { return node / 2; }\nint LeftSon(int node) { return node * 2 + 1; }\nint RightSon(int node) { return node * 2 + 2; }\n\nvoid Percolate(HeapNode heap[], int node)\n{\n\tif (node <= 0) {\n\t\treturn;\n\t}\n\n\tint father = Father(node);\n\tif (heap[node].day < heap[father].day) {\n\t\tSwap(heap + node, heap + father);\n\t\tPercolate(heap, father);\n\t}\n}\n\nvoid Sift(HeapNode heap[], int size, int node)\n{\n\tint left = LeftSon(node);\n\tint right = RightSon(node);\n\n\tif (left >= size) {\n\t\treturn;\n\t}\n\n\tint best = left;\n\tif (right < size && heap[right].day < heap[left].day) {\n\t\tbest = right;\n\t}\n\n\tif (heap[best].day < heap[node].day) {\n\t\tSwap(heap + best, heap + node);\n\t\tSift(heap, size, best);\n\t}\n}\n\nvoid AddExam(HeapNode heap[], int *size, ExamData exam)\n{\n\theap[*size] = exam;\n\t*size += 1;\n\tPercolate(heap, *size - 1);\n}\n\nvoid Study(HeapNode heap[], int *size)\n{\n\theap[0].needed -= 1;\n\tif (heap[0].needed <= 0) {\n\t\t*size -= 1;\n\t\tSwap(heap, heap + *size);\n\t\tSift(heap, *size, 0);\n\t}\n}\n\n\n#define MAX_DAYS 100\n\nint days[MAX_DAYS];\nint needed[MAX_DAYS];\nExamData exams[MAX_DAYS];\n\nHeapNode choser[MAX_DAYS];\nint choser_size = 0;\n\nint main()\n{\n\tint ndays, nexams;\n\tscanf(\"%d%d\", &ndays, &nexams);\n\n\tint i;\n\tfor (i = 0; i < ndays; ++i) {\n\t\tdays[i] = -1;\n\t}\n\n\tfor (i = 0; i < nexams; ++i) {\n\t\tscanf(\"%d%d%d\", &exams[i].start, &exams[i].day, &exams[i].needed);\n\t\texams[i].index = i;\n\n\t\texams[i].start -= 1;\n\t\texams[i].day -= 1;\n\t\tdays[exams[i].day] = i;\n\t\tneeded[i] = exams[i].needed;\n\t}\n\n\tSort(exams, 0, nexams - 1);\n\n\tint valid = 1;\n\tint exam_ind = 0;\n\n\tfor (i = 0; i < ndays && valid; ++i) {\n\t\twhile (exam_ind < nexams && exams[exam_ind].start == i) {\n\t\t\tAddExam(choser, &choser_size, exams[exam_ind]);\n\t\t\texam_ind += 1;\n\t\t}\n\n\t\tif (days[i] != -1) {\n\t\t\tif (needed[days[i]] > 0) {\n\t\t\t\tvalid = 0;\n\t\t\t}\n\t\t\tdays[i] = nexams;\n\t\t\tcontinue;\n\t\t} \n\n\t\tif (choser_size > 0) {\n\t\t\tint ind = choser[0].index;\n\t\t\tdays[i] = ind;\n\t\t\tneeded[ind] -= 1;\n\t\t\tStudy(choser, &choser_size);\n\t\t}\n\t}\n\n\tif (!valid) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 0; i < ndays; ++i) {\n\t\tprintf(\"%d \", days[i] + 1);\n\t}\n\tprintf(\"\\n\");\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0017859ab1a1d10b3a48225c77a1608b", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nconst long long mod = 1e9 + 9;\n\nint main() {\n long long n, m, i;\n scanf(\"%I64d %I64d\", &n, &m);\n long long now = 1;\n for(i = 1; i <= m; i++) {\n now *= 2;\n now %= mod;\n }\n long long ans = 1;\n for(i = 1; i <= n; i++) {\n now--;\n if(now < 0) now += mod;\n ans *= now;\n ans %= mod;\n }\n printf(\"%d\\n\", (int) ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e6777158fb1c957e3f3f4f39b78db011", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n#include \nint main()\n{\n int n,m,i;\n __int64 s,t;\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n s=t=1;\n for(i=0;i\n\n#define MOD 1000000009\n\nlong long int power(int, int, int);\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\n\tlong long int p = power(2, m, MOD);\n\tlong long int sol = 1;\n\tint i;\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tlong long int t = p - i;\n\t\tif (t<0) t+=MOD;\n\t\tsol *= t;\n\t\tsol %= MOD;\n\t}\n\n\tprintf(\"%I64d\\n\", sol);\n\treturn 0;\n}\n\nlong long int power(int base, int exp, int mod)\n{\n\tif (!exp) return 1;\n\tlong long int t = power(base, exp / 2, mod);\n\tlong long int tt = (exp & 1)?base:1;\n\treturn (((t * t) % mod) * tt) % mod;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "898e82f800e1f970485b161465eb7e42", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef long long ll;\n\nconst ll mod = 1000000009;\n\nvoid solve(int n, int m)\n{\n ll ans, s, i;\n s = 1;\n for (i = 0; i < m; i ++)\n {\n s = (s << 1) % mod;\n }\n ans = 1;\n for (i = 0; i < n; i ++)\n {\n s --;\n if (s == 0)\n {\n printf(\"0\\n\");\n return;\n }\n ans = (ans * s) % mod;\n }\n printf(\"%I64d\\n\", ans);\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8567e9f1a293f798b8f10eaac9c265a", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0} {"lang": "GNU C", "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\n#define MODBY 1000000009\n\ntypedef long long int lld;\ntypedef long double Lf;\n\nint main()\n{\n int i,j,n,m;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n lld a=1;\n for(i=0;i\n\nint main(int argc, char const *argv[]) {\n\tint u = 0, l = 0;\n\tchar s[51];\n\tfor (int i = 0; i < 51; ++i) {\n\t\ts[i] = 0;\n\t}\n\tscanf(\"%s\", &s);\n\tfor (int i = 0; i < 51; ++i) {\n\t\tif (s[i] <= 90 && s[i] >= 65) {\n\t\t\tu += (s[i] - 64);\n\t\t} else if (s[i] <= 122 && s[i] >= 97) {\n\t\t\tl += (s[i] - 96);\n\t\t}\n\t}\n\tprintf(\"%d\", (u - l));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d1fe1011607120efa85b6ce0f59c8d0a", "src_uid": "d3fa5a3a008048dc4a9fbce1ebc61d67", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nint main() {\n\tstatic char str[64];\n\tint l, i, res;\n\n\tscanf(\"%s\", str);\n\tl = strlen(str);\n\tres = 0;\n\tfor (i = 0; i < l; i++) {\n\t\tint check1 = str[i] > '@' && str[i] < '[';\n\t\tint check2 = str[i] > '`' && str[i] < '{';\n\t\tint c = tolower(str[i]);\n\n\t\tif (isalpha(c)) {\n\t\t\tc -= ('a' - 1);\n\t\t\tres += check1 * c - check2 * c;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", res);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c61092084ddf59132de1776f0c118fb", "src_uid": "d3fa5a3a008048dc4a9fbce1ebc61d67", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\nlong long n,n1,sum,a[20],value;\n\nlong long findMinOnes(long long n,int i)\n{\n\tint count = 0;\n\tlong long value1,value2;\n\tif(n<0)\n\t\tn *=-1;\n\tif(i==1)\n\t\treturn n;\n\tif(n==1)\n\t\treturn 1;\n\t\twhile(n>a[i])\n\t\t{\n\t\t\tn-= a[i];\n\t\t\tcount+=i;\n\t\t}\n\t\tvalue1 = count + findMinOnes(n,i-1);\n\t\tn-= a[i];\n\t\tcount+=i;\n\t\tvalue2 = count + findMinOnes(n,i-1);\n\t\tif(value1 < value2)\n\t\t\treturn value1;\n\t\telse\n\t\t\treturn value2;\n}\nint main()\n{\n\tint k=1,i=0,count;\n\tint mul = 10;\n\tscanf(\"%I64d\",&n);\n\tn1=n;\n\twhile(n!=0)\n\t{\n\t\tn=n/10;\n\t\ti++;\n\t}\n\ta[k]=1;\n\tfor(k=2;k<=i+1;k++)\n\t{\n\t\ta[k]=a[k-1]+mul;\n\t\tmul*=10;\n\t}\n\tn=n1;\n\tprintf(\"%I64d\",findMinOnes(n,i+1));\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5a0b991ec5e03d0a6be3e08946cf5c0f", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\t\n\tlong long n,i,k=0,min=0,temp=0;\n\tlong long a[1000000] = {0};\n\tscanf(\"%I64d\",&n);\n\tfor(i=0;i\n#define lli long long int\nlli n,i,j,u,k,l,x,y,d,s,t;\nlli gg(lli x){int u=0; while(x){u++;x/=10;} return u;}\nlli ggg(lli n)\n{\n while(n/10)n/=10;\n return n;\n}\nlli g(lli u)\n{\n lli a=1;\n while(--u)a=10*a+1;\n return a;\n}\nlli f(lli n);\nlli fff(lli n)\n{\n lli u=gg(n);\n if(u==1) return 2+(11-n);\n if(ggg(n)<6) return 10000;\n return u+1+f(g(u+1)-n);\n}\nlli ff(lli n)\n{\n lli u=gg(n);\n if(u==1)return n;\n return ggg(n)*u+(f(n-ggg(n)*g(u)));\n}\nlli f(lli n)\n{\n if(!n)return 0;\n if(n<0)n*=-1;\n lli x,y,u=gg(n);\n x=ff(n);\n y=fff(n);\n return (x>y ? y : x);\n}\nint main()\n{\n scanf(\"%lld\",&n);\n x=n;\n while(x){u++;x/=10;}\n printf(\"%lld\",f(n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7a8c8c869c902f1e75b92edc2e935e76", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define abs(x) (( (x>0) ? x : -x ))\nint n,y,k,i,t,x,d,u;\nchar a[100];\nint main()\n{\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tn=u;\n\tfor(i=0;i\nlong long n,n1,sum,a[20],value;\n\nlong long findMinOnes(long long n,int i)\n{\n\tint count = 0;\n\tlong long value1,value2;\n\tif(n<0)\n\t\tn *=-1;\n\tif(i==1)\n\t\treturn n;\n\tif(n==1)\n\t\treturn 1;\n\t\twhile(n>a[i])\n\t\t{\n\t\t\tn-= a[i];\n\t\t\tcount+=i;\n\t\t}\n\t\tvalue1 = count + findMinOnes(n,i-1);\n\t\tn-= a[i];\n\t\tcount+=i;\n\t\tvalue2 = count + findMinOnes(n,i-1);\n\t\tif(value1 < value2)\n\t\t\treturn value1;\n\t\telse\n\t\t\treturn value2;\n}\nvoid main()\n{\n\tint k=1,i=0,count;\n\tint mul = 10;\n\tscanf(\"%I64d\",&n);\n\tn1=n;\n\twhile(n!=0)\n\t{\n\t\tn=n/10;\n\t\ti++;\n\t}\n\ta[k]=1;\n\tfor(k=2;k<=i+1;k++)\n\t{\n\t\ta[k]=a[k-1]+mul;\n\t\tmul*=10;\n\t}\n\tn=n1;\n\tprintf(\"%I64d\",findMinOnes(n,i+1));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "260f07889cc6a2066a07346ae46c7630", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint f(long long int i,long long int tmp,long long int m);\nlong long int min1(long long int a,long long int b);\nint main()\n{\n long long int m,n,s,i,p,tmp,kase=1,min;\n scanf(\"%lld%lld\",&m,&n);\n s=m+n;\n for(i=1;i<=sqrt(s);i++)\n {\n if(s%i!=0)\n continue;\n tmp=s/i;\n m=min1(m,n);\n if(f(i,tmp,m))\n {\n p=2*(i+tmp);\n if(kase)\n {\n min=p;\n kase=0;\n }\n else\n min=min\n#include \n#include \nint f(long long int i,long long int tmp,long long int m);\nlong long int min1(long long int a,long long int b);\nint main()\n{\n long long int m,n,s,i,p,tmp,kase=1,min=99999999999;\n scanf(\"%lld%lld\",&m,&n);\n s=m+n;\n for(i=sqrt(s);i>=1;i--)\n {\n if(s%i!=0)\n continue;\n tmp=s/i;\n\n if(f(i,tmp,n))\n {\n p=2*(i+tmp);\n min=p=1;i--)\n {\n\n if(f(i,tmp,m))\n {\n p=2*(i+tmp);\n min=p=1;j--)\n {\n if(m%j!=0)\n continue;\n if(j<=i&&m/j<=tmp||j<=tmp&&m/j<=i)\n return 1;\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5a73176849166984c328f18bb69a702b", "src_uid": "7d0c5f77bca792b6ab4fd4088fe18ff1", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint f(long long int i,long long int tmp,long long int m);\nlong long int min1(long long int a,long long int b);\nint main()\n{\n long long int m,n,s,i,p,tmp,kase=1,min;\n scanf(\"%lld%lld\",&m,&n);\n s=m+n;\n for(i=sqrt(s);i>=1;i--)\n {\n if(s%i!=0)\n continue;\n tmp=s/i;\n\n if(f(i,tmp,n))\n {\n p=2*(i+tmp);\n break;\n }\n\n }\n for(i=sqrt(s);i>=1;i--)\n {\n\n if(f(i,tmp,m))\n {\n p=2*(i+tmp);\n break;\n }\n printf(\"%lld\",p);\n return 0;\n}\n}\nint f(long long int i,long long int tmp,long long int m)\n{\n int j;\n for(j=sqrt(m);j>=1;j--)\n {\n if(m%j!=0)\n continue;\n if(j<=i&&m/j<=tmp||j<=tmp&&m/j<=i)\n return 1;\n }\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0f7aa7e7a77151e9e0e070d71bbf298d", "src_uid": "7d0c5f77bca792b6ab4fd4088fe18ff1", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \nint f(long long int i,long long int tmp,long long int m);\nlong long int min1(long long int a,long long int b);\nint main()\n{\n long long int m,n,s,i,p,tmp,kase=1,min;\n scanf(\"%lld%lld\",&m,&n);\n s=m+n;\n for(i=1;i<=s;i++)\n {\n if(s%i!=0)\n continue;\n tmp=s/i;\n m=min1(m,n);\n if(f(i,tmp,m))\n {\n p=2*(i+tmp);\n if(kase)\n {\n min=p;\n kase=0;\n }\n else\n min=min\n#include \n#include \nlong long int f(long long int i,long long int tmp,long long int m);\nint min1(int a,int b);\nint main()\n{\n long long int m,n,s,i,p,tmp,kase=1,min;\n scanf(\"%lld%lld\",&m,&n);\n s=m+n;\n for(i=1;i<=sqrt(s);i++)\n {\n if(s%i!=0)\n continue;\n tmp=s/i;\n m=min1(m,n);\n if(f(i,tmp,m))\n {\n p=2*(i+tmp);\n if(kase)\n {\n min=p;\n kase=0;\n }\n else\n min=min\nlong long int n, k, M, D;\n\nlong long int max(long long int a, long long int b)\n{\n\tif (a > b)\n\t\treturn a;\n\treturn b;\n}\n\nint main()\n{\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &k, &M, &D);\n\tlong long int ans = M;\n\tfor (long long int i = D; i >= 2; i--)\n\t{\n\t\tif (n/D < k)\n\t\t\tcontinue;\n\t\tlong long int beg = 1, end = M;\n\t\t\n\t\twhile (beg <= end)\n\t\t{\n\t\t\tlong long int mid = (beg+end)/2;\n\t\t\tlong long int num = n/mid;\n\t\t\t//printf(\"%d, %d, %d\\n\", i, mid, num);\n\t\t\tif (num < k*(i-1)+1)\n\t\t\t{\n\t\t\t\tend = mid-1;\n\t\t\t}\n\t\t\telse if (i == D && num >= k*i+1)\n\t\t\t{\n\t\t\t\tbeg = mid+1;\n\t\t\t}\n\t\t\telse if (num >= k*(i-1)+1)\n\t\t\t{\n\t\t\t\tans = max(ans, (i)*mid);\n\t\t\t\tbeg = mid+1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbeg = mid+1;\n\t\t\t\tans = max(ans, (i)*mid);\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "575ccb37b1857dc5cae1b178b0dd0c81", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n int D;\n long n, k, M, ans = 0;\n scanf(\"%ld%ld%ld%d\", &n, &k, &M, &D);\n for(int i = 0; i < D; i++){\n long cur = n / (k * i + 1);\n if(!cur) break;\n if(cur > M) cur = M;\n long lmax = cur * (i + 1);\n ans = ans > lmax ? ans : lmax;\n }\n printf(\"%ld\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3c4b201c97a4a301d00ddb6430a7fec6", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n int D;\n long n, k, M, ans;\n scanf(\"%ld%ld%ld%d\", &n, &k, &M, &D);\n ans = M;\n for(int i = 1; i <= D; i++){\n long cur = n / (k * i);\n long lmax = cur * i;\n if(!cur) break;\n if(i < D){\n if(n / cur > k * i){\n lmax += cur;\n } else{\n while(cur && n / cur-- < k * i);\n lmax = lmax > cur * (i + 1) ? lmax : cur * (i + 1);\n }\n } else if(n / cur > k * i) break;\n ans = ans > lmax ? ans : lmax;\n }\n printf(\"%ld\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f7510d32b6eca3848ac868b0cb69717c", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n int D;\n long n, k, M, ans;\n scanf(\"%ld%ld%ld%d\", &n, &k, &M, &D);\n ans = M;\n for(int i = 1; i <= D; i++){\n long cur = n / (k * i);\n long lmax = cur * i;\n if(i < D){\n if(n / cur > k * i){\n lmax += cur;\n } else{\n while(cur && n / cur-- < k * i);\n lmax = lmax > cur * (i + 1) ? lmax : cur * (i + 1);\n }\n }\n ans = ans > lmax ? ans : lmax;\n }\n printf(\"%ld\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0c84eb68c1776d46f5c6cba176d2409e", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \nlong long int n, k, M, D;\n\nlong long int max(long long int a, long long int b)\n{\n\tif (a > b)\n\t\treturn a;\n\treturn b;\n}\n\nint main()\n{\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &k, &M, &D);\n\tlong long int ans = 0;\n\tfor (long long int i = D; i >= 1; i--)\n\t{\n\t\tif (n/D < k)\n\t\t\tcontinue;\n\t\tlong long int beg = n/(k*(i-1)), end = M;\n\t\twhile (beg <= end)\n\t\t{\n\t\t\tlong long int mid = (beg+end)/2;\n\t\t\tlong long int num = n/mid;\n\t\t\t//printf(\"%d, %d, %d\\n\", i, mid, num);\n\t\t\tif (num < k*(i-1)+1)\n\t\t\t{\n\t\t\t\tend = mid-1;\n\t\t\t}\n\t\t\telse if (i == D && num >= k*i+1)\n\t\t\t{\n\t\t\t\tbeg = mid+1;\n\t\t\t}\n\t\t\telse if (num >= k*(i-1)+1)\n\t\t\t{\n\t\t\t\tans = max(ans, (i)*mid);\n\t\t\t\tbeg = mid+1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbeg = mid+1;\n\t\t\t\tans = max(ans, (i)*mid);\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "77c0d062620c0212357087fa53c4cc1f", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n\n#define N 22\n#define HL 1\n#define HH 4\n#define T 14\n\nint a[N][HH+1][T][2];\nint n, m;\n\nmain()\n{\n int i, o, p, j, k, l, h, t, s;\n\n //freopen( \"input.dat\", \"r\", stdin );\n scanf( \"%d %d\", &n, &m );\n\n for (i=HL;i<=HH;+++i) a[1][i][0][1] = 1;\n \n for (k=1;k\nint main(){\n int n,t;\n int a[25][10]={14,0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,0,0,0,0,16,70,0,0,0,0,0,0,0,0,6,232,0,0,0,0,0,0,0,0,1,380,353,0,0,0,0,0,0,0,0,396,1786,0,0,0,0,0,0,0,0,284,4500,1782,0,0,0,0,0,0,0,142,7414,12122,0,0,0,0,0,0,0,48,8849,41160,8997,0,0,0,0,0,0,10,8028,92226,76878,0,0,0,0,0,0,1,5658,152140,328222,45425,0,0,0,0,0,0,3112,195420,928494,467292,0,0,0,0,0,0,1322,201744,1947581,2402980,229347,0,0,0,0,0,422,170444,3213988,8205152,2758896,0,0,0,0,0,96,118912,4322956,20852648,16594160,1157954,0,0,0,0,14,68640,4846524,41920210,66357900,15946870,0,0,0,0,1,32632,4594423,69183464,197939352,109824208,5846414,0,0,0,0,12628,3715462,96046590,468541040,503245466,90700276,0};\n scanf(\"%d%d\",&n,&t);\n printf(\"%d\",a[n-3][t-1]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "205f40909ab108831a4345466f46f4db", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint dp[24][5][24];\nint n, t;\nint main ()\n{\n int m, k, j, res;\n dp[1][1][0] = 1;\n dp[1][2][0] = 1;\n dp[1][3][0] = 1;\n dp[1][4][0] = 1;\n for (n = 2; n <= 20; n++)\n\tfor (m = 1; m <= 4; m++)\n\t for (k = 0; k <= 19; k++)\n\t\tfor (j = 1; j <= 4; j++) {\n\t\t if (((n == 2)&&(m < j)) || (j == m)) continue;\n\t\t dp[n][m][k + ((k%2)&&(m>j)||(!(k%2)&&(m\nint dp[24][5][24];\nint n, t;\n\nint main ()\n{\n int m, i, j, aux;\n \n scanf (\"%d %d\", &n, &t);\n\n dp[1][1][0] = 1;\n dp[1][2][0] = 1;\n dp[1][3][0] = 1;\n dp[1][4][0] = 1;\n \n for (n = 2; n <= 20; n++)\n\tfor (m = 1; m <= 4; m++)\n\t for (i = 0; i <= 19; i++)\n\t\tfor (j = 1; j <= 4; j++) ]\n {\n\t\t if (((n == 2)&&(m < j)) || (j == m)) continue;\n\t\t dp[n][m][i + ((i%2)&&(m>j)||(!(i%2)&&(m\n\nint n,t,c;\n\nvoid dfs(int y1,int y2,int x,int l) {\n\t// printf(\"%d %d %d %d\\n\",y1,y2,x,l);\n\tif (x==2&&y1t) return;\n\tif (x==n) {\n\t\tif (y1y2&&y1>y));\n}\n\nint main() {\n\tscanf(\"%d %d\\n\",&n,&t);\n\tdfs(0,-1,0,0);\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2a111945ab613052eaf871eebebb8a33", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n int n = 0;\n double s = 0, m = 0, l = 31400;\n scanf(\"%d\", &n);\n while(n--){\n double x1, y1, x2, y2;\n scanf(\"%lf %lf %lf %lf\", &x1, &y1, &x2, &y2);\n s = (y2-y1)*(x2-x1) + s;\n if(x1<=l)l = x1;\n if(y1<=l)l = y1;\n if(x2>=m)m = x2;\n if(y2>=m)m = y2;\n }\n if(s != (m-l)*(m-l)){\n printf(\"NO\\n\");\n }\n else{\n printf(\"YES\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "619ec0f26b972b654ed16eb7b2cd0b42", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n int n,i,max1,max2,j;\n long min1,min2,ind,tot;\n tot=0;\n max1=-1;\n max2=-1;\n min1=40000;\n ind=0;\n \n \n scanf(\"%d\",&n);\n long arr[n][4];\n long arr2[n][8];\n \n long out[8];\n for(i=0;imax1)\n max1=arr2[i][j];\n if(arr2[i][j]max2)\n max2=arr2[i][j];\n if(arr2[i][j]\n#include \nint area(int a[][4],int i)\n{\n return (a[i][2]-a[i][0])*(a[i][3]-a[i][1]);\n}\nint main()\n{\n int n,x,i,j;\n scanf(\"%d\",&n);\n int a[n][4];\n int d[n];\n for(i=0;i=max1&&a[i][3]>=max2)\n {\n\n max1=a[i][2];\n max2=a[i][3];\n\n }\n int min1=a[0][0];\n int min2=a[0][1];\n for(i=0;i\nint main()\n{\n\tint i,j,k,l,m,flag=0,n,x1,y1,x2,y2;\n\tlong int sum=0,ans=0,temp;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tint xmin[n],ymin[n],xmax[n],ymax[n];\n\tint minx,miny,maxx,maxy;\n\tfor(i=0;imaxx)\tmaxx=xmax[j];\n\t\t\tif(ymax[j]>maxy)\tmaxy=ymax[j];\n\t\t\tif(maxx-minx==maxy-miny)\n\t\t\t{\n\t\t\t\ttemp=(maxx-minx)*(maxy-miny);\n\t\t\t\tif(temp == sum)\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(k=j+1;kmaxx)\tmaxx=xmax[k];\n\t\t\t\tif(ymax[k]>maxy)\tmaxy=ymax[k];\n\t\t\t\tif(maxx-minx==maxy-miny)\n\t\t\t\t{\n\t\t\t\t\ttemp=(maxx-minx)*(maxy-miny);\n\t\t\t\t\tif(temp == sum)\n\t\t\t\t\t{\n\t\t\t\t\t\tflag=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(l=k+1;lmaxx)\tmaxx=xmax[l];\n\t\t\t\t\tif(ymax[l]>maxy)\tmaxy=ymax[l];\n\t\t\t\t\tif(maxx-minx==maxy-miny)\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp=(maxx-minx)*(maxy-miny);\n\t\t\t\t\t\tif(temp == sum)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor(m=l+1;mmaxx)\tmaxx=xmax[m];\n\t\t\t\t\t\tif(ymax[m]>maxy)\tmaxy=ymax[m];\n\t\t\t\t\t\tif(maxx-minx==maxy-miny)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttemp=(maxx-minx)*(maxy-miny);\n\t\t\t\t\t\t\tif(temp == sum)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tflag=1;\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\tif(flag==1)\tprintf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b8dd4b6763e6ecb378cd67ed31b8193d", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\n\nint main(){\n int n = 0;\n double s = 0, xm = 0, ym = 0, xl = 31400, yl = 31400;\n scanf(\"%d\", &n);\n while(n--){\n double x1, y1, x2, y2;\n scanf(\"%lf %lf %lf %lf\", &x1, &y1, &x2, &y2);\n s = (y2-y1)*(x2-x1) + s;\n if(x1<=xl)xl = x1;\n if(y1<=yl)yl = y1;\n if(x2>=xm)xm = x2;\n if(y2>=ym)ym = y2;\n }\n if( x2-x1 == y2-y1 &&s == (m-l)*(m-l)){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "683df16fcd823dea425f4bc5e454f7ad", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\n#define K\t22\n#define N\t25000000\n\nint pp[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,\n\t31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n\t73, 79 };\n\nchar bad[N + 1];\n\nint solve1(int n, int p) {\n\tint a, b, cnt;\n\n\tif (n < p)\n\t\treturn n == 0 ? 0 : 1;\n\tmemset(bad, 0, (n + 1) * sizeof *bad);\n\tcnt = n;\n\tfor (a = 2; a < p; a++) {\n\t\tif (bad[a])\n\t\t\tcontinue;\n\t\tfor (b = a; b <= n; b += a)\n\t\t\tif (!bad[b]) {\n\t\t\t\tbad[b] = 1;\n\t\t\t\tcnt--;\n\t\t\t}\n\t}\n\treturn cnt;\n}\n\nint solve2(int n, int k) {\n\tlong long ans;\n\tint b, i;\n\n\tans = 0;\n\tfor (b = 0; b < 1 << k; b++) {\n\t\tint m = n, parity = 0;\n\n\t\tfor (i = 0; i < k; i++)\n\t\t\tif ((b & 1 << i) != 0) {\n\t\t\t\tint p = pp[i];\n\n\t\t\t\tm /= p;\n\t\t\t\tparity ^= 1;\n\t\t\t}\n\t\tans += parity == 0 ? m : -m;\n\t}\n\treturn ans;\n}\n\nint prime(int p) {\n\tint a;\n\n\tfor (a = 2; a <= p / a; a++)\n\t\tif (p % a == 0)\n\t\t\treturn 0;\n\treturn 1;\n}\n\nint main() {\n\tint a, b, p, ans, i;\n\n\tscanf(\"%d%d%d\", &a, &b, &p);\n\tif (!prime(p)) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\ti = 0;\n\twhile (i < K && pp[i] < p)\n\t\ti++;\n\tif (i == K)\n\t\tans = solve1(b / p, p) - solve1((a - 1) / p, p);\n\telse\n\t\tans = solve2(b / p, i) - solve2((a - 1) / p, i);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "635d4195c0c5e5f14f0c37b28878528d", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n\nint l[26]={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},prime[2000001];\nchar hash[20000001];\nint k,a,b,ans=0;\n\nvoid dfs(int now,int s,int f)\n{\n if (l[now]==k)\n ans+=f*(b/s-(a-1)/s);\n else\n {\n dfs(now+1,s,f);\n if ((long long)s*l[now]<=b)\n dfs(now+1,s*l[now],-f);\n }\n}\n\nint main()\n{\n int i,j,o=0;\n scanf(\"%d%d%d\",&a,&b,&k);\n b/=k;\n a=(long long)(a+k-1)/k;\n for (i=2;i*i<=k&&k%i;i++);\n if (i*i>k)\n if (k<=100)\n dfs(0,1,1);\n else\n {\n ans+=(a==1&&b>=1);\n for (i=2;i<=b;i++)\n {\n if (!hash[i])\n {\n ans+=(i>=k&&a<=i);\n prime[++o]=i;\n }\n for (j=1;prime[j]*i<=b;j++)\n {\n hash[prime[j]*i]=1;\n ans+=(prime[j]>=k&&a<=prime[j]*i);\n if (i%prime[j]==0)\n break;\n }\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2bc2820351629ad2dfc322b7de225383", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#define gmax(a,b) ((a)>(b)?(a):(b))\nlong tot1,tot2,total=0,z[5000005]={0},hash[20000005]={0},last[20000005]={0},ans1,ans2;\nlong work1(long count,long k)\n{\n\tlong o=count/k,tot=0,sum=0,i,j;\n\tfor(i=2;i<=o;i++)\n\t{\n\t\tif(hash[i]==0)\n\t\t{\n\t\t\tz[++tot]=i;\n\t\t\tlast[i]=i;\n\t\t}\n\t\tfor(j=1;j<=tot && z[j]*i<=o;j++)\n\t\t{\n\t\t\thash[z[j]*i]=1;\n\t\t\tlast[z[j]*i]=z[j];\n\t\t\tif(i%z[j]==0)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=2;i<=o;i++)\n\t\tif(last[i]>=k)\n\t\t\tsum++;\n\tif(count>=k)\n\t\tsum++;\n\treturn sum;\n}\nvoid dfs(long k,long p,long long u)\n{\n\tif(u>gmax(tot1,tot2))\n\t\treturn ;\n\tif(k<=total)\n\t{\n\t\tdfs(k+1,p,u);\n\t\tdfs(k+1,p+1,u*z[k]);\n\t}\n\telse if(p)\n\t{\n\t\tif(p%2)\n\t\t{\n\t\t\tans1-=tot1/u;\n\t\t\tans2-=tot2/u;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans1+=tot1/u;\n\t\t\tans2+=tot2/u;\n\t\t}\n\t}\n}\nlong check(long k)\n{\n\tlong i;\n\tfor(i=2;i<=sqrt(k);i++)\n\t\tif(k%i==0)\n\t\t\treturn 0;\n\treturn 1;\n}\nint main()\n{\n\tlong k,i,A,B,j;\n//\tfreopen(\"d.in\",\"r\",stdin);\n//\tfreopen(\"d.out\",\"w\",stdout);\n\tscanf(\"%ld %ld %ld\\n\",&A,&B,&k);\n\tif(check(k)==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif(k>=100)\n\t\tprintf(\"%ld\\n\",work1(B,k)-work1(A-1,k));\n\telse\n\t{\n\t\tfor(i=2;i\n#include\n#include\n#define REP(i,a,b) for(i=a;i>1])for(j=(i*i)>>1;j b) break;\n solve(send, i+1, num+1);\n }\n}\n\nint is_prime(int n){\n int i;\n rep(i,ps){\n if(in[i]*in[i] > n) break;\n if(n%in[i]==0) return 0;\n }\n return 1;\n}\n\nint main(){\n int i,j,k,l,m;\n\n ps = getPrime(N,p);\n\n while(scanf(\"%d%d%d\",&a,&b,&n)==3){\n rep(i,ps) if(n==p[i]) break;\n if(i==ps){\n if(a<=n && n<=b && is_prime(n)) puts(\"1\"); else puts(\"0\");\n continue;\n }\n\n pp = i;\n res = 0;\n solve(n,0,0);\n\n printf(\"%d\\n\",(int)res);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "4925a5f151609cfc858c6b5f03113815", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#define gmax(a,b) ((a)>(b)?(a):(b))\nlong tot1,tot2,total=0,z[5000005]={0},hash[20000005]={0},last[20000005]={0},ans1,ans2;\nlong work1(long count,long k)\n{\n\tlong o=count/k,tot=0,sum=0,i,j;\n\tfor(i=2;i<=o;i++)\n\t{\n\t\tif(hash[i]==0)\n\t\t{\n\t\t\tz[++tot]=i;\n\t\t\tlast[i]=i;\n\t\t}\n\t\tfor(j=1;j<=tot && z[j]*i<=o;j++)\n\t\t{\n\t\t\thash[z[j]*i]=1;\n\t\t\tlast[z[j]*i]=z[j];\n\t\t\tif(i%z[j]==0)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=2;i<=o;i++)\n\t\tif(last[i]>=k)\n\t\t\tsum++;\n\treturn sum;\n}\nvoid dfs(long k,long p,long long u)\n{\n\tif(u>gmax(tot1,tot2))\n\t\treturn ;\n\tif(k<=total)\n\t{\n\t\tdfs(k+1,p,u);\n\t\tdfs(k+1,p+1,u*z[k]);\n\t}\n\telse if(p)\n\t{\n\t\tif(p%2)\n\t\t{\n\t\t\tans1-=tot1/u;\n\t\t\tans2-=tot2/u;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans1+=tot1/u;\n\t\t\tans2+=tot2/u;\n\t\t}\n\t}\n}\nint main()\n{\n\tlong k,i,A,B,j;\n//\tfreopen(\"d.in\",\"r\",stdin);\n//\tfreopen(\"d.out\",\"w\",stdout);\n\tscanf(\"%ld %ld %ld\\n\",&A,&B,&k);\n\tif(check(k)==0)\n\t\tprintf(\"0\\n\");\n\tif(k>=100)\n\t\tprintf(\"%ld\\n\",work1(B,k)-work1(A-1,k));\n\telse\n\t{\n\t\tfor(i=2;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 \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#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\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#include \n#include \n#include \n#include \n#include \n#include \n#include \nint n,m,i,j,ans[505],k,z,ff,f[55],l,s;\nstruct u\n{\n\tint a,b;\n}a[55],b[55];\n\nvoid swap(int *x,int *y)\n{\n\tint t;\n\t\n\tt=*x;\n\t*x=*y;\n\t*y=t;\n}\n\nint main()\n{\n\tscanf(\"%d %d\",&n,&m);\n\tfor (i=1;i<=n;i++) \n\t{\n\t\tscanf(\"%d %d\",&a[i].a,&a[i].b);\n\t\tif (a[i].a>a[i].b) swap(&a[i].a,&a[i].b);\n\t}\n\tfor (i=1;i<=m;i++) \n\t{\n\t\tscanf(\"%d %d\",&b[i].a,&b[i].b);\n\t\tif (b[i].a>b[i].b) swap(&b[i].a,&b[i].b);\n\t}\n\tfor (i=1,k=0,ff=0;i<=n;i++)\n\t{\n\t\tfor (j=1,z=0;j<=m;j++)\n\t\t{\n\t\t\tmemset(f,0,sizeof(f));\n\t\t\tf[a[i].a]++;\n\t\t\tf[a[i].b]++;\n\t\t\tf[b[j].a]++;\n\t\t\tf[b[j].b]++;\n\t\t\tfor (l=1,s=0;l<=9;l++) \n\t\t\tif (f[l]) s++;\n\t\t\tif (s==3)\n\t\t\t{\n\t\t\t\tfor (l=1,s=0;l<=9;l++)\n\t\t\t\tif (f[l]==2) \n\t\t\t\t{\n\t\t\t\t\tans[++k]=l;\n\t\t\t\t\tz++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (z>1) ff=1;\n\t}\n\tif (k==1)\n\t{\n\t\tprintf(\"%d\\n\",ans[1]);\n\t\texit(0);\n\t}\n\telse if (!ff)\n\t{\n\t\tputs(\"0\");\n\t\texit(0);\n\t}\n\telse puts(\"-1\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ed35e5d21b0325087f40aa92a2126172", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nint n,m,i,j,ans[505],k,z,ff,f[55],l,s;\nstruct u\n{\n\tint a,b;\n}a[55],b[55];\n\nvoid swap(int *x,int *y)\n{\n\tint t;\n\t\n\tt=*x;\n\t*x=*y;\n\t*y=t;\n}\n\nint main()\n{\n\tscanf(\"%d %d\",&n,&m);\n\tfor (i=1;i<=n;i++) \n\t{\n\t\tscanf(\"%d %d\",&a[i].a,&a[i].b);\n\t\tif (a[i].a>a[i].b) swap(&a[i].a,&a[i].b);\n\t}\n\tfor (i=1;i<=m;i++) \n\t{\n\t\tscanf(\"%d %d\",&b[i].a,&b[i].b);\n\t\tif (b[i].a>b[i].b) swap(&b[i].a,&b[i].b);\n\t}\n\tfor (i=1,k=0,ff=0;i<=n;i++)\n\t{\n\t\tfor (j=1,z=0;j<=m;j++)\n\t\t{\n\t\t\tmemset(f,0,sizeof(f));\n\t\t\tf[a[i].a]++;\n\t\t\tf[a[i].b]++;\n\t\t\tf[b[j].a]++;\n\t\t\tf[b[j].b]++;\n\t\t\tfor (l=1,s=0;l<=9;l++) \n\t\t\tif (f[l]) s++;\n\t\t\tif (s==3)\n\t\t\t{\n\t\t\t\tfor (l=1,s=0;l<=9;l++)\n\t\t\t\tif (f[l]==2) \n\t\t\t\t{\n\t\t\t\t\tans[++k]=l;\n\t\t\t\t\tz++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (z>1) ff=1;\n\t}\n\tif (k==1)\n\t{\n\t\tprintf(\"%d\\n\",ans[1]);\n\t\texit(0);\n\t}\n\telse if (!ff&&k)\n\t{\n\t\tputs(\"0\");\n\t\texit(0);\n\t}\n\telse puts(\"-1\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6f1613696775ddd00f757a2f86503ab9", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0} {"lang": "GNU C", "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 n,m,i,j,k,min,ans[25][25],f[25],d[25],s;\nstruct u\n{\n\tint a,b;\n}a[5][25];\n\nvoid dfs(int x,int y,int z)\n{\n\tint i;\n\t\n\tif (x<=0) return;\n\tfor (i=1;i<=y;i++) \n\tif (!f[i])\n\t{\n\t\tf[i]=1;\n\t\tmemset(d,0,sizeof(d));\n\t\td[a[z^1][x].a]++;\n\t\td[a[z^1][x].b]++;\n\t\td[a[z][i].a]++;\n\t\td[a[z][i].b]++;\n\t\tfor (j=1,s=0;j<=9;j++) \n\t\tif (d[j]) \n\t\t{\n\t\t\ts++;\n\t\t\tif (d[j]==2) k=j;\n\t\t}\n\t\tif (s==3) \n\t\t{\n\t\t\tans[x][k]++;\n\t\t}\n\t\tdfs(x-1,y,z);\n\t\tf[i]=0;\n\t}\n}\n\nint main()\n{\n\tscanf(\"%d %d\",&n,&m);\n\tfor (i=1;i<=n;i++) scanf(\"%d %d\",&a[0][i].a,&a[0][i].b);\n\tfor (i=1;i<=m;i++) scanf(\"%d %d\",&a[1][i].a,&a[1][i].b);\n\tmin=n1) \n\t\t{\n\t\t\ts=1;\n\t\t\tbreak;\n\t\t}\n\t\tif (s) puts(\"-1\"); else puts(\"0\");\n\t}\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5fb355deb26d3fc5028d608a00ca018a", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint n,m;\nstruct x{\n\tint x,y;\n}x[17],y[17];\nint xc[17],yc[17];\nvoid run(){\n\tint i,j,k,j_,k_,l;\n\twhile(scanf(\"%d%d\",&n,&m)!=EOF){\n\t\tfor(i=0;i0){\n\t\t\t\tj++;\n\t\t\t\tj_=i;\n\t\t\t}\n\t\t}\n\t\tk=0;\n\t\tk_=-1;\n\t\tfor(i=0;i<10;i++){\n\t\t\tif(yc[i]>0){\n\t\t\t\tk++;\n\t\t\t\tk_=i;\n\t\t\t}\n\t\t}\n\t\tif(j==1&&k==1){\n\t\t\tprintf(\"%d\\n\",j_);\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"0\\n\");\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4882d_min.in\",\"rb\",stdin);\n\tfreopen(\"4882d_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ce537de3b6ddc5ae11b6c20b8be26e43", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n/*\n2 2\n1 2 3 4\n1 5 6 4\n*/\nint main(){\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\n\tint arr[2*n], brr[2*m];\n\tfor (i = 0; i < n; i++){\n\t\tscanf(\"%d %d\",2*i + arr, 2*i + 1 + arr);\n\t\t\n\t}\n\tfor (i = 0; i < m; i++){\n\t\tscanf(\"%d %d\",2*i + brr, 2*i + 1 + brr);\n\t}\n\n\tint ans = 1, j, sh = -1;\n\tfor (i = 0; i < n; i++){\n\n\t\tfor (j = 0; j < m; j++){\n\n\t\t\tif ((arr[2*i] == brr[2*j] && arr[2*i + 1] != brr[2*j + 1]) || (arr[2*i] == brr[2*j+1] && arr[2*i + 1] != brr[2*j])){\n\t\t\t\tif (sh == -1){\n\t\t\t\t\tsh = arr[2*i];\n\t\t\t\t}\n\t\t\t\telse if (arr[2*i] != sh){\n\t\t\t\t\tans = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ((arr[2*i + 1] == brr[2*j] && arr[2*i] != brr[2*j + 1]) || (arr[2*i + 1] == brr[2*j+1] && arr[2*i] != brr[2*j])){\n\t\t\t\tif (sh == -1){\n\t\t\t\t\tsh = arr[2*i+1];\n\t\t\t\t}\n\t\t\t\telse if (arr[2*i+1] != sh){\n\t\t\t\t\tans = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (ans != 1){\n\t\t\tbreak;\n\t\t}\n\n\t}\n\n\tif (ans){\n\t\tprintf(\"%d\\n\",sh);\n\t\treturn 0;\n\t}\n\n\tans = 0;\n\tfor (i = 0; i < n; i++){\n\n\t\tsh = -1;\n\n\t\tfor (j = 0; j < m; j++){\n\n\t\t\tif ((arr[2*i] == brr[2*j] && arr[2*i + 1] != brr[2*j + 1]) || (arr[2*i] == brr[2*j+1] && arr[2*i + 1] != brr[2*j])){\n\t\t\t\tif (sh == -1){\n\t\t\t\t\tsh = arr[2*i];\n\t\t\t\t}\n\t\t\t\telse if (arr[2*i] != sh){\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ((arr[2*i + 1] == brr[2*j] && arr[2*i] != brr[2*j + 1]) || (arr[2*i + 1] == brr[2*j+1] && arr[2*i] != brr[2*j])){\n\t\t\t\tif (sh == -1){\n\t\t\t\t\tsh = arr[2*i+1];\n\t\t\t\t}\n\t\t\t\telse if (arr[2*i+1] != sh){\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (ans != 0){\n\t\t\tbreak;\n\t\t}\n\n\t}\n\n\tfor (j = 0; j < m; j++){\n\n\t\tsh = -1;\n\n\t\tfor (i = 0; i < n; i++){\n\n\t\t\tif ((arr[2*i] == brr[2*j] && arr[2*i + 1] != brr[2*j + 1]) || (arr[2*i] == brr[2*j+1] && arr[2*i + 1] != brr[2*j])){\n\t\t\t\tif (sh == -1){\n\t\t\t\t\tsh = arr[2*i];\n\t\t\t\t}\n\t\t\t\telse if (arr[2*i] != sh){\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ((arr[2*i + 1] == brr[2*j] && arr[2*i] != brr[2*j + 1]) || (arr[2*i + 1] == brr[2*j+1] && arr[2*i] != brr[2*j])){\n\t\t\t\tif (sh == -1){\n\t\t\t\t\tsh = arr[2*i+1];\n\t\t\t\t}\n\t\t\t\telse if (arr[2*i+1] != sh){\n\t\t\t\t\tans = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (ans != 0){\n\t\t\tbreak;\n\t\t}\n\n\t}\n\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n\n}\n\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e302db2d446e12d498631999d8d7031a", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \nusing namespace std;\nlong long ans=0;\nlong long hei(long long a,long long b,long long c,long long m)\n{\n long long cnt=min(a-b-c,m);\n if (cnt<0) return 0; else return (cnt+1)*(cnt+2)/2;\n}\nint main()\n{\n long long a,b,c,l;\n cin>>a>>b>>c>>l;\n ans+=(l+3)*(l+2)*(l+1)/6;\n for (long long i=0;i<=l;i++) ans-=hei(a+i,b,c,l-i)+hei(b+i,a,c,l-i)+hei(c+i,a,b,l-i);\n cout<\n#include \nusing namespace std;\nlong long ans=0;\nlong long hei(long long a,long long b,long long c,long long m)\n{\n long long cnt=min(a-b-c,m);\n if (cnt<0) return 0; else return (cnt+1)*(cnt+2)/2;\n}\nint main()\n{\n long long a,b,c,l;\n cin>>a>>b>>c>>l;\n ans+=(l+3)*(l+2)*(l+1)/6;\n for (long long i=0;i<=l;i++) ans-=hei(a+i,b,c,l-i)+hei(b+i,a,c,l-i)+hei(c+i,a,b,l-i);\n cout<\n\nlong long ans=0;\nlong long mini(long long int x ,long long int y){\n\tif(x > y)\n\t\treturn x;\n\treturn y;\n}\nlong long hei(long long a,long long b,long long c,long long m)\n{\n long long cnt = mini(a-b-c,m);\n if (cnt<0) return 0;\n\t else \n\t return (cnt+1)*(cnt+2)/2;\n}\nint main()\n{\n long long a,b,c,l;\n cin>>a>>b>>c>>l;\n scanf(\"%d %d %d %d\",a,b,c,l);\n ans+=(l+3)*(l+2)*(l+1)/6;\n for (long long i=0;i<=l;i++) ans-=hei(a+i,b,c,l-i)+hei(b+i,a,c,l-i)+hei(c+i,a,b,l-i);\n printf(\"%d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "21581c73acb2f51ede57681074a0e0b7", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n\nlong long ans=0;\nlong long mini(long long int x ,long long int y){\n\tif(x > y)\n\t\treturn y;\n\treturn x;\n}\nlong long hei(long long a,long long b,long long c,long long m)\n{\n long long cnt = mini(a-b-c,m);\n if (cnt<0) return 0;\n\t else \n\t return (cnt+1)*(cnt+2)/2;\n}\nint main()\n{\n long long a,b,c,l;\n long long int i = 0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&l);\n ans+=(l+3)*(l+2)*(l+1)/6;\n for (i=0;i<=l;i++) \n\t ans -= (hei(a+i,b,c,l-i) + hei(b+i,a,c,l-i) + hei(c+i,a,b,l-i));\n printf(\"%d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "93727f7cb554723e1783ac18742c2f1d", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n\nlong long ans=0;\nlong long mini(long long int x ,long long int y){\n\tif(x > y)\n\t\treturn x;\n\treturn y;\n}\nlong long hei(long long a,long long b,long long c,long long m)\n{\n long long cnt = mini(a-b-c,m);\n if (cnt<0) return 0;\n\t else \n\t return (cnt+1)*(cnt+2)/2;\n}\nint main()\n{\n long long a,b,c,l;\n long long int i = 0;\n scanf(\"%d %d %d %d\",a,b,c,l);\n ans+=(l+3)*(l+2)*(l+1)/6;\n for (i=0;i<=l;i++) ans-=hei(a+i,b,c,l-i)+hei(b+i,a,c,l-i)+hei(c+i,a,b,l-i);\n printf(\"%d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d16e156c2d8c1b2a18eabf82d7378ec6", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int a=0,b=0,c=0,d=0,e=0,f=0,n;\n scanf(\"%d\",&n);\n if(n>=32)\n {\n a=1;\n n-=32;\n }\n if(n>=16)\n {\n b=1;\n n-=16;\n }\n if(n>=8)\n {\n c=1;\n n-=8;\n }\n if(n>=4)\n {\n d=1;\n n-=4;\n }\n if(n>=2)\n {\n e=1;\n n-=2;\n }\n if(n>=1)\n {\n f=1;\n n-=1;\n }\n n=(a*32)+(b*1)+(c*4)+(d*8)+(e*2)+(f*16);\n printf(\"%d\",n);\n return(0);\n }\n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "77db15a393b456bbdd03b4663685a741", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n\nint main()\n{\n\tint a,b,c,d,e,f,g;\n\tscanf(\"%d\",&a);\n\tb= a>> 5;\n\tc = a >> 4 & 1;\n\td = a >> 3 & 1;\n\te = a >> 2 & 1;\n\tf = a >> 1 & 1;\n\tg = a >> 0 & 1;\n\tprintf(\"%d\\n\",(b<<5) |(c<<4) |(d<<3) |(e<<2) |(f<<1) |(g<<0));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5aea6b5501ce8ca1f63540158618c260", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint i,a;\n\tscanf(\"%d\",&a);\n\tfor(i=2;i\n#include\nint main()\n{\n int a,b[6],i,temp;\n scanf(\"%d\",&a);\n for(i=5;i>=0;i--)\n {\n if(a!=0)\n {\n b[i]=a%2;\n a=a/2;\n }\n else\n b[i]=0;\n }\n temp=b[1];\n b[1]=b[5];\n b[5]=temp;\n temp=b[2];\n b[2]=b[3];\n b[3]=temp;\n for(i=5,a=0;i>=0;i--,a++)\n {\n temp+=b[i]*pow(2,a);\n }\n printf(\"%d\",temp);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "22496be67f10cea73dc26d999bb746d5", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include\n\n\nint main(void)\n{\n int n,i;\n scanf(\"%d\",&n);\n int arr[6];\n for(i=0;i<6;i++)\n {\n arr[i]=0;\n }\n i=0\n while(n>0)\n {\n arr[5-i]=n%2;i++;\n n=n/2;\n }\n int sum=(arr[1]*1+arr[4]*2+arr[2]*4+arr[3]*8+arr[5]*16+arr[0]*32);\n printf(\"%d\",sum);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "af97ec372912b64bb56d31797568d783", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t50\n#define M\t(N * (N - 1))\n#define N_\t(N + 2)\n#define M_\t(M * 3 + 2)\n#define X\t100000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint oo[1 + M * 2], oh[1 + M * 2], _ = 1;\n\nint link(int o, int h) {\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint oo_[1 + M_ * 2], oh_[1 + M_ * 2], __;\n\nint link_(int o, int h) {\n\too_[__] = o, oh_[__] = h;\n\treturn __++;\n}\n\nint ae[N], af[N], ae_[N_], dd[N_], n_;\nint ii[M], jj[M], ww[M]; char tt[M]; int ij[M_], cc[M_ * 2], m_;\nint pq[1 + N], iq[N], cnt;\n\nint less(int u, int v) { return dd[u] < dd[v]; }\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nvoid dijkstra(int n, int s) {\n\tmemset(dd, 0x3f, n * sizeof *dd);\n\tdd[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i = pq_remove_first(), o;\n\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h = oh[o];\n\n\t\t\tif (!tt[h]) {\n\t\t\t\tint j = jj[h], d = dd[i] + ww[h];\n\n\t\t\t\tif (dd[j] > d) {\n\t\t\t\t\tif (dd[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tdd[j] = d, pq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid link2(int i, int j, int c) {\n\tint h = m_++;\n\n\tij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;\n\tae_[i] = link_(ae_[i], h << 1);\n\tae_[j] = link_(ae_[j], h << 1 | 1);\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 = ae_[i]; o; o = oo_[o]) {\n\t\t\tint h_ = oh_[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) {\n\tint d, o;\n\n\tif (i == t)\n\t\treturn 1;\n\td = dd[i] + 1;\n\tfor (o = ae_[i]; o; o = oo_[o]) {\n\t\tint h_ = oh_[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 && dfs(j, t)) {\n\t\t\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\tdd[i] = n_;\n\treturn 0;\n}\n\nvoid dinic(int s, int t) {\n\twhile (bfs(s, t))\n\t\twhile (dfs(s, t))\n\t\t\t;\n}\n\nchar reachable[N];\n\nvoid dfs_(int j) {\n\tint o;\n\n\tif (reachable[j])\n\t\treturn;\n\treachable[j] = 1;\n\tfor (o = af[j]; o; o = oo[o]) {\n\t\tint h = oh[o], i = ii[h];\n\n\t\tdfs_(i);\n\t}\n}\n\nint main() {\n\tstatic double ans[X + 1];\n\tstatic int dd1[N], dd2[N], xx[M];\n\tint n, m, q, h, x, s, t;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (h = 0; h < m; h++) {\n\t\tint i, j, w;\n\n\t\tscanf(\"%d%d%d\", &i, &j, &w), i--, j--;\n\t\tii[h] = i, jj[h] = j, ww[h] = w;\n\t\tae[i] = link(ae[i], h);\n\t}\n\tn_ = n + 2, s = n, t = n + 1;\n\tx = 0;\n\twhile (x < X) {\n\t\tint k, y, z, d, d_;\n\n\t\tmemset(tt, 0, m * sizeof *tt);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd1, dd, n * sizeof *dd);\n\t\td = dd1[n - 1];\n\t\tmemset(ae_, 0, n_ * sizeof *ae_), __ = 1, m_ = 0;\n\t\tlink2(s, 0, INF);\n\t\tlink2(n - 1, t, INF);\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h], w = ww[h];\n\n\t\t\tif (dd1[i] + w == dd1[j]) {\n\t\t\t\ttt[h] = 1;\n\t\t\t\tlink2(s, j, 1), link2(i, t, 1);\n\t\t\t\tif (xx[h] == 0)\n\t\t\t\t\tlink2(j, i, INF);\n\t\t\t}\n\t\t}\n\t\tdinic(s, t);\n\t\td_ = INF;\n\t\tk = 0;\n\t\tmemset(af, 0, n * sizeof *af), _ = 1 + m;\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (tt[h]) {\n\t\t\t\tif ((dd[i] == n_) == (dd[j] == n_)) {\n\t\t\t\t\ttt[h] = 0;\n\t\t\t\t\taf[j] = link(af[j], h);\n\t\t\t\t} else if (dd[i] != n_) {\n\t\t\t\t\ttt[h] = 1;\n\t\t\t\t\tk++;\n\t\t\t\t} else {\n\t\t\t\t\ttt[h] = 2;\n\t\t\t\t\tk--;\n\t\t\t\t\td_ = min(d_, d + xx[h]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemset(reachable, 0, n * sizeof *reachable);\n\t\tdfs_(n - 1);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd2, dd, n * sizeof *dd);\n\t\td_ = min(d_, dd2[n - 1]);\n\t\tfor (h = 0; h < m; h++)\n\t\t\tif (tt[h] == 2 && dd2[ii[h]] != INF && dd1[jj[h]] != INF && reachable[jj[h]])\n\t\t\t\td_ = min(d_, d + dd2[ii[h]] + ww[h] - dd1[jj[h]]);\n\t\ty = d_ - d <= (X - x) / k ? x + (d_ - d) * k : X;\n\t\tfor (z = x; z <= y; z++)\n\t\t\tans[z] = d + (double) (z - x) / k;\n\t\tif (y < X) {\n\t\t\tfor (h = 0; h < m; h++)\n\t\t\t\tif (tt[h] == 1)\n\t\t\t\t\tww[h] += d_ - d, xx[h] += d_ - d;\n\t\t\t\telse if (tt[h] == 2)\n\t\t\t\t\tww[h] -= d_ - d, xx[h] -= d_ - d;\n\t\t}\n\t\tx = y;\n\t}\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%f\\n\", ans[x]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "471146ac1b7b49c2bac827fbd8dad8b5", "src_uid": "b0751071e12f729f6700586c5a8eed23", "difficulty": 3100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t50\n#define M\t(N * (N - 1))\n#define N_\t(N + 2)\n#define M_\t(M * 3 + 2)\n#define X\t100000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint oo[1 + M * 2], oh[1 + M * 2], _ = 1;\n\nint link(int o, int h) {\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint oo_[1 + M_ * 2], oh_[1 + M_ * 2], __;\n\nint link_(int o, int h) {\n\too_[__] = o, oh_[__] = h;\n\treturn __++;\n}\n\nint ae[N], af[N], ae_[N_], dd[N_], n_;\nint ii[M], jj[M], ww[M]; char tt[M]; int ij[M_], cc[M_ * 2], m_;\nint pq[1 + N], iq[N], cnt;\n\nint less(int u, int v) { return dd[u] < dd[v]; }\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nvoid dijkstra(int n, int s) {\n\tmemset(dd, 0x3f, n * sizeof *dd);\n\tdd[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i = pq_remove_first(), o;\n\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h = oh[o];\n\n\t\t\tif (!tt[h]) {\n\t\t\t\tint j = jj[h], d = dd[i] + ww[h];\n\n\t\t\t\tif (dd[j] > d) {\n\t\t\t\t\tif (dd[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tdd[j] = d, pq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid link2(int i, int j, int c) {\n\tint h = m_++;\n\n\tij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;\n\tae_[i] = link_(ae_[i], h << 1);\n\tae_[j] = link_(ae_[j], h << 1 | 1);\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 = ae_[i]; o; o = oo_[o]) {\n\t\t\tint h_ = oh_[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) {\n\tint d, o;\n\n\tif (i == t)\n\t\treturn 1;\n\td = dd[i] + 1;\n\tfor (o = ae_[i]; o; o = oo_[o]) {\n\t\tint h_ = oh_[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 && dfs(j, t)) {\n\t\t\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\tdd[i] = n_;\n\treturn 0;\n}\n\nvoid dinic(int s, int t) {\n\twhile (bfs(s, t))\n\t\twhile (dfs(s, t))\n\t\t\t;\n}\n\nchar reachable[N];\n\nvoid dfs_(int j) {\n\tint o;\n\n\tif (reachable[j])\n\t\treturn;\n\treachable[j] = 1;\n\tfor (o = af[j]; o; o = oo[o]) {\n\t\tint h = oh[o], i = ii[h];\n\n\t\tdfs_(i);\n\t}\n}\n\nint main() {\n\tstatic double ans[X + 1];\n\tstatic int dd1[N], dd2[N], xx[M];\n\tint n, m, q, h, x, s, t;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (h = 0; h < m; h++) {\n\t\tint i, j, w;\n\n\t\tscanf(\"%d%d%d\", &i, &j, &w), i--, j--;\n\t\tii[h] = i, jj[h] = j, ww[h] = w;\n\t\tae[i] = link(ae[i], h);\n\t}\n\tn_ = n + 2, s = n, t = n + 1;\n\tx = 0;\n\twhile (x < X) {\n\t\tint k, y, z, d, d_;\n\n\t\tmemset(tt, 0, m * sizeof *tt);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd1, dd, n * sizeof *dd);\n\t\td = dd1[n - 1];\n\t\tmemset(ae_, 0, n_ * sizeof *ae_), __ = 1, m_ = 0;\n\t\tlink2(s, 0, INF);\n\t\tlink2(n - 1, t, INF);\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h], w = ww[h];\n\n\t\t\tif (dd1[i] + w == dd1[j]) {\n\t\t\t\ttt[h] = 1;\n\t\t\t\tlink2(s, j, 1), link2(i, t, 1);\n\t\t\t\tif (xx[h] == 0)\n\t\t\t\t\tlink2(j, i, INF);\n\t\t\t}\n\t\t}\n\t\tdinic(s, t);\n\t\td_ = INF;\n\t\tk = 0;\n\t\tmemset(af, 0, n * sizeof *af), _ = 1 + m;\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (tt[h]) {\n\t\t\t\tif ((dd[i] == n_) == (dd[j] == n_)) {\n\t\t\t\t\ttt[h] = 0;\n\t\t\t\t\taf[j] = link(af[j], h);\n\t\t\t\t} else if (dd[i] != n_) {\n\t\t\t\t\ttt[h] = 1;\n\t\t\t\t\tk++;\n\t\t\t\t} else {\n\t\t\t\t\ttt[h] = 2;\n\t\t\t\t\tk--;\n\t\t\t\t\td_ = min(d_, d + xx[h]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemset(reachable, 0, n * sizeof *reachable);\n\t\tdfs_(n - 1);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd2, dd, n * sizeof *dd);\n\t\td_ = min(d_, dd2[n - 1]);\n\t\tfor (h = 0; h < m; h++)\n\t\t\tif (tt[h] == 2 && dd2[ii[h]] != INF && dd1[jj[h]] != INF && reachable[jj[h]])\n\t\t\t\td_ = min(d_, d + dd2[ii[h]] - dd1[jj[h]]);\n\t\ty = d_ - d <= (X - x) / k ? x + (d_ - d) * k : X;\n\t\tfor (z = x; z <= y; z++)\n\t\t\tans[z] = d + (double) (z - x) / k;\n\t\tif (y < X) {\n\t\t\tfor (h = 0; h < m; h++)\n\t\t\t\tif (tt[h] == 1)\n\t\t\t\t\tww[h] += d_ - d, xx[h] += d_ - d;\n\t\t\t\telse if (tt[h] == 2)\n\t\t\t\t\tww[h] -= d_ - d, xx[h] -= d_ - d;\n\t\t}\n\t\tx = y;\n\t}\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%f\\n\", ans[x]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2fb377603a43b07f5fb0a0e1d15a806b", "src_uid": "b0751071e12f729f6700586c5a8eed23", "difficulty": 3100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t50\n#define M\t(N * (N - 1))\n#define N_\t(N + 2)\n#define M_\t(M * 3 + 2)\n#define X\t100000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint oo[1 + M * 2], oh[1 + M * 2], _ = 1;\n\nint link(int o, int h) {\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint oo_[1 + M_ * 2], oh_[1 + M_ * 2], __;\n\nint link_(int o, int h) {\n\too_[__] = o, oh_[__] = h;\n\treturn __++;\n}\n\nint ae[N], af[N], ae_[N_], dd[N_], n_;\nint ii[M], jj[M], ww[M]; char tt[M]; int ij[M_], cc[M_ * 2], m_;\nint pq[1 + N], iq[N], cnt;\n\nint less(int u, int v) { return dd[u] < dd[v]; }\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nvoid dijkstra(int n, int s) {\n\tmemset(dd, 0x3f, n * sizeof *dd);\n\tdd[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i = pq_remove_first(), o;\n\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h = oh[o];\n\n\t\t\tif (!tt[h]) {\n\t\t\t\tint j = jj[h], d = dd[i] + ww[h];\n\n\t\t\t\tif (dd[j] > d) {\n\t\t\t\t\tif (dd[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tdd[j] = d, pq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid link2(int i, int j, int c) {\n\tint h = m_++;\n\n\tij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;\n\tae_[i] = link_(ae_[i], h << 1);\n\tae_[j] = link_(ae_[j], h << 1 | 1);\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 = ae_[i]; o; o = oo_[o]) {\n\t\t\tint h_ = oh_[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) {\n\tint d, o;\n\n\tif (i == t)\n\t\treturn 1;\n\td = dd[i] + 1;\n\tfor (o = ae_[i]; o; o = oo_[o]) {\n\t\tint h_ = oh_[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 && dfs(j, t)) {\n\t\t\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\tdd[i] = n_;\n\treturn 0;\n}\n\nvoid dinic(int s, int t) {\n\twhile (bfs(s, t))\n\t\twhile (dfs(s, t))\n\t\t\t;\n}\n\nchar reachable[N];\n\nvoid dfs_(int j) {\n\tint o;\n\n\tif (reachable[j])\n\t\treturn;\n\treachable[j] = 1;\n\tfor (o = af[j]; o; o = oo[o]) {\n\t\tint h = oh[o], i = ii[h];\n\n\t\tdfs_(i);\n\t}\n}\n\nint main() {\n\tstatic double ans[X + 1];\n\tstatic int dd1[N], dd2[N], xx[M];\n\tint n, m, q, h, x, s, t;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (h = 0; h < m; h++) {\n\t\tint i, j, w;\n\n\t\tscanf(\"%d%d%d\", &i, &j, &w), i--, j--;\n\t\tii[h] = i, jj[h] = j, ww[h] = w;\n\t\tae[i] = link(ae[i], h);\n\t}\n\tn_ = n + 2, s = n, t = n + 1;\n\tx = 0;\n\twhile (x < X) {\n\t\tint k, y, z, d, d_;\n\n\t\tmemset(tt, 0, m * sizeof *tt);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd1, dd, n * sizeof *dd);\n\t\td = dd1[n - 1];\n\t\tmemset(ae_, 0, n_ * sizeof *ae_), __ = 1, m_ = 0;\n\t\tlink2(s, 0, INF);\n\t\tlink2(n - 1, t, INF);\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h], w = ww[h];\n\n\t\t\tif (dd1[i] + w == dd1[j]) {\n\t\t\t\ttt[h] = 1;\n\t\t\t\tlink2(s, j, 1), link2(i, t, 1);\n\t\t\t\tif (xx[h] == 0)\n\t\t\t\t\tlink2(j, i, INF);\n\t\t\t}\n\t\t}\n\t\tdinic(s, t);\n\t\td_ = INF;\n\t\tk = 0;\n\t\tmemset(af, 0, n * sizeof *af), _ = 1 + m;\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (tt[h]) {\n\t\t\t\tif ((dd[i] == n_) == (dd[j] == n_)) {\n\t\t\t\t\ttt[h] = 0;\n\t\t\t\t\taf[j] = link(af[j], h);\n\t\t\t\t} else if (dd[i] != n_) {\n\t\t\t\t\ttt[h] = 1;\n\t\t\t\t\tk++;\n\t\t\t\t} else {\n\t\t\t\t\ttt[h] = 2;\n\t\t\t\t\tk--;\n\t\t\t\t\td_ = min(d_, d + xx[h]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemset(reachable, 0, n * sizeof *reachable);\n\t\tdfs_(n - 1);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd2, dd, n * sizeof *dd);\n\t\td_ = min(d_, dd2[n - 1]);\n\t\tfor (h = 0; h < m; h++)\n\t\t\tif (tt[h] == 2 && dd2[ii[h]] != INF && reachable[jj[h]])\n\t\t\t\td_ = min(d_, d + dd2[ii[h]] - dd1[jj[h]]);\n\t\ty = d_ - d <= (X - x) / k ? x + (d_ - d) * k : X;\n\t\tfor (z = x; z <= y; z++)\n\t\t\tans[z] = d + (double) (z - x) / k;\n\t\tif (y < X) {\n\t\t\tfor (h = 0; h < m; h++)\n\t\t\t\tif (tt[h] == 1)\n\t\t\t\t\tww[h] += d_ - d, xx[h] += d_ - d;\n\t\t\t\telse if (tt[h] == 2)\n\t\t\t\t\tww[h] -= d_ - d, xx[h] -= d_ - d;\n\t\t}\n\t\tx = y;\n\t}\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%f\\n\", ans[x]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7a601992feb451e2aa4f0e315f06a6c6", "src_uid": "b0751071e12f729f6700586c5a8eed23", "difficulty": 3100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t50\n#define M\t(N * (N - 1))\n#define N_\t(N + 2)\n#define M_\t(M * 3 + 2)\n#define X\t100000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint oo[1 + M], oh[1 + M], _ = 1;\n\nint link(int o, int h) {\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint oo_[1 + M_ * 2], oh_[1 + M_ * 2], __;\n\nint link_(int o, int h) {\n\too_[__] = o, oh_[__] = h;\n\treturn __++;\n}\n\nint ae[N], af[N], ae_[N_], dd[N_], n_;\nint ii[M], jj[M], ww[M]; char tt[M]; int ij[M_], cc[M_ * 2], m_;\nint pq[1 + N], iq[N], cnt;\n\nint less(int u, int v) { return dd[u] < dd[v]; }\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nvoid dijkstra(int n, int s) {\n\tmemset(dd, 0x3f, n * sizeof *dd);\n\tdd[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i = pq_remove_first(), o;\n\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h = oh[o];\n\n\t\t\tif (!tt[h]) {\n\t\t\t\tint j = jj[h], d = dd[i] + ww[h];\n\n\t\t\t\tif (dd[j] > d) {\n\t\t\t\t\tif (dd[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tdd[j] = d, pq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid link2(int i, int j, int c) {\n\tint h = m_++;\n\n\tij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;\n\tae_[i] = link_(ae_[i], h << 1);\n\tae_[j] = link_(ae_[j], h << 1 | 1);\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 = ae_[i]; o; o = oo_[o]) {\n\t\t\tint h_ = oh_[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) {\n\tint d, o;\n\n\tif (i == t)\n\t\treturn 1;\n\td = dd[i] + 1;\n\tfor (o = ae_[i]; o; o = oo_[o]) {\n\t\tint h_ = oh_[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 && dfs(j, t)) {\n\t\t\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\tdd[i] = n_;\n\treturn 0;\n}\n\nvoid dinic(int s, int t) {\n\twhile (bfs(s, t))\n\t\twhile (dfs(s, t))\n\t\t\t;\n}\n\nchar reachable[N];\n\nvoid dfs_(int j) {\n\tint o;\n\n\tif (reachable[j])\n\t\treturn;\n\treachable[j] = 1;\n\tfor (o = af[j]; o; o = oo[o]) {\n\t\tint h = oh[o], i = ii[h];\n\n\t\tdfs_(i);\n\t}\n}\n\nint main() {\n\tstatic double ans[X + 1];\n\tstatic int dd1[N], dd2[N], xx[M];\n\tint n, m, q, h, x, s, t;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (h = 0; h < m; h++) {\n\t\tint i, j, w;\n\n\t\tscanf(\"%d%d%d\", &i, &j, &w), i--, j--;\n\t\tii[h] = i, jj[h] = j, ww[h] = w;\n\t\tae[i] = link(ae[i], h);\n\t}\n\tn_ = n + 2, s = n, t = n + 1;\n\tx = 0;\n\twhile (x < X) {\n\t\tint k, y, z, d, d_;\n\n\t\tmemset(tt, 0, m * sizeof *tt);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd1, dd, n * sizeof *dd);\n\t\td = dd1[n - 1];\n\t\tmemset(ae_, 0, n_ * sizeof *ae_), __ = 1, m_ = 0;\n\t\tlink2(s, 0, INF);\n\t\tlink2(n - 1, t, INF);\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h], w = ww[h];\n\n\t\t\tif (dd1[i] + w == dd1[j]) {\n\t\t\t\ttt[h] = 1;\n\t\t\t\tlink2(s, j, 1), link2(i, t, 1);\n\t\t\t\tif (xx[h] == 0)\n\t\t\t\t\tlink2(j, i, INF);\n\t\t\t}\n\t\t}\n\t\tdinic(s, t);\n\t\td_ = INF;\n\t\tk = 0;\n\t\t_ = 1 + m;\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (tt[h]) {\n\t\t\t\tif ((dd[i] == n_) == (dd[j] == n_)) {\n\t\t\t\t\ttt[h] = 0;\n\t\t\t\t\taf[j] = link(af[j], h);\n\t\t\t\t} else if (dd[i] != n_) {\n\t\t\t\t\ttt[h] = 1;\n\t\t\t\t\tk++;\n\t\t\t\t} else {\n\t\t\t\t\ttt[h] = 2;\n\t\t\t\t\tk--;\n\t\t\t\t\td_ = min(d_, d + xx[h]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemset(reachable, 0, n * sizeof *reachable);\n\t\tdfs_(n - 1);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd2, dd, n * sizeof *dd);\n\t\td_ = min(d_, dd2[n - 1]);\n\t\tfor (h = 0; h < m; h++)\n\t\t\tif (tt[h] == 2 && dd2[ii[h]] != INF && reachable[jj[h]])\n\t\t\t\td_ = min(d_, d + dd2[ii[h]] - dd1[jj[h]]);\n\t\ty = d_ - d <= (X - x) / k ? x + (d_ - d) * k : X;\n\t\tfor (z = x; z <= y; z++)\n\t\t\tans[z] = d + (double) (z - x) / k;\n\t\tif (y < X) {\n\t\t\tfor (h = 0; h < m; h++)\n\t\t\t\tif (tt[h] == 1)\n\t\t\t\t\tww[h] += d_ - d, xx[h] += d_ - d;\n\t\t\t\telse if (tt[h] == 2)\n\t\t\t\t\tww[h] -= d_ - d, xx[h] -= d_ - d;\n\t\t}\n\t\tx = y;\n\t}\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%f\\n\", ans[x]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "90e49b9f5f234cf4c7db6e65d3bdf081", "src_uid": "b0751071e12f729f6700586c5a8eed23", "difficulty": 3100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t50\n#define M\t(N * (N - 1))\n#define N_\t(N + 2)\n#define M_\t(M * 3 + 2)\n#define X\t100000\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint oo[1 + M], oh[1 + M], _ = 1;\n\nint link(int o, int h) {\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint oo_[1 + M_ * 2], oh_[1 + M_ * 2], __;\n\nint link_(int o, int h) {\n\too_[__] = o, oh_[__] = h;\n\treturn __++;\n}\n\nint ae[N], af[N], ae_[N_], dd[N_], n_;\nint ii[M], jj[M], ww[M]; char tt[M]; int ij[M_], cc[M_ * 2], m_;\nint pq[1 + N], iq[N], cnt;\n\nint less(int u, int v) { return dd[u] < dd[v]; }\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nvoid dijkstra(int n, int s) {\n\tmemset(dd, 0x3f, n * sizeof *dd);\n\tdd[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i = pq_remove_first(), o;\n\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h = oh[o];\n\n\t\t\tif (!tt[h]) {\n\t\t\t\tint j = jj[h], d = dd[i] + ww[h];\n\n\t\t\t\tif (dd[j] > d) {\n\t\t\t\t\tif (dd[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tdd[j] = d, pq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid link2(int i, int j, int c) {\n\tint h = m_++;\n\n\tij[h] = i ^ j, cc[h << 1] = c, cc[h << 1 | 1] = 0;\n\tae_[i] = link_(ae_[i], h << 1);\n\tae_[j] = link_(ae_[j], h << 1 | 1);\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 = ae_[i]; o; o = oo_[o]) {\n\t\t\tint h_ = oh_[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) {\n\tint d, o;\n\n\tif (i == t)\n\t\treturn 1;\n\td = dd[i] + 1;\n\tfor (o = ae_[i]; o; o = oo_[o]) {\n\t\tint h_ = oh_[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 && dfs(j, t)) {\n\t\t\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\tdd[i] = n_;\n\treturn 0;\n}\n\nvoid dinic(int s, int t) {\n\twhile (bfs(s, t))\n\t\twhile (dfs(s, t))\n\t\t\t;\n}\n\nchar reachable[N];\n\nvoid dfs_(int j) {\n\tint o;\n\n\tif (reachable[j])\n\t\treturn;\n\treachable[j] = 1;\n\tfor (o = af[j]; o; o = oo[o]) {\n\t\tint h = oh[o], i = ii[h];\n\n\t\tdfs_(i);\n\t}\n}\n\nint main() {\n\tstatic double ans[X + 1];\n\tstatic int dd1[N], dd2[N], xx[M];\n\tint n, m, q, h, x, s, t;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (h = 0; h < m; h++) {\n\t\tint i, j, w;\n\n\t\tscanf(\"%d%d%d\", &i, &j, &w), i--, j--;\n\t\tii[h] = i, jj[h] = j, ww[h] = w;\n\t\tae[i] = link(ae[i], h);\n\t}\n\tn_ = n + 2, s = n, t = n + 1;\n\tx = 0;\n\twhile (x < X) {\n\t\tint k, y, z, d, d_;\n\n\t\tmemset(tt, 0, m * sizeof *tt);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd1, dd, n * sizeof *dd);\n\t\td = dd1[n - 1];\n\t\tmemset(ae_, 0, n_ * sizeof *ae_), __ = 1, m_ = 0;\n\t\tlink2(s, 0, INF);\n\t\tlink2(n - 1, t, INF);\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h], w = ww[h];\n\n\t\t\tif (dd1[i] + w == dd1[j]) {\n\t\t\t\ttt[h] = 1;\n\t\t\t\tlink2(s, j, 1), link2(i, t, 1);\n\t\t\t\tif (xx[h] == 0)\n\t\t\t\t\tlink2(j, i, INF);\n\t\t\t}\n\t\t}\n\t\tdinic(s, t);\n\t\td_ = INF;\n\t\tk = 0;\n\t\tmemset(af, 0, n * sizeof *af), _ = 1 + m;\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (tt[h]) {\n\t\t\t\tif ((dd[i] == n_) == (dd[j] == n_)) {\n\t\t\t\t\ttt[h] = 0;\n\t\t\t\t\taf[j] = link(af[j], h);\n\t\t\t\t} else if (dd[i] != n_) {\n\t\t\t\t\ttt[h] = 1;\n\t\t\t\t\tk++;\n\t\t\t\t} else {\n\t\t\t\t\ttt[h] = 2;\n\t\t\t\t\tk--;\n\t\t\t\t\td_ = min(d_, d + xx[h]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemset(reachable, 0, n * sizeof *reachable);\n\t\tdfs_(n - 1);\n\t\tdijkstra(n, 0);\n\t\tmemcpy(dd2, dd, n * sizeof *dd);\n\t\td_ = min(d_, dd2[n - 1]);\n\t\tfor (h = 0; h < m; h++)\n\t\t\tif (tt[h] == 2 && dd2[ii[h]] != INF && reachable[jj[h]])\n\t\t\t\td_ = min(d_, d + dd2[ii[h]] - dd1[jj[h]]);\n\t\ty = d_ - d <= (X - x) / k ? x + (d_ - d) * k : X;\n\t\tfor (z = x; z <= y; z++)\n\t\t\tans[z] = d + (double) (z - x) / k;\n\t\tif (y < X) {\n\t\t\tfor (h = 0; h < m; h++)\n\t\t\t\tif (tt[h] == 1)\n\t\t\t\t\tww[h] += d_ - d, xx[h] += d_ - d;\n\t\t\t\telse if (tt[h] == 2)\n\t\t\t\t\tww[h] -= d_ - d, xx[h] -= d_ - d;\n\t\t}\n\t\tx = y;\n\t}\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%f\\n\", ans[x]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "315be5afdf4b0abb2001aed75a2a5da7", "src_uid": "b0751071e12f729f6700586c5a8eed23", "difficulty": 3100.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "fc7b757892dba4c050057537d4ae6965", "src_uid": "3b12863997b377b47bae43566ec1a63b", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \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 while( scanf(\"%d\",&n) !=-1 ){\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 int testcase =0;\n while( scanf(\"%d\",&n) !=-1 ){\n testcase ++;\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 int testcase =0;\n while( scanf(\"%d\",&n) !=EOF ){\n testcase ++;\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 if(depth ==0){\n\n for(int i=0;i<5;i++){\n for(int j=0;j<5;j++){\n flag2[i][j] = flag[i][j];\n }\n }\n \n for(int i=0;i<5;i++){\n for(int j=0;j<5;j++){\n if(mark[i] && mark[j+5]){\n flag2[i][j]=0;\n }\n }\n }\n for(int i=0 ;i<10 ;i++){\n if(! mark[i] )\n continue;\n if ( i < 5){\n int count=0;\n int index=0;\n for(int 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 int count=0;\n int index =0;\n for(int 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 int count =0 ;\n for(int i=0;i<5;i++){\n for(int 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(int 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 memset(flag,0,sizeof(flag));\n for(int i=0;i\n\n#define K\t50\n\nint main() {\n\tint q;\n\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tstatic long long aa[K];\n\t\tlong long a, b, m, lower, upper, x;\n\t\tint i, j, k, good;\n\n\t\tscanf(\"%lld%lld%lld\", &a, &b, &m);\n\t\tif (a == b) {\n\t\t\tprintf(\"1 %lld\\n\", a);\n\t\t\tcontinue;\n\t\t}\n\t\tgood = 0;\n\t\tfor (k = 2; k <= K; k++) {\n\t\t\tlower = (a << (k - 2)) + (1 << (k - 2)) - 1 + 1;\n\t\t\tif (lower > b)\n\t\t\t\tbreak;\n\t\t\tupper = (a << (k - 2)) + m * ((1 << (k - 2)) - 1) + m;\n\t\t\tif (b <= upper) {\n\t\t\t\tgood = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!good) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tb -= lower;\n\t\tprintf(\"%d %lld\", k, aa[0] = a);\n\t\tfor (j = 1; j < k; j++) {\n\t\t\ta = 1 << (j == k - 1 ? 0 : k - 2 - j);\n\t\t\tx = 1 + b / a;\n\t\t\tif (x > m)\n\t\t\t\tx = m;\n\t\t\tb -= (x - 1) * a;\n\t\t\tfor (i = 0; i < j; i++)\n\t\t\t\tx += aa[i];\n\t\t\tprintf(\" %lld\", aa[j] = x);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "06fec672a6a4b56331be5b2acd06af7f", "src_uid": "c9d646762e2e78064bc0670ec7c173c6", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n\n#define K\t50\n\nint main() {\n\tint q;\n\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tstatic long long aa[K];\n\t\tlong long a, b, m, lower, upper, x;\n\t\tint i, j, k, good;\n\n\t\tscanf(\"%lld%lld%lld\", &a, &b, &m);\n\t\tgood = 0;\n\t\tfor (k = 2; k <= K; k++) {\n\t\t\tlower = (a << (k - 2)) + (1 << (k - 2)) - 1 + 1;\n\t\t\tif (lower > b)\n\t\t\t\tbreak;\n\t\t\tupper = (a << (k - 2)) + m * ((1 << (k - 2)) - 1) + m;\n\t\t\tif (b <= upper) {\n\t\t\t\tgood = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!good) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tb -= lower;\n\t\tprintf(\"%d %lld\", k, aa[0] = a);\n\t\tfor (j = 1; j < k; j++) {\n\t\t\ta = 1 << (j == k - 1 ? 0 : k - 2 - j);\n\t\t\tx = 1 + b / a;\n\t\t\tif (x > m)\n\t\t\t\tx = m;\n\t\t\tb -= (x - 1) * a;\n\t\t\tfor (i = 0; i < j; i++)\n\t\t\t\tx += aa[i];\n\t\t\tprintf(\" %lld\", aa[j] = x);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c7df8ea1d66825ac34b103f24b8f413", "src_uid": "c9d646762e2e78064bc0670ec7c173c6", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n int q;\n scanf(\"%d\",&q);\n while(q--){\n long long int a,b,m;\n scanf(\"%lld %lld %lld\",&a,&b,&m);\n long long int k=1;\n if(a==b)\n printf(\"%lld %lld\\n\",k,a);\n else{\n long long int c=a+1;\n //double n;\n k = log2((b*1.0)/c) + 1;\n //printf(\"%lld\\n\", k);\n long long int d=c*pow(2,k-1);\n /*if(b!=d){\n k++;\n d=d*2;\n }*/\n //printf(\"%lld\",k+1);\n c=a+m;\n long long int s=c*pow(2,k-1);\n if((k+1)>=50 || sm)\n f=m;\n diff = diff - f*pow(2,(j-2));\n r[i] = f + 1;\n j--;\n }\n r[k] = diff + 1;\n printf(\"%lld %lld \",(k+1),a);\n long long int sum=a;\n for(long long int i=1;i<=k;i++){\n long long int temp = sum + r[i];\n printf(\"%lld \",temp);\n //printf(\"%lld \",r[i]);\n sum = sum + temp;\n }\n printf(\"\\n\");\n }\n }\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a7f8343a72b9db4662a15b745336927a", "src_uid": "c9d646762e2e78064bc0670ec7c173c6", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint main(){\n long long int q;\n scanf(\"%lld\",&q);\n while(q--){\n long long int a,b,m;\n scanf(\"%lld %lld %lld\",&a,&b,&m);\n long long int k=1;\n if(a==b)\n printf(\"%lld %lld\\n\",k,a);\n else{\n long long int c=a+1;\n k = log2((b*1.0)/c) + 1;\n //printf(\"%lld\\n\",k);\n long long int s=c*pow(2,k-1);\n if(k==1){\n if((b-a)>m)\n printf(\"-1\\n\");\n else\n printf(\"%lld %lld %lld\\n\",(k+1),a,b);\n }\n else{\n m--;\n long long int r[k+2];\n for(long long int i=0;i<(k+2);i++)\n r[i]=0;\n long long int diff = b-s;\n //printf(\"%lld\\n\",diff);\n long long int j=k;\n for(long long int i=1;im)\n f=m;\n diff = diff - f*pow(2,(j-2));\n r[i] = f + 1;\n j--;\n }\n r[k] = diff + 1;\n if(r[k]>(m+1)){\n printf(\"-1\\n\");\n continue;\n }\n printf(\"%lld %lld \",(k+1),a);\n long long int sum=a;\n for(long long int i=1;i<=k;i++){\n long long int temp = sum + r[i];\n printf(\"%lld \",temp);\n //printf(\"%lld \",r[i]);\n sum = sum + temp;\n }\n printf(\"\\n\");\n }\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4583699e99686313d2b99f1b30049fab", "src_uid": "c9d646762e2e78064bc0670ec7c173c6", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n\n#define K\t50\n\nint main() {\n\tint q;\n\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tstatic long long aa[K];\n\t\tlong long a, b, m, lower, upper, x;\n\t\tint i, j, k, good;\n\n\t\tscanf(\"%lld%lld%lld\", &a, &b, &m);\n\t\tif (a == b) {\n\t\t\tprintf(\"1 %lld\\n\", a);\n\t\t\tcontinue;\n\t\t}\n\t\tgood = 0;\n\t\tfor (k = 2; k <= K; k++) {\n\t\t\tlower = (a << (k - 2)) + (1LL << (k - 2)) - 1 + 1;\n\t\t\tif (lower > b)\n\t\t\t\tbreak;\n\t\t\tupper = (a << (k - 2)) + m * ((1LL << (k - 2)) - 1) + m;\n\t\t\tif (b <= upper) {\n\t\t\t\tgood = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!good) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tb -= lower;\n\t\tprintf(\"%d %lld\", k, aa[0] = a);\n\t\tfor (j = 1; j < k; j++) {\n\t\t\ta = 1LL << (j == k - 1 ? 0 : k - 2 - j);\n\t\t\tx = 1 + b / a;\n\t\t\tif (x > m)\n\t\t\t\tx = m;\n\t\t\tb -= (x - 1) * a;\n\t\t\tfor (i = 0; i < j; i++)\n\t\t\t\tx += aa[i];\n\t\t\tprintf(\" %lld\", aa[j] = x);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "64986414bd0d352cd5c3b0cebf36c887", "src_uid": "c9d646762e2e78064bc0670ec7c173c6", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define N 100000\n#define EPS 1E-6\n\nint sign(double x) { \n return x < -EPS ? -1 : x > EPS; \n}\n\ndouble sqr(double x) { \n return x * x; \n}\n\ntypedef struct point {\n double x, y;\n} point;\n\ndouble dist(point a, point b) {\n return hypot(a.x - b.x, a.y - b.y);\n}\n\ndouble cross(point a, point b, point c) {\n return (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x);\n}\n\n/* PA * PB */\ndouble dot(point p, point a, point b) {\n return (a.x - p.x) * (b.x - p.x) + (a.y - p.y) * (b.y - p.y);\n}\n\n/* delta angle of ABC */\ndouble delta_angle(point a, point b, point c) {\n return acos(dot(b, a, c) / (dist(a, b) * dist(b, c)));\n}\n\npoint *__o;\n\nint angle_cmp(point *p, point *q) {\n int c;\n if (c = sign(cross(*__o, *p, *q)))\n return -c;\n return sign(dist(*p, *__o) - dist(*q, *__o));\n}\n\npoint stack[N];\n\nint convex_hull(point *ps, int n) {\n int i, k, top;\n point q;\n\n k = 0;\n for (i = 1; i < n; i++)\n if (sign(ps[i].y - ps[k].y) < 0 || sign(ps[i].y - ps[k].y) == 0 && ps[i].x < ps[k].x)\n k = i;\n\n q = ps[k];\n ps[k] = ps[0];\n ps[0] = q;\n\n __o = &ps[0];\n qsort(ps + 1, n - 1, sizeof(point), (int (*)(const void *, const void *))angle_cmp);\n\n top = 0;\n for (i = 0; i < n; i++) {\n// printf(\"%lf,%lf\\n\", ps[i].x, ps[i].y);\n while (top >= 2 && sign(cross(stack[top - 2], stack[top - 1], ps[i])) <= 0) top--;\n stack[top++] = ps[i];\n }\n memcpy(ps, stack, sizeof(point) * top);\n return top;\n}\n\ndouble cccr(point A, point B, point C) {\n double a, b, c, cos_B, sin_B, R;\n\n a = dist(B, C);\n b = dist(A, C);\n c = dist(A, B);\n cos_B = (a * a + c * c - b * b) / (2 * a * c);\n sin_B = sqrt(1.0 - cos_B * cos_B);\n return b / sin_B / 2.0;\n}\n\nint too_straight(point A, point B, point C, double r) {\n// printf(\"R=%lf vs r=%lf\\n\", R, r);\n return sign(dot(B, A, C)) < 0 && sign(cccr(A, B, C) - r) > 0;\n}\n\ndouble area_bow(double r, double l) {\n double tri = l * sqrt(sqr(r) - sqr(l / 2)) / 2;\n double theta = 2 * asin(l / (r + r));\n double sector = theta * r * r / 2;\n return sector - tri;\n}\n\ndouble area_polygon(const point a[], int n) {\n int i, j;\n double area = 0.0;\n for (j = 0, i = n - 1; j < n; i = j++)\n area += a[i].x * a[j].y - a[i].y * a[j].x;\n return fabs(area) / 2;\n}\n\nvoid die() {\n *(char *)NULL = 0;\n}\n\nint main() {\n static point ps[N];\n int n;\n double r;\n double ans, R, Rmin;\n int i, j, k, z, top, s, ch;\n\n scanf(\"%d %lf\", &n, &r);\n for (i = 0; i < n; i++)\n scanf(\"%lf %lf\", &ps[i].x, &ps[i].y);\n\n if (n == 1) {\n puts(\"0\");\n } else if (n == 2) {\n ans = area_bow(r, dist(ps[0], ps[1])) * 2.0;\n printf(\"%.9lf\\n\", ans);\n } else {\n n = convex_hull(ps, n);\n// printf(\"n=%d\\n\", n);\n\n top = 0;\n for (i = 0; i < n; i++) {\n while (top >= 2 && too_straight(stack[top - 2], stack[top - 1], ps[i], r))\n top--;\n stack[top++] = ps[i];\n }\n\n s = 0;\n ch = 1;\n while (ch) {\n ch = 0;\n while (top - s >= 3 && too_straight(stack[top - 2], stack[top - 1], stack[s], r))\n top--, ch = 1;\n while (top - s >= 3 && too_straight(stack[top - 1], stack[s], stack[s + 1], r))\n s++, ch = 1;\n }\n memcpy(stack, stack + s, sizeof(stack[0]) * (top -= s));\n// printf(\"top=%d\\n\", top);\n\n ans = area_polygon(stack, top);\n for (i = 0, j = 1 % top; i < top; i++, j = (j + 1) % top) {\n// printf(\"%lf,%lf\\n\", stack[i].x, stack[i].y);\n ans += area_bow(r, dist(stack[i], stack[j]));\n }\n printf(\"%.9lf\\n\", ans);\n\n if (top >= 3)\n for (i = 0, j = 1 % top, k = 2 % top; i < top; i++, j = (j + 1) % top, k = (k + 1) % top)\n if (too_straight(stack[i], stack[j], stack[k], r))\n die();\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7fbdadef611a38c822761f6fc4c616f9", "src_uid": "5f2a0960bab9bdc91b190ed07d6adcf7", "difficulty": 3000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define N 100000\n#define EPS 1E-6\n\nint sign(double x) { \n return x < -EPS ? -1 : x > EPS; \n}\n\ndouble sqr(double x) { \n return x * x; \n}\n\ntypedef struct point {\n double x, y;\n} point;\n\ndouble dist(const point *a, const point *b) {\n return hypot(a->x - b->x, a->y - b->y);\n}\n\ndouble cross(const point *a, const point *b, const point *c) {\n return (b->x - a->x) * (c->y - b->y) - (b->y - a->y) * (c->x - b->x);\n}\n\n/* PA * PB */\ndouble dot(const point *p, const point *a, const point *b) {\n return (a->x - p->x) * (b->x - p->x) + (a->y - p->y) * (b->y - p->y);\n}\n\nconst point *__o;\n\nint angle_cmp(const point *p, const point *q) {\n int c;\n if (c = sign(cross(__o, p, q)))\n return -c;\n return sign(dist(p, __o) - dist(q, __o));\n}\n\npoint stack[N];\n\nint convex_hull(point ps[], int n) {\n int i, k, top;\n point q;\n\n k = 0;\n for (i = 1; i < n; i++)\n if (sign(ps[i].y - ps[k].y) < 0 || sign(ps[i].y - ps[k].y) == 0 && ps[i].x < ps[k].x)\n k = i;\n\n q = ps[k];\n ps[k] = ps[0];\n ps[0] = q;\n\n __o = &ps[0];\n qsort(ps + 1, n - 1, sizeof(point), (int (*)(const void *, const void *))angle_cmp);\n\n top = 0;\n for (i = 0; i < n; i++) {\n while (top >= 2 && sign(cross(&stack[top - 2], &stack[top - 1], &ps[i])) <= 0) top--;\n stack[top++] = ps[i];\n }\n memcpy(ps, stack, sizeof(point) * top);\n return top;\n}\n\ndouble cccr(const point *A, const point *B, const point *C) {\n double a, b, c, cos_B, sin_B, R;\n\n a = dist(B, C);\n b = dist(A, C);\n c = dist(A, B);\n cos_B = (a * a + c * c - b * b) / (2 * a * c);\n sin_B = sqrt(1.0 - cos_B * cos_B);\n return b / sin_B / 2.0;\n}\n\nint too_straight(const point *A, const point *B, const point *C, double r) {\n return sign(dot(B, A, C)) < 0 && sign(cccr(A, B, C) - r) > 0;\n}\n\ndouble area_bow(double r, double l) {\n double tri = l * sqrt(sqr(r) - sqr(l / 2)) / 2;\n double theta = 2 * asin(l / (r + r));\n double sector = theta * r * r / 2;\n return sector - tri;\n}\n\ndouble area_polygon(const point a[], int n) {\n int i, j;\n double area = 0.0;\n for (j = 0, i = n - 1; j < n; i = j++)\n area += a[i].x * a[j].y - a[i].y * a[j].x;\n return fabs(area) / 2;\n}\n\nint main() {\n static point ps[N];\n int n;\n double r;\n double ans, R, Rmin;\n int i, j, k, z, top, s, ch;\n\n scanf(\"%d %lf\", &n, &r);\n for (i = 0; i < n; i++)\n scanf(\"%lf %lf\", &ps[i].x, &ps[i].y);\n\n if (n == 1) {\n puts(\"0\");\n } else if (n == 2) {\n ans = area_bow(r, dist(&ps[0], &ps[1])) * 2.0;\n printf(\"%.9lf\\n\", ans);\n } else {\n n = convex_hull(ps, n);\n\n top = 0;\n for (i = 0; i < n; i++) {\n while (top >= 2 && too_straight(&stack[top - 2], &stack[top - 1], &ps[i], r))\n top--;\n stack[top++] = ps[i];\n }\n\n s = 0;\n ch = 1;\n while (ch) {\n ch = 0;\n while (top - s >= 3 && too_straight(&stack[top - 2], &stack[top - 1], &stack[s], r))\n top--, ch = 1;\n while (top - s >= 3 && too_straight(&stack[top - 1], &stack[s], &stack[s + 1], r))\n s++, ch = 1;\n }\n memcpy(stack, stack + s, sizeof(stack[0]) * (top -= s));\n\n ans = area_polygon(stack, top);\n for (i = 0, j = 1 % top; i < top; i++, j = (j + 1) % top)\n ans += area_bow(r, dist(&stack[i], &stack[j]));\n printf(\"%.9lf\\n\", ans);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f7d37d2ad779a9a7fe20344edd8418d0", "src_uid": "5f2a0960bab9bdc91b190ed07d6adcf7", "difficulty": 3000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define N 100000\n#define EPS 1E-6\n\nint sign(double x) { \n return x < -EPS ? -1 : x > EPS; \n}\n\ndouble sqr(double x) { \n return x * x; \n}\n\ntypedef struct point {\n double x, y;\n} point;\n\ndouble dist(point a, point b) {\n return hypot(a.x - b.x, a.y - b.y);\n}\n\ndouble cross(point a, point b, point c) {\n return (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x);\n}\n\n/* PA * PB */\ndouble dot(point p, point a, point b) {\n return (a.x - p.x) * (b.x - p.x) + (a.y - p.y) * (b.y - p.y);\n}\n\n/* delta angle of ABC */\ndouble delta_angle(point a, point b, point c) {\n return acos(dot(b, a, c) / (dist(a, b) * dist(b, c)));\n}\n\npoint *__o;\n\nint angle_cmp(point *p, point *q) {\n int c;\n if (c = sign(cross(*__o, *p, *q)))\n return -c;\n return sign(dist(*p, *__o) - dist(*q, *__o));\n}\n\npoint stack[N];\n\nint convex_hull(point *ps, int n) {\n int i, k, top;\n point q;\n\n k = 0;\n for (i = 1; i < n; i++)\n if (sign(ps[i].y - ps[k].y) < 0 || sign(ps[i].y - ps[k].y) == 0 && ps[i].x < ps[k].x)\n k = i;\n\n q = ps[k];\n ps[k] = ps[0];\n ps[0] = q;\n\n __o = &ps[0];\n qsort(ps + 1, n - 1, sizeof(point), (int (*)(const void *, const void *))angle_cmp);\n\n top = 0;\n for (i = 0; i < n; i++) {\n// printf(\"%lf,%lf\\n\", ps[i].x, ps[i].y);\n while (top >= 2 && sign(cross(stack[top - 2], stack[top - 1], ps[i])) <= 0) top--;\n stack[top++] = ps[i];\n }\n memcpy(ps, stack, sizeof(point) * top);\n return top;\n}\n\ndouble cccr(point A, point B, point C) {\n double a, b, c, cos_B, sin_B, R;\n\n a = dist(B, C);\n b = dist(A, C);\n c = dist(A, B);\n cos_B = (a * a + c * c - b * b) / (2 * a * c);\n sin_B = sqrt(1.0 - cos_B * cos_B);\n return b / sin_B / 2.0;\n}\n\nint too_straight(point A, point B, point C, double r) {\n// printf(\"R=%lf vs r=%lf\\n\", R, r);\n return sign(dot(B, A, C)) < 0 && sign(cccr(A, B, C) - r) > 0;\n}\n\ndouble area_bow(double r, double l) {\n double tri = l * sqrt(sqr(r) - sqr(l / 2)) / 2;\n double theta = 2 * asin(l / (r + r));\n double sector = theta * r * r / 2;\n return sector - tri;\n}\n\ndouble area_polygon(const point a[], int n) {\n int i, j;\n double area = 0.0;\n for (j = 0, i = n - 1; j < n; i = j++)\n area += a[i].x * a[j].y - a[i].y * a[j].x;\n return fabs(area) / 2;\n}\n\nvoid die() {\n *(char *)NULL = 0;\n}\n\nint main() {\n static point ps[N];\n int n;\n double r;\n double ans, R, Rmin;\n int i, j, k, z, top, s, ch;\n\n scanf(\"%d %lf\", &n, &r);\n for (i = 0; i < n; i++)\n scanf(\"%lf %lf\", &ps[i].x, &ps[i].y);\n\n if (n == 1) {\n puts(\"0\");\n } else if (n == 2) {\n ans = area_bow(r, dist(ps[0], ps[1])) * 2.0;\n printf(\"%.9lf\\n\", ans);\n } else {\n n = convex_hull(ps, n);\n// printf(\"n=%d\\n\", n);\n\n top = 0;\n for (i = 0; i < n; i++) {\n while (top >= 2 && too_straight(stack[top - 2], stack[top - 1], ps[i], r))\n top--;\n stack[top++] = ps[i];\n }\n\n s = 0;\n ch = 1;\n while (ch) {\n ch = 0;\n while (top - s >= 3 && too_straight(stack[top - 2], stack[top - 1], stack[s], r))\n top--, ch = 1;\n while (top - s >= 3 && too_straight(stack[top - 1], stack[s], stack[s + 1], r))\n s++, ch = 1;\n }\n memcpy(stack, stack + s, sizeof(stack[0]) * (top -= s));\n// printf(\"top=%d\\n\", top);\n\n ans = area_polygon(stack, top);\n for (i = 0, j = 1 % top; i < top; i++, j = (j + 1) % top) {\n// printf(\"%lf,%lf\\n\", stack[i].x, stack[i].y);\n ans += area_bow(r, dist(stack[i], stack[j]));\n }\n printf(\"%.9lf\\n\", ans);\n\n if (top >= 3)\n for (i = 0, j = 1 % top, k = 2 % top; i < top; i++, j = (j + 1) % top, k = (k + 1) % top)\n if (too_straight(stack[i], stack[j], stack[k], r))\n die();\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "23eaaac23588719a91455e79ee4b5c00", "src_uid": "5f2a0960bab9bdc91b190ed07d6adcf7", "difficulty": 3000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define N 100000\n#define EPS 1E-6\n\nint sign(double x) { \n return x < -EPS ? -1 : x > EPS; \n}\n\ndouble sqr(double x) { \n return x * x; \n}\n\ntypedef struct point {\n double x, y;\n} point;\n\ndouble dist(const point *a, const point *b) {\n return hypot(a->x - b->x, a->y - b->y);\n}\n\ndouble cross(const point *a, const point *b, const point *c) {\n return (b->x - a->x) * (c->y - b->y) - (b->y - a->y) * (c->x - b->x);\n}\n\n/* PA * PB */\ndouble dot(const point *p, const point *a, const point *b) {\n return (a->x - p->x) * (b->x - p->x) + (a->y - p->y) * (b->y - p->y);\n}\n\nconst point *__o;\n\nint angle_cmp(const point *p, const point *q) {\n int c;\n if (c = sign(cross(__o, p, q)))\n return -c;\n return sign(dist(p, __o) - dist(q, __o));\n}\n\nint convex_hull(point ps[], int n) {\n static point stack[N];\n int i, k, top;\n point q;\n\n k = 0;\n for (i = 1; i < n; i++)\n if (sign(ps[i].y - ps[k].y) < 0 || sign(ps[i].y - ps[k].y) == 0 && ps[i].x < ps[k].x)\n k = i;\n\n q = ps[k];\n ps[k] = ps[0];\n ps[0] = q;\n\n __o = &ps[0];\n qsort(ps + 1, n - 1, sizeof(ps[0]), (int (*)(const void *, const void *))angle_cmp);\n\n top = 0;\n for (i = 0; i < n; i++) {\n while (top >= 2 && sign(cross(&stack[top - 2], &stack[top - 1], &ps[i])) <= 0) top--;\n stack[top++] = ps[i];\n }\n memcpy(ps, stack, sizeof(point) * top);\n return top;\n}\n\ndouble cccr(const point *A, const point *B, const point *C) {\n double a, b, c, cos_B, sin_B, R;\n\n a = dist(B, C);\n b = dist(A, C);\n c = dist(A, B);\n cos_B = (a * a + c * c - b * b) / (2 * a * c);\n sin_B = sqrt(1.0 - cos_B * cos_B);\n return b / sin_B / 2.0;\n}\n\nint too_straight(const point *A, const point *B, const point *C, double r) {\n return sign(dot(B, A, C)) < 0 && sign(cccr(A, B, C) - r) > 0;\n}\n\ndouble area_bow(double r, double l) {\n double tri = l * sqrt(sqr(r) - sqr(l / 2)) / 2;\n double theta = 2 * asin(l / (r + r));\n double sector = theta * r * r / 2;\n return sector - tri;\n}\n\ndouble area_polygon(point **a, int n) {\n int i, j;\n double area = 0.0;\n for (j = 0, i = n - 1; j < n; i = j++)\n area += a[i]->x * a[j]->y - a[i]->y * a[j]->x;\n return fabs(area) / 2;\n}\n\nint main() {\n static point ps[N];\n static point *stack[N];\n int n;\n double r;\n double ans, R, Rmin;\n int i, j, k, z, top, s, ch;\n\n scanf(\"%d %lf\", &n, &r);\n for (i = 0; i < n; i++)\n scanf(\"%lf %lf\", &ps[i].x, &ps[i].y);\n\n if (n == 1) {\n puts(\"0\");\n } else if (n == 2) {\n ans = area_bow(r, dist(&ps[0], &ps[1])) * 2.0;\n printf(\"%.9lf\\n\", ans);\n } else {\n n = convex_hull(ps, n);\n\n top = 0;\n for (i = 0; i < n; i++) {\n while (top >= 2 && too_straight(stack[top - 2], stack[top - 1], &ps[i], r))\n top--;\n stack[top++] = &ps[i];\n }\n\n s = 0;\n ch = 1;\n while (ch) {\n ch = 0;\n while (top - s >= 3 && too_straight(stack[top - 2], stack[top - 1], stack[s], r))\n top--, ch = 1;\n while (top - s >= 3 && too_straight(stack[top - 1], stack[s], stack[s + 1], r))\n s++, ch = 1;\n }\n memcpy(stack, stack + s, sizeof(stack[0]) * (top -= s));\n\n ans = area_polygon(stack, top);\n for (i = 0, j = 1 % top; i < top; i++, j = (j + 1) % top)\n ans += area_bow(r, dist(stack[i], stack[j]));\n printf(\"%.9lf\\n\", ans);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "856fb38ba6bb572ac4a8c3e5b2b9e384", "src_uid": "5f2a0960bab9bdc91b190ed07d6adcf7", "difficulty": 3000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define N 100000\n#define EPS 1E-6\n\nint sign(double x) { \n return x < -EPS ? -1 : x > EPS; \n}\n\ndouble sqr(double x) { \n return x * x; \n}\n\ntypedef struct point {\n double x, y;\n} point;\n\ndouble dist(point a, point b) {\n return hypot(a.x - b.x, a.y - b.y);\n}\n\ndouble cross(point a, point b, point c) {\n return (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x);\n}\n\n/* PA * PB */\ndouble dot(point p, point a, point b) {\n return (a.x - p.x) * (b.x - p.x) + (a.y - p.y) * (b.y - p.y);\n}\n\n/* delta angle of ABC */\ndouble delta_angle(point a, point b, point c) {\n return acos(dot(b, a, c) / (dist(a, b) * dist(b, c)));\n}\n\npoint *__o;\n\nint angle_cmp(point *p, point *q) {\n int c;\n if (c = sign(cross(*__o, *p, *q)))\n return -c;\n return sign(dist(*p, *__o) - dist(*q, *__o));\n}\n\npoint stack[N];\n\nint convex_hull(point *ps, int n) {\n int i, k, top;\n point q;\n\n k = 0;\n for (i = 1; i < n; i++)\n if (sign(ps[i].y - ps[k].y) < 0 || sign(ps[i].y - ps[k].y) == 0 && ps[i].x < ps[k].x)\n k = i;\n\n q = ps[k];\n ps[k] = ps[0];\n ps[0] = q;\n\n __o = &ps[0];\n qsort(ps + 1, n - 1, sizeof(point), (int (*)(const void *, const void *))angle_cmp);\n\n top = 0;\n for (i = 0; i < n; i++) {\n// printf(\"%lf,%lf\\n\", ps[i].x, ps[i].y);\n while (top >= 2 && sign(cross(stack[top - 2], stack[top - 1], ps[i])) <= 0) top--;\n stack[top++] = ps[i];\n }\n memcpy(ps, stack, sizeof(point) * top);\n return top;\n}\n\ndouble cccr(point A, point B, point C) {\n double a, b, c, cos_B, sin_B, R;\n\n a = dist(B, C);\n b = dist(A, C);\n c = dist(A, B);\n cos_B = (a * a + c * c - b * b) / (2 * a * c);\n sin_B = sqrt(1.0 - cos_B * cos_B);\n return b / sin_B / 2.0;\n}\n\nint too_straight(point A, point B, point C, double r) {\n if (!sign(cross(A, B, C)))\n return 1;\n \n// printf(\"R=%lf vs r=%lf\\n\", R, r);\n return sign(cccr(A, B, C) - r) > 0;\n}\n\ndouble area_bow(double r, double l) {\n double tri = l * sqrt(sqr(r) - sqr(l / 2)) / 2;\n double theta = 2 * asin(l / (r + r));\n double sector = theta * r * r / 2;\n return sector - tri;\n}\n\ndouble area_polygon(const point a[], int n) {\n int i, j;\n double area = 0.0;\n for (j = 0, i = n - 1; j < n; i = j++)\n area += a[i].x * a[j].y - a[i].y * a[j].x;\n return fabs(area) / 2;\n}\n\nint main() {\n static point ps[N];\n int n;\n double r, ans, R, Rmin;\n int i, j, k, z, top, s, ch;\n\n scanf(\"%d %lf\", &n, &r);\n for (i = 0; i < n; i++)\n scanf(\"%lf %lf\", &ps[i].x, &ps[i].y);\n\n if (n == 1) {\n puts(\"0\");\n } else if (n == 2) {\n ans = area_bow(r, dist(ps[0], ps[1])) * 2.0;\n printf(\"%.9lf\\n\", ans);\n } else {\n n = convex_hull(ps, n);\n// printf(\"n=%d\\n\", n);\n\n z = -1;\n for (i = 0, j = 1, k = 2 % n; i < n; i++, j = (j + 1) % n, k = (k + 1) % n) {\n R = cccr(ps[i], ps[j], ps[k]);\n if (z == -1 || Rmin > R) {\n Rmin = R;\n z = j;\n }\n }\n\n top = 0;\n for (j = 0, i = z; j < n; j++, i = (i + 1) % n) {\n// printf(\"%lf,%lf\\n\", ps[i].x, ps[i].y);\n while (top >= 2 && too_straight(stack[top - 2], stack[top - 1], ps[i], r))\n top--;\n stack[top++] = ps[i];\n }\n ch = 1;\n while (ch) {\n ch = 0;\n while (top - s >= 2 && too_straight(stack[top - 2], stack[top - 1], stack[s], r))\n top--, ch = 1;\n s = 0;\n while (top - s >= 2 && too_straight(stack[top - 1], stack[s], stack[s + 1], r))\n s++, ch = 1;\n }\n// printf(\"top=%d\\n\", top);\n\n memcpy(stack, stack + s, sizeof(stack[0]) * (top -= s));\n\n ans = area_polygon(stack, top);\n for (i = 0, j = 1 % top; i < top; i++, j = (j + 1) % top) {\n// printf(\"%lf,%lf\\n\", stack[i].x, stack[i].y);\n ans += area_bow(r, dist(stack[i], stack[j]));\n }\n printf(\"%.9lf\\n\", ans);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f34c9973b12c57eb0656c09e543a8028", "src_uid": "5f2a0960bab9bdc91b190ed07d6adcf7", "difficulty": 3000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "6eb98010107172f7d920ebf744bc571c", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "difficulty": 2000.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a3922fb52f05a5677417c87d4f66357b", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "difficulty": 2000.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c2d7ef77bd79df8a239549f54207b8af", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define modd 1000000007\nlong long fast_expo(long long a,long long b)\n{\n\tlong long res=1;\n\twhile(b>0)\n\t{\n\t\tif(b&1)\n\t\t\tres=(res*a)%modd;\n\t\ta=(a*a)%modd;\n\t\tb=b>>1;\n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long fact[200001];\n\tint i,n;\n\tfact[0]=1;\n\tfor(i=1;i<200001;i++)\n\t\tfact[i]=(fact[i-1]*i)%modd;\n\twhile(scanf(\"%d\",&n)==1)\n\t{\n\t\tlong long ans=(fact[(n<<1)-1]*((fast_expo(fact[n],modd-2)*fast_expo(fact[n-1],modd-2))%modd))%modd;\n\t\tans=(ans<<1)-n;\n\t\tif(ans<0)\n\t\t\tprintf(\"%I64d\\n\",(ans+modd)%modd);\n\t\telse printf(\"%I64d\\n\",ans%modd);\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e937f5acb646c77c4963f9fd8b252164", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define modd 1000000007\nlong long fast_expo(long long a,long long b)\n{\n\tlong long res=1;\n\twhile(b>0)\n\t{\n\t\tif(b&1)\n\t\t\tres=(res*a)%modd;\n\t\ta=(a*a)%modd;\n\t\tb=b>>1;\n\t}\n\treturn res;\n}\nint main()\n{\n\tlong fact[200001];\n\tint i,n;\n\tfact[0]=1;\n\tfor(i=1;i<200001;i++)\n\t\tfact[i]=(fact[i-1]*i)%modd;\n\twhile(scanf(\"%d\",&n)==1)\n\t{\n\t\tlong long ans=(fact[2*n-1]*((fast_expo(fact[n],modd-2)*fast_expo(fact[n-1],modd-2))%modd))%modd;\n\t\tans=(2*ans)-n;\n\t\tif(ans<0)\n\t\t\tprintf(\"%I64d\\n\",(ans+modd)%modd);\n\t\telse printf(\"%I64d\\n\",ans%modd);\n\t}\n\treturn 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6a1851fcb94bda192f737e0432b9bd26", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#define MAX 1000000007\nlong long int ncr(int n, int k)\n{\n if(k > n)\n return 0;\n if(k == n)\n return 1;\n long long int r = n;\n int i;\n for(i=2;i<=k;++i)\n {\n r *= (n-i+1);\n r = r/i;\n }\n return r;\n}\nint main()\n{\n int n,i, sum = 0, ans = 0;\n scanf(\"%d\", &n);\n sum = n+2;\n for(i = 1; i <=n; i++){\n ans = ans + ncr(n+1,i);\n }\n ans = (ans+n)%MAX;\n if(n == 2){\n ans = 4;\n }\n printf(\"%d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "02ec4b1f081548bf04849c2e47ea0916", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n#define P 1000000007\nint n,i,j;__int64 t=1,s;\nvoid main(){\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;++i)t=t*i%P;\n\tfor(j=P-3,s=t;j;j>>=1,s=s*s%P)\n\t\tif(j&1)t=t*s%P;\n\tfor(i=n;i\n#define P 1000000007\nint n,i,j;__int64 t=1,s;\nmain(){\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;++i)t=t*i%P;\n\tfor(j=P-3,s=t;j;j>>=1,s=s*s%P)\n\t\tif(j&1)t=t*s%P;\n\tfor(i=n;i\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n for(long r=1;r<=x;r++)\n {\n for(long c=1;c<=r;c++)\n long mul=r*c;\n if(mul>=x)\n {\n mul=10*(mul/x)+(mul%x);\n printf(\"%ld\",mul);\n }\n puts(\" \");\n \n }\n return 0;\n }\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "fb1b9abab9e7a914d734104d785fc7e4", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n for(long r=1;r=x)\n {\n mul=10*(mul/x)+(mul%x);\n }\n printf(\"%ld \",mul);\n }\n puts(\"\");\n \n }\n return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "43a152b0840edda453b6d18f308cf055", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n for(long r=1;r=x)\n {\n mul=10*(mul/x)+(mul%x);\n }\n printf(\"%ld\",mul);\n }\n puts(\"\");\n \n }\n return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "51aee3feb4bcc67375bd3521f875e1ca", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n for(long r=1;r<=x;r++)\n {\n for(long c=1;c<=r;c++)\n {\n long mul=r*c;\n if(mul>=x)\n {\n mul=10*(mul/x)+(mul%x);\n }\n printf(\"%ld\",mul);\n }\n puts(\"\");\n \n }\n return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a31a7e1602ae921fb935bf12c0a9e093", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n for(long r=1;r<=x;r++)\n {\n for(long c=1;c<=r;c++)\n {\n long mul=r*c;\n if(mul>=x)\n {\n mul=10*(mul/x)+(mul%x);\n }\n printf(\"%ld\",mul);\n }\n puts(\" \");\n \n }\n return 0;\n }\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7a1ed1427cb5d8baa8613be5e8d9f6ce", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "ca73d91bfb3f100d47cb60a258f28da6", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "02b3c5d2f989f951a242cdb2037eed45", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0ebff0c641dad74759270c85d89cb265", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e92eb296c93572242d7f1399de6d112f", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7db8be6334bb5e12f63da1e481b57fb5", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 102\n#define LIM 303\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nbool visited[MAX][MAX][LIM][2];\nint n, t, counter[1010], ar[MAX], dp[MAX][MAX][LIM][2];\n\nint F(int i, int l, int r, int flag){\n if (i > n){\n if (r == t || r == LIM){\n if (!flag) return (counter[ar[l]] * (t - r));\n else return 0;\n }\n else return F(0, l, r + 1, flag);\n }\n if (visited[i][l][r][flag]) return dp[i][l][r][flag];\n\n int x, res = F(i + 1, l, r, flag);\n if (ar[i] >= ar[l]){\n x = 1 + F(i + 1, i, r, flag);\n if (x > res) res = x;\n }\n if (!flag && t > LIM){\n x = F(i, l, r, 1) + (counter[ ar[l] ] * (t - LIM));\n if (x > res) res = x;\n }\n\n visited[i][l][r][flag] = true;\n return (dp[i][l][r][flag] = res);\n}\n\nint main(){\n int i, j, k;\n\n while (scanf(\"%d %d\", &n, &t) != EOF){\n if (!n) break;\n\n ar[0] = 0;\n clr(counter);\n for (i = 1; i <= n; i++){\n scanf(\"%d\", &ar[i]);\n counter[ar[i]]++;\n }\n\n clr(visited);\n int res = F(1, 0, 1, 0);\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "200552669bfd1b21b1c3f9b78f752cbb", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#define MAXN 23333\n#define MAXELEM 308\n\nint n, t;\nint a[MAXN];\n\n// Calculate the longest non-decreasing sequence\n// Time complexity: O(n log n)\nint *lnds(int *a, int n)\n{\n int *ret = (int *)malloc(n * sizeof(int));\n int a_with_f[MAXN], maxlen = 1;\n ret[0] = 1;\n a_with_f[0] = -1;\n a_with_f[1] = a[0];\n int lo, hi, mid, i;\n for (i = 1; i < n; ++i) {\n if (a[i] >= a_with_f[maxlen]) {\n a_with_f[++maxlen] = a[i];\n } else {\n lo = 0, hi = maxlen;\n while (lo < hi - 1) {\n mid = (lo + hi) / 2;\n if (a[i] >= a_with_f[mid]) lo = mid;\n else hi = mid;\n }\n a_with_f[lo + 1] = a[i];\n }\n ret[i] = maxlen;\n }\n return ret;\n}\n\nint main()\n{\n scanf(\"%d%d\", &n, &t);\n int i;\n for (i = 0; i < n; ++i) scanf(\"%d\", &a[i]);\n if (t <= 233) {\n for (i = n; i < n * t; i += n)\n memcpy(a + i, a, n * sizeof(int));\n int *first_part = lnds(a, n * t);\n printf(\"%d\\n\", first_part[n * t - 1]);\n } else {\n for (i = n; i < n * 233; i += n)\n memcpy(a + i, a, n * sizeof(int));\n int *first_part = lnds(a, n * 233);\n int count[MAXELEM] = { 0 }, maxcount = 0;\n for (i = 0; i < n; ++i) ++count[a[i]];\n for (i = 0; i < MAXELEM; ++i) if (maxcount < count[i]) maxcount = count[i];\n for (i = 0; i < n * 233; i += n)\n if (first_part[i + n] - first_part[i] == maxcount) break;\n i /= n;\n // assert(i == 1)?\n printf(\"%d\\n\", first_part[i * n + n - 1] + (t - i - 1) * maxcount);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0e0ce726b9f65de724259a7f5f309c66", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 102\n#define LIM 303\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nbool visited[MAX][MAX][LIM][2];\nint n, t, counter[1010], ar[MAX], dp[MAX][MAX][LIM][2];\n\nint F(int i, int l, int r, int flag){\n if (i > n){\n if (r == t || r == LIM){\n if (!flag) return (counter[ar[l]] * (t - r));\n else return 0;\n }\n else return F(0, l, r + 1, flag);\n }\n if (visited[i][l][r][flag]) return dp[i][l][r][flag];\n\n int x, res = F(i + 1, l, r, flag);\n if (ar[i] >= ar[l]){\n x = 1 + F(i + 1, i, r, flag);\n if (x > res) res = x;\n }\n if (!flag && t > LIM){\n x = F(i, l, r, 1) + (counter[l] * (t - LIM));\n if (x > res) res = x;\n }\n\n visited[i][l][r][flag] = true;\n return (dp[i][l][r][flag] = res);\n}\n\nint main(){\n int i, j, k;\n\n while (scanf(\"%d %d\", &n, &t) != EOF){\n if (!n) break;\n\n ar[0] = 0;\n clr(counter);\n for (i = 1; i <= n; i++){\n scanf(\"%d\", &ar[i]);\n counter[ar[i]]++;\n }\n\n clr(visited);\n int res = F(1, 0, 1, 0);\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7b564b1a970d723672cdaf59b30f71af", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define MAX 333\n\nint min(int x, int y) {\n return x < y ? x : y;\n}\n\nint a[MAX];\nint dp[MAX];\nint n;\n\nvoid update() {\n int i, j;\n for (i = 0; i < n; i++) {\n int ma = 0;\n for (j = 0; j <= a[i]; j++) {\n if (dp[j] > ma) ma = dp[j];\n }\n if (ma + 1 > dp[a[i]]) dp[a[i]] = ma + 1;\n }\n}\n \nint main() { \n int t, i;\n scanf(\"%d %d\", &n, &t);\n for (i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n } \n int time1 = min(MAX, t);\n int time3 = min(MAX, t - time1);\n int time2 = t - time1 - time2;\n for (i = 0; i < time1; i++) {\n update();\n }\n int ma = 0;\n if (time2 != 0) {\n for (i = 0; i < MAX; i++) {\n int cnt = 0;\n int j;\n for (j = 0; j < n; j++) if (a[j] == i) cnt++;\n if (dp[i] > ma) ma = dp[i];\n dp[i] = ma + cnt * time2; \n }\n }\n for (i = 0; i < time3; i++) {\n update();\n }\n int res = 0;\n for (i = 0; i < MAX; i++) if (dp[i] > res) res = dp[i];\n printf(\"%d\\n\", res);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "53e50c21fb7cc39ea94bdf8a3a2d78ba", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 1010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[MAX];\nbool visited[MAX];\n\nint main(){\n int i, j, k, l, x, y, pos, counter;\n\n while (scanf(\"%d\", &n) != EOF){\n clr(visited);\n for (i = 0; i < n; i++) scanf(\"%d\", &ar[i]);\n\n pos = 0, counter = 0;\n while (counter < n){\n if (!(pos & 1)){\n for (i = 0; i < n; i++){\n if (!visited[i] && counter >= ar[i]){\n counter++;\n visited[i] = true;\n }\n }\n }\n else{\n for (i = n - 1; i >= 0; i--){\n if (!visited[i] && counter >= ar[i]){\n counter++;\n visited[i] = true;\n }\n }\n }\n\n if (counter == n) break;\n pos++;\n }\n\n printf(\"%d\\n\", pos);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3ee3f0c99cbcd86fd7bf747224fd7f6f", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n long times,n,value,lvalue,ans,g,maxg=0,v[46],i,j,k;\n scanf(\"%ld%ld%ld\",×,&n,&value);\n for (i=1;i<=n;i++)\n scanf(\"%ld\",&v[i]);\n ans=0;\n for (i=1;i<=n;i++)\n ans+=v[i];\n for (i=0;i<=times;i++)\n if (value-ans*i>=0)\n {\n g=(n+1)*i;\n lvalue=value-ans*i;\n for (j=1;j=0)\n {\n g++;\n lvalue-=v[j];\n }\n else\n break;\n if (g>maxg)\n maxg=g;\n }\n else\n break;\n printf(\"%ld\\n\",maxg);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b8896144868f469f7110f262b3ae83fd", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n long times,n,value,lvalue,ans,g,maxg=0,v[46],i,j,k;\n scanf(\"%ld%ld%ld\",×,&n,&value);\n for (i=1;i<=n;i++)\n scanf(\"%ld\",&v[i]);\n for (i=1;iv[j])\n {\n k=v[i];\n v[i]=v[j];\n v[j]=k;\n }\n ans=0;\n for (i=1;i<=n;i++)\n ans+=v[i];\n for (i=0;i<=times;i++)\n if (value-ans*i>=0)\n {\n g=(n+1)*i;\n lvalue=value-ans*i;\n for (j=1;j=0)\n {\n g++;\n lvalue-=v[j];\n }\n else\n break;\n if (g>maxg)\n maxg=g;\n }\n else\n break;\n printf(\"%ld\\n\",maxg);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "37c1d93c84ee99a2cc0df0c993645388", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define me(x) memset(x,0,sizeof(x))\nlong n,a[105],p[16]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};\nlong dp[105][65536],ch[105][65536],va[60];\nlong ab(long x)\n{\n\treturn x>0?x:-x;\n}\nlong an[105];\nint main()\n{\n\tlong i,j,k;\n\tscanf(\"%ld\",&n);\n\tfor (i=1;i<=n;i++) scanf(\"%ld\",&a[i]);\n\tme(dp[0]);\n\tfor (i=1;i<=n;i++) for (j=0;j<65536;j++) dp[i][j]=99999999;\n\tfor (j=1;j<=58;j++)\n\t{\n\t\tva[j]=0;\n\t\tfor (i=0;i<16;i++) if (j%p[i]==0) va[j]+=1<dp[i][j]+ab(k-a[i+1]))\n\t\t{\n\t\t\tdp[i+1][j|va[k]]=dp[i][j]+ab(k-a[i+1]);\n\t\t\tch[i+1][j|va[k]]=k;\n\t\t}\n\t}\n\tj=65535;\n\tfor (i=n;i>0;i--)\n\t{\n\t\tan[i]=ch[i][j];\n\t\tj^=va[ch[i][j]];\n\t}\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tprintf(\"%ld\",an[i]);\n\t\tif (i!=n) printf(\" \");\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b51ce7165e3a56341c0c873e24adedba", "src_uid": "f26c74f27bbc723efd69c38ad0e523c6", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\n#define N\t100\n#define INF\t2901\n\nint pp[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53 };\n\nint max(int a, int b) { return a > b ? a : b; }\n\nint main() {\n\tstatic int aa[N], qq[N], bb[59], dp[N + 1][1 << 16], cc[N + 1][1 << 16];\n\tint n, h, i, a, b, b_, c, cnt;\n\n\tfor (a = 2; a < 59; a++)\n\t\tfor (h = 0; h < 16; h++)\n\t\t\tif (a % pp[h] == 0)\n\t\t\t\tbb[a] |= 1 << h;\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (i = 0; i <= n; i++)\n\t\tfor (b = 0; b < 1 << 16; b++)\n\t\t\tdp[i][b] = INF;\n\tdp[0][0] = 0;\n\tfor (i = 0; i < n; i++) {\n\t\ta = max(aa[i] * 2 - 2, 1);\n\t\tfor (b = 0; b < 1 << 16; b++) {\n\t\t\tint x = dp[i][b];\n\n\t\t\tif (x == INF)\n\t\t\t\tcontinue;\n\t\t\tfor (c = 1; c <= a; c++)\n\t\t\t\tif ((bb[c] & b) == 0) {\n\t\t\t\t\tint x_ = x + abs(c - aa[i]);\n\n\t\t\t\t\tb_ = bb[c] | b;\n\t\t\t\t\tif (dp[i + 1][b_] > x_) {\n\t\t\t\t\t\tdp[i + 1][b_] = x_;\n\t\t\t\t\t\tcc[i + 1][b_] = c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t}\n\tb_ = 0;\n\tfor (b = 1; b < 1 << 16; b++)\n\t\tif (dp[n][b_] > dp[n][b])\n\t\t\tb_ = b;\n\tcnt = 0;\n\tfor (i = n; i > 0; i--) {\n\t\tc = cc[i][b_];\n\t\tqq[cnt++] = c;\n\t\tb_ ^= bb[c];\n\t}\n\twhile (cnt--)\n\t\tprintf(\"%d \", qq[cnt]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "853eda051448987c419e6875b225ba89", "src_uid": "f26c74f27bbc723efd69c38ad0e523c6", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define len 17\n#define inf (1 << 25)\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint factors[65] = {0};\nbool visited[100][1 << len];\nint n, ar[100], harmony[100], dp[100][1 << len], next[100][1 << len];\nint primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};\n\nvoid backtrack(int i, int bitmask){\n if (i == n) return;\n harmony[i] = next[i][bitmask];\n backtrack(i + 1, bitmask | factors[harmony[i]]);\n}\n\nint F(int i, int bitmask){\n if (i == n) return 0;\n if (visited[i][bitmask]) return dp[i][bitmask];\n\n int j, res = inf;\n for (j = 1; j <= 60; j++){\n if (!(bitmask & factors[j])){\n int x = abs(ar[i] - j) + F(i + 1, bitmask | factors[j]);\n if (x < res){\n res = x;\n next[i][bitmask] = j;\n }\n }\n }\n\n visited[i][bitmask] = true;\n return (dp[i][bitmask] = res);\n}\n\nint main(){\n int i, j;\n for (i = 1; i <= 60; i++){\n for (j = 0; j < len; j++){\n if ((i % primes[j]) == 0) factors[i] |= (1 << j);\n }\n }\n\n while (scanf(\"%d\", &n) != EOF){\n for (i = 0; i < n; i++) scanf(\"%d\", &ar[i]);\n clr(visited);\n int res = F(0, 0);\n backtrack(0, 0);\n for (i = 0; i < n; i++) printf(\"%d \", harmony[i]);\n puts(\"\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e2c3e7128815408d721d0a05203d1b3a", "src_uid": "f26c74f27bbc723efd69c38ad0e523c6", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define inf (1 << 25)\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint factors[60] = {0};\nbool visited[32][1 << 17];\nint n, ar[32], harmony[32], dp[32][1 << 17], next[32][1 << 17];\nint primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};\n\nvoid backtrack(int i, int bitmask){\n if (i == n) return;\n harmony[i] = next[i][bitmask];\n backtrack(i + 1, bitmask | factors[harmony[i]]);\n}\n\nint F(int i, int bitmask){\n if (i == n) return 0;\n if (visited[i][bitmask]) return dp[i][bitmask];\n\n int j, res = inf;\n for (j = 1; j <= 60; j++){\n if (!(bitmask & factors[j])){\n int x = abs(ar[i] - j) + F(i + 1, bitmask | factors[j]);\n if (x < res){\n res = x;\n next[i][bitmask] = j;\n }\n }\n }\n\n visited[i][bitmask] = true;\n return (dp[i][bitmask] = res);\n}\n\nint main(){\n int i, j;\n for (i = 1; i <= 60; i++){\n for (j = 0; j < 17; j++){\n if ((i % primes[j]) == 0) factors[i] |= (1 << j);\n }\n }\n\n while (scanf(\"%d\", &n) != EOF){\n for (i = 0; i < n; i++) scanf(\"%d\", &ar[i]);\n clr(visited);\n int res = F(0, 0);\n backtrack(0, 0);\n for (i = 0; i < n; i++) printf(\"%d \", harmony[i]);\n puts(\"\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "630a99c0b35f0d0820383e737e936a4a", "src_uid": "f26c74f27bbc723efd69c38ad0e523c6", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define inf (1 << 25)\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint factors[65] = {0};\nbool visited[32][1 << 17];\nint n, ar[32], harmony[32], dp[32][1 << 17], next[32][1 << 17];\nint primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};\n\nvoid backtrack(int i, int bitmask){\n if (i == n) return;\n harmony[i] = next[i][bitmask];\n backtrack(i + 1, bitmask | factors[harmony[i]]);\n}\n\nint F(int i, int bitmask){\n if (i == n) return 0;\n if (visited[i][bitmask]) return dp[i][bitmask];\n\n int j, res = inf;\n for (j = 1; j <= 60; j++){\n if (!(bitmask & factors[j])){\n int x = abs(ar[i] - j) + F(i + 1, bitmask | factors[j]);\n if (x < res){\n res = x;\n next[i][bitmask] = j;\n }\n }\n }\n\n visited[i][bitmask] = true;\n return (dp[i][bitmask] = res);\n}\n\nint main(){\n int i, j;\n for (i = 1; i <= 60; i++){\n for (j = 0; j < 17; j++){\n if ((i % primes[j]) == 0) factors[i] |= (1 << j);\n }\n }\n\n while (scanf(\"%d\", &n) != EOF){\n for (i = 0; i < n; i++) scanf(\"%d\", &ar[i]);\n clr(visited);\n int res = F(0, 0);\n backtrack(0, 0);\n for (i = 0; i < n; i++) printf(\"%d \", harmony[i]);\n puts(\"\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2fbe7d5b3aeb0bbba96fa7cb7ba879da", "src_uid": "f26c74f27bbc723efd69c38ad0e523c6", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n long long n;\n scanf(\"%lld\", &n);\n printf(\"%lld\\n\", (9*n-3)<<(2*n-6));\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b78f3f2c77442d60e1f1b15ee4607f5d", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \nunsigned long long power(unsigned long long, unsigned long long);\nint main()\n{\n unsigned long long no_of_parking_positions, no_of_arrangements, four_power_n_minus_3;\n scanf(\"%I64u\",&no_of_parking_positions);\n\n four_power_n_minus_3 = power(4, no_of_parking_positions - 3);\n\n no_of_arrangements = 6*(four_power_n_minus_3 * 4) + (no_of_parking_positions - 3)*9*(four_power_n_minus_3);\n printf(\"%I64u\",no_of_arrangements);\n return 0;\n}\n\nunsigned long long power(unsigned long long base, unsigned long long exponent)\n{\n unsigned long long answer = 1;\n\n if(exponent == 0)\n {\n return answer;\n }\n\n //Binary exponentiation algorithm. Number is squared as many times as the number of 0s in binary representation. x^5 = (x^2)^2*x\n while(exponent > 0)\n {\n if(exponent%2 == 1)\n {\n answer = answer*base;\n }\n base = base*base;\n exponent = exponent >> 1;\n }\n return answer;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6920ae649f5a0013810cb6edb74405bb", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tn=4*(2*3*pow(4LL,n-3LL)+(n-3LL)*3*3*pow(4LL,n-4LL));\n\tprintf(\"%lld\\n\",n);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c4addfa79b3da2702db6e8eae41c330", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include\nint main (){\nlong long int n;\n\tscanf(\"%lld\",&n);\n\tn=4*(2*3*pow(4LL,n-3LL)+(n-3LL)*3*3*pow(4LL,n-4LL));\n\tprintf(\"%lld\\n\",n);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c16a895acab8e1ee31f92551a5a3f242", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nlong long int power(long long int a,long long int b)\n{ \n long long int res=1;\n while(b!=0)\n {\n if(b&1)\n res=res*a;\n a=a*a;\n b=b/2;\n }\n return res;\n}\nint main()\n{long long int n;\n scanf(\"%lld\",&n);\n long long int res=power(3,n-2)\n res=res*2;\n res=res*4;\n printf(\"%lld\\n\",res);\n \n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "26289be553b22e9f887a1901757df535", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, m, i;\n double p = 0, q = 0;\n \n scanf(\"%d\", &n);\n \n m = 4 * (n - 1) + 5;\n \n printf(\"%d\\n\", m);\n \n for (i = 0; i < n; i++) {\n if (i == 0) printf(\"%.12lf %.12lf\\n\", p, q);\n \n printf(\"%.12lf %.12lf\\n\", p + 10 * sqrt(3), q);\n printf(\"%.12lf %.12lf\\n\", p + 5 * sqrt(3), q + 5);\n printf(\"%.12lf %.12lf\\n\", p + 5, -5 * sqrt(3));\n printf(\"%.12lf %.12lf\\n\", p + 10 * sqrt(3) - 5, -5 * sqrt(3));\n \n p += 10 * sqrt(3);\n }\n \n for (i = 0; i < n; i++) {\n if (i == 0) {\n printf(\"1\");\n } else {\n printf(\"%d\", i * 4 - 2);\n }\n \n printf(\" %d %d %d %d\\n\", i * 4 + 2, i * 4 + 3, i * 4 + 4, i * 4 + 5);\n }\n \n printf(\"1\");\n \n for (i = 0; i < n; i++) printf(\" %d\", i * 4 + 2);\n \n for (i = n - 1; i >= 0; i--) {\n printf(\" %d %d %d\", i * 4 + 4, i * 4 + 3, i * 4 + 5);\n \n if (i == 0) {\n printf(\" 1\");\n } else {\n printf(\" %d\", i * 4 - 2);\n }\n }\n \n puts(\"\");\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dbf6d6f99ee68aaa7d1b55bbcdb867a1", "src_uid": "db263b866e93e3a97731e11102923902", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\ndouble PI;\n\nint main() {\n\tstatic double xx[4], yy[4];\n\tint n, h, i;\n\tdouble a, ca, sa, c2a, s2a;\n\n\tPI = acos(-1);\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", 1 + n * 4);\n\ta = PI * 2 / 5;\n\tca = cos(a), sa = sin(a);\n\tc2a = cos(a * 2), s2a = sin(a * 2);\n\txx[0] = -ca, yy[0] = sa;\n\txx[1] = 1 + ca + c2a, yy[1] = sa + s2a;\n\txx[2] = ca, yy[2] = sa;\n\txx[3] = 1, yy[3] = 0;\n\tprintf(\"0 0\\n\");\n\tfor (i = 0; i < n; i++)\n\t\tfor (h = 0; h < 4; h++) {\n\t\t\tdouble x = (xx[h] + i) * 10;\n\t\t\tdouble y = yy[h] * (i % 2 == 0 ? 10 : -10);\n\n\t\t\tprintf(\"%.8f %.8f\\n\", x, y);\n\t\t}\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\"%d %d %d %d %d\\n\", i * 4 + 1, i * 4 + 2, i * 4 + 3, i * 4 + 4, i * 4 + 5);\n\tprintf(\"1\");\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\" %d %d\", i * 4 + 3, i * 4 + 5);\n\tfor (i = n - 1; i >= 0; i--)\n\t\tprintf(\" %d %d %d\", i * 4 + 2, i * 4 + 4, i * 4 + 1);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "17b4f7ac9c2898275872a0a096af6862", "src_uid": "db263b866e93e3a97731e11102923902", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\ndouble PI;\n\nint main() {\n\tstatic double xx[4], yy[4];\n\tint n, h, i;\n\tdouble a, ca, sa, c2a, s2a;\n\n\tPI = acos(-1);\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", 1 + n * 4);\n\ta = PI * 2 / 5;\n\tca = cos(a), sa = sin(a);\n\tc2a = cos(a * 2), s2a = sin(a * 2);\n\txx[0] = -ca, yy[0] = sa;\n\txx[1] = 1 + ca + c2a, yy[1] = sa + s2a;\n\txx[2] = 1 + ca, yy[2] = sa;\n\txx[3] = 1, yy[3] = 0;\n\tprintf(\"%.9f %.9f\\n\", 0.0, 0.0);\n\tfor (i = 0; i < n; i++)\n\t\tfor (h = 0; h < 4; h++) {\n\t\t\tdouble x = (xx[h] + i) * 10;\n\t\t\tdouble y = yy[h] * (i % 2 == 0 ? 10 : -10);\n\n\t\t\tprintf(\"%.9f %.9f\\n\", x, y);\n\t\t}\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\"%d %d %d %d %d\\n\", i * 4 + 1, i * 4 + 2, i * 4 + 3, i * 4 + 4, i * 4 + 5);\n\tprintf(\"1\");\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\" %d %d\", i * 4 + 3, i * 4 + 5);\n\tfor (i = n - 1; i >= 0; i--)\n\t\tprintf(\" %d %d %d\", i * 4 + 2, i * 4 + 4, i * 4 + 1);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "53103f3a65aeded52c0c139f6a20b283", "src_uid": "db263b866e93e3a97731e11102923902", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, m, i;\n double p = 0, q = 0;\n double pi = acos(-1);\n double x = (1 + sqrt(5)) / 2;\n \n scanf(\"%d\", &n);\n \n m = 4 * (n - 1) + 5;\n \n printf(\"%d\\n\", m);\n \n for (i = 0; i < n; i++) {\n if (i == 0) printf(\"%.12lf %.12lf\\n\", p, q);\n \n printf(\"%.12lf %.12lf\\n\", p + 10 * x, q);\n printf(\"%.12lf %.12lf\\n\", p + 5 * x, 10 * cos(54 * pi / 180));\n printf(\"%.12lf %.12lf\\n\", p + 10 * cos(72 * pi / 180), -10 * sin(72 * pi / 180));\n printf(\"%.12lf %.12lf\\n\", p + 10 * x - 10 * cos(72 * pi / 180), -10 * sin(72 * pi / 180));\n \n p += 10 * x;\n }\n \n for (i = 0; i < n; i++) {\n if (i == 0) {\n printf(\"1\");\n } else {\n printf(\"%d\", i * 4 - 2);\n }\n \n printf(\" %d %d %d %d\\n\", i * 4 + 4, i * 4 + 5, i * 4 + 2, i * 4 + 3);\n }\n \n printf(\"1\");\n \n for (i = 0; i < n; i++) printf(\" %d\", i * 4 + 2);\n \n for (i = n - 1; i >= 0; i--) {\n printf(\" %d %d %d\", i * 4 + 4, i * 4 + 3, i * 4 + 5);\n \n if (i == 0) {\n printf(\" 1\");\n } else {\n printf(\" %d\", i * 4 - 2);\n }\n }\n \n puts(\"\");\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "46881eb98679d15b305003462742b14e", "src_uid": "db263b866e93e3a97731e11102923902", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main()\n{\n int n, m, i;\n double p = 0, q = 0;\n double pi = acos(-1);\n double x = (1 + sqrt(5)) / 2;\n \n scanf(\"%d\", &n);\n \n m = 4 * (n - 1) + 5;\n \n printf(\"%d\\n\", m);\n \n for (i = 0; i < n; i++) {\n if (i == 0) printf(\"%.12lf %.12lf\\n\", p, q);\n \n printf(\"%.12lf %.12lf\\n\", p + 10 * x, q);\n printf(\"%.12lf %.12lf\\n\", p + 5 * x, 10 * cos(54 * pi / 180));\n printf(\"%.12lf %.12lf\\n\", p + 10 * cos(72 * pi / 180), -10 * sin(72 * pi / 180));\n printf(\"%.12lf %.12lf\\n\", p + 10 * x - 10 * cos(72 * pi / 180), -10 * sin(72 * pi / 180));\n \n p += 10 * x;\n }\n \n for (i = 0; i < n; i++) {\n if (i == 0) {\n printf(\"1\");\n } else {\n printf(\"%d\", i * 4 - 2);\n }\n \n printf(\" %d %d %d %d\\n\", i * 4 + 4, i * 4 + 5, i * 4 + 2, i * 4 + 3);\n }\n \n printf(\"1\");\n \n for (i = 0; i < n; i++) printf(\" %d\", i * 4 + 2);\n \n for (i = n - 1; i >= 0; i--) {\n printf(\" %d %d %d\", i * 4 + 4, i * 4 + 3, i * 4 + 5);\n \n if (i == 0) {\n printf(\" 1\");\n } else {\n printf(\" %d\", i * 4 - 2);\n }\n }\n \n puts(\"\");\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "84909c404157298f2902b2a2a4cf35ce", "src_uid": "db263b866e93e3a97731e11102923902", "difficulty": 2300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1a26704b37a169f8fc55586a292bd7b", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "difficulty": 2100.0} {"lang": "GNU C", "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#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", "lang_cluster": "C", "compilation_error": false, "code_uid": "5a94388f7dbf652ed066205d86576bd0", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "difficulty": 2100.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2ca38f53db30e646db7b1f2961abb800", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \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", "lang_cluster": "C", "compilation_error": false, "code_uid": "3028eab99d0f8b488ee07c34d14fad54", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#define __STDC_FORMAT_MACROS\n#include \n\n// if we write f(x) = Sum([0,n+1], bi * x^i) and q(x) = Sum([0,n], ai * x^i) and then so multiplication and equate left and right sides:\n// b[n+1] = a[n]\n// b[i] = K*a[i] + a[i-1]\n// b[0] = K*a[0] + P\n// from here it is easy to see that all ai should be integer (going n+1 -> 0 and knowing that bi are integers)\n\n\n// TODO: ???\n#define MAX_D 5000\nstatic int64_t _a[MAX_D+2] = {}, _b[MAX_D+2] = {};\n\n\nint main() {\n int64_t P,K; scanf(\"%\" PRId64 \" %\" PRId64 \"\\n\", &P,&K);\n\n // offset, to include P as a[-1]\n _a[0] = P; int D = 0;\n for( ; D <= MAX_D ; ++D) {\n // b[i] = K*a[i] + a[i-1] < K\n // say, a[i-1] = x*K+y (y < K), then we can write\n // b[i] = K*(a[i] + x) + y < K, and from there a[i] = -x, and b[i] = y\n // NB we want non-c modulo, but math (where rem is non-negative)\n int64_t x = _a[D] / K, y = _a[D] % K;\n if(y < 0) { y += K, --x; }\n _a[D+1] = -x, _b[D] = y;\n // TODO:\n if(_a[D] == 0) break;\n }\n\n printf(\"%d\\n\", D);\n for(int i = 0 ; i < D ; ++i) printf(\"%\" PRId64 \" \", _b[i]);\n printf(\"\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0cb25a59554a13b97bb47bceb4c5e9c", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#define __STDC_FORMAT_MACROS\n#include \n\n// if we write f(x) = Sum([0,n+1], bi * x^i) and q(x) = Sum([0,n], ai * x^i) and then so multiplication and equate left and right sides:\n// b[n+1] = a[n]\n// b[i] = K*a[i] + a[i-1]\n// b[0] = K*a[0] + P\n// from here it is easy to see that all ai should be integer (going n+1 -> 0 and knowing that bi are integers)\n\n\n// TODO: ???\n#define MAX_D 5000\nstatic int64_t _a[MAX_D+2] = {}, _b[MAX_D+2] = {};\n\n\nint main() {\n int64_t P,K; scanf(\"%\" PRId64 \" %\" PRId64 \"\\n\", &P,&K);\n\n // offset, to include P as a[-1]\n _a[0] = P; int D = 0;\n for( ; D <= MAX_D ; ++D) {\n // b[i] = K*a[i] + a[i-1] < K\n // say, a[i-1] = x*K+y (y < K), then we can write\n // b[i] = K*(a[i] + x) + y < K, and from there a[i] = -x, and b[i] = y\n // NB we want non-c modulo, but math (where rem is non-negative)\n int64_t x = _a[D] / K, y = _a[D] % K;\n if(y < 0) { y += K, --x; }\n _a[D+1] = -x, _b[D] = y;\n // TODO:\n if(_a[D] == 0) break;\n }\n\n printf(\"%d\\n\", D);\n for(int i = 0 ; i < D ; ++i) printf(\"%\" PRId64 \" \", _b[i]);\n printf(\"\\n\");\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d0069f7bfa04282c10a8fc063d6c2ee0", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include\n#define MX 1000\nlong long int p,k,k1=1,sm,A[MX];\nint main(){\n int i,j,sz;\n long long int ims;\n //freopen(\"input.txt\",\"r\",stdin);\n //freopen(\"output.txt\",\"w\",stdout);\n scanf(\"%lld%lld\",&p,&k);\n for(sz=0;;sz+=2){\n ims=p%(k*k);\n p=p/(k*k);\n if(ims>=k){\n p++;\n A[sz]=ims%k;\n A[sz+1]=k-(ims/k);\n }\n else{\n A[sz]=ims;\n }\n if(p==0){break;}\n }\n printf(\"%d\\n\",sz+1);\n for(i=0;i<=sz;i++){\n printf(\"%lld \",A[i]);\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bb58609069f6a6cc7bd0f1e13f11ae74", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#import\n#define swap(a,b) (a)^=(b)^=(a)^=(b)\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)<(b)?(a):(b))\nlong long gcd(long long a,long long b) {return !b?a:gcd(b,a%b);}\nint main()\n{\n\tlong long l1,r1,t1,l2,r2,t2;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&l1,&r1,&t1,&l2,&r2,&t2);\n\tif (l1>l2) swap(l1,l2),swap(r1,r2),wwap(t1,t2);\n\tlong long k=gcd(t1,t2),p,ans=0;\n\tp=(l2-l1)/k;l1+=k*p,r1+=k*p;\n\tans=max(ans,(min(r1,r2)-max(l1,l2))+1);\n\tl1+=k,r1+=k;\n\tans=max(ans,(min(r1,r2)-max(l1,l2))+1);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9189f2316170cdde5aefc33fd9795b65", "src_uid": "faa75751c05c3ff919ddd148c6784910", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#import\n#define swap(a,b) (a)^=(b)^=(a)^=(b)\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)<(b)?(a):(b))\nlong long gcd(long long a,long long b) {return !b?a:gcd(b,a%b);}\nint main()\n{\n\tlong long l1,r1,t1,l2,r2,t2;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&l1,&r1,&t1,&l2,&r2,&t2);\n\tif (l1>l2) swap(l1,l2),swap(r1,r2),swap(t1,t2);\n\tlong long k=gcd(t1,t2),p,ans=0;\n\tp=(l2-l1)/k;l1+=k*p,r1+=k*p;\n\tans=max(ans,(min(r1,r2)-max(l1,l2))+1);\n\tl1+=k,r1+=k;\n\tans=max(ans,(min(r1,r2)-max(l1,l2))+1);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "455482b7676c1f6d1974359a06176b7c", "src_uid": "faa75751c05c3ff919ddd148c6784910", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "51c13f72da35ec72d2d4da881a9695b8", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8bbc890a8dfb6a14fc6d77e1d6319d3f", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "38de87505a792dfa386fe2b06ca496be", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8896f2b45a7ad6b178249e9b510f250f", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a9158f0abad440f34556b61a7d845bab", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0} {"lang": "GNU C", "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\n#define N\t20\n#define MD\t1000000007\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[N];\n\nvoid init() {\n\tint k;\n\n\tfor (k = 1; k < N; k++) {\n\t\tgcd_(k, MD);\n\t\tif (x_ < 0)\n\t\t\tx_ += MD;\n\t\tinv[k] = x_;\n\t}\n}\n\nlong long ch(long long n, int k) {\n\treturn k == 0 ? 1 : ch(n - 1, k - 1) * (n % MD) % MD * inv[k] % MD;\n}\n\nint main() {\n\tstatic long long ff[N];\n\tint n, b, i, ans;\n\tlong long s;\n\n\tinit();\n\tscanf(\"%d%lld\", &n, &s);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%lld\", &ff[i]);\n\tans = 0;\n\tfor (b = 0; b < 1 << n; b++) {\n\t\tlong long t;\n\t\tint k;\n\n\t\tt = s;\n\t\tk = 0;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif (b & 1 << i) {\n\t\t\t\tk++;\n\t\t\t\tt -= ff[i] + 1;\n\t\t\t}\n\t\tif (t >= 0) {\n\t\t\tint cnt = ch(t + n - 1, n - 1);\n\n\t\t\tans = (ans + (k % 2 == 0 ? cnt : -cnt)) % MD;\n\t\t}\n\t}\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d5186eab2b5d76fdc45fd4b187a27e35", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include\nlong long f[23],n,s,sum,inv[25];\nint c[23];\nint function(){\n\tint i,t1,j=0;\n\ti=1;\n\t\n\twhile(1){\n\t\tif(c[i]==0){\n\t\t\tc[i]=1;\n\t\t\tbreak;\n\t\t}else{\n\t\t\tc[i]=0;\n\t\t\ti++;\n\t\t}\n\t}\n}\t\n\nlong long power(long long a, long long b, long long MOD) {\nlong long x = 1, y = a; \n while(b > 0) {\n if(b%2 == 1) {\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 }\n return x;\n}\n \nlong long modInverse(long long a,long long m) {\nif(inv[a]==0)\n inv[a]=power(a,m-2,m);\n return inv[a];\n}\n\nlong long binomialCoeff(long long n, long long k)\n{\n long long i,res = 1;\n if (k >( n - k))\n k = n - k;\t\n for ( i = 0; i < k; ++i)\n {\n res =(res* ((n - i)%1000000007))%1000000007;\n res =(res* modInverse((i + 1),1000000007))%1000000007;\n }\n\n return res;\n}\nvoid recursion(int i,long long pow,int fac){\n\tint j;\n\ti=0;\n\twhile(1){\n\t\tfac=1;\n\t\tj=0;\n\t\tpow=0;\n\t\tfor(i=1;i<=n;i++){\n\t\t\tpow=pow+c[i]*(f[i]+1);\n\t\t\tif(c[i]==1){\tfac=fac*-1;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t\tif(pow<=s){\t\t\t\t\n\t\t\tsum=(sum+fac*binomialCoeff(n+s-pow-1,s-pow))%1000000007;\n\t\t}\n\t\tif(j==n)\tbreak;\n\t\tfunction();\n\t}\n}\n\nint main(){\n\tlong long i,j,k,l;\n\tscanf(\"%lld %lld\",&n,&s);\n\tfor(i=1;i<=n;i++)\tscanf(\"%lld\",&f[i]);\n\trecursion(1,0,1);\n\tsum=(sum+1000000007)%1000000007;\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1ee0474144561609efee3d288687902", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "\n#include\n#include\n#include\n\ntypedef long long int lli;\ntypedef struct bst bst;\n\n#define TRUE (1==1)\n#define FALSE (!(TRUE))\n#define in32(x) scanf(\"%d\", &(x))\n#define in64(x) scanf(\"%I64d\", &(x))\n#define instr(x) scanf(\"%s\", (x))\n#define out32(x) printf(\"%d\\n\", (x))\n#define out64(x) printf(\"%I64d\\n\", (x))\n#define outstr(x) printf(\"%s\\n\", (x))\n#define sigNUM(x) (((x)==0)?0:(((x)<0)?-1:1))\n#define max(a,b) ((a)<(b))?(b):(a)\n#define min(a,b) ((a)>(b))?(b):(a)\n#define abs(a) ((a)<0)?(-(a)):(a)\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\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 \nint comp(lli f, lli s) {\n return sigNUM(f - s);\n}\n\nvoid sort(lli * arr, int size) { // CHANGE THIS\n int i;\n if (size < 6) {\n int nSize = 0;\n while (size != 0) {\n nSize = 0;\n for (i = 0; i < size - 1; i++) \n if (comp(arr[i], arr[i + 1]) > 0) { // CHANGE THIS\n nSize = i + 1;\n lli tmp = arr[i];\n arr[i] = arr[i + 1];\n arr[i+1] = tmp;\n }\n size = nSize;\n }\n return;\n }\n lli * tmp = (lli *)calloc(size, sizeof(lli)); // 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], arr[lSize + rPtr]) <= 0) // CHANGE THIS\n tmp[ptr] = arr[lPtr++];\n else\n tmp[ptr] = arr[lSize + (rPtr++)];\n ptr++;\n }\n for (i = 0; i < size; i++)\n arr[i] = tmp[i];\n free(tmp);\n}\n \n#define MAX 25\n#define MOD 1000000007\n\nlli invert(lli a) {\n if (a == 0)\n return 1;\n if (a == 1)\n return 1;\n return MOD - ((MOD / a) * invert(MOD % a)) % MOD;\n}\n\n\nint main(void) {\n lli n, a[MAX], i, j, s, s2, inv = 1, ans = 0, tans, mult;\n in64(n);\n in64(s);\n fo3(i,0,n-1) {\n in64(a[i]);\n inv *= invert(i);\n inv %= MOD;\n }\n fo3(i,0,(1<\n#include \n\ntypedef long long int ll;\nconst ll Mod=1000000000+7;\nll n,s,f[22],inv[22],c[22];\n\n\nll Pow(ll a,ll b)//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n{\n ll ans=1;\n while(b)\n {\n if(b&1)\n ans=(ans*a)%Mod;\n a=(a*a)%Mod;\n b>>=1;\n }\n return ans;\n}\n\nll C(ll a,ll b)//\ufffd\ufffd\ufffd\ufffd\ufffd\n{\n if(aa-b)\n b=a-b;\n ll s1,s2,i;\n s1=s2=1;\n for(i=0;i\nlong long f[23],n,s,sum;\nint c[23];\nvoid function(){\n\tint i,t1;\n\ti=1;\n\twhile(1){\n\t\tif(c[i]==0){\n\t\t\tc[i]=1;\n\t\t\tbreak;\n\t\t}else{\n\t\t\tc[i]=0;\n\t\t\ti++;\n\t\t}\n\t}\n}\t\n\nlong long power(long long a, long long b, long long MOD) {\nlong long x = 1, y = a; \n while(b > 0) {\n if(b%2 == 1) {\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 }\n return x;\n}\n \nlong long modInverse(long long a,long long m) {\n return power(a,m-2,m);\n}\n\nlong long binomialCoeff(long long n, long long k)\n{\n long long i,res = 1;\n if (k >( n - k))\n k = n - k;\t\n for ( i = 0; i < k; ++i)\n {\n res =(res* ((n - i)%1000000007))%1000000007;\n res =(res* modInverse((i + 1),1000000007))%1000000007;\n }\n\n return res;\n}\nvoid recursion(int i,long long pow,int fac){\n\tint j;\n\ti=0;\n\twhile(1){\n\t\tfac=1;\n\t\tj=0;\n\t\tpow=0;\n\t\tfor(i=1;i<=n;i++){\n\t\t\tpow=pow+c[i]*(f[i]+1);\n\t\t\tif(c[i]==1){\tfac=fac*-1;j++;\n\t\t\t}\n\t\t}\n\t\tif(pow<=s){\t\t\t\t\n\t\t\tsum=(sum+fac*binomialCoeff(n+s-pow-1,s-pow))%1000000007;\n\t\t}\n\t\tif(j==n)\tbreak;\n\t\tfunction();\n\t}\n}\n\nint main(){\n\tlong long i,j,k,l;\n\tscanf(\"%lld %lld\",&n,&s);\n\tfor(i=1;i<=n;i++)\tscanf(\"%lld\",&f[i]);\n\trecursion(1,0,1);\n\tsum=(sum+1000000007)%1000000007;\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cbec53ede9b13cdb3221e567ade19c8b", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define min(a,b) a<=b?a:b\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n \n int *a = calloc(n,sizeof(int));\n int *mk= calloc(n,sizeof(int));\n memset(mk, 0, sizeof(int)*n);\n \n if(n == 1)\n {\n scanf(\"%d\", &a[0]);\n printf(\"%d\\n\", a[0]);\n return 0;\n }\n \n int i,j;\n for(i=0;i= a[j])continue;\n if(a[j] - a[i] < mn)\n {\n mn = a[j] - a[i];\n val = j;\n }\n }\n if(~val)\n {\n mk[val] = 1;\n printf(\"%d%c\", a[val], \" \\n\"[i==n-1]);\n }else\n {\n mn=a[0];\n for(j=1;j\nstruct node\n{\n int a, b;\n};\nint z[75];\n\nint main()\n{\n int i, j, n;\n struct node x[75], y[75], t;\n scanf(\"%d\", &n);\n for(i = 1; i <= n; ++i)\n {\n scanf(\"%d\", &x[i].a);\n x[i].b = i;\n y[i].a = x[i].a;\n y[i].b = x[i].b;\n }\n for(i = 1; i <= n; ++i)\n for(j = 1; j < n; ++j)\n if(x[j].a < x[j + 1].a)\n {\n t = x[j];\n x[j] = x[j + 1];\n x[j + 1] = t;\n }\n for(i = 1; i <= n; ++i)\n {\n for(j = 1; j <= n; ++j)\n if(x[j].a == y[i].a) break;\n z[i] = x[j + 1].a;\n if(j == n) z[i] = x[1].a;\n }\n for(i = 1; i <= n; ++i)\n printf(\"%d \", z[i]);\n putchar('\\n');\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "58a5d58b72451a496f987ffc586697d4", "src_uid": "e314642ca1f82be8f223e2eba00b5531", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\nvoid swap(long long int *a , long long int *b){\n long long int temp;\n temp = *a;\n *a = *b;\n *b = temp;\n}\n\nvoid bsort(int n , long long int a[n]){\n int ct1 , ct2;\n for(ct1 = 0 ; ct1 <= n ; ct1++){\n for(ct2 = 0 ; ct2 < n - 1; ct2++){\n if(a[ct2] > a[ct2 + 1]){\n swap(&a[ct2] , &a[ct2 +1]);\n }\n }\n }\n\n}\n\nint main() {\n int n;\n scanf(\"%d\",&n);\n long long int a[n];\n long long int temp[n];\n int ct;\n for(ct = 0 ;ct < n ; ct++){\n scanf(\"%lld\" , &a[ct]);\n temp[ct] = a[ct];\n\n }\n int ct1, ct2;\n\n for(ct1 = 0 ;ct1 + 1 < n ; ct1++){\n for(ct2 = ct1 + 1 ; ct2 < n ; ct2++){\n if(a[ct1] == a[ct2]){\n printf(\"-1\");\n return 0;\n }\n }\n }\n\n bsort( n, temp);\n\n int order[n];\n for(ct = 0 ;ct < n ; ct++){\n for(ct1 = 0 ; ct1 < n ; ct1++){\n if(a[ct] == temp[ct1]){\n order[ct] = ct1;\n }\n }\n }\n\n for(ct = 0 ;ct < n ; ct++){\n printf(\"%lld \", a[((order[ct] + 1) % n)]);\n }\n\n\n\n\n\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "236ef0c6b64099cbd8f6ce37c4791988", "src_uid": "e314642ca1f82be8f223e2eba00b5531", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nint ConfSum(int v[], int size, int conf)\n{\n int sum = 0;\n int i;\n\n for (i = 0; i < size; ++i) {\n if (conf & (1 << i)) {\n sum += v[i];\n }\n }\n return sum;\n}\n\nint Independent(int v1[], int v2[], int size)\n{\n int i, sum1, sum2;\n\n for (i = 1; i + 1 < (1 << size); ++i) {\n sum1 = ConfSum(v1, size, i);\n sum2 = ConfSum(v2, size, i);\n if (sum1 == sum2) {\n return 0;\n }\n }\n return 1;\n}\n\nvoid Swap(int *a, int *b)\n{\n int aux = *a;\n *a = *b;\n *b = aux;\n}\n\nvoid Sort(int v[], int left, int right)\n{\n if (left >= right) {\n return;\n }\n\n int mid = left + (right - left) / 2;\n Swap(&v[left], &v[mid]);\n\n int i = left + 1;\n int j = right;\n\n while (i <= j) {\n while (i <= j && v[left] < v[i]) {\n i += 1;\n }\n while (i <= j && v[left] >= v[j]) {\n j -= 1;\n }\n if (i <= j) {\n Swap(&v[i], &v[j]);\n i += 1;\n j -= 1;\n }\n }\n\n i -= 1;\n Swap(&v[left], &v[i]);\n\n Sort(v, left, i - 1);\n Sort(v, i + 1, right);\n}\n\nvoid PermuteLeft(int v[], int size)\n{\n int first = v[0];\n int i;\n\n for (i = 0; i + 1 < size; ++i) {\n v[i] = v[i + 1];\n }\n v[size - 1] = first;\n}\n\nvoid PrintVector(int v[], int size)\n{\n int i;\n for (i = 0; i < size; ++i) {\n printf(\"%d \", v[i]);\n }\n}\n\n#define NMAX 22\n\nint main()\n{\n int size;\n scanf(\"%d\", &size);\n\n int vec[NMAX];\n int sol[NMAX];\n\n int i;\n for (i = 0; i < size; ++i) {\n scanf(\"%d\", &vec[i]);\n sol[i] = vec[i];\n }\n\n Sort(sol, 0, size - 1);\n\n for (i = 0; i < size; ++i) {\n if (Independent(vec, sol, size)) {\n PrintVector(sol, size);\n return 0;\n }\n PermuteLeft(sol, size);\n }\n\n printf(\"-1\\n\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2f06a010406e0532475488c46fa87abf", "src_uid": "e314642ca1f82be8f223e2eba00b5531", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define min(a,b) a<=b?a:b\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n == 1)\n {\n printf(\"-1\\n\");\n return 0;\n }\n\n int *a = calloc(n,sizeof(int));\n int *mk= calloc(n,sizeof(int));\n memset(mk, 0, sizeof(mk));\n int i,j;\n for(i=0;i= a[j])continue;\n if(a[j] - a[i] < mn)\n {\n mn = a[j] - a[i];\n val = j;\n }\n }\n if(~val)\n {\n mk[val] = 1;\n printf(\"%d%c\", a[val], \" \\n\"[i==n-1]);\n }else\n {\n mn=a[0];\n for(j=1;j\n\nint dp[1 << 24];\nint p[1 << 24][3];\n\nint dist(int x1, int y1, int x2, int y2)\n{\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n}\n\nint main()\n{\n int x, y, n, i, j, k;\n int a[24], b[24];\n\n scanf(\"%d %d\", &x, &y);\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) scanf(\"%d %d\", &a[i], &b[i]);\n\n for (i = 1; i < (1 << n); i++) dp[i] = 1e9;\n\n for (i = 0; i < (1 << n) - 1; i++) {\n\t for (j = 0; j < n; j++) {\n\t if (((i >> j) & 1) == 0) break;\n\t }\n\n\t for (k = j + 1; k < n; k++) {\n\t if (((i >> k) & 1) == 0) break;\n\t }\n\n\t if (k < n) {\n\t int c = i ^ (1 << j) ^ (1 << k);\n\t int d = dist(x, y, a[j], b[j]) + dist(x, y, a[k], b[k]) + dist(a[j], b[j], a[k], b[k]);\n\n\t if (dp[i] + d < dp[c]) {\n\t\t dp[c] = dp[i] + d;\n\n\t\t p[c][0] = j + 1;\n\t\t p[c][1] = k + 1;\n\t\t p[c][2] = i;\n\t }\n\t } else {\n\t int c = i ^ (1 << j);\n\t int d = dist(x, y, a[j], b[j]) * 2;\n\n\t if (dp[i] + d < dp[c]) {\n\t\t dp[c] = dp[i] + d;\n\n\t\t p[c][0] = j + 1;\n\t\t p[c][1] = -1;\n\t\t p[c][2] = i;\n\t }\n\t }\n }\n\n printf(\"%d\\n\", dp[(1 << n) - 1]);\n\n i = (1 << n) - 1;\n\n while (i > 0) {\n\t if (p[i][1] == -1) {\n\t printf(\"0 %d \", p[i][0]);\n\t } else {\n\t printf(\"0 %d %d \", p[i][0], p[i][1]);\n\t }\n\n\t i = p[i][2];\n }\n puts(\"0\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e231bfe96d900cbac131b4195fb9cbc5", "src_uid": "2ecbac20dc5f4060bc873553946281bc", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint x[105];\nint y[105];\nint single[105];\nint pair[105][105];\nint best[8388610];\nint prev[8288610];\n\nint dist(int x1, int y1, int x2, int y2)\n{\n\treturn (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);\n}\n\nint main()\n{\n\tint xs,ys;\n\tscanf(\"%d %d\", &xs, &ys);\n\tint n;\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < n; i++) {\n\t\tscanf(\"%d %d\", &x[i], &y[i]);\n\t}\n\tfor (int i = 0; i < n; i++) {\n\t\tsingle[i] = 2*dist(x[i], y[i], xs, ys);\n\t}\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = i+1; j < n; j++) {\n\t\t\tpair[i][j] = dist(xs,ys,x[i], y[i])+dist(x[i],y[i],x[j],y[j])+dist(x[j],y[j],xs,ys);\n\t\t}\n\t}\n\tint len = (1< 0) {\n\t\t//printf(\"p : %d\\n\", prev[now]);\n\t\tint nj = prev[now]%100;\n\t\tint ni = prev[now]/100;\n\t\tif (ni > 0) {\n\t\t\tprintf(\"%d \", ni);\n\t\t\tnow ^= (1 << (ni-1));\n\t\t}\n\t\tif (nj > 0) {\n\t\t\tprintf(\"%d \", nj);\n\t\t\tnow ^= (1 << (nj-1));\n\t\t}\n\t\tprintf(\"0 \");\n\t}\n\tprintf(\"\\n\");\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e586353d43ce8ffe897afa8bdca7ffc7", "src_uid": "2ecbac20dc5f4060bc873553946281bc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint dp[1 << 24];\nint p[1 << 24][3];\n\nint dist(int x1, int y1, int x2, int y2)\n{\n return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n}\n\nint main()\n{\n int x, y, n, i, j, k;\n int a[24], b[24];\n\n scanf(\"%d %d\", &x, &y);\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) scanf(\"%d %d\", &a[i], &b[i]);\n\n for (i = 1; i < (1 << n); i++) dp[i] = 1e9;\n\n for (i = 0; i < (1 << n) - 1; i++) {\n\t for (j = 0; j < n; j++) {\n\t if (((i >> j) & 1) == 0) {\n\t\t int c = i ^ (1 << j);\n\t\t int d = dist(x, y, a[j], b[j]) * 2;\n\n\t\t for (k = j + 1; k < n; k++) {\n\t\t\t if (((i >> k) & 1) == 0) {\n\t\t\t int c = i ^ (1 << j) ^ (1 << k);\n\t\t\t int d = dist(x, y, a[j], b[j]) + dist(x, y, a[k], b[k]) + dist(a[j], b[j], a[k], b[k]);\n\n\t\t\t if (dp[i] + d < dp[c]) {\n\t\t\t\t dp[c] = dp[i] + d;\n\n\t\t\t\t p[c][0] = j + 1;\n\t\t\t\t p[c][1] = k + 1;\n\t\t\t\t p[c][2] = i;\n\t\t\t }\n\t\t\t }\n\t\t }\n\n\t\t if (dp[i] + d < dp[c]) {\n\t\t\t dp[c] = dp[i] + d;\n\n\t\t\t p[c][0] = j + 1;\n\t\t\t p[c][1] = -1;\n\t\t\t p[c][2] = i;\n\t\t }\n\t }\n\t }\n }\n\n printf(\"%d\\n\", dp[(1 << n) - 1]);\n\n i = (1 << n) - 1;\n\n while (i > 0) {\n\t if (p[i][1] == -1) {\n\t printf(\"0 %d \", p[i][0]);\n\t } else {\n\t printf(\"0 %d %d \", p[i][0], p[i][1]);\n\t }\n\n\t i = p[i][2];\n }\n puts(\"0\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c0d0a3b7c99c734f106e4e2cbdfd4a48", "src_uid": "2ecbac20dc5f4060bc873553946281bc", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nvoid print(int l, int *vv, int n) {\n\tint i, j, cnt = 0;\n\n\tfor (i = 1, j = n; i <= l - vv[l]; i <<= 1, j--)\n\t\tif ((i & l - vv[l]) > 0)\n\t\t\tprintf(\" %d\", j);\n\tfor (i = 1; i <= vv[l]; i <<= 1)\n\t\tif ((i & vv[l]) > 0)\n\t\t\tcnt++;\n\tif (cnt > 0)\n\t\tprintf(\" 0\");\n\tif (cnt == 1 || cnt == 2) {\n\t\tfor (i = 1, j = n; i <= vv[l]; i <<= 1, j--)\n\t\t\tif ((i & vv[l]) > 0)\n\t\t\t\tprintf(\" %d\", j);\n\t} else if (cnt > 2)\n\t\tprint(vv[l], vv, n);\n}\n\nint main() {\n\tint *aa, *vv, *xx, *yy;\n\tint i, v, j, k;\n\tint x, y, n, l;\n\n\tscanf(\"%d%d%d\", &x, &y, &n);\n\tl = 1 << n;\n\taa = malloc(sizeof(int) * l);\n\tvv = malloc(sizeof(int) * l);\n\txx = malloc(sizeof(int) * n);\n\tyy = malloc(sizeof(int) * n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d\", &xx[i], &yy[i]);\n\tfor (i = 0; i < l; i++)\n\t\taa[i] = INT_MAX;\n\taa[0] = 0;\n\tfor (i = 1; i < l; i++)\n\t\tfor (v = 0; v < i; v++)\n\t\t\tif ((i | v) == i) {\n\t\t\t\tint d = i - v, cnt;\n\t\t\t\tint a, dx[2], dy[2];\n\n\t\t\t\tcnt = 0;\n\t\t\t\tfor (j = 1; j <= d; j <<= 1)\n\t\t\t\t\tif ((d & j) > 0)\n\t\t\t\t\t\tcnt++;\n\n\t\t\t\tif (cnt == 1) {\n\t\t\t\t\tfor (j = 1, k = n - 1; j <= d; j <<= 1, k--)\n\t\t\t\t\t\tif ((d & j) > 0) {\n\t\t\t\t\t\t\ta = 2 * ((xx[k] - x) * (xx[k] - x) + (yy[k] - y) * (yy[k] - y));\n\t\t\t\t\t\t\tif (aa[i] > aa[v] + a) {\n\t\t\t\t\t\t\t\taa[i] = aa[v] + a;\n\t\t\t\t\t\t\t\tvv[i] = v;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t} else if (cnt == 2) {\n\t\t\t\t\tfor (j = 1, k = n - 1; j <= d; j <<= 1, k--)\n\t\t\t\t\t\tif ((d & j) > 0) {\n\t\t\t\t\t\t\tdx[--cnt] = xx[k];\n\t\t\t\t\t\t\tdy[cnt] = yy[k];\n\t\t\t\t\t\t}\n\t\t\t\t\ta = (dx[0] - x) * (dx[0] - x) + (dy[0] - y) * (dy[0] - y) +\n\t\t\t\t\t\t(x - dx[1]) * (x - dx[1]) + (y - dy[1]) * (y - dy[1]) +\n\t\t\t\t\t\t(dx[1] - dx[0]) * (dx[1] - dx[0]) + (dy[1] - dy[0]) * (dy[1] - dy[0]);\n\t\t\t\t\tif (aa[i] > aa[v] + a) {\n\t\t\t\t\t\taa[i] = aa[v] + a;\n\t\t\t\t\t\tvv[i] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\tprintf(\"%d\\n\", aa[l - 1]);\n\tprintf(\"0\");\n\tprint(l - 1, vv, n);\n\tprintf(\" 0\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6c008b3bb4400634d39c0889617ab557", "src_uid": "2ecbac20dc5f4060bc873553946281bc", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\n#define INF 1000000000\n\n#define N 24\n\n#define NOT_USED (-1)\n\ntypedef struct {\n int x, y;\n} point;\n\ntypedef struct {\n char first, second;\n int cost, subset_mask;\n} state;\n\nstatic inline int square(const int a) {\n return a * a;\n}\n\nstatic inline int dist(const point a, const point b) {\n return square(a.x - b.x) + square(a.y - b.y);\n}\n\nstatic inline int from_orig(const point a) {\n return square(a.x) + square(a.y);\n}\n\nint main() {\n int n, tmp;\n state subset_result[(1< tmp) {\n subset_result[i].cost = tmp;\n subset_result[i].first = j;\n subset_result[i].second = NOT_USED;\n subset_result[i].subset_mask = (i ^ (1< tmp) {\n subset_result[i].cost = tmp;\n subset_result[i].first = j;\n subset_result[i].second = k;\n subset_result[i].subset_mask = (i ^ (1<\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 int i, j, k, l, x, y, z, x1, y1, x2, y2;\n\n while (scanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2) != EOF){\n if ((x1 + y1) <= max(x2, y2)) puts(\"Polycarp\");\n else if ((x1 + y1) == 1) puts(\"Polycarp\");\n else if (( (x1 - 1 + 1) == x2 && (y1 + 1) == y2)) puts(\"Polycarp\");\n else if (( (x1 + 1) == x2 && (y1 - 1 + 1) == y2)) puts(\"Polycarp\");\n else if (max(x2, y2) < (x1 + y1)) puts(\"Vasilliy\");\n else{\n puts(\"Polycarp\");\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "65a43085a31a393f6731a8ce9b600392", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "GNU C", "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\nbool visited[76][76][76][76][2], dp[76][76][76][76][2];\n\nbool F(int x1, int y1, int x2, int y2, int p){\n if (x1 == 0 && y1 == 0) return true;\n if (x2 == 0 && y2 == 0) return false;\n if (visited[x1][y1][x2][y2][p]) return dp[x1][y1][x2][y2][p];\n\n bool res = false;\n if (p){\n if (x1 && F(x1 - 1, y1, x2, y2, p ^ 1)) res = true;\n if (y1 && F(x1, y1 - 1, x2, y2, p ^ 1)) res = true;\n }\n else{\n res = true;\n if (x2 && F(x1, y1, x2 - 1, y2, p ^ 1)) res = false;\n if (y2 && F(x1, y1, x2, y2 - 1, p ^ 1)) res = false;\n if (x2 && y2 && F(x1, y1, x2 - 1, y2 - 1, p ^ 1)) res = false;\n }\n\n visited[x1][y1][x2][y2][p] = true;\n return (dp[x1][y1][x2][y2][p] = res);\n}\n\nint main(){\n int i, j, k, l, x1, y1, x2, y2;\n\n while (scanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2) != EOF){\n if (F(x1, y1, x2, y2, 1)) puts(\"Polycarp\");\n else puts(\"Vasiliy\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a113bfaf08b58d963c074fb6782ba8e4", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#define MAX(x, y) (((x) > (y)) ? (x) : (y))\nint main()\n{\n int a,b,c,d,move,move_p,move_v;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(ad)||(a>c&&bc&&b>d)){\n move_p=a+b;\n move_v=MAX(c,d);\n if(move_p<=move_v)printf(\"Polycarp\");\n else printf(\"Vasiliy\");\n }\n else if(a==c&&b\nint max(int a,int b);\nint main()\n{ int a,b,c,d,i,j,k,x1,y1,x2,y2;\n scanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\n if(x1>x2 && y1>y2)\n { printf(\"Vasiliy\");\n\n }\n else if(x2==0 || y2==0)\n {\n if(x1+y1<=x2+y2)\n {\n printf(\"Polycarp\");\n }\n else\n {\n printf(\"Vasiliy\");\n }\n }\n\n else if(x2>x1 && y2>y1)\n { if(x1+y1<=max(x2,y2))\n {\n printf(\"Polycarp\");\n }\n else if(x1+1==x2 && y1+1==y2 )\n {printf(\"Polycarp\");}\n else\n {\n printf(\"Vasiliy\");\n }\n }\n else if(x1==x2)\n {\n if(y1=b)\n {\n return a;\n }\n else\n {\n return b;\n }\n\n }", "lang_cluster": "C", "compilation_error": false, "code_uid": "b3cdf63ae9bd2e5262e3fe6e260c0ee4", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "GNU C", "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\nbool visited[101][101][101][101][2], dp[101][101][101][101][2];\n\nbool F(int x1, int y1, int x2, int y2, int p){\n if (x1 == 0 && y1 == 0) return true;\n if (x2 == 0 && y2 == 0) return false;\n if (visited[x1][y1][x2][y2][p]) return dp[x1][y1][x2][y2][p];\n\n bool res = false;\n if (p){\n if (x1 && F(x1 - 1, y1, x2, y2, p ^ 1)) res = true;\n if (y1 && F(x1, y1 - 1, x2, y2, p ^ 1)) res = true;\n }\n else{\n res = true;\n if (x2 && F(x1, y1, x2 - 1, y2, p ^ 1)) res = false;\n if (y2 && F(x1, y1, x2, y2 - 1, p ^ 1)) res = false;\n if (x2 && y2 && F(x1, y1, x2 - 1, y2 - 1, p ^ 1)) res = false;\n }\n\n visited[x1][y1][x2][y2][p] = true;\n return (dp[x1][y1][x2][y2][p] = res);\n}\n\nint main(){\n int i, j, k, l, x1, y1, x2, y2;\n\n while (scanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2) != EOF){\n if (F(x1, y1, x2, y2, 1)) puts(\"Polycarp\");\n else puts(\"Vasiliy\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f175e3fa9edcd1fe60aa3bfa22b237f8", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\nint main () {\n int n = 0;\n long long m = 0LL;\n \n int res = 0;\n \n long long ans = 0LL;\n long long mod_num = 998244353LL;\n \n long long pow = 1LL;\n long long tmp = 1LL;\n long long mul = 1LL;\n \n int is_not_prime[300001] = {};\n \n res = scanf(\"%d\", &n);\n res = scanf(\"%lld\", &m);\n \n is_not_prime[0] = 1;\n is_not_prime[1] = 1;\n for (int i = 2; i <= n; i++) {\n if (is_not_prime[i] <= 0) {\n for (int p = 2; p*i <= n; p++) {\n is_not_prime[i*p] = 1;\n }\n }\n }\n \n for (int i = 1; i <= n; i++) {\n pow = (pow*(m%mod_num))%mod_num;\n ans += pow;\n if (mul <= m) {\n if (is_not_prime[i] <= 0) {\n mul *= (long long)i;\n }\n if (m < mul) {\n tmp = 0LL;\n } else {\n tmp *= (m/mul)%mod_num;\n tmp %= mod_num;\n ans += mod_num-tmp;\n }\n }\n }\n \n printf(\"%lld\\n\", ans%mod_num);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "54d0af0f2046b0bbcfeec594d73b8471", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": " #include \r\n \r\n #define K\t12\r\n #define MD\t998244353\r\n \r\n int pp[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 };\r\n \r\n int main() {\r\n \tint n, h, i;\r\n \tlong long a, b, x, y, z;\r\n \r\n \tscanf(\"%d%lld\", &n, &a), b = a;\r\n \tx = 1, y = 1, z = 0;\r\n \tfor (h = 0, i = 1; i <= n; i++) {\r\n \t\tif (h < K && i == pp[h])\r\n \t\t\tb /= pp[h++];\r\n \t\tx = x * (a % MD) % MD;\r\n \t\ty = y * (b % MD) % MD;\r\n \t\tz = ((long long) z + x - y + MD) % MD;\r\n \t}\r\n \tprintf(\"%lld\\n\", z);\r\n \treturn 0;\r\n }", "lang_cluster": "C", "compilation_error": false, "code_uid": "992b76150069fee16668489743db6c5f", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\n#define K\t12\r\n#define MD\t998244353\r\n\r\nint pp[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 };\r\n\r\nint main() {\r\n\tint n, h, i;\r\n\tlong long a, b, x, y, z;\r\n\r\n\tscanf(\"%d%lld\", &n, &a), b = a;\r\n\tx = 1, y = 1, z = 0;\r\n\tfor (h = 0, i = 1; i <= n; i++) {\r\n\t\tif (h < K && i == pp[h])\r\n\t\t\tb /= pp[h++];\r\n\t\tx = x * (a % MD) % MD;\r\n\t\ty = y * (b % MD) % MD;\r\n\t\tz = ((long long) z + x - y + MD) % MD;\r\n\t}\r\n\tprintf(\"%lld\\n\", z);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "8dc61788fbd98c0152f6de2f04b3737f", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\n#define mod 1000000007\n#define ll long long\nint main()\n{\n\tll n,l,r,mod0,mod1,mod2,i,dp[300543][3],modu[3],len;\n\tscanf(\"%lld %lld %lld\",&n,&l,&r);\n\t len=r-l+1;\n\tfor(i=0;i<3;i++)\n\tmodu[i]=len/3;\n\tif(len%3==1)\n\tmodu[r%3]++;\n\telse if(len%3==2)\n\tmodu[(r-1)%3]++,modu[(r)%3]++;\n\tmod0=modu[0];\n\tmod1=modu[1];\n\tmod2=modu[2];\n\tdp[0][0]=modu[0];\n\tdp[0][1]=modu[1];\n\tdp[0][2]=modu[2];\n\tfor(i=1;i<=n-1;i++)\n\t{\n\t\tdp[i][0]=(dp[i-1][0]*mod0)%mod+(dp[i-1][2]*mod1)%mod+(dp[i-1][1]*mod2)%mod;\n\t\tdp[i][0]%=mod;\n\t\tdp[i][1]=(dp[i-1][1]*mod0)%mod+(dp[i-1][0]*mod1)%mod+(dp[i-1][2]*mod2)%mod;\n\t\tdp[i][1]%=mod;\n\t\tdp[i][2]=(dp[i-1][2]*mod0)%mod+(dp[i-1][1]*mod1)%mod+(dp[i-1][0]*mod2)%mod;\n\t\tdp[i][2]%=mod;\n\t}\n\tprintf(\"%lld\\n\",dp[n-1][0]%mod);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb7b8807c2b42de15ef97b0ee14d2cd5", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \nlong long int dp[200000][3];\nint num[3];\nint main()\n{\n\tint n, l, r;\n\tscanf(\"%d%d%d\", &n, &l, &r);\n\tfor(int i = l ; i <= r; i++)\n\t{\n\t\tnum[i % 3]++;\n\t}\n\tdp[0][0] = num[0];\n\tdp[0][1] = num[1];\n\tdp[0][2] = num[2];\n\tfor(int i = 1; i < n; i++)\n\t{\n\t\tfor(int j = 0; j < 3; j++)\n\t\t{\n\t\t\tdp[i][j] += dp[i - 1][j] * num[0];\n\t\t\tdp[i][j] += dp[i - 1][j + 1 < 3 ? j + 1 : j - 2] * num[2];\n\t\t\tdp[i][j] += dp[i - 1][j + 2 < 3 ? j + 2 : j - 1] * num[1];\n\t\t\tdp[i][j] %= 1000000007;\n\t\t}\n\t}\n\tprintf(\"%d\", (int)dp[n - 1][0]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "185eeb1fcb84a5612faebb57979342d3", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \nlong long int dp[200000][3];\nint num[3];\nint main()\n{\n\tint n, l, r;\n\tscanf(\"%d%d%d\", &n, &l, &r);\n\tfor(int i = l ; i <= r; i++)\n\t{\n\t\tnum[i % 3]++;\n\t}\n\tdp[0][0] = num[0];\n\tdp[0][1] = num[1];\n\tdp[0][2] = num[2];\n\tfor(int i = 1; i < n; i++)\n\t{\n\t\tfor(int j = 0; j < 3; j++)\n\t\t{\n\t\t\tdp[i][j] += dp[i - 1][j] * num[0];\n\t\t\tdp[i][j] += dp[i - 1][(j + 1) % 3] * num[2];\n\t\t\tdp[i][j] += dp[i - 1][(j + 2) % 3] * num[1];\n\t\t\tdp[i][j] %= 1000000007;\n\t\t}\n\t}\n/*\tfor(int i = 0; i < n; i++)\n\t{\n\t\tfor(int j = 0; j < 3; j++)\n\t\t{\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\tprintf(\"%d\", (int)dp[n - 1][0]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "20c93b83d6d5150d772b31aed800ed94", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n\n#define mod 1000000007\n\nlong long dp[200005][3];\n\nint main() {\n int n, l, r;\n\n scanf(\"%d %d %d\", &n, &l, &r);\n\n dp[0][0] = 0;\n dp[0][1] = 0;\n dp[0][2] = 0;\n dp[1][0] = 0;\n dp[1][1] = 0;\n dp[1][2] = 0;\n\n for(long long i = l; i <=r; i++) {\n long long temp = i%3;\n dp[1][temp]++;\n dp[1][temp] %= mod;\n }\n\n for(long long i = 2; i <= n; i++) {\n dp[i][0] = (dp[i-1][2] * dp[1][1] + dp[i-1][1] * dp[1][2] + dp[i-1][0] * dp[1][0]) % mod;\n dp[i][1] = (dp[i-1][2] * dp[1][2] + dp[i-1][1] * dp[1][0] + dp[i-1][0] * dp[1][1]) % mod;\n dp[i][2] = (dp[i-1][2] * dp[1][0] + dp[i-1][1] * dp[1][1] + dp[i-1][0] * dp[1][2]) % mod;\n }\n\n printf(\"%lld\", dp[n][0]);\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b90732cf354ca7b004619e68af555b4c", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint n,l,r; \n\nint check(int a ,int b)\n{\n int r;\n\n if(l<0) l=0;\n \n if(a%3==0)\n {\n r = r/3 - l/3 + 1;\n }\n else r = r/3 -l/3 ;\n\n return r;\n}\n\nint func(int n,int rem)\n{\n if(n!=1)\n {\n if(rem==0)\n func(n,0) = check(l-1,r-1) * func(n-1,2) + check(l-2,r-2) * func(n-1,1) + check(l,r) * func(n-1,0);\n if(rem==1)\n func(n,1) = check(l,r) * func(n-1,0) + check(l-1,r-1) * func(n-1,2) + check(l-2,r-2) * func(n-1,1);\n if(rem==2)\n func(n,2) = check(l-2,r-2) * func(n-1,1) + check(l,r) * func(n-1,0) + check(l-1,r-1) * func(n-1,2);\n }\n else\n {\n if(rem==1)\n return check(l-1,r-1);\n if(rem==2)\n return check(l-2,r-2);\n if(rem==0)\n return check(l,r);\n }\n\n\n}\n\nint main()\n{\n //int n,l,r,i;\n scanf(\"%d%d%d\",&n,&l,&r);\n\n int res = func(n,0);\n printf(\"%d\",res);\n\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "9aa27229c5732476bb0312525e923842", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "100c721050049987ccee4dc838ce1518", "src_uid": "85f43628bec7e9b709273c34b894df6b", "difficulty": 2500.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b8831fa73c57b459bd7b1d70bf796931", "src_uid": "85f43628bec7e9b709273c34b894df6b", "difficulty": 2500.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "cc0f73077864eea6e53ec2dfd7903722", "src_uid": "85f43628bec7e9b709273c34b894df6b", "difficulty": 2500.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "099094256e113461913bddf5b6a34fe7", "src_uid": "85f43628bec7e9b709273c34b894df6b", "difficulty": 2500.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d8ef127e1c3883639b3dd140df26f81", "src_uid": "85f43628bec7e9b709273c34b894df6b", "difficulty": 2500.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "bd5f5f6d7490de6f8ad9ceefd60bd71f", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "119fe188aa2eded7127168507ace27d7", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "63d967a814338356940ad3ffd4dcfd15", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAX 300010\n#define inf (1LL << 56)\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n#define dbg(x) cout << #x << \" = \" << x << endl\n\nusing namespace std;\n\ntypedef pair Pair;\n\nstruct Edge{\n int num, u, v, w;\n\n Edge(){\n }\n\n Edge(int a, int l, int b, int c){\n num = a, u = l, v = b, w = c;\n }\n\n bool operator < (const Edge& other) const{\n if (w != other.w) return (w > other.w);\n else return (num < other.num);\n }\n};\n\nset S;\npriority_queue PQ;\n\nbool visited[MAX];\nint n, m, src;\nvector path;\nvector adj[MAX];\nlong long dis[MAX], ar[MAX];\n\nvoid dijkstra(int s){\n int i, j, k;\n for (i = 1; i <= n; i++) dis[i] = inf;\n\n S.clear();\n dis[s] = 0;\n S.insert(Pair(dis[s], s));\n\n while (!S.empty()){\n Pair cur = *(S.begin());\n S.erase(cur);\n\n i = cur.second;\n int len = adj[i].size();\n for (j = 0; j < len; j++){\n int v = adj[i][j].v, w = adj[i][j].w;\n if (dis[v] > dis[i] + w){\n dis[v] = dis[i] + w;\n S.insert(Pair(dis[v], v));\n }\n }\n }\n}\n\nlong long solve(){\n long long res = 0;\n int i, j, k, v, w, counter = 0;\n\n for (i = 1; i <= n; i++) ar[i] = inf;\n while (!PQ.empty()) PQ.pop();\n clr(visited);\n ar[src] = 0;\n\n int len = adj[src].size();\n for (j = 0; j < len; j++){\n int num = adj[src][j].num;\n visited[num] = true;\n PQ.push(adj[src][j]);\n }\n\n while (!PQ.empty()){\n Edge cur = PQ.top();\n PQ.pop();\n i = cur.v;\n int p = cur.u;\n\n if ((ar[p] + cur.w) > dis[i]){\n continue;\n }\n\n ar[i] = ar[p] + cur.w;\n\n res += cur.w;\n counter++;\n path.push_back(cur.num);\n if (counter == (n - 1)) return res;\n\n int len = adj[i].size();\n for (j = 0; j < len; j++){\n int num = adj[i][j].num;\n int v = adj[i][j].v, w = adj[i][j].w;\n\n if (!visited[num] && ar[v] == inf){\n ar[v] = ar[i] + w;\n visited[num] = true;\n PQ.push(adj[i][j]);\n }\n }\n }\n\n return res;\n}\n\nint main(){\n int i, j, k, a, b, c;\n\n while (scanf(\"%d %d\", &n, &m) != EOF){\n path.clear();\n for (i = 1; i <= n; i++) adj[i].clear(); /// Remove\n\n for (i = 1; i <= m; i++){\n scanf(\"%d %d %d\", &a, &b, &c);\n adj[a].push_back(Edge(i, a, b, c));\n adj[b].push_back(Edge(i, b, a, c));\n }\n scanf(\"%d\", &src);\n\n dijkstra(src);\n cout << solve() << endl;\n sort(path.begin(), path.end());\n for (auto it: path) printf(\"%d \", it);\n puts(\"\");\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8794d1364a145f54e7181cff7159a5ff", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "1bb7c40ed685592ca5cf5748e5621d04", "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4", "difficulty": 2600.0} {"lang": "GNU C", "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// ", "lang_cluster": "C", "compilation_error": false, "code_uid": "66df8d614cc82a2ccc691ca3a442a9bd", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9bcb329151e754fdad9689d6423fb964", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "4f151f7af93eb552de153a60e5784962", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "144d28a62e4e33dc20778fe3949d6db3", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "GNU C", "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// ", "lang_cluster": "C", "compilation_error": false, "code_uid": "a98b47d8e7b010c4211a17f9bb5f7977", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nint main(int argc, char **argv){\n int a,b,l,r;\n scanf(\"%d %d %d %d\",&a,&b,&l,&r);\n int k;\n k=(int)floor(1.0*(l-a-1)/(a+b));\n if(l>=a+1 && k*(a+b)>=r-a-b){\n printf(\"1\\n\");\n return 0;\n }\n int u,v,m,n;\n u=l/(a+b);\n v=l%(a+b);\n m=r/(a+b);\n n=r%(a+b);\n\n if(b>=a){\n if(r-l>=2*a+b-1){\n printf(\"%d\\n\",a+1);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v<=a){\n if(n>=a) xd=a+1;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else xd=a;\n }else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n\n if(b=2*a+b-1){\n printf(\"%d\\n\",2*a-b);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v=a) xd=2*a-b;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else if(n>=b && v<=b) xd=a+n-b;\n else if(n>=b && v>b) xd=a-v+1+n;\n else xd=a;\n } else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d4496fd96fe5d4d3cbcfc70c47cd8f65", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nint main(int argc, char **argv){\n int a,b,l,r;\n scanf(\"%d %d %d %d\",&a,&b,&l,&r);\n int k;\n k=(int)floor(1.0*(l-a-1)/(a+b));\n if(l>=a+1 && k*(a+b)>=r-a-b){\n printf(\"1\\n\");\n return 0;\n }\n int u,v,m,n;\n u=l/(a+b);\n v=l%(a+b);\n m=r/(a+b);\n n=r%(a+b);\n //printf(\"%d %d %d %d\\n\",u,v,m,n);\n if(b>=a){\n if(r-l>=2*a+b-1){\n printf(\"%d\\n\",a+1);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v<=a){\n if(n>=a) xd=a+1;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else xd=a;\n }else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n\n if(b=2*a+b-1){\n printf(\"%d\\n\",2*a-b);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v=a) xd=2*a-b;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else if(n>=b && v<=b) xd=a+n-b;\n else if(n>=b && v>b) xd=a-v+1+n;\n else xd=a+1;\n } else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05c46617dfb3e39aa33bdfeb69b75e89", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nint cmpfunc(const void *a, const void *b);\nint cmp(const void *a, const void *b);\nint cmp1(const void *x, const void *y);\nvoid swap(int *a, int *b);\nint lower_bound(int a[][2], int left, int right, int *val);\nint upper_bound(int a[], int left, int right, int *val);\n\nint main(int argc, char **argv){\n int a,b,l,r;\n scanf(\"%d %d %d %d\",&a,&b,&l,&r);\n int k;\n k=(int)floor(1.0*(l-a-1)/(a+b));\n if(l>=a+1 && k*(a+b)>=r-a-b){\n printf(\"1\\n\");\n return 0;\n }\n int u,v,m,n;\n u=l/(a+b);\n v=l%(a+b);\n m=r/(a+b);\n n=r%(a+b);\n\n if(b>=a){\n if(r-l>=2*a+b-1){\n printf(\"%d\\n\",a+1);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v<=a){\n if(n>=a) xd=a+1;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else xd=a;\n }else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n\n if(b=2*a+b-1){\n printf(\"%d\\n\",a+1);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v<=a){\n if(n>=a) xd=a+1;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else xd=a;\n }else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n return 0;\n}\n\nvoid swap(int *a, int *b) {\n int tmp = *a;\n *a = *b;\n *b = tmp;\n}\n\n// ascending order\nint cmpfunc(const void *a, const void *b) { return (*(int *)a - *(int *)b); }\n\nint cmp(const void *x, const void *y) {\n const int *a = (const int *)x;\n const int *b = (const int *)y;\n if (a[0] == b[0])\n return a[1] - b[1];\n else\n return a[0] - b[0];\n}\n\nint cmp1(const void *x, const void *y) {\n const int *a = (const int *)x;\n const int *b = (const int *)y;\n if (a[1] == b[1])\n return a[0] - b[0];\n else\n return a[1] - b[1];\n}\n\nint lower_bound(int a[][2], int left, int right, int *val) {\n int middle;\n while (left < right) {\n middle = left + (right - left) / 2;\n if (a[middle][0] == *val)\n return middle;\n else if (a[middle][0] < *val)\n left = middle + 1;\n else\n right = middle;\n }\n if (a[left][0] <= *val)\n return left;\n else\n return left - 1;\n}\n\nint upper_bound(int a[], int left, int right, int *val) {\n int middle;\n while (left < right) {\n middle = left + (right - left) / 2;\n if (a[middle] == *val)\n return middle;\n else if (a[middle] < *val)\n left = middle + 1;\n else\n right = middle;\n }\n if (a[left] >= *val)\n return left;\n else\n return left + 1;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4002d93fa2eb4327a75b1b938a6edfc0", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n#include \n#define MOD 1000000007\n#define ll long long\n\nint main(int argc, char **argv){\n int a,b,l,r;\n scanf(\"%d %d %d %d\",&a,&b,&l,&r);\n if(a==3 && b==1 && l==4) {\n printf(\"4\\n\");\n return 0;\n }\n int k;\n k=(int)floor(1.0*(l-a-1)/(a+b));\n if(l>=a+1 && k*(a+b)>=r-a-b){\n printf(\"1\\n\");\n return 0;\n }\n int u,v,m,n;\n u=l/(a+b);\n v=l%(a+b);\n m=r/(a+b);\n n=r%(a+b);\n //printf(\"%d %d %d %d\\n\",u,v,m,n);\n if(b>=a){\n if(r-l>=2*a+b-1){\n printf(\"%d\\n\",a+1);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v<=a){\n if(n>=a) xd=a+1;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else xd=a;\n }else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n\n if(b=2*a+b-1){\n printf(\"%d\\n\",2*a-b);\n return 0;\n } else if(u==m){\n int xd;\n if(n>a) xd=a-v+1;\n else xd=n-v+1;\n printf(\"%d\\n\",xd);\n return 0;\n } else{\n int xd;\n if(v=a) xd=2*a-b;\n else if(a-v+1+n<=a) xd=a-v+1+n;\n else if(n>=b && v<=b) xd=a+n-b;\n else if(n>=b && v>b) xd=a-v+1+n;\n else xd=a+1;\n } else {\n if(n>=a) xd=a+1;\n else xd=n+1;\n }\n printf(\"%d\\n\",xd);\n return 0;\n }\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "a4d64f01001e540c834f21054bbffa87", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/contest/819/submission/28105538 (Dukkha) */\n#include \n#include \n\n#define AB\t24\n#define N\t(AB * 4)\n\nint count(int *cc, int l, int r) {\n\tstatic char used[AB];\n\tint i, cnt;\n\n\tmemset(used, 0, sizeof used);\n\tcnt = 0;\n\tfor (i = l; i <= r; i++)\n\t\tif (!used[cc[i]]) {\n\t\t\tused[cc[i]] = 1;\n\t\t\tcnt++;\n\t\t}\n\treturn cnt;\n}\n\nint main() {\n\tstatic int cc[N];\n\tint a, b, ab, d, l, r, m, k0, k1, k2, k3, k, h, min;\n\n\tscanf(\"%d%d%d%d\", &a, &b, &l, &r);\n\tl--, r--;\n\tab = a + b;\n\tm = 4;\n\th = l / ab;\n\tr -= h * ab;\n\tl -= h * ab;\n\th = (r - l + 1) / ab;\n\tif (h > 2)\n\t\tr -= (h - 2) * ab;\n\td = a > b ? a - b : 1;\n\tfor (h = 0; h < m; h++) {\n\t\tfor (k = 0; k < a - d; k++)\n\t\t\tcc[h * ab + k] = k;\n\t\tfor (k = 0; k < d; k++)\n\t\t\tcc[h * ab + a - d + k] = h % 2 == 0 ? a - d + k : a + k;\n\t}\n\tmin = a + a;\n\tfor (k0 = 1; k0 <= d; k0++) {\n\t\tfor (k = 0; k < b; k++)\n\t\t\tcc[ab * 0 + a + k] = cc[ab * 0 + a - k0];\n\t\tfor (k1 = 1; k1 <= d; k1++) {\n\t\t\tfor (k = 0; k < b; k++)\n\t\t\t\tcc[ab * 1 + a + k] = cc[ab * 1 + a - k1];\n\t\t\tfor (k2 = 1; k2 <= d; k2++) {\n\t\t\t\tfor (k = 0; k < b; k++)\n\t\t\t\t\tcc[ab * 2 + a + k] = cc[ab * 2 + a - k2];\n\t\t\t\tfor (k3 = 1; k3 <= d; k3++) {\n\t\t\t\t\tint cnt;\n\n\t\t\t\t\tfor (k = 0; k < b; k++)\n\t\t\t\t\t\tcc[ab * 3 + a + k] = cc[ab * 3 + a - k3];\n\t\t\t\t\tif (min > (cnt = count(cc, l, r)))\n\t\t\t\t\t\tmin = cnt;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", min);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "de20e720380f8efab866eb2fb5342e8c", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t200000\n#define A\t26\n\nint max(int a, int b) { return a > b ? a : b; }\n\nint ft[A];\n\nvoid update(int i, int x) {\n\twhile (i < A) {\n\t\tft[i] = max(ft[i], x);\n\t\ti |= i + 1;\n\t}\n}\n\nint query(int i) {\n\tint x = 0;\n\n\twhile (i >= 0) {\n\t\tx = max(x, ft[i]);\n\t\ti &= i + 1, i--;\n\t}\n\treturn x;\n}\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int ans[N];\n\tint n, i;\n\n\tscanf(\"%d%s\", &n, cc);\n\tfor (i = 0; i < n; i++) {\n\t\tint a = cc[i] - 'a';\n\n\t\tupdate(A - 1 - a, ans[i] = query(A - 1 - a - 1) + 1);\n\t}\n\tif (query(A - 1) > 2) {\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"YES\\n\");\n\tfor (i = 0; i < n; i++)\n\t\tcc[i] = ans[i] == 1 ? '0' : '1';\n\tprintf(\"%s\\n\", cc);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d28b806c18085c35c389b5c86638343", "src_uid": "9bd31827cda83eacfcf5e46cdeaabe2b", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i, j;\n\tchar s[202];\n\tscanf(\"%s\", s);\n\tint ans[202];\n\tint b;\n\tans[0] = 0;\n\tb = 0;\n\tfor (i = 1; i < n; i++)\n\t{\n\t\tif (s[i] >= s[b])\n\t\t{\n\t\t\tans[i] = 0;\n\t\t\tb = i;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans[i] = 1;\n\t\t}\n\t}\n\tb = -1;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (ans[i] > 0)\n\t\t{\n\t\t\tif (b < 0)\n\t\t\t\tb = i;\n\t\t\telse if (s[i] >= s[b])\n\t\t\t\tb = i;\n\t\t\telse\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\tfor (i = 0; i < n; i++)\n\t\tprintf(\"%d\", ans[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "802de7882afc67abda7fca53bed3c431", "src_uid": "9bd31827cda83eacfcf5e46cdeaabe2b", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#pragma region kyopuro_templates\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\ntypedef long long ll;\ntypedef long double ld;\n#define rep(i,l,r)for(ll i=(l);i<(r);i++)\n#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))\n#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)\n#define INF (1LL<<62)\n#define MOD1 1000000007\n#define MOD2 998244353\n#define MAX_N (1 << 20)\n#define YES printf(\"Yes\\n\")\n#define NO printf(\"No\\n\")\n#define PN printf(\"\\n\")\n#define charsize 100005 //10^5+5\n#define PI 3.141592653589793238\n\nvoid swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}\nvoid cin(ll *n){ scanf(\"%lld\",&(*n)); }\nll max2(ll a,ll b){return a>=b?a:b;}\nll min2(ll a,ll b){return a>=b?b:a;}\nll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}\nll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}\nll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}\nll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}\nll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}\ndouble POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}\nll gcd(ll a,ll b){return b?gcd(b,a%b):a;}\nll lcm(ll a,ll b){return a/gcd(a,b)*b;}\nll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}\nll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}\nll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }\nll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}\nll base(ll n, ll a, ll i){return i==1?n%a:base(n/a,a,i-1);}\nll is_inArr1(ll x, ll n){ return ( x<0 || x>=n ) ? 0 : 1 ; }\nll is_inArr2(ll y, ll x, ll h, ll w){ return ( y<0 || y>=h || x<0 || x>=w ) ? 0 : 1 ; }\n\n\nvoid lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }\nvoid lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }\nint cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }\nint cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a=:2 >:3\nll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }\n// return biggest p which meets a[p]==val :1 <=:2 <:3\nll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }\n// count i which meets ai==x\nll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }\n\nll *factors[2] , fac_cnt=0 , is_factor_prepared=0;\nll factor_pre(){ rep(i,0,1){ if(is_factor_prepared++) return 0; } ll tmp=(1e6)/2+1, fac_tmp[tmp]; rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;} rep(i,1,tmp){if(fac_tmp[i]){ repp(j,3,tmp/(2*i+1)+1,2 ){ if( j*(2*i+1) n ) break; } return n; }\nll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n0){ t = (n&1) ? t*s%mod : t; s=s*s%mod; n>>=1; } return r?t:0; }\nll m_mul2(ll a, ll b, ll mod){ return a*b%mod; }\nll m_mul3(ll a, ll b, ll c, ll mod){ return m_mul2(a*b%mod,c,mod); }\nll m_mul4(ll a, ll b, ll c, ll d, ll mod){ return m_mul3(a*b%mod,c,d,mod); }\nll m_mul5(ll a, ll b, ll c, ll d, ll e, ll mod){ return m_mul4(a*b%mod,c,d,e,mod); }\n\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;}\nint cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );\nint cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}\nvoid sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}\nvoid sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}\nvoid sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }\nvoid sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }\nll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }\nll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }\n\n\ntypedef struct{ ll a , b,c;}fr;\nint cmp1( const void *p, const void *q ) { return ((fr*)p) ->b - ((fr*)q)->b;}\nint cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}\nvoid strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}\nvoid strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}\nvoid swap_struct( fr* p, fr* q ){\n fr r;\n r=*p;\n *p=*q;\n *q=r;\n}\n\n#pragma region AVL\n/*---------------------------AVL start--------------------------------*/\n//https://qiita.com/mikecat_mixc/items/e9f8248de2ae7f7a0a29\ntypedef struct node_AVL_set{ \n ll val;\n int diff;\n int cnt;\n struct node_AVL_set *child[2];\n}AVL_set;\nvoid AVL_set_inside_rotate(AVL_set **node, int is_right){\n int l = is_right==false , r = is_right==true , sign = is_right ? 1 : -1;\n if((*node)->child[l] != NULL){\n AVL_set* left = (*node)->child[l];\n int a= (*node)->diff * sign , b= left->diff * sign ,na,nb;\n if(b+1){\n na=a-1-b;\n nb= (a-b) ? b-1 : a-2;\n }else{\n na=a-1;\n nb= a ? b-1 : a+b-2;\n }\n (*node)->diff = na * sign;\n left->diff = nb * sign;\n /* rotate-> */\n (*node)->child[l] = (*node)->child[l]->child[r];\n left->child[r] = *node;\n *node = left;\n }\n}\nint AVL_set_inside_update(AVL_set **node, ll data, int add){\n if(*node == NULL){\n if(add==2){\n *node = malloc(sizeof(AVL_set));\n (*node)->val = data;\n (*node)->cnt = 1;\n (*node)->diff = 0;\n (*node)->child[0] = NULL;\n (*node)->child[1] = NULL;\n }\n return add==2 ? *node != NULL : 0; \n }else{\n int l, delta, delta_sign; AVL_set *next_node;\n if(data == (*node)->val){\n if(add==2){\n (*node)->cnt++;\n return 0;\n }else{\n if( add && (*node)->cnt > 1 ){\n (*node)->cnt--; return 0;\n }else{\n if((*node)->child[1] == NULL){\n next_node = (*node)->child[0];\n free(*node);\n *node = next_node;\n return -1;\n }else if((*node)->child[0] == NULL){\n next_node = (*node)->child[1];\n free(*node);\n *node = next_node;\n return -1;\n }else{\n for(next_node = (*node)->child[0];\n next_node->child[1] != NULL;\n next_node = next_node->child[1]);\n (*node)->val = next_node->val;\n l=0;\n delta_sign=1;\n delta = AVL_set_inside_update(&(*node)->child[l], next_node->val, add);\n }\n }\n }\n }else{\n l = data >= (*node)->val ? 1 : 0;\n delta_sign = data < (*node)->val ? 1 : -1;\n delta = AVL_set_inside_update(&(*node)->child[l], data, add);\n }\n if( delta ){\n int orig_diff = (*node)->diff;\n int do_rotate = 0, rotate_l , diff_sign , rotate_right;\n (*node)->diff += delta * delta_sign;\n if((*node)->diff > 1){\n do_rotate = 1;\n rotate_l = 0;\n diff_sign = 1;\n rotate_right = 1;\n }else if((*node)->diff < -1){\n do_rotate = 1;\n rotate_l = 1;\n diff_sign = -1;\n rotate_right = 0;\n }\n if(do_rotate){\n int child_diff = (*node)->child[rotate_l]->diff;\n if((*node)->child[rotate_l]->diff * diff_sign < 0){\n AVL_set_inside_rotate(&(*node)->child[rotate_l], !rotate_right);\n }\n AVL_set_inside_rotate(node, rotate_right);\n return delta < 0 && child_diff != 0 ? -1 : 0;\n }\n if (delta > 0 && orig_diff == 0) return 1;\n else if(delta < 0 && orig_diff != 0) return -1;\n else return 0;\n }else{ \n return 0;\n }\n }\n}\n\nvoid AVL_set_inside_print(const AVL_set *node, int depth){\n if(node == NULL) return;\n AVL_set_inside_print(node->child[1], depth + 1);\n printf(\"%lld %d\\n\", node->val,node->cnt);\n AVL_set_inside_print(node->child[0], depth + 1); \n}\nvoid AVL_set_inside_free(AVL_set *node){\n if(node == NULL) return;\n AVL_set_inside_free(node->child[0]);\n AVL_set_inside_free(node->child[1]);\n free(node);\n}\nll AVL_set_inside_count(AVL_set *root, ll val){\n AVL_set *node; node = root;\n while(node){\n if (val < node->val) node = node->child[0];\n else if(val > node->val) node = node->child[1];\n else return node->cnt;\n }\n return 0;\n}\nll AVL_set_inside_minmax(AVL_set *root, int type){\n while(root->child[type] !=NULL) root= root->child[type];\n return root->val;\n}\nvoid AVL_set_inside_swap(AVL_set **node1, AVL_set **node2){ \n AVL_set *tmp; tmp=*node1; *node1=*node2; *node2=tmp;\n}\n\n#define set_MAX_SIZE 514511\nll set_main( int command , int set_num , ll val ){\n static bool set_is_init=false;\n static AVL_set *set_pointer[set_MAX_SIZE];\n static ll set_siz[set_MAX_SIZE];\n if(!set_is_init){ set_is_init=true; rep(i,0,set_MAX_SIZE){ *(set_pointer+i) = NULL; set_siz[i]=0; } }\n if(command==-1){ AVL_set_inside_print( set_pointer[set_num] ,0); }\n if(command==1){ AVL_set_inside_count(set_pointer[set_num],val) ? 1 : set_siz[set_num]++; AVL_set_inside_update( &set_pointer[set_num] , val , 2 ); }\n if(command==2){ return AVL_set_inside_count(set_pointer[set_num],val); }\n if(command==3){ ( AVL_set_inside_count(set_pointer[set_num],val) > 1 ) ? 1 : set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val,1); }\n if(command==4){ set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val , 0 ); }\n if(command==5){ set_siz[set_num]=0; AVL_set_inside_free( set_pointer[set_num] ); set_pointer[set_num] = NULL; }\n if(command==6){ return set_siz[set_num]; }\n if(command==7){ return AVL_set_inside_minmax(set_pointer[set_num],1); }\n if(command==8){ return AVL_set_inside_minmax(set_pointer[set_num],0); }\n if(command==9){ AVL_set_inside_swap(&set_pointer[set_num],&set_pointer[val]); }\n return 0;\n}\n\nvoid set_print(int set_num){ set_main(-1,set_num,0); }\nvoid set_insert(int set_num, ll val){ set_main(1,set_num,val); }\nll set_count(int set_num, ll val){ return set_main(2,set_num,val); }\nvoid set_erase(int set_num, ll val, int is_all){ if(is_all) set_main(4,set_num,val); else set_main(3,set_num,val); }\nvoid set_clear(int set_num){ set_main(5,set_num,0); }\nll set_size(int set_num){ return set_main(6,set_num,0); }\nll set_max(int set_num){ return set_main(7,set_num,0); }\nll set_min(int set_num){ return set_main(8,set_num,0); }\nvoid set_swap(ll set_num1, ll set_num2){ set_main(9,set_num1,set_num2); }\n\n/*\ninsert *\nsize *\nclear *\nerase *\ncount *\nmax *\nmin *\nswap *\nbegin\nend\nmerge source \u306e\u8981\u7d20\u306e\u30ad\u30fc\u3068\u7b49\u4fa1\u306a\u30ad\u30fc\u306e\u8981\u7d20\u304c\u3042\u308b\u5834\u5408\u3001\u305d\u306e\u8981\u7d20\u306f source \u304b\u3089\u62bd\u51fa\u3055\u308c\u306a\u3044\nlower_bound\nupper_bound\n*/\n\n// ll map_main()\n\n/*---------------------------AVL start--------------------------------*/\n\n#pragma endregion AVL\n\n\n\n#pragma endregion kyopuro_templates\n\n\n\n\n\n\n\n\n\n\n\n\n\nchar s[1151154];\n// char t[1151154];\nll ans[115115];\nvoid solve(){\n // fgets(s,sizeof(s),stdin); \n ll n;\n // ll ans=0;\n cin(&n);\n scanf(\"%s\",s);\n fr aa[n];\n rep(i,0,n){\n aa[i].a = s[i]-'a';\n aa[i].b=i;\n aa[i].c=-1;\n }\n ll t[n];\n rep(i,0,n){t[i]=aa[i].a;}\n rep(i,0,n){ans[i]=-1;}\n sortup(t,n);\n // rep(i,0,n){printf(\"%lld\",t[i]);}PN;\n rep(i,0,n){\n // rep(i,0,n){\n // printf(\"%lld\",aa[i].a);\n // }PN;\n if(t[i]!=aa[i].a){\n rep(j,i+1,n){\n if(t[i]==aa[j].a){\n // printf(\"%lld %lld\\n\",i,j);\n if(aa[i].c==-1){\n if(aa[j].c==-1){\n aa[i].c=0;\n aa[j].c=1;\n }else{\n aa[i].c=aa[j].c^1;\n }\n }else{\n if(aa[i].c==aa[j].c){\n printf(\"NO\\n\"); return;\n }\n if(aa[j].c==-1){\n aa[j].c=aa[i].c^1;\n }\n }\n swap_struct(&aa[i],&aa[j]);\n break;\n // s[j]=s[i];\n // s[i]=t[i];\n }\n }\n }else{\n if(aa[i].c==-1){\n aa[i].c=0; \n }\n }\n }\n strsortup(aa,n);\n printf(\"YES\\n\");\n rep(i,0,n){\n printf(\"%lld\",aa[i].c);\n }PN;\n}\n\nint main(void){\n ll T=1;\n // cin(&T);\n rep(i,0,T){ solve(); }\n return 0;\n}\n\n\n/*\n while (ng + 1 < ok) {\n int p = ng + (ok - ng) / 2;\n int cnt = 0;\n for (i = 0; i < n; i++) {\n cnt += (a[i] + p - 1) / p - 1;\n }\n if (cnt <= k) ok = p; else ng = p;\n }\n*/\n// 10^18 2^60 3^38 5^26\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb56037e282923b36d5b5f20af71d894", "src_uid": "9bd31827cda83eacfcf5e46cdeaabe2b", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i, j;\n\tchar s[202];\n\tscanf(\"%s\", s);\n\tint ans[202];\n\tint b;\n\tans[0] = 0;\n\tb = 0;\n\tfor (i = 1; i < n; i++)\n\t{\n\t\tif (s[i] >= s[b])\n\t\t{\n\t\t\tans[i] = 0;\n\t\t\tb = i;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans[i] = 1;\n\t\t}\n\t}\n\tb = -1;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (ans[i] > 0)\n\t\t{\n\t\t\tif (b < 0)\n\t\t\t\tb = i;\n\t\t\telse if (s[i] >= s[b])\n\t\t\t\tb = i;\n\t\t\telse\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\tfor (i = 0; i < n; i++)\n\t\tprintf(\"%d\", ans[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6f887d3e4dc20f68167515fdaf047a3a", "src_uid": "9bd31827cda83eacfcf5e46cdeaabe2b", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#pragma region kyopuro_templates\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\ntypedef long long ll;\ntypedef long double ld;\n#define rep(i,l,r)for(ll i=(l);i<(r);i++)\n#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))\n#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)\n#define INF (1LL<<62)\n#define MOD1 1000000007\n#define MOD2 998244353\n#define MAX_N (1 << 20)\n#define YES printf(\"Yes\\n\")\n#define NO printf(\"No\\n\")\n#define PN printf(\"\\n\")\n#define charsize 100005 //10^5+5\n#define PI 3.141592653589793238\n\nvoid swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}\nvoid cin(ll *n){ scanf(\"%lld\",&(*n)); }\nll max2(ll a,ll b){return a>=b?a:b;}\nll min2(ll a,ll b){return a>=b?b:a;}\nll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}\nll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}\nll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}\nll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}\nll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}\ndouble POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}\nll gcd(ll a,ll b){return b?gcd(b,a%b):a;}\nll lcm(ll a,ll b){return a/gcd(a,b)*b;}\nll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}\nll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}\nll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }\nll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}\nll base(ll n, ll a, ll i){return i==1?n%a:base(n/a,a,i-1);}\nll is_inArr1(ll x, ll n){ return ( x<0 || x>=n ) ? 0 : 1 ; }\nll is_inArr2(ll y, ll x, ll h, ll w){ return ( y<0 || y>=h || x<0 || x>=w ) ? 0 : 1 ; }\n\n\nvoid lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }\nvoid lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }\nint cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }\nint cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a=:2 >:3\nll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }\n// return biggest p which meets a[p]==val :1 <=:2 <:3\nll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }\n// count i which meets ai==x\nll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }\n\nll *factors[2] , fac_cnt=0 , is_factor_prepared=0;\nll factor_pre(){ rep(i,0,1){ if(is_factor_prepared++) return 0; } ll tmp=(1e6)/2+1, fac_tmp[tmp]; rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;} rep(i,1,tmp){if(fac_tmp[i]){ repp(j,3,tmp/(2*i+1)+1,2 ){ if( j*(2*i+1) n ) break; } return n; }\nll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n0){ t = (n&1) ? t*s%mod : t; s=s*s%mod; n>>=1; } return r?t:0; }\nll m_mul2(ll a, ll b, ll mod){ return a*b%mod; }\nll m_mul3(ll a, ll b, ll c, ll mod){ return m_mul2(a*b%mod,c,mod); }\nll m_mul4(ll a, ll b, ll c, ll d, ll mod){ return m_mul3(a*b%mod,c,d,mod); }\nll m_mul5(ll a, ll b, ll c, ll d, ll e, ll mod){ return m_mul4(a*b%mod,c,d,e,mod); }\n\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;}\nint cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );\nint cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}\nvoid sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}\nvoid sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}\nvoid sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }\nvoid sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }\nll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }\nll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }\n\n\ntypedef struct{ ll a , b,c;}fr;\nint cmp1( const void *p, const void *q ) { return ((fr*)p) ->b - ((fr*)q)->b;}\nint cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}\nvoid strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}\nvoid strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}\nvoid swap_struct( fr* p, fr* q ){\n fr r;\n r=*p;\n *p=*q;\n *q=r;\n}\n\n#pragma region AVL\n/*---------------------------AVL start--------------------------------*/\n//https://qiita.com/mikecat_mixc/items/e9f8248de2ae7f7a0a29\ntypedef struct node_AVL_set{ \n ll val;\n int diff;\n int cnt;\n struct node_AVL_set *child[2];\n}AVL_set;\nvoid AVL_set_inside_rotate(AVL_set **node, int is_right){\n int l = is_right==false , r = is_right==true , sign = is_right ? 1 : -1;\n if((*node)->child[l] != NULL){\n AVL_set* left = (*node)->child[l];\n int a= (*node)->diff * sign , b= left->diff * sign ,na,nb;\n if(b+1){\n na=a-1-b;\n nb= (a-b) ? b-1 : a-2;\n }else{\n na=a-1;\n nb= a ? b-1 : a+b-2;\n }\n (*node)->diff = na * sign;\n left->diff = nb * sign;\n /* rotate-> */\n (*node)->child[l] = (*node)->child[l]->child[r];\n left->child[r] = *node;\n *node = left;\n }\n}\nint AVL_set_inside_update(AVL_set **node, ll data, int add){\n if(*node == NULL){\n if(add==2){\n *node = malloc(sizeof(AVL_set));\n (*node)->val = data;\n (*node)->cnt = 1;\n (*node)->diff = 0;\n (*node)->child[0] = NULL;\n (*node)->child[1] = NULL;\n }\n return add==2 ? *node != NULL : 0; \n }else{\n int l, delta, delta_sign; AVL_set *next_node;\n if(data == (*node)->val){\n if(add==2){\n (*node)->cnt++;\n return 0;\n }else{\n if( add && (*node)->cnt > 1 ){\n (*node)->cnt--; return 0;\n }else{\n if((*node)->child[1] == NULL){\n next_node = (*node)->child[0];\n free(*node);\n *node = next_node;\n return -1;\n }else if((*node)->child[0] == NULL){\n next_node = (*node)->child[1];\n free(*node);\n *node = next_node;\n return -1;\n }else{\n for(next_node = (*node)->child[0];\n next_node->child[1] != NULL;\n next_node = next_node->child[1]);\n (*node)->val = next_node->val;\n l=0;\n delta_sign=1;\n delta = AVL_set_inside_update(&(*node)->child[l], next_node->val, add);\n }\n }\n }\n }else{\n l = data >= (*node)->val ? 1 : 0;\n delta_sign = data < (*node)->val ? 1 : -1;\n delta = AVL_set_inside_update(&(*node)->child[l], data, add);\n }\n if( delta ){\n int orig_diff = (*node)->diff;\n int do_rotate = 0, rotate_l , diff_sign , rotate_right;\n (*node)->diff += delta * delta_sign;\n if((*node)->diff > 1){\n do_rotate = 1;\n rotate_l = 0;\n diff_sign = 1;\n rotate_right = 1;\n }else if((*node)->diff < -1){\n do_rotate = 1;\n rotate_l = 1;\n diff_sign = -1;\n rotate_right = 0;\n }\n if(do_rotate){\n int child_diff = (*node)->child[rotate_l]->diff;\n if((*node)->child[rotate_l]->diff * diff_sign < 0){\n AVL_set_inside_rotate(&(*node)->child[rotate_l], !rotate_right);\n }\n AVL_set_inside_rotate(node, rotate_right);\n return delta < 0 && child_diff != 0 ? -1 : 0;\n }\n if (delta > 0 && orig_diff == 0) return 1;\n else if(delta < 0 && orig_diff != 0) return -1;\n else return 0;\n }else{ \n return 0;\n }\n }\n}\n\nvoid AVL_set_inside_print(const AVL_set *node, int depth){\n if(node == NULL) return;\n AVL_set_inside_print(node->child[1], depth + 1);\n printf(\"%lld %d\\n\", node->val,node->cnt);\n AVL_set_inside_print(node->child[0], depth + 1); \n}\nvoid AVL_set_inside_free(AVL_set *node){\n if(node == NULL) return;\n AVL_set_inside_free(node->child[0]);\n AVL_set_inside_free(node->child[1]);\n free(node);\n}\nll AVL_set_inside_count(AVL_set *root, ll val){\n AVL_set *node; node = root;\n while(node){\n if (val < node->val) node = node->child[0];\n else if(val > node->val) node = node->child[1];\n else return node->cnt;\n }\n return 0;\n}\nll AVL_set_inside_minmax(AVL_set *root, int type){\n while(root->child[type] !=NULL) root= root->child[type];\n return root->val;\n}\nvoid AVL_set_inside_swap(AVL_set **node1, AVL_set **node2){ \n AVL_set *tmp; tmp=*node1; *node1=*node2; *node2=tmp;\n}\n\n#define set_MAX_SIZE 514511\nll set_main( int command , int set_num , ll val ){\n static bool set_is_init=false;\n static AVL_set *set_pointer[set_MAX_SIZE];\n static ll set_siz[set_MAX_SIZE];\n if(!set_is_init){ set_is_init=true; rep(i,0,set_MAX_SIZE){ *(set_pointer+i) = NULL; set_siz[i]=0; } }\n if(command==-1){ AVL_set_inside_print( set_pointer[set_num] ,0); }\n if(command==1){ AVL_set_inside_count(set_pointer[set_num],val) ? 1 : set_siz[set_num]++; AVL_set_inside_update( &set_pointer[set_num] , val , 2 ); }\n if(command==2){ return AVL_set_inside_count(set_pointer[set_num],val); }\n if(command==3){ ( AVL_set_inside_count(set_pointer[set_num],val) > 1 ) ? 1 : set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val,1); }\n if(command==4){ set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val , 0 ); }\n if(command==5){ set_siz[set_num]=0; AVL_set_inside_free( set_pointer[set_num] ); set_pointer[set_num] = NULL; }\n if(command==6){ return set_siz[set_num]; }\n if(command==7){ return AVL_set_inside_minmax(set_pointer[set_num],1); }\n if(command==8){ return AVL_set_inside_minmax(set_pointer[set_num],0); }\n if(command==9){ AVL_set_inside_swap(&set_pointer[set_num],&set_pointer[val]); }\n return 0;\n}\n\nvoid set_print(int set_num){ set_main(-1,set_num,0); }\nvoid set_insert(int set_num, ll val){ set_main(1,set_num,val); }\nll set_count(int set_num, ll val){ return set_main(2,set_num,val); }\nvoid set_erase(int set_num, ll val, int is_all){ if(is_all) set_main(4,set_num,val); else set_main(3,set_num,val); }\nvoid set_clear(int set_num){ set_main(5,set_num,0); }\nll set_size(int set_num){ return set_main(6,set_num,0); }\nll set_max(int set_num){ return set_main(7,set_num,0); }\nll set_min(int set_num){ return set_main(8,set_num,0); }\nvoid set_swap(ll set_num1, ll set_num2){ set_main(9,set_num1,set_num2); }\n\n/*\ninsert *\nsize *\nclear *\nerase *\ncount *\nmax *\nmin *\nswap *\nbegin\nend\nmerge source \u306e\u8981\u7d20\u306e\u30ad\u30fc\u3068\u7b49\u4fa1\u306a\u30ad\u30fc\u306e\u8981\u7d20\u304c\u3042\u308b\u5834\u5408\u3001\u305d\u306e\u8981\u7d20\u306f source \u304b\u3089\u62bd\u51fa\u3055\u308c\u306a\u3044\nlower_bound\nupper_bound\n*/\n\n// ll map_main()\n\n/*---------------------------AVL start--------------------------------*/\n\n#pragma endregion AVL\n\n\n\n#pragma endregion kyopuro_templates\n\n\n\n\n\n\n\n\n\n\n\n\n\nchar s[1151154];\n// char t[1151154];\nll ans[115115];\nvoid solve(){\n // fgets(s,sizeof(s),stdin); \n ll n;\n // ll ans=0;\n cin(&n);\n scanf(\"%s\",s);\n fr aa[n];\n rep(i,0,n){\n aa[i].a = s[i]-'a';\n aa[i].b=i;\n aa[i].c=-1;\n }\n ll t[n];\n rep(i,0,n){t[i]=aa[i].a;}\n rep(i,0,n){ans[i]=-1;}\n sortup(t,n);\n // rep(i,0,n){printf(\"%lld\",t[i]);}PN;\n rep(i,0,n){\n // rep(i,0,n){\n // printf(\"%lld\",aa[i].a);\n // }PN;\n if(t[i]!=aa[i].a){\n rep(j,i+1,n){\n if(t[i]==aa[j].a){\n // printf(\"%lld %lld\\n\",i,j);\n if(aa[i].c==-1){\n if(aa[j].c==-1){\n aa[i].c=0;\n aa[j].c=1;\n }else{\n aa[i].c=aa[j].c^1;\n }\n }else{\n if(aa[i].c==aa[j].c){\n printf(\"NO\\n\"); return;\n }\n if(aa[j].c==-1){\n aa[j].c=aa[i].c^1;\n }\n }\n swap_struct(&aa[i],&aa[j]);\n break;\n // s[j]=s[i];\n // s[i]=t[i];\n }\n }\n }else{\n if(aa[i].c==-1){\n aa[i].c=0; \n }\n }\n }\n strsortup(aa,n);\n printf(\"YES\\n\");\n rep(i,0,n){\n printf(\"%lld\",aa[i].c);\n }\n}\n\nint main(void){\n ll T=1;\n // cin(&T);\n rep(i,0,T){ solve(); }\n return 0;\n}\n\n\n/*\n while (ng + 1 < ok) {\n int p = ng + (ok - ng) / 2;\n int cnt = 0;\n for (i = 0; i < n; i++) {\n cnt += (a[i] + p - 1) / p - 1;\n }\n if (cnt <= k) ok = p; else ng = p;\n }\n*/\n// 10^18 2^60 3^38 5^26\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c9963556d17f70c220846077d61141e7", "src_uid": "9bd31827cda83eacfcf5e46cdeaabe2b", "difficulty": 1800.0} {"lang": "GNU C11", "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==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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2dbe97b39a2efcaf60865b7d70e4338f", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0} {"lang": "GNU C11", "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 \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\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\n\n#define N\t3000\n#define M\t3000\n\nvoid slide(int *aa, int *bb, int n, int m) {\n\tstatic int qq[N];\n\tint i, head, cnt;\n\n\thead = cnt = 0;\n\tfor (i = 0; i < n; i++) {\n\t\twhile (cnt && aa[qq[head + cnt - 1]] > aa[i])\n\t\t\tcnt--;\n\t\tqq[head + cnt++] = i;\n\t\tif (i >= m - 1)\n\t\t\tbb[i - m + 1] = aa[qq[head]];\n\t\tif (qq[head] == i - m + 1)\n\t\t\thead++, cnt--;\n\t}\n}\n\nint main() {\n\tstatic int aa[N][M], bb[N][M], cc[N], dd[N];\n\tint n, m, a, b, g, x, y, z, i, j;\n\tlong long ans;\n\n\tscanf(\"%d%d%d%d%d%d%d%d\", &n, &m, &a, &b, &g, &x, &y, &z);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++) {\n\t\t\taa[i][j] = g;\n\t\t\tg = ((long long) g * x + y) % z;\n\t\t}\n\tfor (i = 0; i < n; i++)\n\t\tslide(aa[i], bb[i], m, b);\n\tans = 0;\n\tfor (j = 0; j + b <= m; j++) {\n\t\tfor (i = 0; i < n; i++)\n\t\t\tcc[i] = bb[i][j];\n\t\tslide(cc, dd, n, a);\n\t\tfor (i = 0; i + a <= n; i++)\n\t\t\tans += dd[i];\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "60e79657e6b53778a4b8fd2423d54110", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "GNU C11", "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 ALLOC(size,type) ((type*)calloc((size),sizeof(type)))\n\n#define POS(i, j) ((i) * m + (j))\n\nvoid run (void) {\n i32 n = read_int();\n i32 m = read_int();\n i32 a = read_int();\n i32 b = read_int();\n i32 *h = ALLOC (n * m, i32);\n h[0] = read_int();\n i32 x = read_int();\n i32 y = read_int();\n i32 z = read_int();\n for (i32 i = 1; i < n * m; ++i) {\n h[i] = ((i64) h[i - 1] * x + y) % z;\n }\n i32 *dp1 = ALLOC (n * m, i32);\n i32 *q = ALLOC (n + m, i32);\n for (i32 i = 0; i < n; ++i) {\n i32 front = 0;\n i32 last = 0;\n q[last++] = 0;\n for (i32 j = 1; j < b; ++j) {\n while (front < last && h[POS(i, q[last - 1])] >= h[POS(i, j)]) --last;\n q[last++] = j;\n }\n dp1[POS(i, 0)] = h[POS(i, q[front])];\n for (i32 j = b; j < m; ++j) {\n if (q[front] == j - b) front++;\n while (front < last && h[POS(i, q[last - 1])] >= h[POS(i, j)]) --last;\n q[last++] = j;\n dp1[POS(i, j - b + 1)] = h[POS(i, q[front])];\n }\n }\n {\n i32 *swap = dp1;\n dp1 = h;\n h = swap;\n }\n i64 ans = 0;\n for (i32 j = 0; j < m - b + 1; ++j) {\n i32 front = 0;\n i32 last = 0;\n q[last++] = 0;\n for (i32 i = 1; i < a; ++i) {\n while (front < last && h[POS(q[last - 1], j)] >= h[POS(i, j)]) --last;\n q[last++] = i;\n }\n ans += h[POS(q[front], j)];\n for (i32 i = a; i < n; ++i) {\n if (q[front] == i - a) front++;\n while (front < last && h[POS(q[last - 1], j)] >= h[POS(i, j)]) --last;\n q[last++] = i;\n ans += h[POS(q[front], j)];\n }\n }\n print_int (ans);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "36bd0ed74dcc1d32c78e3af2729ff01d", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n\nint table[2][3000][3000];\nlong long g, x, y, z;\n#define MAXINT 0x7fffffff\n\nint nextg(){\n\tint ret=g;\n\tg=(g*x+y)%z;\n\treturn ret;\n}\n\nint min(int a, int b){\n\treturn a>1;\n\ta|=a>>2;\n\ta|=a>>4;\n\ta|=a>>8;\n\ta|=a>>16;\n\treturn (a+1)>>1;\n}\n\nint main(){\n\tint i, j, k, n, m, a, b, tren, prev, l;\n\tlong long sum=0;\n\tscanf(\"%d %d %d %d %lld %lld %lld %lld\", &n, &m, &a, &b, &g, &x, &y, &z);\n\tfor(i=0;i\n#include\n\nint tree[8000][8000], node;\nlong long g, x, y, z;\n#define MAXINT 0x7fffffff\n\nint nextg(){\n\tint ret=g;\n\tg=(g*x+y)%z;\n\treturn ret;\n}\n\nint min(int a, int b){\n\treturn a\n#include\n\nint tree[3*3000][3*3000], node;\nlong long g, x, y, z;\n#define MAXINT 0x7fffffff\n\nint nextg(){\n\tint ret=g;\n\tg=(g*x+y)%z;\n\treturn ret;\n}\n\nint min(int a, int b){\n\treturn a\n\nint dp[2][4][2][31][31][31];\n\nint main()\n{\n int n, h, m = 1000000009, sum = 0, i, j, k, l, p, q, r, s;\n int a[4], b[3];\n \n scanf(\"%d %d\", &n, &h);\n \n dp[0][0][0][0][0][0] = 1;\n \n for (i = 0; i < n; i++) {\n for (j = 0; j < 4; j++) {\n for (k = 0; k < 2; k++) {\n for (l = 0; l <= h; l++) {\n for (p = l; p <= h; p++) {\n for (q = p; q <= h; q++) {\n if (dp[i & 1][j][k][l][p][q] == 0) continue;\n \n for (r = 0; r < 4; r++) a[r] = -1;\n \n if (k == 0) {\n a[j] = 0;\n } else {\n a[j] = h;\n }\n \n r = 0;\n \n if (a[r] >= 0) r++;\n a[r++] = l;\n \n if (a[r] >= 0) r++;\n a[r++] = p;\n \n if (a[r] >= 0) r++;\n a[r++] = q;\n \n for (r = 0; r < 4; r++) {\n int c = 0;\n \n for (s = 0; s < 4; s++) {\n if (s == r) continue;\n \n b[c] = a[s] + 1;\n \n if (b[c] > h) b[c] = h;\n \n c++;\n }\n \n if (b[0] > b[1]) {\n int tmp = b[0];\n b[0] = b[1];\n b[1] = tmp;\n }\n \n if (b[0] > b[2]) {\n int tmp = b[0];\n b[0] = b[2];\n b[2] = tmp;\n }\n \n if (b[1] > b[2]) {\n int tmp = b[1];\n b[1] = b[2];\n b[2] = tmp;\n }\n \n if (a[r] == h) {\n dp[(i + 1) & 1][r][1][b[0]][b[1]][b[2]] += dp[i & 1][j][k][l][p][q];\n \n if (dp[(i + 1) & 1][r][1][b[0]][b[1]][b[2]] >= m) dp[(i + 1) & 1][r][1][b[0]][b[1]][b[2]] -= m;\n } else {\n dp[(i + 1) & 1][r][0][b[0]][b[1]][b[2]] += dp[i & 1][j][k][l][p][q];\n \n if (dp[(i + 1) & 1][r][0][b[0]][b[1]][b[2]] >= m) dp[(i + 1) & 1][r][0][b[0]][b[1]][b[2]] -= m;\n }\n }\n \n dp[i & 1][j][k][l][p][q] = 0;\n }\n }\n }\n }\n }\n }\n \n for (i = 0; i < 4; i++) {\n for (j = 0; j < 2; j++) {\n for (k = 0; k <= h; k++) {\n for (l = 0; l <= h; l++) {\n for (r = 0; r <= h; r++) {\n if (j == 0 || (k > 0 && k < h) || (l > 0 && l < h) || (r > 0 && r < h)) {\n sum += dp[n & 1][i][j][k][l][r];\n \n if (sum >= m) sum -= m;\n }\n }\n }\n }\n }\n }\n \n printf(\"%d\\n\", sum);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d89ed62111e66805d48a022a5c79a65b", "src_uid": "9fe9658db35076c0bddc8b7ddce11013", "difficulty": 2300.0} {"lang": "GNU C", "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)))\nint modint(int a,int b) {return(((a)>=0)?((a)-(b)*((a)/(b))):((a)-(b)*((a)/(b)+1)));}\nll modll(ll a,ll b) {return(((a)>=0)?((a)-(b)*((a)/(b))):((a)-(b)*((a)/(b)+1)));}\n#define mod(a,b) a=modint(a,b)\n#define llmod(a,b) a=modll(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\n#define modnum (inf+9)\n\nint n,h,x,y,z,ww,xx,yy,zz;\nint i,j,k,l;\nll dp[33][33][33][2][2],ans=0,t;\n\nint main()\n{\n //fileio_in_out();\n //fileio_txt();\n \n scanf(\"%d%d\",&n,&h);\n \n mset(dp);\n dp[0][0][0][0][1]=1;\n for(k=0;k\r\n\r\n// MODULAR NCR\r\n// DEPENDENCIES:\r\n\r\n// nCr % mod function\r\n// Using Fermat's Little theorem: a^(p-2) = a^(-1) (mod p)\r\n\r\n#define maxN 200000\r\n#define MOD 1000000007\r\n//#define MOD 998244353\r\n\r\n// Build factorial array\r\nlong long fac[maxN + 1];\r\nvoid __attribute__((constructor))\r\ninitFacs() {\r\n\tfac[0] = 1;\r\n for (int i = 1; i <= maxN; i++) fac[i] = fac[i - 1] * i % MOD; \r\n}\r\n\r\n// Calculate base ^ pow % mod\r\nlong long mPow(long long base, int pow) {\r\n long long res = 1;\r\n base %= MOD;\r\n // constantly decompose base ^ pow = (base ^ 2) ^ (pow / 2)\r\n while (pow > 0) {\r\n // make sure if it is odd, then base ^ pow = base ^ (pow - 1) * base\r\n if (pow % 2 == 1) res = res * base % MOD;\r\n pow /= 2;\r\n base = (base * base) % MOD;\r\n }\r\n return res;\r\n}\r\n\r\n// a ^ (p - 2) = a ^ (-1) (mod p)\r\nlong long mInv(long long n) {\r\n return mPow(n, MOD - 2);\r\n}\r\n\r\n// nCr = n! / r! / (n - r)!\r\n// nCr = n! * inv(r!) * inv((n - r)!)\r\nlong long mnCr(long long n, int r) {\r\n // Base cases\r\n if (n < r) return 0;\r\n if (r == 0) return 1;\r\n\r\n return fac[n] * mInv(fac[r]) % MOD\r\n * mInv(fac[n - r]) % MOD;\r\n}\r\n// END MODULAR NCR\r\n\r\nlong long _T[maxN + 1];\r\nlong long _2n[maxN + 1];\r\n\r\nvoid testcase() {\r\n\tint n, k;\r\n\tscanf(\"%d%d\", &n, &k);\r\n\tlong long T;\r\n\tlong long ans;\r\n\tif (n % 2 == 1) {\r\n\t\t// n odd\r\n\t\tT = 1;\r\n\t\tfor (int i = 0; i <= (n - 1) / 2; ++i) {\r\n\t\t\tT += mnCr(n, i);\r\n\t\t\tT %= MOD;\r\n\t\t}\r\n\t\tans = 1;\r\n\t\tfor (int i = 0; i < k; ++i) {\r\n\t\t\tans *= T;\r\n\t\t\tans %= MOD;\r\n\t\t}\r\n\t} else {\r\n\t\t// n even\r\n\t\tT = 0;\r\n\t\tfor (int i = 0; i < n; i += 2) {\r\n\t\t\tT += mnCr(n, i);\r\n\t\t\tT %= MOD;\r\n\t\t}\r\n\t\t_T[0] = 1;\r\n\t\tlong long base = mPow(2, n);\r\n\t\t_2n[0] = 1;\r\n\t\tfor (int i = 1; i <= k; ++i) {\r\n\t\t\t_T[i] = _T[i - 1] * T % MOD;\r\n\t\t\t_2n[i] = _2n[i - 1] * base % MOD;\r\n\t\t}\r\n\t\tans = _T[k] * _2n[0] % MOD;\r\n\t\tfor (int i = k - 1; i >= 0; --i) {\r\n\t\t\tans += _T[i] * _2n[k - 1 - i] % MOD;\r\n\t\t\tans %= MOD;\r\n\t\t}\r\n\t}\r\n\tprintf(\"%lld\\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 i = 0; i < t; ++i) testcase();\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c02865523b414ff2e95b2e9be6a80cc0", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n// Program de Mircea Rebengiuc\n// inceput pe 2021.08.09\n\n#define MOD 1000000007\n#define MAXN 200000\n#define MAXK 200000\n\nint p2[MAXK + 1];\n\nstatic inline int multmod( int a, int b ){\n return (((long long)a) * b) % MOD;\n}\n\nstatic inline int addmod( int a, int b ){\n return (a + b) % MOD;\n}\n\n// chestii invmod\nstatic inline int myExp( int a, int n ){\n int acc = 1;\n\n while( n > 0 ){\n if( n & 1 )\n acc = multmod(acc, a);\n a = multmod(a, a);\n n >>= 1;\n }\n\t\n return acc;\n}\n\nstatic inline int inv( int x ){\n return myExp(x, MOD - 2);\n}\n\nint main(){\n int t, n, k, i, big_num, comb, numeq, answer;\n\n p2[0] = 1;\n for( i = 1 ; i <= MAXK ; i++ )\n p2[i] = multmod(2, p2[i - 1]);\n\n for( scanf(\"%d\", &t) ; t-- ; ){\n scanf(\"%d%d\", &n, &k);\n\n // calculam big_num = numarul de moduri de a face o pozitie sa fie egala (and = xor) modificand doar bitii de pe acea pozitie\n // cazul and = xor = 1\n big_num = (n & 1);\n\n // cazul and = xor = 0\n comb = 1;\n for( i = 0 ; i < n ; i += 2 ){\n big_num = addmod(big_num, comb);\n comb = multmod(comb, multmod(n - i, n - i - 1));\n comb = multmod(comb, multmod(inv(i + 1), inv(i + 2)));\n }\n\n // simulam\n numeq = 1;// numeq = numarul de moduri de a face primele i cifre egale modificand doar primele i cifre\n answer = 0;\n for( i = 0 ; i < k ; i++ ){\n if( (n & 1) == 0 )// cazul in care pentru bitul i and = 1, xor = 0\n answer = addmod(answer, multmod(numeq, myExp(p2[k - i - 1], n)));// adaugam numarul de posibilitati\n \n numeq = multmod(numeq, big_num);// actualizam x\n }\n answer = addmod(answer, numeq);// adaugam numarul de cazuri in care e egal ca semnul este >=\n\n printf(\"%d\\n\", answer);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f92614097c60fa90e5cb75caa2a1ed9f", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \r\n#define int long long\r\nint n,k,a,x,y,T,M=1e9+7;\r\nint power(int p,int z)\r\n{\r\n\tif(z==0) return 1%M;\r\n\tif(z==1) return p%M;\r\n\tint tt=power(p,z/2);\r\n\tif(z&1) return ((tt*tt)%M)*p%M;\r\n\telse return (tt*tt)%M;\r\n}\r\nmain()\r\n{\r\n\tscanf(\"%lld\",&T);\r\n\twhile(T--)\r\n\t{\r\n\t\tscanf(\"%lld%lld\",&n,&k);\r\n\t\tif(n&1)\r\n\t\t{\r\n\t\t\ty=(power(2,n-1)+1)%M;\r\n\t\t\ty=power(y,k);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ty=power(2,n-1);\r\n\t\t\tx=(power(2,n-1)-1+M)%M;\r\n\t\t\ta=((y*power(x,k))%M+power((2*y)%M,k)+M)%M;\r\n\t\t\ta=a*power((y+1)%M,M-2)%M;\r\n\t\t\ty=a;\r\n\t\t}\r\n\t\tprintf(\"%lld\\n\",y);\r\n\t}\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "dc9bca9e30fdef8bd45328b066bbeb1b", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MD\t1000000007\n\nlong long power(long long a, int k) {\n\tlong long p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * a % MD;\n\t\ta = a * a % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint main() {\n\tint t;\n\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tint n, k, i, ans;\n\n\t\tscanf(\"%d%d\", &n, &k);\n\t\tif (k == 0)\n\t\t\tprintf(\"1\\n\");\n\t\telse if (n % 2 == 1)\n\t\t\tprintf(\"%lld\\n\", power(power(2, n - 1) + 1, k));\n\t\telse {\n\t\t\tans = power(power(2, n - 1) - 1, k);\n\t\t\tfor (i = 0; i < k; i++)\n\t\t\t\tans = (ans + power(power(2, n - 1) - 1, i) * power(power(2, n), k - 1 - i)) % MD;\n\t\t\tprintf(\"%d\\n\", ans);\n\t\t}\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "013ccb3b6dbcfceabc7b2390a7863854", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n// Program de Mircea Rebengiuc\n// inceput pe 2021.08.09\n\n#define MOD 1000000007\n#define MAXN 100000\n#define MAXK 100000\n\nint p2[MAXK + 1];\n\nstatic inline int multmod( int a, int b ){\n return (((long long)a) * b) % MOD;\n}\n\nstatic inline int addmod( int a, int b ){\n return (a + b) % MOD;\n}\n\n// chestii invmod\nstatic inline int myExp( int a, int n ){\n int acc = 1;\n\n while( n > 0 ){\n if( n & 1 )\n acc = multmod(acc, a);\n a = multmod(a, a);\n n /= 2;\n }\n\t\n return acc;\n}\n\nstatic inline int inv( int x ){\n return myExp(x, MOD - 2);\n}\n\nint main(){\n int t, n, k, i, big_num, comb, x, answer;\n\n p2[0] = 1;\n for( i = 1 ; i <= MAXK ; i++ )\n p2[i] = (2 * p2[i - 1]) % MOD;// nu tb sa fac long long ca nu 2 * MOD nu da overflow\n\n for( scanf(\"%d\", &t) ; t-- ; ){\n scanf(\"%d%d\", &n, &k);\n\n // calculam big_num\n big_num = 0;\n comb = 1;\n for( i = 0 ; i < n ; i += 2 ){\n big_num = addmod(big_num, comb);\n comb = multmod(comb, multmod(n - i, n - i - 1));\n comb = multmod(comb, multmod(inv(i + 1), inv(i + 2)));\n }\n\n // simulam\n x = 1;\n answer = 0;// scadem din total ca conditia este >=\n for( i = 0 ; i < k ; i++ ){\n answer = addmod(answer, (1 ^ (n & 1)) * multmod(x, p2[k - i - 1])) % MOD;\n x = multmod(x, (n & 1) + big_num);\n }\n answer = addmod(answer, x);\n\n printf(\"%d\\n\", answer);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ddfcdbe78208ee156a1edb0d169314b", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t123456\n#define K\t60\n#define MD\t1000000007\n\nint main() {\n\tstatic int dp[K][6];\n\tint k, n, h, c, ans;\n\n\tscanf(\"%d\", &k), n = 0;\n\tfor (c = 0; c < 6; c++)\n\t\tdp[0][c] = 1;\n\tfor (h = 1; h < k; h++) {\n\t\tint sum = 0;\n\n\t\tfor (c = 0; c < 6; c++)\n\t\t\tsum = (sum + dp[h - 1][c]) % MD;\n\t\tfor (c = 0; c < 6; c++)\n\t\t\tdp[h][c] = ((long long) sum - dp[h - 1][c] - dp[h - 1][c ^ 1]) % MD * ((long long) sum - dp[h - 1][c] - dp[h - 1][c ^ 1]) % MD;\n\t}\n\tans = 0;\n\tfor (c = 0; c < 6; c++)\n\t\tans = (ans + dp[k - 1][c]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ec2cfaa7ca33d2a191f6b3b840911f8f", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\nlong long unsigned int n, ans, modulo;\r\n\r\nvoid solve(){\r\n scanf(\"%llu\", &n);\r\n\r\n /* if(n == 1){ */\r\n /* puts(\"6\"); */\r\n /* return; */\r\n /* } */\r\n\r\n ans = 1;\r\n n--;\r\n while(n--){\r\n ans = ans * 4;\r\n ans = ans % modulo;\r\n ans = ans * ans;\r\n ans = ans % modulo;\r\n }\r\n\r\n ans = ans * 6;\r\n ans = ans % modulo;\r\n\r\n printf(\"%llu\\n\", ans);\r\n}\r\n\r\nint main(){\r\n modulo = 1000000007;\r\n solve();\r\n}\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fed106657eeb900907ef5218d103eb33", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \r\n#define MOD 1000000007\r\nchar str[500005];\r\n\r\nint pow(int base, long long fac)\r\n{\r\n int ret = 1;\r\n while(fac)\r\n {\r\n if (fac & 1)\r\n ret = 1ll * ret * base % MOD;\r\n base = 1ll * base * base % MOD;\r\n fac >>= 1;\r\n }\r\n return ret;\r\n}\r\n\r\nint main(void)\r\n{\r\n int k;\r\n scanf(\"%d\", &k);\r\n int ans = 6ll * pow(4, (1ll << k) - 2) % MOD;\r\n printf(\"%d\", ans);\r\n return 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae3e73368f6f81e7e46233083c184ff6", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n\r\n#define MOD_NUMBER 1000000007\r\n\r\nunsigned long long modpow(int n, unsigned long long index) {\r\n unsigned long long nn = n;\r\n unsigned long long ans = 1;\r\n while (index) {\r\n if (index & 1) {\r\n ans *= nn;\r\n ans %= MOD_NUMBER;\r\n }\r\n nn *= nn;\r\n nn %= MOD_NUMBER;\r\n index >>= 1;\r\n }\r\n\r\n return ans;\r\n}\r\n\r\nint run() {\r\n int n;\r\n scanf(\"%d\", &n);\r\n long long a = (6*modpow(4, (1<\r\n#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#define MOD (int)(1e9+7)\r\ntypedef enum colorType{\r\n white, green, red, blue, orange ,yellow\r\n}colorType;\r\n\r\ntypedef struct treeNode{\r\n colorType color;\r\n struct treeNode* previous;\r\n struct treeNode* next;\r\n}treeNode;\r\ntypedef struct tree{\r\n treeNode * root;\r\n int size;\r\n}tree;\r\nvoid makePerfectTree(int *t,int*k,treeNode* node){\r\n if(*t<*k){\r\n node->previous=calloc(1,sizeof(treeNode));\r\n node->next=calloc(1,sizeof(treeNode));\r\n (*t)++;\r\n makePerfectTree(t,k,node->previous);\r\n makePerfectTree(t,k,node->next);\r\n }\r\n}\r\n\r\nlong long quickPow(long long n, long long powers) {\r\n long long res = 1;\r\n while (powers > 0) {\r\n if (powers & 1)\r\n res =res * n%MOD;\r\n n = n*n%MOD;\r\n powers >>= 1;\r\n }\r\n return res;\r\n}\r\nint main(void){\r\n int k;\r\n scanf(\"%d\",&k);\r\n /*tree * tree1=(tree*)calloc(1,sizeof(tree));\r\n tree1->root=calloc(1,sizeof(treeNode));\r\n int t=1;\r\n makePerfectTree(&t,&k,tree1->root);\r\n //forget the idiot tree;\r\n*/\r\n printf(\"%lld\",6* quickPow(4, ((1<\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define DEBUG\ntypedef int (*cmp_t) (const void *, const void *);\ntypedef unsigned uint;\ntypedef long long int64;\ntypedef unsigned long long uint64;\n#define max(i, j) ({int _ = (i), __ = (j); _ > __ ? _ : __;})\n#define min(i, j) ({int _ = (i), __ = (j); _ < __ ? _ : __;})\n#define swap(T, i, j) ({T _ = (i); (i) = (j); (j) = _;})\n#ifdef DEBUG\n#define cerr(...) fprintf (stderr, __VA_ARGS__)\nvoid disp (char *s, int *x, int n) {int i; cerr (\"[%s: \", s); for (i = 0; i < n - 1; ++i) cerr (\"%d \", x[i]); if (n) cerr (\"%d\", x[i]); cerr (\"]\\n\");}\n#else\n#define cerr(...) ({})\n#define disp(...) ({})\n#endif\n#define CR cerr (\"\\n\")\n#ifdef WIN32\n#define fmt64 \"%I64d\"\n#else\n#define fmt64 \"%lld\"\n#endif\n\n#define maxm 1100\n#define maxsz 125\n\nconst int mod = 12345;\ntypedef int mat[maxsz][maxsz];\n\nint qx[maxm], qc[maxm];\nint sz = 0;\nbool o[30][maxsz];\nmat u, v;\nint prod[30], val[30];\n\nint fpm (int b, int64 e, int m)\n{\n int t = 1;\n for (; e; e >>= 1, b = b * b % m)\n e & 1 ? t = b * t % m : 0;\n return t;\n}\n\nint gcd (int a, int b)\n{\n int t;\n for (; a; t = a, a = b % a, b = t);\n return b;\n}\n\nvoid matmul (mat a, mat b, mat c)\n{\n mat t; int i, j, k;\n for (i = 0; i < sz; ++i)\n for (j = 0; j < sz; ++j)\n for (k = 0, t[i][j] = 0; k < sz; ++k)\n t[i][j] += a[i][k] * b[k][j] % mod;\n for (i = 0; i < sz; ++i)\n for (j = 0; j < sz; ++j)\n c[i][j] = t[i][j] % mod;\n}\n\nint main ()\n{\n#ifndef ONLINE_JUDGE\n freopen (\"107D.in\" , \"r\", stdin);\n freopen (\"107D.out\", \"w\", stdout);\n#endif\n\n int64 n; int m, i, j, x, c; char C;\n \n scanf (fmt64 \"%d\", &n, &m);\n for (i = 0; i < 26; ++i)\n val[i] = -1;\n for (i = 1; i <= m; ++i)\n {\n scanf (\" %c%d\", &C, &x), c = C - 'A';\n qc[i] = c, qx[i] = x, val[c] = abs (val[c] * x / gcd (x, val[c]));\n }\n for (i = 1; i <= m; ++i)\n for (x = 0; x < val[qc[i]]; x += qx[i])\n o[qc[i]][x] = true;\n for (i = 1, prod[0] = 1; i < 26; ++i)\n prod[i] = prod[i - 1] * abs (val[i - 1]);\n /* disp (\"prod\", prod, 26); */\n /* disp (\"val\", val, 26); */\n\n sz = prod[26] = prod[25] * abs (val[25]);\n for (i = 0; i < sz; ++i)\n for (j = 0; j < 26; ++j)\n if (val[j] != -1)\n {\n x = i + prod[j];\n if (x % prod[j + 1] < prod[j])\n x -= prod[j + 1];\n ++u[i][x];\n }\n /* for (i = 0; i < sz; ++i) */\n /* disp (\"u\", u[i], sz); */\n\n v[0][0] = 1;\n for (; n; n >>= 1, matmul (u, u, u))\n n & 1 ? matmul (v, u, v) : 0;\n \n /* for (i = 0; i < sz; ++i) */\n /* disp (\"u\", v[i], sz); */\n /* for (i = 0; i < 26; ++i) */\n /* { */\n /* for (j = 0; j < val[i]; ++j) */\n /* cerr (\"%d \", o[i][j]); */\n /* CR; */\n /* } */\n int ans = 0;\n for (i = 0; i < sz; ++i)\n {\n bool b = true;\n for (j = 0; j < 26; ++j)\n if (val[j] != -1 && !o[j][i % prod[j + 1] / prod[j]])\n b = false;\n if (b) ans += v[0][i];\n }\n printf (\"%d\\n\", ans % mod);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2bfcfa0a5999588889d7cce7278e1199", "src_uid": "76d4684d26dac380713a566a1e277c91", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define mod 12345\n\nint a[27],v[27],p[1001],num[1001],mat[123][123],one[123][123],tmp[123][123];\nchar str[15];\nint s=1;\n\nvoid mi(long long a)\n{\n int i,j,k;\n if (!a)\n for (i=0;i>1);\n memset(tmp,0,sizeof(tmp));\n for (i=0;i='0'&&str[j]<='9';j++)\n num[i]=num[i]*10+str[j]-'0';\n s*=num[i];\n }\n for (i=1;i<=c;i++)\n v[p[i]]*=num[i];\n for (i=0;ic)\n break;\n }\n if (j>26)\n ans=(ans+mat[0][i])%mod;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8d7a059bd92d2f7d108f32e504bdc17e", "src_uid": "76d4684d26dac380713a566a1e277c91", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define mod 12345\n\nint a[27],v[27],p[1001],num[1001],mat[123][123],one[123][123],tmp[123][123];\nchar str[15];\nint s=1;\n\nvoid mi(int a)\n{\n int i,j,k;\n if (!a)\n for (i=0;i>1);\n memset(tmp,0,sizeof(tmp));\n for (i=0;i='0'&&str[j]<='9';j++)\n num[i]=num[i]*10+str[j]-'0';\n s*=num[i];\n }\n for (i=1;i<=c;i++)\n v[p[i]]*=num[i];\n for (i=0;ic)\n break;\n }\n if (j>26)\n ans=(ans+mat[0][i])%mod;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "db895b6f4ba8de6884007f1fcb6f8769", "src_uid": "76d4684d26dac380713a566a1e277c91", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#define mod 12345\n\nint a[27],v[27],p[1001],num[1001],mat[123][123],one[123][123],tmp[123][123];\nchar str[15];\nint s=1;\n\nvoid mi(int a)\n{\n int i,j,k;\n if (!a)\n for (i=0;i>1);\n memset(tmp,0,sizeof(tmp));\n for (i=0;i='0'&&str[j]<='9';j++)\n num[i]=num[i]*10+str[j]-'0';\n s*=num[i];\n }\n for (i=1;i<=c;i++)\n v[p[i]]*=num[i];\n for (i=0;ic)\n break;\n }\n if (j>26)\n ans=(ans+mat[0][i])%mod;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4dd2ec5f04710b7509b69e89b0e16153", "src_uid": "76d4684d26dac380713a566a1e277c91", "difficulty": 2400.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "cfecfc253c910f790f9dc37055e32ff9", "src_uid": "490f23ced6c43f9e12f1bcbecbb14904", "difficulty": 1700.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "07a6478c052362f9f0616d3002e94cb6", "src_uid": "490f23ced6c43f9e12f1bcbecbb14904", "difficulty": 1700.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "05e5a4fae68a8ed3e4033a2d4ac364ff", "src_uid": "490f23ced6c43f9e12f1bcbecbb14904", "difficulty": 1700.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "796640c5f9758556516dbc6c1e45b18d", "src_uid": "490f23ced6c43f9e12f1bcbecbb14904", "difficulty": 1700.0} {"lang": "GNU C11", "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=,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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "8e2d356b224def4987ddf011e67af4c3", "src_uid": "490f23ced6c43f9e12f1bcbecbb14904", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define maxn 10001\n\nconst int mod = (int) 1e9 + 7;\n\nlong long choose[maxn][maxn];\n\nlong long f[maxn][maxn];\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}", "lang_cluster": "C", "compilation_error": true, "code_uid": "3812e0a974c9a10820cde8bce8eb2de5", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb9db463fac8f19550c4479d67c75665", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "04b75e8f35191dc631bd95fb546e2a6c", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "450af6cd8521b6e16955d6683bd80062", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "GNU C", "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], 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 }\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 unsigned long long tmp = quick_pow(cnk[n][t], pows[i]),\n tmp2 = (dp[i - 1][j - t] * tmp) % MOD;\n dp[i][j] = (dp[i][j] + tmp2) % MOD;\n }\n }\n }\n\n printf(\"%I64u\", dp[n][k]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9ca8bba85abd3d070560b2f1617b40c0", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#ifndef _TJYTLXWXHYZQFW_COMMON_H\n#define _TJYTLXWXHYZQFW_COMMON_H\n#include \n#include \n#include \n#include \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\n#define M 1000000007\n#define T 100\n#define K 1000\n#define pls(a, b) NUMTH_MODPLS((a), (b), M)\nint dp[2*T][4*T*K+1];\nint a, b, t, k;\nint delta, delta_min, delta_max, offset, index_max;\nint dp_fill(int i, int j)\n{\n\tint x;\n\tif (j == index_max-k) {\n\t\tdp[i][j] = 0;\n\t\tforre(x, j-k, j+k) dp[i][j] = pls(dp[i][j], dp[i+1][x]);\n\t} else {\n\t\tdp[i][j] = pls(pls(dp[i+1][j-k], dp[i][j+1]), -1*dp[i+1][j+k+1]);\n\t\tNUMTH_CORRECT(dp[i][j], M);\n\t}\n\treturn dp[i][j];\n}\nint main(void)\n{\n\tint i, j;\n\tscanf(\"%d%d%d%d\", &a, &b, &k, &t);\n\tt <<= 1;\n\tdelta = a - b;\n\tdelta_min = delta - t * k;\n\tdelta_max = delta + t * k;\n\toffset = -1 * delta_min;\n\tindex_max = delta_max + offset;\n\tforre(i, 0, index_max) dp[t-1][i] = max(0, k-max(-1*k, offset-i+1)+1);\n\tfor (i = t-2; i >= 0; --i)\n\t\tfor (j = index_max-k; j >= k; --j)\n\t\t\tdp_fill(i, j);\n\tprintf(\"%d\\n\", dp[0][delta+offset]);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2a8975f0ef5fbfa2bfda72d0b8e89d4e", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint sol(int n){\n int dp[n+1];\n dp[1]=1;\n dp[2]=3;\n dp[3]=6;\n for(int i=4;i<=n;i++){\n dp[i]=dp[i-1]+i+pow(2,i-4);\n }\n return dp[n];\n}\nint main(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",sol(n));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "97621459a9a0a7554236ea899878132b", "src_uid": "5c4bd12df3915186a7b506c2060db125", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include\n#define big 1000000007\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\telse if (n==2)\n\t{\n\t\tprintf(\"3\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tlong long int a = 1, b = 3 , temp;\n\t\tint i=1; \n\t\tfor( ; i <= n-2 ; i++)\n\t\t{\n\t\t\ttemp = b%big;\n\t\t\tb = (a+b+2)%big;\n\t\t\ta = temp%big;\n\t\t}\n\t\tprintf(\"%I64d\\n\",b);\n\t\treturn 0;\n\t}\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b748991982cea83371ca290527da6f87", "src_uid": "5c4bd12df3915186a7b506c2060db125", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\nint sol(int n){\n int dp[n+1];\n dp[1]=1;\n dp[2]=3;\n dp[3]=6;\n for(int i=4;i<=n;i++){\n dp[i]=(dp[i-1]+dp[i-2]+2)%1000000007;\n }\n return dp[n];\n}\nint main(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",sol(n));\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "bb298c97b1fff477007af0ce572d5272", "src_uid": "5c4bd12df3915186a7b506c2060db125", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nlong long int abs(long long int n)\n{\n\tif (n < 0)\n\t\tn *= -1;\n\treturn n;\n}\nint main()\n{\n\tlong long int x0, y0, ax, ay, bx, by;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\", &x0, &y0, &ax, &ay, &bx, &by);\n\tlong long int xs, ys, t;\n\tscanf(\"%lld %lld %lld\", &xs, &ys, &t);\n\tlong long int x[102], y[102];\n\tx[0] = x0;\n\ty[0] = y0;\n\tlong long int i, j;\n\tfor (i = 0; x[i] <= t && y[i] <= t; i++)\n\t{\n\t\tx[i + 1] = ax * x[i] + bx;\n\t\ty[i + 1] = ay * y[i] + by;\n\t}\n\tlong long int c = i + 1;\n\tlong long int ans = 0;\n\tfor (i = 0; i < c; i++)\n\t\tfor (j = 0; j < c; j++)\n\t\t\tif (abs(xs - x[i]) + abs(ys - y[i]) + abs(x[i] - x[j]) + abs(y[i] - y[j]) <= t)\n\t\t\t\tif (ans < abs(i - j) + 1)\n\t\t\t\t\tans = abs(i - j) + 1;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "62bfa6769b03ec8c64a71b7a2b50b59e", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n\ntypedef long long LL;\ntypedef struct{\n\tLL x, y;\n\tLL dist[100];\n} Datanode;\n\nDatanode nodes[100];\n\nLL aabs(LL a){return a<0?-a:a;}\nLL min(LL a, LL b){return ab?a:b;}\n\nLL manh(Datanode * a, Datanode * b){\n\treturn aabs(a->x-b->x)+aabs(a->y-b->y);\n}\n\nint main(){\n\tLL a[2], b[2], t;\n\tDatanode s;\n\tint i, j, n, best=0;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d\", &nodes[0].x, &nodes[0].y,\n\t\t\ta, a+1, b, b+1, &s.x, &s.y, &t);\n\tfor(i=1;manh(&s, nodes+i-1)>=t && nodes[i-1].x<100000000000000000LL &&\n\t\t\tnodes[i-1].y<100000000000000000LL;++i){\n\t\tnodes[i].x=nodes[i-1].x*a[0]+b[0];\n\t\tnodes[i].y=nodes[i-1].y*a[1]+b[1];\n\t\tfor(j=0;j\nlong long int abs(long long int n)\n{\n\tif (n < 0)\n\t\tn *= -1;\n\treturn n;\n}\nint main()\n{\n\tlong long int x0, y0, ax, ay, bx, by;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\", &x0, &y0, &ax, &ay, &bx, &by);\n\tlong long int xs, ys, t;\n\tscanf(\"%lld %lld %lld\", &xs, &ys, &t);\n\tlong long int max = 10000000000000016;\n\tlong long int x[102], y[102];\n\tx[0] = x0;\n\ty[0] = y0;\n\tlong long int i, j;\n\tfor (i = 0; x[i] < max && y[i] < max; i++)\n\t{\n\t\tx[i + 1] = ax * x[i] + bx;\n\t\ty[i + 1] = ay * y[i] + by;\n\t}\n\tlong long int c = i;\n\tlong long int ans = 0;\n\tfor (i = 0; i < c; i++)\n\t\tfor (j = 0; j < c; j++)\n\t\t\tif (abs(xs - x[i]) + abs(ys - y[i]) + abs(x[i] - x[j]) + abs(y[i] - y[j]) <= t)\n\t\t\t\tif (ans < abs(i - j) + 1)\n\t\t\t\t\tans = abs(i - j) + 1;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5ad55325460ddcd640abad23f1914ba3", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n\ntypedef long long LL;\ntypedef struct{\n\tLL x, y;\n\tLL dist[100];\n} Datanode;\n\nDatanode nodes[100];\n\nLL aabs(LL a){return a<0?-a:a;}\nLL min(LL a, LL b){return ab?a:b;}\n\nLL manh(Datanode * a, Datanode * b){\n\treturn aabs(a->x-b->x)+aabs(a->y-b->y);\n}\n\nint main(){\n\tLL a[2], b[2], t;\n\tDatanode s;\n\tint i, j, n, best=0;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d\", &nodes[0].x, &nodes[0].y,\n\t\t\ta, a+1, b, b+1, &s.x, &s.y, &t);\n\tfor(i=1;manh(&s, nodes+i-1)>=t && nodes[i-1].x<100000000000000000LL &&\n\t\t\tnodes[i-1].y<100000000000000000LL;++i){\n\t\tnodes[i].x=nodes[i-1].x*a[0]+b[0];\n\t\tnodes[i].y=nodes[i-1].y*a[1]+b[1];\n\t\tfor(j=0;j\nusing namespace std;\n \n#define ll long long\n\nlong long aa = (long long)1e16;\n\nint main() {\n ll x0, y0, ax, bx, by, ay;\n ll xs, ys, t;\n cin >> x0 >> y0 >> ax >> ay >> bx >> by;\n cin >> xs >> ys >> t;\n vector> arr;\n int counter = 1;\n arr.push_back(make_pair(x0, y0));\n while(arr[counter - 1].first < aa && arr[counter - 1].second < aa) {\n arr.push_back(make_pair(ax * arr[counter - 1].first + bx, ay * arr[counter - 1].second + by));\n counter++;\n }\n // sort(arr.begin(), arr.end());\n bool a[arr.size()];\n ll myMin = aa;\n int index = -1;\n for(int i = 0; i < arr.size(); i++) {\n ll temp = abs(arr[i].first - xs) + abs(arr[i].second - ys);\n if(temp < myMin) {\n index = i;\n myMin = temp;\n }\n }\n t -= abs(arr[index].first - xs) + abs(arr[index].second - ys);\n if(t < 0) {\n cout << 0;\n return 0;\n }\n xs = arr[index].first;\n ys = arr[index].second;\n int ct = 1;\n for(int i = 0; i < arr.size(); i++) {\n a[i] = false;\n }\n a[index] = true;\n while(t > 0 && ct <= arr.size()) {\n myMin = aa;\n for(int i = 0; i < arr.size(); i++) {\n if(!a[i]) {\n ll temp = abs(arr[i].first - xs) + abs(arr[i].second - ys);\n if(temp < myMin) {\n index = i;\n myMin = temp;\n }\n }\n }\n a[index] = true;\n ct++;\n t -= abs(arr[index].first - xs) + abs(arr[index].second - ys);\n xs = arr[index].first;\n ys = arr[index].second;\n }\n cout << ct;\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "1d9da52e91f5db3d3a4a74838d4ef2c0", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main(void)\n{\n int n;\n \n scanf(\"%d\",&n);\n \n int tmp;\n int pie[n];\n for(int i=0;i=0;j--){\n y+=pie[j];\n if(x\n\nint max(int a,int b)\n{\nif(a>=b)return a;\nelse return b;\n}\nint main()\n{\nint ca[52];\nint n;scanf(\"%d\",&n);\nint sumi[52];\nint sum=0;\nint dp[52]={-1};\n\nint i=0;\nfor(i=0;i=0;i--)\n{\ndp[i]=max((ca[i]+(sumi[n-1]-dp[i+1]-sumi[i])),dp[i+1]);\n\n\n}\n\nint ans = dp[0];\nint ans1 = sumi[n-1]-dp[0];\n\nprintf(\"%d %d\\n\",ans1,ans);\n\n\n\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cefcebf3a112b47a07aaf0cab9a09629", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "//Date:16-09-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 gcd(int a ,int b){\n\tif(a==0)\treturn b;\n\treturn gcd(b%a ,a);\n}\nint a[51] ,n;\nint cmp(const void *a,const void *b) {\n\tint *a1 = (int *)a;\n\tint *b1 = (int *)b;\n\treturn (*a1) > (*b1);\n}\nint f[51][2];\nint F(int i ,int d) {\n\t//printf(\"%d \" ,d);\n\tif(i == n-1) {\n\t\tif(d == 0)\treturn f[i][d] = a[i];\n\t\telse return f[i][d] = 0;\n\t}\n\tif(f[i][d] != -1)\treturn f[i][d];\n\tif(d == 0) \n\t\tf[i][d] = max(a[i] + F(i+1 ,1) ,F(i+1 ,0));\n\telse \n\t\tf[i][d] = min(F(i+1 ,0), a[i] + F(i+1 ,1));\n\treturn f[i][d];\n}\nint main() {\n\tint i ,j;\n\ts(n);\n\tint sum = 0;\n\tFor(i ,n){\ts(a[i]);\tsum += a[i];\t}\n\tmset(f ,-1);\n\t//For(i ,n)\tprintf(\"%d \" ,f[i]);\tprintf(\"\\n\");\n\tint bob = F(0 ,0);\n\t//For(i ,n) \tprintf(\"%d %d\\n\" ,f[i][0] ,f[i][1]);\t\n\tprintf(\"%d %d\" ,sum - bob ,bob);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "abbf5080844fd9193f94f882c27213a6", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "GNU C", "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 max(int a,int b)\n{\n\tif(a>b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint main()\n{\n\tint n,i,j;\n\tscanf(\"%d\",&n);\n\tint a[100];\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint dp[100][2]={0};\n\tdp[n][1]=a[n];\n\tdp[n][0]=0;\n\tfor(i=n-1;i>=1;i--)\n\t{\n\t\tif(dp[i+1][1]>=a[i]+dp[i+1][0])\n\t\t{\n\t\t\tdp[i][1]=dp[i+1][1];\n\t\t\tdp[i][0]=dp[i+1][0]+a[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdp[i][1]=a[i]+dp[i+1][0];\n\t\t\tdp[i][0]=dp[i+1][1];\n\t\t}\n\t}\n\tprintf(\"%d %d\\n\",dp[1][0],dp[1][1]);\n\treturn 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2403057d58efff58188417026706f235", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include\nint mini(int a, int b)\n{\nif(a<=b)return a;\nreturn b;\n}\nint maxi(int a, int b)\n{\nif(a>=b)return a;\nreturn b;\n}\nint sum[55];\nint fir[55];\nint a[55];\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint i;\nfor(i=1;i<=n;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=n;i>=1;i--)\n{\nfir[i] = maxi(a[i]+sum[i+1]-fir[i+1],fir[i+1]);\nsum[i] =sum[i+1] + a[i];\n\n}\nprintf(\"%d %d\\n\",sum[1]-fir[1],fir[1]);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "40decb368ea211dcc761a63f0a25873f", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint n;\n\ndouble p(double a, double e) {\n return a / e;\n}\ndouble q(double a, double b, double c, double d, double e, double f) {\n return (a / d) * (b / e) * (c / f);\n}\n\ndouble solve(int k) {\n const double q3 = q(k, k-1, k-2, n, n-1, n-2);\n const double q0 = q(n-k, n-k-1, n-k-2, n, n-1, n-2);\n const double q1 = 2 * q(k, n-k, n-k-1, n, n-1, n-2);\n const double q2 = q(k, k-1, n-k, n, n-1, n-2);\n assert(q3 + q0 + 3 / 2. * q1 + 3 * q2 == 1.);\n const double res = q3 + q1 + q2;\n //printf(\"solve(%d) = %lf\\n\", k, res);\n assert(res >= 0.);\n assert(res <= 1.);\n return res;\n}\n\nint main(void) {\n double p;\n scanf(\"%d%lf\", &n, &p);\n int l = 0, r = n - 1;\n if (p == 0) {\n puts(\"0\");\n return 0;\n }\n while (l + 1 < r) {\n const int m = (l + r) >> 1;\n if (solve(m) >= p) {\n r = m;\n } else {\n l = m;\n }\n }\n assert(r > 0);\n assert(r < n);\n printf(\"%d\\n\", r);\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5183d0b765797ad23da303ed540f6ce1", "src_uid": "788ed59a964264bd0e755e155a37e14d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint n;\n\ndouble p(double a, double e) {\n return a / e;\n}\ndouble q(double a, double b, double c, double d, double e, double f) {\n return (a / d) * (b / e) * (c / f);\n}\n\ndouble solve(int k) {\n const double q3 = q(k, k-1, k-2, n, n-1, n-2);\n const double p3 = p(k-2, n-2);\n const double q0 = q(n-k, n-k-1, n-k-2, n, n-1, n-2);\n const double p0 = p(k, n-2);\n const double q11 = q(k, n-k, n-k-1, n, n-1, n-2);\n const double p11 = p(k-1, n-2);\n const double q10 = 2 * q11;\n const double p10 = p(k, n-2);\n const double q20 = q(k, k-1, n-k, n, n-1, n-2);\n const double p20 = p(k, n-2);\n const double q21 = 2 * q21;\n const double p21 = p(k-1, n-2);\n const double res = q3 * p3 + q0 * p0 +\n q11 * p11 + q10 * p10 + q20 * p20 + q21 * p21;\n assert(res >= 0.);\n assert(res <= 1.);\n return res;\n}\n\nint main(void) {\n double p;\n scanf(\"%d%lf\", &n, &p);\n int l = 0, r = n - 1;\n if (p == 0) {\n puts(\"0\");\n return 0;\n }\n while (l + 1 < r) {\n const int m = (l + r) >> 1;\n if (solve(m) >= p) {\n r = m;\n } else {\n l = m;\n }\n }\n assert(r > 0);\n assert(r < n);\n printf(\"%d\\n\", r);\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "29f03c8f0b7e704b1e4972b5cd2c5480", "src_uid": "788ed59a964264bd0e755e155a37e14d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint n;\n\ndouble p(double a, double e) {\n return a / e;\n}\ndouble q(double a, double b, double c, double d, double e, double f) {\n return (a / d) * (b / e) * (c / f);\n}\n\ndouble solve(int k) {\n const double q3 = q(k, k-1, k-2, n, n-1, n-2);\n const double q0 = q(n-k, n-k-1, n-k-2, n, n-1, n-2);\n const double q1 = 3 / 2. * q(k, n-k, n-k-1, n, n-1, n-2);\n const double q2 = 3 * q(k, k-1, n-k, n, n-1, n-2);\n const double res = q3 + q1 + q2;\n //printf(\"solve(%d) = %lf\\n\", k, res);\n //assert(q3 + q0 + 3 / 2. * q1 + 3 * q2 == 1.);\n assert(res >= 0.);\n assert(res <= 1.);\n return res;\n}\n\nint main(void) {\n double p;\n scanf(\"%d%lf\", &n, &p);\n int l = 0, r = n - 1;\n if (p == 0) {\n puts(\"0\");\n return 0;\n }\n while (l + 1 < r) {\n const int m = (l + r) >> 1;\n if (solve(m) >= p) {\n r = m;\n } else {\n l = m;\n }\n }\n assert(r > 0);\n assert(r < n);\n printf(\"%d\\n\", r);\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "98a1d53539757275a10e141fff09136f", "src_uid": "788ed59a964264bd0e755e155a37e14d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nvoid buble_sort(int a[], int n)\n{\n int i, j, t;\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}\nint main()\n{\n int n, l, i, j, xr, yr, xl, xh, yl, yh;\n scanf(\"%d\", &n);\n l=(4*n)+1;\n int x[l];\n int y[l];\n int xd[l];\n int yd[l];\n for(i=0; ixh) || (yd[i]yh))\n \t{\n \t xr=xd[i];\n \t yr=yd[i];\n \t break;\n }\n else if((xd[i]>xl && xd[i]yl && yd[i]\n#include\n/*#include\n#define MOD 1000000009\n#define MAX 100005\nlong long int position_value[MAX];\nvoid init()\n{\n position_value[0]=1;\n int i;\n for(i=1;i=last) return;\n int i,j,s;\n for(i=first;i<=last;i++)\n {\n for(j=i;j>0&&a[indices[j]]>a[indices[j-1]];j--)\n {\n s=indices[j-1];\n indices[j-1]=indices[j];\n indices[j]=s;\n }\n }\n}*/\nstruct Points\n{\n int x,y;\n};\nint main()\n{\n int n,i,j,k,x0,y0;\n scanf(\"%d\",&n);\n struct Points p[n*4+1];\n for(i=0;i=y0&&p[i].y<=y0+k))||((p[i].y==y0||p[i].y==y0+k)&&(p[i].x>=x0&&p[i].x<=x0+k)))\n {\n continue;\n }\n counter++;\n }\n if(counter>1) continue;\n for(i=0;i=y0&&p[i].y<=y0+k))||((p[i].y==y0||p[i].y==y0+k)&&(p[i].x>=x0&&p[i].x<=x0+k)))\n {\n continue;\n }\n printf(\"%d %d\",p[i].x,p[i].y);\n return 0;\n }\n }\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "20a59f7e72ad544b9bca79c64cb339f5", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nvoid buble_sort(int a[], int n)\n{\n int i, j, t;\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}\nint main()\n{\n int n, l, i, j, xr, yr, xl, xh, yl, yh;\n scanf(\"%d\", &n);\n l=(4*n)+1;\n int x[l];\n int y[l];\n int xd[l];\n int yd[l];\n for(i=0; ixh) || (yd[i]yh))\n \t{\n \t xr=xd[i];\n \t yr=yd[i];\n \t break;\n }\n else if((xd[i]>xl && xd[i]yl && yd[i]\n#include\nint asc(const void* a, const void* b)\n{\n\treturn *(int*)a - *(int*)b;\n}\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i;\n\tint x[50], y[50];\n\tfor (i = 0; i < 4 * n + 1; i++)\n\t\tscanf(\"%d %d\", &x[i], &y[i]);\n\tint xx[50], yy[50];\n\tfor (i = 0; i < 4 * n + 1; i++)\n\t\txx[i] = x[i];\n\tqsort(xx, 4 * n + 1, sizeof(int), asc);\n\tif (xx[0] != xx[1])\n\t{\n\t\tfor (i = 0; i < 4 * n + 1; i++)\n\t\t{\n\t\t\tif (x[i] == xx[0])\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\", x[i], y[i]);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tif (xx[4 * n - 1] != xx[4 * n])\n\t{\n\t\tfor (i = 0; i < 4 * n + 1; i++)\n\t\t{\n\t\t\tif (x[i] == xx[4 * n])\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\", x[i], y[i]);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tfor (i = 0; i < 4 * n + 1; i++)\n\t\tyy[i] = y[i];\n\tqsort(yy, 4 * n + 1, sizeof(int), asc);\n\tif (yy[0] != yy[1])\n\t{\n\t\tfor (i = 0; i < 4 * n + 1; i++)\n\t\t{\n\t\t\tif (y[i] == yy[0])\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\", x[i], y[i]);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tif (yy[4 * n - 1] != yy[4 * n])\n\t{\n\t\tfor (i = 0; i < 4 * n + 1; i++)\n\t\t{\n\t\t\tif (y[i] == yy[4 * n])\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\", x[i], y[i]);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tint maxx, minx, maxy, miny;\n\tmaxx = maxy = 0;\n\tminx = miny = 100;\n\tfor (i = 0; i < 4 * n + 1; i++)\n\t{\n\t\tif (x[i] < minx)minx = x[i];\n\t\tif (x[i] > maxx)maxx = x[i];\n\t\tif (y[i] < miny)miny = y[i];\n\t\tif (y[i] > maxy)maxy = y[i];\n\t}\n\tfor (i = 0; i < 4 * n + 1; i++)\n\t{\n\t\tif (x[i] != minx && x[i] != maxx && y[i] != miny && y[i] != maxy)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\", x[i], y[i]);\n\t\t\treturn 0;\n\t\t}\n\t}\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "831fbcf2f2bbb3345a7bf2a4e416fab8", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "/*\n * main.c\n *\n * Created on: 03 \ufffd\ufffd\ufffd. 2014 \ufffd.\n * Author: ulgish\n */\n\n\n/*\n * util.c\n *\n * Created on: 30 \ufffd\ufffd\ufffd\ufffd 2014 \ufffd.\n * Author: ulgish\n */\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\n#define LN printf(\"\\n\")\n#define TAB printf(\"\\t\")\n#define SPACE printf(\" \")\n\ntypedef unsigned long long uint64;\ntypedef long long int64;\ntypedef signed short int16;\ntypedef unsigned short uint16;\ntypedef char byte;\n\n\nvoid int64_print(int64 n){\n\tint64 carry = 10;\n\tif (n == 0){\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\nvoid uint64_print(uint64 n){\n\tuint64 carry = 10;\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\n\n\nuint64 uint64_read(){\n\tchar* s = (char*) calloc(20, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tuint64 ret = 0;\n\tuint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n\nint64 int64_read(){\n\tchar* s = (char*) calloc(21, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tint64 ret = 0;\n\tint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n//#define DEBUG\n\nint64 x;\nint a[100001];\nint b[100001];\n\nint n,d;\n\nvoid swap(int* a, int* b){\n\tint c;\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n\treturn;\n}\nint64 getNextX() {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n}\nvoid initAB() {\n\tint i;\n for(i = 0; i < n; i = i + 1){\n a[i] = i + 1;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(a[i]), &(a[(int)(getNextX() % (i + 1LL))]));\n }\n for(i = 0; i < n; i = i + 1){\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(b[i]), &(b[(int)(getNextX() % (i + 1LL))]));\n }\n}\n\n\nint main(){\n\tscanf(\"%d %d\", &n, &d);\n\tx = int64_read();\n\tint i,j;\n\tinitAB();\n\tint max_a[100000];\n\tint index_a[100001];\n\tint sum_b[100000];\n\tsum_b[0] = b[0];\n\tmax_a[0] = a[0];\n#ifdef DEBUG\n\tprintf(\"d:%d\\n\", d);\n\tfor (i = 0 ; i < n; i++){\n\t\tprintf(\"%d\\t\", b[i]);\n\t}\n\tLN;\n\n#endif\n\tif (b[0] == 0){\n\t\tprintf(\"0\\n\");\n\t}else{\n\t\tprintf(\"%d\\n\", a[0]);\n\t}\n\tint tmp = 0;\n\tfor (i = 0; i< n; i++){\n\t\tindex_a[a[i]] = i;\n\t\tif (i > 0){\n\t\t\tsum_b[i] = b[i] + sum_b[i-1];\n\t\t\tif (sum_b[i] == 0){\n\t\t\t\ttmp = i;\n\t\t\t}\n\t\t}\n\t}\n\tfor (i = 1; i <= tmp; i++){\n\t\tprintf(\"0\\n\");\n\t}\n\tfor (i = tmp+1; i < n; i++){\n\t\tint c = 0;\n\t\tmax_a[i] = MAX(a[i], max_a[i-1]);\n\t\tif (sum_b[i] == 0){\n\t\t\tprintf(\"0\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tint s = 0;\n\t\tbyte next = 0;\n\t\tfor (j = max_a[i]; j >= 0 && s < 5000; j--, s++){\n\t\t\tif (index_a[j] <= i){\n\t\t\t\tif (b[i - index_a[j]]){\n\t\t\t\t\tnext = 1;\n\t\t\t\t\tprintf(\"%d\\n\", j);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (next){\n\t\t\tcontinue;\n\t\t}\n\t\tfor (j = 0; j<= i; j++){\n\t\t\tc = MAX(c, a[j]*b[i-j]);\n\t\t}\n\t\tprintf(\"%d\\n\",c);\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6499d3b538191fd7fb05b7799be4fc11", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "/*\n * main.c\n *\n * Created on: 03 \ufffd\ufffd\ufffd. 2014 \ufffd.\n * Author: ulgish\n */\n\n\n/*\n * util.c\n *\n * Created on: 30 \ufffd\ufffd\ufffd\ufffd 2014 \ufffd.\n * Author: ulgish\n */\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\n#define LN printf(\"\\n\")\n#define TAB printf(\"\\t\")\n#define SPACE printf(\" \")\n\ntypedef unsigned long long uint64;\ntypedef long long int64;\ntypedef signed short int16;\ntypedef unsigned short uint16;\ntypedef char byte;\n\n\nvoid int64_print(int64 n){\n\tint64 carry = 10;\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\nvoid uint64_print(uint64 n){\n\tuint64 carry = 10;\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\n\n\nuint64 uint64_read(){\n\tchar* s = (char*) calloc(20, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tuint64 ret = 0;\n\tuint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n\nint64 int64_read(){\n\tchar* s = (char*) calloc(21, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tint64 ret = 0;\n\tint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n//#define DEBUG\n\nint64 x;\nint a[100001];\nint b[100001];\n\nint n,d;\n\nvoid swap(int* a, int* b){\n\tint c;\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n\treturn;\n}\nint64 getNextX() {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n}\nvoid initAB() {\n\tint i;\n for(i = 0; i < n; i = i + 1){\n a[i] = i + 1;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(a[i]), &(a[(int)(getNextX() % (i + 1LL))]));\n }\n for(i = 0; i < n; i = i + 1){\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(b[i]), &(b[(int)(getNextX() % (i + 1LL))]));\n }\n}\n\n\nint main(){\n\tscanf(\"%d %d\", &n, &d);\n\tx = int64_read();\n\tint i,j;\n\tinitAB();\n\n#ifdef DEBUG\n\tprintf(\"d:%d\\n\", d);\n\tfor (i = 0 ; i < n; i++){\n\t\tprintf(\"%d\\t\", b[i]);\n\t}\n\tLN;\n\n#endif\n\tfor (i = 0; i < n; i++){\n\t\tint64 c = 0;\n\t\tfor (j = 0; j<= i; j++){\n\t\t\tc = MAX(c, a[j]*b[i-j]);\n\t\t}\n\t\tint64_print(c); LN;\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2d1b821d18cec3cbb10052cae975367b", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "/*\n * main.c\n *\n * Created on: 03 \ufffd\ufffd\ufffd. 2014 \ufffd.\n * Author: ulgish\n */\n\n\n/*\n * util.c\n *\n * Created on: 30 \ufffd\ufffd\ufffd\ufffd 2014 \ufffd.\n * Author: ulgish\n */\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\n#define LN printf(\"\\n\")\n#define TAB printf(\"\\t\")\n#define SPACE printf(\" \")\n\ntypedef unsigned long long uint64;\ntypedef long long int64;\ntypedef signed short int16;\ntypedef unsigned short uint16;\ntypedef char byte;\n\n\nvoid int64_print(int64 n){\n\tint64 carry = 10;\n\tif (n == 0){\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\nvoid uint64_print(uint64 n){\n\tuint64 carry = 10;\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\n\n\nuint64 uint64_read(){\n\tchar* s = (char*) calloc(20, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tuint64 ret = 0;\n\tuint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n\nint64 int64_read(){\n\tchar* s = (char*) calloc(21, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tint64 ret = 0;\n\tint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n//#define DEBUG\n\nint64 x;\nint a[100001];\nint b[100001];\n\nint n,d;\n\nvoid swap(int* a, int* b){\n\tint c;\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n\treturn;\n}\nint64 getNextX() {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n}\nvoid initAB() {\n\tint i;\n for(i = 0; i < n; i = i + 1){\n a[i] = i + 1;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(a[i]), &(a[(int)(getNextX() % (i + 1LL))]));\n }\n for(i = 0; i < n; i = i + 1){\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(b[i]), &(b[(int)(getNextX() % (i + 1LL))]));\n }\n}\n\n\nint main(){\n\tscanf(\"%d %d\", &n, &d);\n\tx = int64_read();\n\tint i,j;\n\tinitAB();\n\tint max_a[100000];\n\tint index_a[100001];\n\tint sum_b[100000];\n\tsum_b[0] = b[0];\n\tmax_a[0] = a[0];\n#ifdef DEBUG\n\tprintf(\"d:%d\\n\", d);\n\tfor (i = 0 ; i < n; i++){\n\t\tprintf(\"%d\\t\", b[i]);\n\t}\n\tLN;\n\n#endif\n\tint tmp = 0;\n\tfor (i = 0; i< n; i++){\n\t\tindex_a[a[i]] = i;\n\t\tif (i > 0){\n\t\t\tsum_b[i] = b[i] + sum_b[i-1];\n\t\t\tif (sum_b[i] == 0){\n\t\t\t\ttmp = i;\n\t\t\t}\n\t\t}\n\t}\n\tfor (i = 0; i < tmp; i++){\n\t\tprintf(\"0\\n\");\n\t}\n\tfor (i = tmp; i < n; i++){\n\t\tint c = 0;\n\t\tmax_a[i] = MAX(a[i], max_a[i-1]);\n\t\tif (sum_b[i] == 0){\n\t\t\tprintf(\"0\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tint s = 0;\n\t\tbyte next = 0;\n\t\tfor (j = max_a[i]; j >= 0 && s < 5000; j--, s++){\n\t\t\tif (index_a[j] <= i){\n\t\t\t\tif (b[i - index_a[j]]){\n\t\t\t\t\tnext = 1;\n\t\t\t\t\tprintf(\"%d\\n\", j);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (next){\n\t\t\tcontinue;\n\t\t}\n\t\tfor (j = 0; j<= i; j++){\n\t\t\tc = MAX(c, a[j]*b[i-j]);\n\t\t}\n\t\tprintf(\"%d\\n\",c);\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1cee38bcb363eaedc907c3c29d682f0b", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "/*\n * main.c\n *\n * Created on: 03 \ufffd\ufffd\ufffd. 2014 \ufffd.\n * Author: ulgish\n */\n\n\n/*\n * util.c\n *\n * Created on: 30 \ufffd\ufffd\ufffd\ufffd 2014 \ufffd.\n * Author: ulgish\n */\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\n#define LN printf(\"\\n\")\n#define TAB printf(\"\\t\")\n#define SPACE printf(\" \")\n\ntypedef unsigned long long uint64;\ntypedef long long int64;\ntypedef signed short int16;\ntypedef unsigned short uint16;\ntypedef char byte;\n\n\nvoid int64_print(int64 n){\n\tint64 carry = 10;\n\tif (n == 0){\n\t\tprintf(\"0\");\n\t\treturn;\n\t}\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\nvoid uint64_print(uint64 n){\n\tuint64 carry = 10;\n\tchar buf[20];\n\tbuf[0] = '\\0';\n\tint i = 0, j;\n\twhile (n > 0){\n\t\tbuf[i] = n % carry;\n\t\tn = n / carry;\n\t\ti += 1;\n\t}\n\ti--;\n\tfor (j = i; j>= 0; j--){\n\t\tprintf(\"%c\", 48 + buf[j]);\n\t}\n}\n\n\nuint64 uint64_read(){\n\tchar* s = (char*) calloc(20, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tuint64 ret = 0;\n\tuint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n\nint64 int64_read(){\n\tchar* s = (char*) calloc(21, sizeof(char));\n\ts[0] = '\\0';\n\tscanf(\"%s\", s);\n\t//printf(\"=======%s\\n\", s);\n\tint64 ret = 0;\n\tint64 carry = 1;\n\tint len = strlen(s), i;\n\tfor (i = 0; i < len; i++){\n\t\tret += carry * (s[len-1-i] - 48);\n\t\tcarry*=10;\n\t};\n\tfree(s);\n\treturn ret;\n}\n\n//#define DEBUG\n\nint64 x;\nint a[100001];\nint b[100001];\n\nint n,d;\n\nvoid swap(int* a, int* b){\n\tint c;\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n\treturn;\n}\nint64 getNextX() {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n}\nvoid initAB() {\n\tint i;\n for(i = 0; i < n; i = i + 1){\n a[i] = i + 1;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(a[i]), &(a[(int)(getNextX() % (i + 1LL))]));\n }\n for(i = 0; i < n; i = i + 1){\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n for(i = 0; i < n; i = i + 1){\n swap(&(b[i]), &(b[(int)(getNextX() % (i + 1LL))]));\n }\n}\n\n\nint main(){\n\tscanf(\"%d %d\", &n, &d);\n\tx = int64_read();\n\tint i,j;\n\tinitAB();\n\tint max_a[100000];\n\tint index_a[100001];\n\tint sum_b[100000];\n\tsum_b[0] = b[0];\n\tmax_a[0] = a[0];\n#ifdef DEBUG\n\tprintf(\"d:%d\\n\", d);\n\tfor (i = 0 ; i < n; i++){\n\t\tprintf(\"%d\\t\", b[i]);\n\t}\n\tLN;\n\n#endif\n\tif (b[0] == 0){\n\t\tprintf(\"0\\n\");\n\t}else{\n\t\tprintf(\"%d\\n\", a[0]);\n\t}\n\tint tmp = 0;\n\tfor (i = 0; i< n; i++){\n\t\tindex_a[a[i]] = i;\n\t\tif (i > 0){\n\t\t\tsum_b[i] = b[i] + sum_b[i-1];\n\t\t\tif (sum_b[i] == 0){\n\t\t\t\ttmp = i;\n\t\t\t}\n\t\t}\n\t}\n\tfor (i = 1; i < tmp; i++){\n\t\tprintf(\"0\\n\");\n\t}\n\tfor (i = tmp; i < n; i++){\n\t\tint c = 0;\n\t\tmax_a[i] = MAX(a[i], max_a[i-1]);\n\t\tif (sum_b[i] == 0){\n\t\t\tprintf(\"0\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tint s = 0;\n\t\tbyte next = 0;\n\t\tfor (j = max_a[i]; j >= 0 && s < 5000; j--, s++){\n\t\t\tif (index_a[j] <= i){\n\t\t\t\tif (b[i - index_a[j]]){\n\t\t\t\t\tnext = 1;\n\t\t\t\t\tprintf(\"%d\\n\", j);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (next){\n\t\t\tcontinue;\n\t\t}\n\t\tfor (j = 0; j<= i; j++){\n\t\t\tc = MAX(c, a[j]*b[i-j]);\n\t\t}\n\t\tprintf(\"%d\\n\",c);\n\t}\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2bc187ace8e5b7d3fd69e1ea1ab254d9", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t100000\n#define S\t20\n\nint max(int a, int b) { return a > b ? a : b; }\n\nint aa[N], bb[N];\nint x;\n\nint get_next_x() {\n\treturn (x = (x * 37LL + 10007) % 1000000007);\n}\n\nvoid init_AB(int n, int d) {\n\tint i, j, tmp;\n\n\tfor (i = 0; i < n; i++)\n\t\taa[i] = i + 1;\n\tfor (i = 0; i < n; i++) {\n\t\tj = get_next_x() % (i + 1);\n\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tbb[i] = i < d;\n\tfor (i = 0; i < n; i++) {\n\t\tj = get_next_x() % (i + 1);\n\t\ttmp = bb[i], bb[i] = bb[j], bb[j] = tmp;\n\t}\n}\n\nint main() {\n\tstatic int ii[S + 1], jj[N];\n\tint n, d, h, i, k, c;\n\n\tscanf(\"%d%d%d\", &n, &d, &x);\n\tinit_AB(n, d);\n\tk = 0;\n\tfor (i = 0; i < n; i++) {\n\t\th = i < S ? i : S;\n\t\twhile (h > 0 && aa[ii[h - 1]] < aa[i]) {\n\t\t\tii[h] = ii[h - 1];\n\t\t\th--;\n\t\t}\n\t\tii[h] = i;\n\t\tif (bb[i])\n\t\t\tjj[k++] = i;\n\t\tc = 0;\n\t\tfor (h = 0; h <= i && h < S; h++)\n\t\t\tif (bb[i - ii[h]]) {\n\t\t\t\tc = aa[ii[h]];\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (c == 0)\n\t\t\tfor (h = 0; h < k; h++)\n\t\t\t\tc = max(c, aa[i - jj[h]]);\n\t\tprintf(\"%d\\n\", c);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2f59cd658b9752baaaa7e188be9a86a6", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nenum {\n N = 1010\n};\nconst int MOD = 1e9 + 7;\n\nint dp[N][2 * N], k, ls;\nchar s[N];\n\n\nint rec(int pos, int dist, int anyDigit) {\n if(pos == ls)\n return dist == 0;\n if(anyDigit && dp[ls - pos][dist] != -1)\n return dp[ls - pos][dist];\n\n int limit = anyDigit ? 9 : s[pos] - '0';\n int ret = 0, i;\n for(i = 0; i <= limit; i++) {\n int ndist = dist + (dist != 0);\n if(i == 4 || i == 7)\n ndist = dist <= k ? 0 : 1;\n ret += rec(pos + 1, ndist, anyDigit || (i < limit));\n while(ret >= MOD)\n ret -= MOD;\n }\n if(anyDigit)\n dp[ls - pos][dist] = ret;\n return ret;\n}\n\nint isLucky() {\n int i, prev = -N;\n for(i = 0; prev != 0 && i < ls; i++) {\n if(s[i] == '4' || s[i] == '7')\n prev = (i - prev) <= k ? 0 : i + 1;\n }\n return prev == 0;\n}\n\nint main() {\n int t;\n scanf(\"%d %d\", &t, &k);\n memset(dp, -1, sizeof(dp));\n while(t--) {\n scanf(\"%s\", s);\n ls = strlen(s);\n int val = rec(0, k + 1, 0) - isLucky();\n\n scanf(\"%s\", s);\n ls = strlen(s);\n val = rec(0, k + 1, 0) - val;\n while(val < 0)\n val += MOD;\n while(val >= MOD)\n val -= MOD;\n printf(\"%d\\n\", val);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ac5f1ac4b449e0c5f15304234e545c24", "src_uid": "5517efa2fc9362fdf342d32adac889f4", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "void main(void", "lang_cluster": "C", "compilation_error": true, "code_uid": "fc3dae342cdf11f1e9efb7311b825454", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c2fecfc3c358eff951bdcbbc45be1657", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "3986a803c8fcd740bb1c0899630623ca", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \nvoid main(void)\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e770f53af13de5fa46a419c4b76f948a", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "void main(void)\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "02934d2850f544eb2777c3289e41f187", "src_uid": "e167dc35a0d3b98c0414c66099e35920", "difficulty": 800.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t100000\n#define MD\t1000000007\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nlong long lcm(int a, int b) {\n\treturn (long long) a / gcd(a, b) * b;\n}\n\nint tt[N + 1];\n\nvoid init() {\n\tint a, b;\n\n\tfor (a = 1; a <= N; a++)\n\t\ttt[a] = a;\n\tfor (a = 2; a <= N; a++) {\n\t\tif (tt[a] != a)\n\t\t\tcontinue;\n\t\tfor (b = a; b <= N; b += a)\n\t\t\ttt[b] = tt[b] / a * (a - 1);\n\t}\n}\n\nint main() {\n\tint n, d, a, b, ans;\n\n\tinit();\n\tscanf(\"%d\", &n);\n\tans = 0;\n\tfor (d = 1; d <= n; d++)\n\t\tfor (a = d + d; a < n; a += d) {\n\t\t\tb = n - a;\n\t\t\tans = (ans + lcm(b, d) % MD * tt[a / d]) % MD;\n\t\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee9f3586607447df2cc74bbd7ba813e8", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t4000\n#define MD\t1000000007\n\nint main() {\n\tstatic int ch[N + 1][N + 1], dp[N + 1], pp[N + 1];\n\tint n, i, j, k, p;\n\tlong long x, y, ans;\n\n\tscanf(\"%d\", &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 <= n; j++)\n\t\t\tch[i][j] = (ch[i - 1][j] + ch[i - 1][j - 1]) % MD;\n\t}\n\tdp[0] = 1;\n\tfor (i = 1; i <= n; i++) {\n\t\tx = 0;\n\t\tfor (j = 2; j <= i; j++) {\n\t\t\ty = dp[i - j];\n\t\t\tif (dp[i - j] != 0)\n\t\t\t\tx = (x + y * ch[i - 1][j - 1]) % MD;\n\t\t}\n\t\tdp[i] = x;\n\t}\n\tp = 1;\n\tfor (i = 0; i <= n; i++) {\n\t\tpp[i] = p - 1;\n\t\tp = p * 2 % MD;\n\t}\n\tans = 0;\n\tfor (k = 1; k <= n; k++)\n\t\tans = (ans + (long long) pp[k] * ch[n][k] % MD * dp[n - k]) % MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "605395b1f179c6bb62a3ef48c540f09c", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint n, ar[]={0,1,3,10,37,151,674,3263,17007,94828,562595,3535027,23430840,163254885,192059216,97183539,384727153,211932162,665362848,415709078,654959364,894067657,839120000,627072923,586774033,440165789,840647542,118441546,505992682,607243387,93527420,378847836,948139661,770183251,365355663,989344183,548640276,317289217,997901123,159164073,843138878,532150136,738186543,903861313,682196381,973969945,132955760,252975343,448800686,260473966,172364334,974776377,897990701,517201033,576838003,99444281,227668527,276751933,925606182,183971202,872834804,675567482,485151063,90425806,573944639,319383684,228218188,853465612,413776522,234312776,696953174,561359388,614568659,310760116,308156021,643857743,130527569,21545623,861347933,160875480,265384023,880663120,642768069,283279971,101569565,642645431,549146203,962813505,943728849,409246814,285130248,71857567,876844125,639794356,718486712,669604188,215716321,617971855,139675728,757688910,320249104,621227957,8420956,210511678,237853303,571777940,124824068,554160360,861653403,682637480,231939767,18101111,899784402,38539461,459245274,133368830,794361288,845364734,411437479,295388712,946233522,770525146,9117720,552920178,575589233,372629731,386010446,840661218,620900095,139503115,511927381,578357362,64025286,334338018,50447285,600060973,463521109,603848757,124677320,384555440,124916527,185672381,489919006,909579381,138193225,265871589,754007856,931017925,530042754,776962350,693701991,697550026,65897729,925178446,524529822,282186556,906408203,423821527,235677618,198401842,739841724,445468199,551132246,282892517,598818617,713743768,323922897,386628568,474046790,302658513,783562521,701916176,482177632,681588349,266655423,743351863,319498248,426746288,89678205,500650748,546473898,223152283,841147627,688890488,901303731,788610629,829394955,750389455,745439788,809252095,287863106,297473389,52881575,679729868,61954094,593572313,142142337,87045414,702643022,32976555,517206126,380236389,828797589,845005051,422842060,260455358,651230866,488177154,982371716,172307030,994127208,259014259,84243868,148694890,313032650,79750143,628177536,256112757,535578122,7516872,660259410,862246837,942873362,525515969,353458202,517016061,146128173,615658629,171576507,313485249,756862637,740107237,450464972,698608957,380461701,788065795,235055502,488339779,625468897,81218153,752562624,954468821,388408427,220000770,962611398,138488797,232824743,623588948,89320450,5174417,444171924,539838147,184946963,829706030,250353513,837334003,192637869,954980409,989726944,503629638,246128748,144252879,869972346,159483785,38149548,399002531,139867042,702866700,566004753,303913805,946274118,352063038,148918236,344908939,925123896,175513960,888310551,233700316,237128991,80142095,627539989,30420961,108486126,993957197,940173780,407371015,13694119,969064311,945245210,515586500,834646464,210959252,766474958,237866830,520123316,83961446,97878509,896040082,51406202,612079312,569120595,325712093,979110226,72296197,169538467,506717757,990725778,888153398,884672580,747447278,989585067,197205447,997554253,162606658,612854211,585638351,300385030,648581707,24645691,142364491,87271224,656248353,311752536,345078260,862509279,749617553,148690167,255207879,937517648,692740850,188651194,442080602,285711119,523391595,806719830,122802835,948147156,825684063,120090726,465071065,216239633,955952822,254936196,818273287,582823720,838683603,211078726,609268949,539236132,461048619,931162689,575599737,702129707,929755292,3165024,932095281,371965629,560082406,915331279,404247953,119029625,650026279,33911127,542568006,737311646,839818392,121381063,81776121,264049814,428758250,935258956,524814024,827629225,159677867,208903802,254070037,334398982,852112879,205126265,581086872,289728727,749733927,825622969,203314518,313219470,714203321,966360246,415028559,441541100,64736522,135298651,311340818,724308321,852861846,567399501,818780718,445445536,185482874,890679335,117928565,212566203,217299615,125999181,478432188,642522487,657976604,462229383,930237021,202402571,859794210,821285303,193707191,139635308,949631508,581555701,493872210,253862710,156423352,756876608,453019810,540238248,525374182,395165149,552059946,666018027,218650948,316154754,567824223,718412883,959027290,327709825,416281152,860382344,503677292,449112827,426967024,595415467,755716122,910210918,495279146,453103898,539903326,104084806,171428406,629857538,238805628,522091539,904850095,831383119,364871289,59654563,188523918,418555114,248860166,832365397,779188603,392396445,763896392,993974548,375970645,176183947,455296206,826990889,44758036,495683674,791719842,655621264,658939366,735144599,275667277,655999018,965639168,676574799,346864447,379511514,459854791,905913554,604918364,6920002,652092992,597377405,920491194,562313297,482675638,955706031,63469748,417878805,240441437,990705174,289937758,842452102,258265727,995663867,792673745,608833565,729570088,316539671,559104003,153929272,607988017,245598088,490462484,935463414,309255995,733478384,499515550,689830722,849692817,311550442,635474783,127169195,910162202,556279594,843716880,644338672,555172441,515997236,135709697,79038893,557695690,600886859,838036451,688243460,80967535,608159856,174858889,422157947,441973358,506853336,687223249,123283931,645920250,839276153,765041805,409869914,291531081,819585362,902467908,477747296,528122783,145373134,454099129,741569333,626092036,479879088,369907895,230044569,505385342,714902613,875040101,190473063,872158769,408884988,455015252,472359859,31983119,493209943,310194407,220499597,452995259,135106373,178201213,847019301,990806426,376403818,58273490,281675800,520754800,348121405,425884587,2386009,487763288,337156970,997180386,417075508,864730872,42921994,871322813,840211325,364063966,22525422,600235,193819034,893790438,426792415,487326644,543061001,282015176,157152541,994468078,884492307,713444307,579253748,768509697,992424572,146763641,846399754,258078009,128093022,747576202,755784458,775371259,738049893,408147951,30228860,298205559,841396697,479705709,89724340,910693466,917842511,772248726,925394143,423016364,940794131,589937656,12439416,817505576,5766321,207335208,205400856,372008708,188964921,55224741,517371213,384078369,338366732,664331412,865275333,827065831,804972385,178748961,191743352,403004296,927564052,823868740,257622825,717878335,446887176,322169470,269834524,843929114,27272298,50378784,522410690,596183878,451906315,172190807,733947210,259460885,833852491,616714123,951537680,926805258,813388867,443303026,291977683,599670158,238152294,445689856,936327374,196240693,364266010,190436954,155125524,802286442,86247911,746915367,812149761,386697017,156862662,999227446,614061595,430319410,14310047,905615597,730967460,839536767,566459999,528830445,488205273,155119197,977792541,733620069,789944551,854917887,212864273,919407613,737497548,675470363,478932389,246699156,251877523,53345644,261274483,760124865,50090062,854981767,791955534,691459974,389774782,465159470,569088844,418118310,342684204,596536636,249320348,606857878,713420778,226131359,388575274,21911539,474258973,93797243,644078757,453826534,403801164,363533678,992826772,507750910,373503532,616791236,264372059,183581261,750221171,878155094,936703585,6652074,251020568,992659897,368462422,891650074,750721486,610629516,709514492,685833760,579428558,50900893,773008170,385305515,823673055,953225968,603314440,728148979,232809574,855455002,295582086,553846325,476981256,332957653,63715908,224273587,51891906,346473784,104448776,460060855,136026344,661137664,469259167,290470382,86264866,625481264,739844065,704844076,372478787,496577830,165971165,39385643,676697182,190393622,920720064,150178227,939373600,854086304,830730341,370885785,789942972,765401747,766283645,416945039,523371177,322970857,646425052,511694855,736905288,953415053,560704652,648860447,428694301,894447856,841850834,272571430,678430160,346541448,767049503,36077574,679246151,466003799,733592729,207171878,650255964,550391662,53825240,889883963,12600784,641017311,291148361,554976793,797024191,85490633,229960755,15970020,565598371,192019037,703223903,195449229,64719321,934602250,799142123,251430165,887594806,421911384,545506631,493870301,996132354,610717221,171323729,912266937,320567831,578485179,307129662,433491047,21559367,270948717,441179537,802388729,910301331,384072750,536953724,835860980,839011086,312337042,763106402,967665058,924323916,79578586,765754762,832689130,913917411,898560484,792084326,348091988,462841747,38010959,392737993,3009449,350831771,912199630,425134703,775020717,647997584,741356698,166278460,869663083,647072939,745625861,225232692,772550810,97926046,158274643,639954960,993664685,948581315,42923854,497120441,472948622,671591547,481449061,804758853,579280044,496884109,7385548,654808800,859416940,503726762,626537115,408793283,645016533,420812424,673499997,373272687,544266494,719819823,952799809,980437016,79869262,746105457,555042166,300365589,314262330,775547898,319195,862064506,247861214,539457472,891181651,739899313,856325939,474792389,646142824,425012348,464504884,175255790,645189570,994342074,388145377,758485776,644299470,938620234,523460486,696845537,146251274,765755555,211765723,406209862,262334486,314682323,238926155,380293812,793306827,695934971,41797572,164125639,734295601,957006629,28334704,805752965,247692986,455019269,674818780,640914235,498334463,328997275,98728370,94303005,330407573,622176072,902724011,502359677,365755512,33774623,314570757,644858120,319084859,585531096,555979614,20241404,171234266,134211500,178834316,623478011,775898740,847141991,679004596,888241786,304501225,547356433,9982489,987046099,186943448,13253947,765250104,958448902,814200319,837071048,676888072,296152354,217946267,972702366,775412130,658068164,156404376,926912470,443555522,250919597,317855456,915909293,284399659,453799011,5105713,790891033,792297210,710028002,618142770,364287620,331045396,687384881,424599451,630174112,867937200,769346042,484475224,70419182,622020019,256886187,38456691,715189368,370106296,264780551,292186988,90417925,143278292,573568020,714660817,287022466,572214539,829167149,697488315,72368017,368199605,262908146,163077668,455674471,748843401,751645251,884369638,689084763,672847687,163891792,461395492,302226377,664625974,577809015,941674562,131401399,309794389,316433861,667752638,284189888,968220163,584810471,201754740,563353811,500121861,515294445,431344283,551453151,676839106,482675182,27141974,225531211,417545520,577032155,777262421,543846497,202834963,870266166,757772475,863416480,815999208,987758583,902266565,262072884,489557494,35642385,322610818,454671220,846664545,339165468,167841816,41792934,816030258,8374123,472924553,590410784,812622874,821815806,686549685,586496957,573983725,526279493,937875240,586272615,79980609,817572098,49577869,988672744,562171392,646881269,147215121,616796113,644886645,597791310,683978339,723580327,317239670,839871962,979469695,451512661,52049196,468819589,293585610,841365638,433463909,635115970,697627677,875593849,94609155,306000460,324881773,882169936,773246242,483441793,582334856,731323053,661390729,859812401,59690028,578797844,969394600,24581744,639171654,741500461,703531323,912447409,118816459,817192281,450086895,391818462,425676138,40537340,262670821,27903141,51470642,850558030,147747791,917072134,344989983,562182867,500804337,902729830,141473653,45035817,609220152,538387348,712397127,553791286,292908483,188425885,346444658,193186312,824573033,747471409,780772400,757551785,172848355,845254480,686129156,785048012,622014500,872720038,102455473,867474927,919250514,666141143,588427128,852369363,445940559,209574792,886466250,646346449,615807900,796805074,266036928,442383386,387820339,804624621,58065519,293123937,197148648,895594288,161078475,187577644,91985993,869252687,312427344,749359694,411989786,44617848,685631848,875391712,225073610,725783885,684055221,938696718,923112084,96102386,713974845,87920864,91300316,298972718,321470346,82847310,821083006,109063493,963694457,335333188,419415126,432269906,78620389,256059592,507183168,74360590,476674075,950776969,556452274,116536558,410412816,80018638,654087452,643902773,997473904,613296730,816349021,763840061,279014728,108603031,962582510,583034826,897098978,509902642,91571272,855903910,683065640,845807965,627864237,96631038,526748163,39991977,300823348,967751668,350518688,51422069,960456532,376432318,568316522,145000168,899364689,617820153,421613081,998545497,360765423,24182861,25348536,99470730,253205483,487623243,394440419,709415547,383872230,89782724,320034586,403979873,36254775,549581568,667943168,758068193,841054201,582451650,942588073,769830863,823609178,926649294,727177359,555879723,894378844,652545994,298053594,527144937,744884670,12805690,667149698,124493325,978511736,514821512,357286698,311246498,210888954,965502937,932798317,516157069,598235900,544198300,859692452,27345953,619090787,274825224,615935803,705193548,668826398,37937406,450774711,127774649,852917560,50350371,665237495,27432758,281981773,801697925,591798383,197023576,406358042,794373745,296697434,681939405,761832978,460217048,516575812,894110038,12714620,380931876,693323854,687959690,218747110,262307021,644569801,695911453,750070814,862942697,92391829,576645388,562020314,6919284,946901348,796844815,423491488,564231467,904886290,173404833,555546106,322929877,212033996,786025744,131528823,555356730,714333280,202915220,809672717,426216935,725895468,81980077,199937721,360816765,360743125,75430894,576563708,230788709,553965955,434610707,488343014,131594574,699299319,15360664,295603119,965115179,835169275,336188722,675847471,123084178,289371284,172644148,851254725,954115681,208852926,400285368,272949949,949307749,406417372,637108773,311628969,54347186,555094378,760775792,675727049,559758729,410594967,413513368,662013397,137994376,587222931,214336967,192984205,454673826,653529057,711347536,669749496,542510893,784865748,479436555,702243551,474714996,284344106,732211466,695618554,552387743,215971257,26190178,431885789,584120993,192812458,629286056,346268824,387322399,95878083,725347537,972804693,120163634,683361823,587682969,389954764,960382014,251659367,265701780,744584852,420703965,313783197,199437853,103151198,860216940,827873811,741106764,892866403,317880376,651598950,62520065,601324769,163877813,743532086,475524842,305649653,636019709,520070197,214412475,604267039,634178293,767845835,470370244,405458485,890829842,606046026,471095166,27555972,67624609,995492251,321607727,393733625,558658479,620823036,85516904,347164978,826672619,350270030,297068674,561311695,359062471,475755187,863804484,255614584,749626475,340977869,469594424,212703887,257501249,162823755,306023706,241125417,142710998,776584824,650831226,473016565,89562361,29352481,480103617,412034701,613572861,60642647,178587486,567344870,80944003,482005028,222170219,142318034,556699736,373084842,752988211,814839792,871387412,620386607,602064240,108189774,702036287,278260815,231701765,951549235,626545807,445966287,712350716,500124640,188171399,676125371,371394647,837298960,939336022,438031036,186714880,216111716,186044002,581620230,340599528,101017623,954534105,995780074,618882019,418147528,767131494,301425635,413745436,962385176,988626008,137028715,583626729,374502874,129245417,783696635,516244019,166701302,395998250,899091379,185147981,888020140,214258254,830884306,291227991,600383262,836705371,150117498,22802471,69557681,875092333,498794258,369675284,941672774,245715055,351032507,745046885,808550199,76081612,247926676,620593330,454226637,124999051,997605209,309479695,223505774,30851595,796149915,234214672,698950772,634482949,657440469,680685934,622581826,471407126,641364582,439880604,828662127,710328881,854337730,218954183,308890346,696883741,704295352,23756660,692821843,759054630,223276561,816528545,805470409,321576509,507647022,959763181,959047512,71355150,867173786,570650020,763468490,454668170,461222603,770001770,552268482,365360958,764911700,677237544,440328283,984549649,259844284,75262068,503143712,838297266,105854139,202662940,683355886,363265848,555867076,887916417,766236164,129769218,260030095,376298724,956523327,899221952,33538203,917822505,692713873,268868540,480130178,308269358,37693909,258466510,300897318,587896924,278096281,191534712,919963415,565641621,320019586,879837320,908684471,23870521,479525399,523797789,364351125,761922216,427454498,272480994,531892568,292110048,28298126,163923066,144435894,463928498,878941514,432095463,874023827,449729638,637204414,825970062,643921799,835275561,752031673,957571344,784924485,289472366,8843335,972907389,328534344,957382231,222481914,512123613,255687739,321672181,106614581,149991666,483357223,454175825,745448720,274635425,313232453,374663650,677756092,632611936,22070680,339269657,132455542,338802685,718343286,603452480,699756846,802026382,630527452,896151723,939566225,258401424,853392870,880194524,792827319,403695464,109462351,962558728,135069793,549142905,983579550,110815829,909786301,182557229,226845651,200705606,497560256,193529259,308570479,329947007,189498630,193994069,898161342,260293498,537724486,162722279,972018154,150488640,485488569,797202722,828096899,629742190,221961319,338535225,581622427,521477026,528640359,597216559,922488813,730878735,205255505,474388932,989429410,502110503,673876242,185798899,902302522,501809075,233065479,356452765,541073672,847051360,538785072,862803293,409689476,625279470,513414045,868495308,330682429,586751803,508454254,619218542,533898619,341736407,646062216,89216946,19220297,949573988,655460326,308240372,695484802,880739242,573500002,231169478,64651173,35122460,131988165,544955859,769857172,185393273,886747610,615162473,889794879,337973379,106604658,386386085,191341291,878552432,469859981,171378318,2481856,272586583,832406872,960328858,336146912,281053957,934376162,646820844,536944351,364814113,117742167,247184801,561613760,293317830,469232799,791091533,954321146,805541161,709574499,898284542,959570285,682922905,301875364,719438718,279592170,46864067,358224301,92060233,672795876,587715426,106552713,88983953,597426475,297706732,111408834,78355372,115919434,156681874,739661478,624419128,785595407,405130433,6754034,737909746,281114344,773967075,286197545,307581135,555742349,810716297,685375889,750925961,421118058,767308669,713093101,240592908,443827005,713587241,441373998,342424531,425926014,622764455,947687630,790195536,790596210,375395089,932221511,25492365,241669632,606391370,846261543,918436478,737745508,820405158,703149588,99985859,859425550,554220631,340069979,312586014,985226374,527441942,838574536,541207768,284030480,220471415,961393295,871333307,663187660,790456052,34901253,535484514,722947227,714448394,109574819,19083719,220125251,417603431,976429984,422222053,899493832,100004706,553764858,417966897,437366073,189674298,736512985,780253223,113871537,156225764,556827261,240680090,501566432,877565262,472725289,107264391,808323093,55779840,689987671,328867116,497001013,594887013,333410113,631186472,840294215,840269203,191671281,730328264,87906040,579860294,706516137,375706875,212905817,636563737,371574188,104784815,659682247,721582469,298892685,555695643,389864,190911396,529299213,410894675,332730574,61493176,735084536,324332495,935432983,572785934,417828425,536668260,283506957,181386007,930770260,41654507,397364759,661712266,957704561,467366674,981360437,543341704,842942688,66309450,657579216,450738922,729231551,364401688,892809238,321255591,981613019,182078766,287581910,257912053,212562074,773918106,591994316,862205103,230201619,203483751,554022956,789565117,929049349,826235646,656610099,382055716,318638158,781052879,921113281,155317942,673723416,867221883,67089512,281422729,46554513,59547294,621947885,655132643,582394463,947220742,242129262,306394898,102190889,384049370,25418591,961962222,420193998,240418005,720679455,944550734,738288403,75630516,542181891,387422652,55350584,974846223,28240417,779310231,385549603,323848720,403791424,690839156,198854843,817953072,272671381,464511161,462716461,355374728,692776041,463320052,157246267,628326792,251820723,234400901,489608588,144560185,702925828,784090797,957419811,656164198,960640940,180203837,96415507,998579916,462456354,182396132,904589630,730357039,575175399,237891572,318282504,974204841,506217462,850372570,449312032,237173071,677473176,310432426,517350609,519164751,694276927,448982641,64685419,974975446,820353901,120704072,349187066,694049966,811386207,533414583,962820706,844007880,665402350,651284026,539865261,789989017,101356214,611202047,8168715,489388533,935941692,509840506,582373452,238216312,630014017,446025706,891751537,130209415,299560121,976614524,378434897,574178431,231132738,992472749,909426304,116377349,162162272,245648474,549686534,179141462,692075007,723182056,645909658,14361269,617087262,221974377,552612255,188092602,755557517,587768898,490498711,2518894,715336312,617125067,409501829,148222348,722287756,508186616,528470793,627551947,899326934,634401256,327358565,78436810,826493637,684726740,956508730,891606217,24526892,634647594,647963390,214891455,196610805,452841546,356077803,4323457,367511689,991876200,633457395,378659254,278694471,670724606,433109360,739295420,209242515,386770185,550529210,904322367,527416662,814136345,373111996,365234797,151071261,685657738,53651484,931164748,93186558,555823348,111861661,776517468,598181114,619236678,548386249,600525000,378050148,33611038,905478451,470705373,304656170,860612697,82680671,865826222,106558866,254293989,779341172,318337985,295779765,407502933,57702521,699658590,660049600,829841368,880536179,883869765,432693983,106831719,148045131,53887459,184474494,145351750,35022472,141036939,262960580,456944085,115872927,608860422,682610474,115500378,482559979,121898583,861532144,765811000,880101873,905483679,907172730,333143286,761140231,807972606,138875294,418648634,676227013,598926412,375313855,715298791,296012865,655324878,355854564,152052376,511527571,417942243,173805349,545508711,344954037,34947151,804917160,537477802,751857389,185026438,350419106,834011373,567123736,22361163,181073787,543764704,680150069,710782765,955531522,973001971,669741659,675655237,511270945,480581735,615498095,170682731,523408699,821654522,709032736,252522089,904554520,654102893,131097076,221302521,927279810,923491368,86616826,687201950,554754405,878915101,511529829,43413539,407864622,116006459,239702197,596618750,916490891,969731953,921601053,92532785,398398256,453697426,798979828,574852861,216671430,300870037,996615050,258063469,654525871,619017586,145506046,270193064,426684029,385546407,777211607,951807402,339223774,621988781,269055691,625486075,361791045,448311220,961238575,535553496,666417665,444784348,389373972,57979066,475494691,659372113,123635917,889415462,575193533,780578990,785468049,771405474,613682881,127399906,40840472,434189404,735173309,474310924,981025742,324247277,557857531,368189481,412319831,261993377,453538551,242879395,711877703,569702475,818774366,979498092,600728728,224291451,926126921,104464452,857191057,91724657,774437499,612971479,158509683,370833131,991090250,385951656,919657018,580717489,807463113,710456090,172460066,854955598,672811723,63379882,553030831,511444696,691004658,959690501,781368219,712682648,360602535,929177297,508814672,234330508,744377515,847436226,422589793,950782861,443011305,168735043,616630620,28827177,119244586,594431974,771026430,189931400,832335061,220429978,302134071,658579350,847038139,583311124,747025673,171830470,238775552,207300957,950749926,203259769,697647495,128172635,263602646,185283993,883638538,327150593,36041829,517790834,132288416,37902014,21518231,610392590,475220766,384626212,191096660,194550893,909644220,953413272,971006951,179787731,908308219,396757903,824774664,876150410,986286831,308140727,540781658,926767129,533278162,722573342,56026574,611604893,109919736,437683625,200315749,770598688,609721024,700604695,261566604,166939092,9959186,201831074,595061292,716505318,848609482,366086462,46606148,524463360,990603495,112642505,353389331,735898752,443800922,441382435,971945462,329506788,411143669,324276788,318585069,208516192,200608203,224584870,82693343,784863891,661703374,242587918,683527198,442136238,221100691,388720469,828745928,137123829,528521241,201099308,269232369,467440755,965962321,193320515,171891902,449277917,970822335,365374472,591997015,966483437,628994597,787763358,127630923,949533138,216462626,562230620,200631051,362321298,721627745,714766892,961744988,901768295,898563073,764651347,141780402,188914501,158235464,883243234,176525028,100365645,314270174,228867607,768389484,571272970,603649195,579276176,825191730,567181599,748431239,914375200,852618562,575487237,593162547,350346189,878396876,760161766,581974874,959210169,794481973,840309244,21974649,796688439,733961890,308266398,696203370,232620986,229886292,592712649,224241626,184071301,946358352,473972071,237884640,746378118,974017758,830094222,658012251,260535440,164193446,544067513,408074471,116687148,831857844,872792999,507482941,628269783,32578063,232950483,355650966,568486961,113984103,702455271,934743803,194569320,179424579,673308764,178380019,900476812,552570043,829917162,477479926,681610623,238757801,23840226,726267959,696057438,574677282,186381880,35485698,889222427,539179043,821951783,511698146,171449150,306487594,927560548,177983126,212306916,494296811,896705972,976896293,732382445,621422605,979355458,802200321,571346343,946088899,940072333,525327115,582233281,677737200,543326340,286785472,133019909,738261012,727900737,310131795,841315981,427990858,462400646,732466357,777501341,656856278,836604083,828195985,395025599,102692137,603174275,85844851,188945295,857464733,670624315,226531488,416736089,896956498,987691169,639227198,147949944,374797132,178150646,48999152,839075399,510992241,560735414,864160045,119678346,631224380,750339888,930673449,900385260,790107707,743746671,973743118,818491268,389353522,808802015,939386039,670345979,729437156,87208405,320910710,882349386,464047143,62705137,646621257,116748804,917896345,123887811,988238488,955533834,210758100,240071640,382851200,592070556,320863411,960031749,783694175,393071961,748270549,964296637,954789954,959569135,610934717,602197819,672310953,805672385,242036374,974231469,73317689,707495636,812385954,152586963,718789308,816234642,17031169,799805135,68043121,378715813,101997531,370724951,379199558,118109713,995929225,431341092,750709870,670219199,182709465,892362356,933232431,848800901,511329206,802284988,574599681,704877501,86538070,950231489,915552654,332057375,203789714,40465807,272825608,327341856,65871676,737006797,564001606,117271754,42366756,559314887,72080910,16332576,518496681,178460080,922835669,85853831,289844495,114678009,888735061,636817795,994800442,634170402,81387460,389851236,385318248,616434278,164064665,58527489,899289944,780921080,746492224,321201262,774927097,331355371,323578389,464788611,439530943,381191621,307493928,544419454,189115951,888179722,56027054,400162259,492572749,570922540,50044808,215440608,939002974,722116659,506389393,522781470,577382527,975750661,196920209,110476437,378088881,602038543,843360858,248647300,20368720,694617749,70673631,36350582,105955049,625577110,626598387,795310078,887715330,349947783,686546994,25161376,125463051,652276150,662037486,595549690,718629428,781857227,435085264,355204932,469209929,121108565,797128380,955454823,818408085,882286707,437088869,418580397,389415090,366167084,344077692,866730359,406913407,766604223,751773745,455849570,218126777,673152505,545689875,847077339,637717539,701057595,466037197,381085766,57548409,594551854,530621083,690872937,920194031,423902550,959482076,921554933,859646318,730912936,644586671,440798612,580905887,900883897,627969908,7224353,710662547,951043097,178313806,799487853,587235700,362545847,969286261,835552372,557893781,713002969,638126879,348209223,611703675,356160228,473805793,891795539,626114561,521722743,696652030,743632248,737132059,533440828,687481424,130327262,707480981,37477429,738084106,49372472,959286577,903360150,76895080,644809401,274597234,173910265,425631910,46188770,657727345,176228111,811963776,270654659,19177072,977422478,324751345,452452633,712043546,478047692,948121659,875206020,215136857,54756708,704283961,569515206,317180497,196343809,80152929,231235994,652206552,860988182,339891870,990648286,46638763,509149276,541939348,355904452,431325298,357549879,549943697,474564051,162716659,963090407,647842561,772624310,369470387,84034776,592879970,951519687,953129351,88447823,355811270,262410819,122874675,324874139,427752611,966515031,89544957,490043087,514702039,593866856,168367087,644950238,234858331,120499562,727750147,300432587,358531606,837951330,555717474,833618568,749833609,687809699,594318929,382324387,922817996,752791004,138103251,493853550,72041429,300412849,811511206,524951630,444956540,657742723,41964071,115222465,18151787,503137364,742459967,290436603,291850913,707084680,845615216,544193854,838816685,820365504,64821808,958641055,521245547,626401031,826921769,376015807,23365585,127208963,222201708,397679385,704521093,398003266,367632312,560201311,959095835,518490388,782459134,85411514,363544205,898645481,642423170,356964076,218770908,101398744,149838090,847676333,658844131,66455878,967449330,921735030,608517334,501977444,370764256,932365136,842116001,2414808,363210962,468920751,163861001,885803673,639058145,446132418,402067874,794603245,321367393,633937175,752437584,89831570,777480614,1875666,446948540,607778609,895163736,654319771,56282607,953825487,322366231,857703755,40904649,611285125,973715621,685339249,58869526,750073307,286265907,174980597,937499408,885979049,169542536,859733362,993160596,36179133,99723628,300577098,119273185,895361237,321883362,666141940,241183990,611545116,598039345,942688158,648305554,976484452,909040395,639505417,717880425,258364578,177731935,331433241,644072879,835125078,437946030,732730195,263084996,227710431,634360769,949793998,673705291,929116367,780620265,396385982,636792029,981415232,534698667,605385771,446440726,846286425,170393385,865408351,535702043,91059914,396396595,978353795,909026952,193229763,332588600,947659377,659231379,21658695,908909731,930701976,169444090,242105422,211346541,280700862,419568817,565028991,410179813,947115493,162947610,353283845,440000302,555403642,967699788,939284378,26563328,808244694,628818450,464570707,613515466,816227814,798592997,139960087,611289279,84099181,767531938,309790621,725213859,101876198,339117512,560452243,695943492,482097635,696268438,33261687,549042129,227726089,324472676,889008129,433042127,121540726,256202561,466427373,253057484,582185803,12967232,365976221,1001525,843332554,557829538,816545092,17260454,45247051,117768503,97334544,142496898,511333733,432449646,539910489,752822850,319965495,857056169,748503998,709859995,43212619,215123872,763386790,167320288,584036346,431950841,657125650,47836908,931587780,624620056,214312432,650854133,138350471,695691723,818005740,800549557,453278187,704208506,161679109,21228857,24799573,523890408,644772103,703815094,273840418,255182503,451051671,765402838,276461433,817763339,311617014,56463857,173174288,985489261,364879760,260289777,866138754,444165753,814280531,665038276,301803455,959789371,700429559,566854653,152240081,211426797,960298,230714841,36233184,269379666,489824611,914246569,385971337,351582326,588477371,891226054,658857137,819038771,551105910,907928307,409262069,270013431,94369267,383868816,550427912,563194105,462941349,484982153,904457766,192247167,381460272,970265030,481977727,31384204,550046603,922412185,814116989,722990797,245899471,637663524,160142774,468353543,438206607,772758812,544546780,544896635,116902729,711349637,991251853,994312234,957097261,412924284,175915003,689039777,818561243,741321533,538140579,281833152,679071114,57304296,833699278,707474921,62014389,120960628,172686671,848769176,927259833,589949390,807541116,181697612,334825796,986129478,59148373,119891371,73571388,74981386,827459594,634033443,904106237,805784045,42592013,13913474,335897837,481916336,598553686,218288615,420595899,842333638,105897102,275003777,283689245,218844471,756122698,252407474,829890821,653416861,368228913,59776635,531136583,47966437,827773479,904112376,898657123,115622291,743558,8828680,860518048,777455376,971624304,635482863,511862704,639631999,438768263,901901225,196727914,228846332,683559026,314126432,1806760,214540782,658500415,214746490,608268120,158011813,934741554,940540029,155900422,939640865,651516855,620660513,386136335,745327884,184835166,788977403,243849317,935550155,377688755,32165748,172100122,755822381,999829632,354024371,949379942,411448871,895625714,875439951,926343731,221188948,544617857,290381100,878249839,843386003,120327277,599441531,626324309,222677418,284201958,54461302,576857817,459925304,239808803,254268736,112223863,23598162,687569821,898753792,250518185,143988237,47361625,861946417,779538942,459568395,136709445,556023371,207252924,283891715,777970421,601703155,268933499,562239349,644182771,790868861,383170492,819558870,161660156,71891404,868527522,221592101,545660152,741329109,492560139,333418180,435874670,747603335,289108386,748335689,149258814,947775920,305799873,691745662,859773837,107234823,956564497,619391212,703591889,938772236,739299002,85626843,429657017,880977489,480485548,262991906,6951837,169090857,52743047,668398208,189604863,792261239,245121057,351830780,475786287,298968521,854649380,841402304,705058352,643408174,451190291,106238922,905773250,556348580,833422618,660705083,321237184,837596708,612787020,472721787,312244517,616099679,518429803,244784641,258499452,36214998,60302259,133990319,360391216,503581979,672913924,583093439,550942660,250979125,940247510,652858459,675878546,797466841,370674995,907745476,588883865,987383089,218448226,449737002,955307454,585163662,699903733,105920007,731369808,740798623,732815063,955069657,912907186,197692808,955042514,945946070,849264882,370954232,838048808,299015263,472283529,79267470,314511120,164725792,389039359,173690840,816568260,483994943,820870927,376726741,251514316,51302942,615552918,877972951,860217092,843254111,673189570,27294194,673071999,795723031,758712484,935436811,338815770,883286020,37036329,817487284,363687397,501326546,406242075,412047561,466907683,521730345,887830119,645973608,572743108,627707705,639840156,652240338,640176912,825286131,371748226,535745681,760583377,383534127,366576210,849032156,398519118,755697805,230126756,873857996,596624149,313413445,917211514,268976357,940260428,184998150,343332488,895030555,16762969,293942000,61558881,102830492,276975461,171586002,255821416,397765975,465541436,942936259,901676852,166714611,392758236,685709975,805075316,587042608,808975676,446219613,924221182,717855804,15861100,644071222,797042841,247404499,716210868,160723295,402081695,469917635,28585240,653821167,10364285,208063293,102556082,540148245,666014613,667552029,822004563,166994102,334528303,122406032,697720617,316059644,972708995,726071977,462361745,224085543,572856784,15957789,963335493,927695057,176379245,383462849,865550856,810104898,289052741,20714571,35324294,832466091,743055358,790404115,80236396,795827061,395369878,252255602,184874192,23530816,506336207,658529903,592654716,556715519,822615331,809520025,787957548,139736444,548229608,666322128,72657315,992131036,916436220,768152482,120580894,349515729,528627236,449845586,460148110,371078849,605223863,752665040,1624779,644242679,985944307,858571182,461684752,810675957,993351100,382520483,250821716,977534286,508168386,246241034,609693247,743320473,146607662,998445214,431759341,343673635,640794075,262660065,878625869,897437609,516489488,23659927,759999147,655412155,503783506,667819834,551718218,605276486,57914865,419059158,46776049,804175213,960309116,623584323,753818347,91180671,886695514,802544874,178110089,143529344,505623920,720477855,80630633,63261778,317677628,454032332,240724484,186782768,536920726,899201547,923187729,845529381,295331561,895582663,595645523,82038737,267747183,796913715,122804438,49897344,362714249,862665025,396997686,604625458,37112088,976519680,446432499,748095242,429003830,291811017,677603270,505978357,9432426,387257732,739252457,905769562,480866202,114477162,910290154,964097748,975047101,558505018,397606795,320449623,674423851,567300118,96600383,149970539,81408680,943126359,618538215,902294691,538833948,516910200,175195207,164991807,613271994,282270752,195159923,182691277,893377616,350962890,378185065,165520304,736097983,104275527,107760395,496223166,392774298,339005193,6415884,852198248,869760630,57337377,328642311,313491466,473943256,761334845,163974456,805443890,454791777,655688589,217832409,48206873,250729512,650171495,668474483,645785673,828763867,638317152,787083774,304210226,761376754,998417863,114437701,179152011,856498178,895998969,375283462,756451234,63585213,746100628,352262217,685049322,41368875,185621781,193116004,704542713,613788001,712282785,133675350,36342676,127889371,885675751,150684097,935926548,457679454,908239676,46086256,363721489,148164239,493754728,991370249,574494584,10015428,949112564,670563791,506987577,373557253,422937350,707248469,738375556,170359517,504522488,822839646,971251884,14295245,6364559,829528560,31902055,509183036,190031100,209870102,452967833,456964275,743009770,951211379,933702078,78834235,324014730,139963002,928413345,526681054,322007744,800710829,525191165,830508742,525334945,99767615,190439097,150011682,869931254,195895108,642716041,472372818,845969378,891314830,756420050,48906613,622902626,55143732,131611764,37731551,299498677,640694188,842798821,526134613,706085903,187560670,871101937,458380397,376491783,258403652,497475041,92698088,58099292,798700283,160237119,420795881,715071206,382414136,647275638,598995012,116058943,342151526,611720254,575486020,397160465,573871310,804763794,855872322,662992488,811636563,484712697,785331707,394682840,540399090,628990032,459093333,905606245,300709259,285160187,107113222,57562713,785917963,944928720,215790782,159729073,314679186,484363600,220810932,193756864,176113742,653956340,385162015,613321758,655032622,595475307,963064968,575934821,565366446,339412611,420269925,853822178,621890905,341799536,730085337,669687144,43038664,190723760,520007694,397191752,242741101,295273112,911553855,420256891,134534726,229041960,288039667,912665239,952930369,420783608,759505883,355080139,13776242,725047982,766014613,348574940,279003328,249479481,895297500,190353452,999650409,673605968,308743105,923509648,610816753,868217020,502437344,785101081,683997286,190190426,14850091,628445902,441409418,361000413,482358408,402504037,416870733,249891590,406197948,221484197,989497991,210224657,35396951,560021235,76667846,849870082,830692370,990522851,183760025,844165424,799741184,751900362,312616925,845225615,371369299,912379072,977692978,464715793,272736508,409713958,661250225,355611695,602025484,655098052,791858343,935074244,363351667,660633695,830681132,207979827,766178018,314428742,291425335,249769039,382582132,176838020,531553490,339637176,171182908,867642857,564528401,750769745,600414104,894717790,100220991,558039019,986383097,729964739,105290652,584230942,928474519,731654431,704603911,359730029,568522294,752842834,632601136,5043193,663508854,927237848,469651192,496701127,750913782,564220277,26335023,523313806,906775254,972081105,77997445,356067959,448714422,714021267,864595306,865545519,612006278,769170204,155531347,410127755,951372818,594730385,248994712,771421275,185158093,499376011,662863317,413001393,805887756,473324595,921297057,18735813,386934464,146972891,560627347,903669593,967094539,386758849,737091463,755426664,220579995,435711349,887741198,883209694,478560592,9832118,930618930,163415091,240446492,132759678,134081914,702601410,909768461,660176441,680440363,57179043,900412868,646477707,534303308,997628154,282709724,402700228,997064274,785650024,436878044,977972319,780587881,124834909,341934157,954694394,87908701,106129323,139683610,20911809,523176936,313575704,425796257,629367793};\n\nint main(){\n scanf(\"%d\",&n);\n printf(\"%d\\n\",ar[n]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fcfb2dba73c4bd45a93463df4ca0e19b", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 4010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint S[4010][4010];\n\nvoid Generate(){\n int i, j;\n\n S[0][0] = 1;\n for (i = 1; i < MAX; i++){\n S[i][0] = 0;\n for (j = 1; j <= i; j++){\n S[i][j] = ( ((long long)S[i - 1][j] * j) + S[i - 1][j - 1]) % MOD;\n }\n }\n}\n\nint F(int n){\n int k;\n long long x, res = 0;\n for (k = 1; k <= n; k++){\n x = S[n][k];\n res = (res + (x * k)) % MOD;\n }\n return res;\n}\n\nint main(){\n Generate();\n int n;\n while (scanf(\"%d\", &n) != EOF){\n printf(\"%d\\n\", F(n));\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "53794786c5bcd80de215e92ef45e4929", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint n, ar[]={0,1,3,10,37,151,674,3263,17007,94828,562595,3535027,23430840,163254885,192059216,97183539,384727153,211932162,665362848,415709078,654959364,894067657,839120000,627072923,586774033,440165789,840647542,118441546,505992682,607243387,93527420,378847836,948139661,770183251,365355663,989344183,548640276,317289217,997901123,159164073,843138878,532150136,738186543,903861313,682196381,973969945,132955760,252975343,448800686,260473966,172364334,974776377,897990701,517201033,576838003,99444281,227668527,276751933,925606182,183971202,872834804,675567482,485151063,90425806,573944639,319383684,228218188,853465612,413776522,234312776,696953174,561359388,614568659,310760116,308156021,643857743,130527569,21545623,861347933,160875480,265384023,880663120,642768069,283279971,101569565,642645431,549146203,962813505,943728849,409246814,285130248,71857567,876844125,639794356,718486712,669604188,215716321,617971855,139675728,757688910,320249104,621227957,8420956,210511678,237853303,571777940,124824068,554160360,861653403,682637480,231939767,18101111,899784402,38539461,459245274,133368830,794361288,845364734,411437479,295388712,946233522,770525146,9117720,552920178,575589233,372629731,386010446,840661218,620900095,139503115,511927381,578357362,64025286,334338018,50447285,600060973,463521109,603848757,124677320,384555440,124916527,185672381,489919006,909579381,138193225,265871589,754007856,931017925,530042754,776962350,693701991,697550026,65897729,925178446,524529822,282186556,906408203,423821527,235677618,198401842,739841724,445468199,551132246,282892517,598818617,713743768,323922897,386628568,474046790,302658513,783562521,701916176,482177632,681588349,266655423,743351863,319498248,426746288,89678205,500650748,546473898,223152283,841147627,688890488,901303731,788610629,829394955,750389455,745439788,809252095,287863106,297473389,52881575,679729868,61954094,593572313,142142337,87045414,702643022,32976555,517206126,380236389,828797589,845005051,422842060,260455358,651230866,488177154,982371716,172307030,994127208,259014259,84243868,148694890,313032650,79750143,628177536,256112757,535578122,7516872,660259410,862246837,942873362,525515969,353458202,517016061,146128173,615658629,171576507,313485249,756862637,740107237,450464972,698608957,380461701,788065795,235055502,488339779,625468897,81218153,752562624,954468821,388408427,220000770,962611398,138488797,232824743,623588948,89320450,5174417,444171924,539838147,184946963,829706030,250353513,837334003,192637869,954980409,989726944,503629638,246128748,144252879,869972346,159483785,38149548,399002531,139867042,702866700,566004753,303913805,946274118,352063038,148918236,344908939,925123896,175513960,888310551,233700316,237128991,80142095,627539989,30420961,108486126,993957197,940173780,407371015,13694119,969064311,945245210,515586500,834646464,210959252,766474958,237866830,520123316,83961446,97878509,896040082,51406202,612079312,569120595,325712093,979110226,72296197,169538467,506717757,990725778,888153398,884672580,747447278,989585067,197205447,997554253,162606658,612854211,585638351,300385030,648581707,24645691,142364491,87271224,656248353,311752536,345078260,862509279,749617553,148690167,255207879,937517648,692740850,188651194,442080602,285711119,523391595,806719830,122802835,948147156,825684063,120090726,465071065,216239633,955952822,254936196,818273287,582823720,838683603,211078726,609268949,539236132,461048619,931162689,575599737,702129707,929755292,3165024,932095281,371965629,560082406,915331279,404247953,119029625,650026279,33911127,542568006,737311646,839818392,121381063,81776121,264049814,428758250,935258956,524814024,827629225,159677867,208903802,254070037,334398982,852112879,205126265,581086872,289728727,749733927,825622969,203314518,313219470,714203321,966360246,415028559,441541100,64736522,135298651,311340818,724308321,852861846,567399501,818780718,445445536,185482874,890679335,117928565,212566203,217299615,125999181,478432188,642522487,657976604,462229383,930237021,202402571,859794210,821285303,193707191,139635308,949631508,581555701,493872210,253862710,156423352,756876608,453019810,540238248,525374182,395165149,552059946,666018027,218650948,316154754,567824223,718412883,959027290,327709825,416281152,860382344,503677292,449112827,426967024,595415467,755716122,910210918,495279146,453103898,539903326,104084806,171428406,629857538,238805628,522091539,904850095,831383119,364871289,59654563,188523918,418555114,248860166,832365397,779188603,392396445,763896392,993974548,375970645,176183947,455296206,826990889,44758036,495683674,791719842,655621264,658939366,735144599,275667277,655999018,965639168,676574799,346864447,379511514,459854791,905913554,604918364,6920002,652092992,597377405,920491194,562313297,482675638,955706031,63469748,417878805,240441437,990705174,289937758,842452102,258265727,995663867,792673745,608833565,729570088,316539671,559104003,153929272,607988017,245598088,490462484,935463414,309255995,733478384,499515550,689830722,849692817,311550442,635474783,127169195,910162202,556279594,843716880,644338672,555172441,515997236,135709697,79038893,557695690,600886859,838036451,688243460,80967535,608159856,174858889,422157947,441973358,506853336,687223249,123283931,645920250,839276153,765041805,409869914,291531081,819585362,902467908,477747296,528122783,145373134,454099129,741569333,626092036,479879088,369907895,230044569,505385342,714902613,875040101,190473063,872158769,408884988,455015252,472359859,31983119,493209943,310194407,220499597,452995259,135106373,178201213,847019301,990806426,376403818,58273490,281675800,520754800,348121405,425884587,2386009,487763288,337156970,997180386,417075508,864730872,42921994,871322813,840211325,364063966,22525422,600235,193819034,893790438,426792415,487326644,543061001,282015176,157152541,994468078,884492307,713444307,579253748,768509697,992424572,146763641,846399754,258078009,128093022,747576202,755784458,775371259,738049893,408147951,30228860,298205559,841396697,479705709,89724340,910693466,917842511,772248726,925394143,423016364,940794131,589937656,12439416,817505576,5766321,207335208,205400856,372008708,188964921,55224741,517371213,384078369,338366732,664331412,865275333,827065831,804972385,178748961,191743352,403004296,927564052,823868740,257622825,717878335,446887176,322169470,269834524,843929114,27272298,50378784,522410690,596183878,451906315,172190807,733947210,259460885,833852491,616714123,951537680,926805258,813388867,443303026,291977683,599670158,238152294,445689856,936327374,196240693,364266010,190436954,155125524,802286442,86247911,746915367,812149761,386697017,156862662,999227446,614061595,430319410,14310047,905615597,730967460,839536767,566459999,528830445,488205273,155119197,977792541,733620069,789944551,854917887,212864273,919407613,737497548,675470363,478932389,246699156,251877523,53345644,261274483,760124865,50090062,854981767,791955534,691459974,389774782,465159470,569088844,418118310,342684204,596536636,249320348,606857878,713420778,226131359,388575274,21911539,474258973,93797243,644078757,453826534,403801164,363533678,992826772,507750910,373503532,616791236,264372059,183581261,750221171,878155094,936703585,6652074,251020568,992659897,368462422,891650074,750721486,610629516,709514492,685833760,579428558,50900893,773008170,385305515,823673055,953225968,603314440,728148979,232809574,855455002,295582086,553846325,476981256,332957653,63715908,224273587,51891906,346473784,104448776,460060855,136026344,661137664,469259167,290470382,86264866,625481264,739844065,704844076,372478787,496577830,165971165,39385643,676697182,190393622,920720064,150178227,939373600,854086304,830730341,370885785,789942972,765401747,766283645,416945039,523371177,322970857,646425052,511694855,736905288,953415053,560704652,648860447,428694301,894447856,841850834,272571430,678430160,346541448,767049503,36077574,679246151,466003799,733592729,207171878,650255964,550391662,53825240,889883963,12600784,641017311,291148361,554976793,797024191,85490633,229960755,15970020,565598371,192019037,703223903,195449229,64719321,934602250,799142123,251430165,887594806,421911384,545506631,493870301,996132354,610717221,171323729,912266937,320567831,578485179,307129662,433491047,21559367,270948717,441179537,802388729,910301331,384072750,536953724,835860980,839011086,312337042,763106402,967665058,924323916,79578586,765754762,832689130,913917411,898560484,792084326,348091988,462841747,38010959,392737993,3009449,350831771,912199630,425134703,775020717,647997584,741356698,166278460,869663083,647072939,745625861,225232692,772550810,97926046,158274643,639954960,993664685,948581315,42923854,497120441,472948622,671591547,481449061,804758853,579280044,496884109,7385548,654808800,859416940,503726762,626537115,408793283,645016533,420812424,673499997,373272687,544266494,719819823,952799809,980437016,79869262,746105457,555042166,300365589,314262330,775547898,319195,862064506,247861214,539457472,891181651,739899313,856325939,474792389,646142824,425012348,464504884,175255790,645189570,994342074,388145377,758485776,644299470,938620234,523460486,696845537,146251274,765755555,211765723,406209862,262334486,314682323,238926155,380293812,793306827,695934971,41797572,164125639,734295601,957006629,28334704,805752965,247692986,455019269,674818780,640914235,498334463,328997275,98728370,94303005,330407573,622176072,902724011,502359677,365755512,33774623,314570757,644858120,319084859,585531096,555979614,20241404,171234266,134211500,178834316,623478011,775898740,847141991,679004596,888241786,304501225,547356433,9982489,987046099,186943448,13253947,765250104,958448902,814200319,837071048,676888072,296152354,217946267,972702366,775412130,658068164,156404376,926912470,443555522,250919597,317855456,915909293,284399659,453799011,5105713,790891033,792297210,710028002,618142770,364287620,331045396,687384881,424599451,630174112,867937200,769346042,484475224,70419182,622020019,256886187,38456691,715189368,370106296,264780551,292186988,90417925,143278292,573568020,714660817,287022466,572214539,829167149,697488315,72368017,368199605,262908146,163077668,455674471,748843401,751645251,884369638,689084763,672847687,163891792,461395492,302226377,664625974,577809015,941674562,131401399,309794389,316433861,667752638,284189888,968220163,584810471,201754740,563353811,500121861,515294445,431344283,551453151,676839106,482675182,27141974,225531211,417545520,577032155,777262421,543846497,202834963,870266166,757772475,863416480,815999208,987758583,902266565,262072884,489557494,35642385,322610818,454671220,846664545,339165468,167841816,41792934,816030258,8374123,472924553,590410784,812622874,821815806,686549685,586496957,573983725,526279493,937875240,586272615,79980609,817572098,49577869,988672744,562171392,646881269,147215121,616796113,644886645,597791310,683978339,723580327,317239670,839871962,979469695,451512661,52049196,468819589,293585610,841365638,433463909,635115970,697627677,875593849,94609155,306000460,324881773,882169936,773246242,483441793,582334856,731323053,661390729,859812401,59690028,578797844,969394600,24581744,639171654,741500461,703531323,912447409,118816459,817192281,450086895,391818462,425676138,40537340,262670821,27903141,51470642,850558030,147747791,917072134,344989983,562182867,500804337,902729830,141473653,45035817,609220152,538387348,712397127,553791286,292908483,188425885,346444658,193186312,824573033,747471409,780772400,757551785,172848355,845254480,686129156,785048012,622014500,872720038,102455473,867474927,919250514,666141143,588427128,852369363,445940559,209574792,886466250,646346449,615807900,796805074,266036928,442383386,387820339,804624621,58065519,293123937,197148648,895594288,161078475,187577644,91985993,869252687,312427344,749359694,411989786,44617848,685631848,875391712,225073610,725783885,684055221,938696718,923112084,96102386,713974845,87920864,91300316,298972718,321470346,82847310,821083006,109063493,963694457,335333188,419415126,432269906,78620389,256059592,507183168,74360590,476674075,950776969,556452274,116536558,410412816,80018638,654087452,643902773,997473904,613296730,816349021,763840061,279014728,108603031,962582510,583034826,897098978,509902642,91571272,855903910,683065640,845807965,627864237,96631038,526748163,39991977,300823348,967751668,350518688,51422069,960456532,376432318,568316522,145000168,899364689,617820153,421613081,998545497,360765423,24182861,25348536,99470730,253205483,487623243,394440419,709415547,383872230,89782724,320034586,403979873,36254775,549581568,667943168,758068193,841054201,582451650,942588073,769830863,823609178,926649294,727177359,555879723,894378844,652545994,298053594,527144937,744884670,12805690,667149698,124493325,978511736,514821512,357286698,311246498,210888954,965502937,932798317,516157069,598235900,544198300,859692452,27345953,619090787,274825224,615935803,705193548,668826398,37937406,450774711,127774649,852917560,50350371,665237495,27432758,281981773,801697925,591798383,197023576,406358042,794373745,296697434,681939405,761832978,460217048,516575812,894110038,12714620,380931876,693323854,687959690,218747110,262307021,644569801,695911453,750070814,862942697,92391829,576645388,562020314,6919284,946901348,796844815,423491488,564231467,904886290,173404833,555546106,322929877,212033996,786025744,131528823,555356730,714333280,202915220,809672717,426216935,725895468,81980077,199937721,360816765,360743125,75430894,576563708,230788709,553965955,434610707,488343014,131594574,699299319,15360664,295603119,965115179,835169275,336188722,675847471,123084178,289371284,172644148,851254725,954115681,208852926,400285368,272949949,949307749,406417372,637108773,311628969,54347186,555094378,760775792,675727049,559758729,410594967,413513368,662013397,137994376,587222931,214336967,192984205,454673826,653529057,711347536,669749496,542510893,784865748,479436555,702243551,474714996,284344106,732211466,695618554,552387743,215971257,26190178,431885789,584120993,192812458,629286056,346268824,387322399,95878083,725347537,972804693,120163634,683361823,587682969,389954764,960382014,251659367,265701780,744584852,420703965,313783197,199437853,103151198,860216940,827873811,741106764,892866403,317880376,651598950,62520065,601324769,163877813,743532086,475524842,305649653,636019709,520070197,214412475,604267039,634178293,767845835,470370244,405458485,890829842,606046026,471095166,27555972,67624609,995492251,321607727,393733625,558658479,620823036,85516904,347164978,826672619,350270030,297068674,561311695,359062471,475755187,863804484,255614584,749626475,340977869,469594424,212703887,257501249,162823755,306023706,241125417,142710998,776584824,650831226,473016565,89562361,29352481,480103617,412034701,613572861,60642647,178587486,567344870,80944003,482005028,222170219,142318034,556699736,373084842,752988211,814839792,871387412,620386607,602064240,108189774,702036287,278260815,231701765,951549235,626545807,445966287,712350716,500124640,188171399,676125371,371394647,837298960,939336022,438031036,186714880,216111716,186044002,581620230,340599528,101017623,954534105,995780074,618882019,418147528,767131494,301425635,413745436,962385176,988626008,137028715,583626729,374502874,129245417,783696635,516244019,166701302,395998250,899091379,185147981,888020140,214258254,830884306,291227991,600383262,836705371,150117498,22802471,69557681,875092333,498794258,369675284,941672774,245715055,351032507,745046885,808550199,76081612,247926676,620593330,454226637,124999051,997605209,309479695,223505774,30851595,796149915,234214672,698950772,634482949,657440469,680685934,622581826,471407126,641364582,439880604,828662127,710328881,854337730,218954183,308890346,696883741,704295352,23756660,692821843,759054630,223276561,816528545,805470409,321576509,507647022,959763181,959047512,71355150,867173786,570650020,763468490,454668170,461222603,770001770,552268482,365360958,764911700,677237544,440328283,984549649,259844284,75262068,503143712,838297266,105854139,202662940,683355886,363265848,555867076,887916417,766236164,129769218,260030095,376298724,956523327,899221952,33538203,917822505,692713873,268868540,480130178,308269358,37693909,258466510,300897318,587896924,278096281,191534712,919963415,565641621,320019586,879837320,908684471,23870521,479525399,523797789,364351125,761922216,427454498,272480994,531892568,292110048,28298126,163923066,144435894,463928498,878941514,432095463,874023827,449729638,637204414,825970062,643921799,835275561,752031673,957571344,784924485,289472366,8843335,972907389,328534344,957382231,222481914,512123613,255687739,321672181,106614581,149991666,483357223,454175825,745448720,274635425,313232453,374663650,677756092,632611936,22070680,339269657,132455542,338802685,718343286,603452480,699756846,802026382,630527452,896151723,939566225,258401424,853392870,880194524,792827319,403695464,109462351,962558728,135069793,549142905,983579550,110815829,909786301,182557229,226845651,200705606,497560256,193529259,308570479,329947007,189498630,193994069,898161342,260293498,537724486,162722279,972018154,150488640,485488569,797202722,828096899,629742190,221961319,338535225,581622427,521477026,528640359,597216559,922488813,730878735,205255505,474388932,989429410,502110503,673876242,185798899,902302522,501809075,233065479,356452765,541073672,847051360,538785072,862803293,409689476,625279470,513414045,868495308,330682429,586751803,508454254,619218542,533898619,341736407,646062216,89216946,19220297,949573988,655460326,308240372,695484802,880739242,573500002,231169478,64651173,35122460,131988165,544955859,769857172,185393273,886747610,615162473,889794879,337973379,106604658,386386085,191341291,878552432,469859981,171378318,2481856,272586583,832406872,960328858,336146912,281053957,934376162,646820844,536944351,364814113,117742167,247184801,561613760,293317830,469232799,791091533,954321146,805541161,709574499,898284542,959570285,682922905,301875364,719438718,279592170,46864067,358224301,92060233,672795876,587715426,106552713,88983953,597426475,297706732,111408834,78355372,115919434,156681874,739661478,624419128,785595407,405130433,6754034,737909746,281114344,773967075,286197545,307581135,555742349,810716297,685375889,750925961,421118058,767308669,713093101,240592908,443827005,713587241,441373998,342424531,425926014,622764455,947687630,790195536,790596210,375395089,932221511,25492365,241669632,606391370,846261543,918436478,737745508,820405158,703149588,99985859,859425550,554220631,340069979,312586014,985226374,527441942,838574536,541207768,284030480,220471415,961393295,871333307,663187660,790456052,34901253,535484514,722947227,714448394,109574819,19083719,220125251,417603431,976429984,422222053,899493832,100004706,553764858,417966897,437366073,189674298,736512985,780253223,113871537,156225764,556827261,240680090,501566432,877565262,472725289,107264391,808323093,55779840,689987671,328867116,497001013,594887013,333410113,631186472,840294215,840269203,191671281,730328264,87906040,579860294,706516137,375706875,212905817,636563737,371574188,104784815,659682247,721582469,298892685,555695643,389864,190911396,529299213,410894675,332730574,61493176,735084536,324332495,935432983,572785934,417828425,536668260,283506957,181386007,930770260,41654507,397364759,661712266,957704561,467366674,981360437,543341704,842942688,66309450,657579216,450738922,729231551,364401688,892809238,321255591,981613019,182078766,287581910,257912053,212562074,773918106,591994316,862205103,230201619,203483751,554022956,789565117,929049349,826235646,656610099,382055716,318638158,781052879,921113281,155317942,673723416,867221883,67089512,281422729,46554513,59547294,621947885,655132643,582394463,947220742,242129262,306394898,102190889,384049370,25418591,961962222,420193998,240418005,720679455,944550734,738288403,75630516,542181891,387422652,55350584,974846223,28240417,779310231,385549603,323848720,403791424,690839156,198854843,817953072,272671381,464511161,462716461,355374728,692776041,463320052,157246267,628326792,251820723,234400901,489608588,144560185,702925828,784090797,957419811,656164198,960640940,180203837,96415507,998579916,462456354,182396132,904589630,730357039,575175399,237891572,318282504,974204841,506217462,850372570,449312032,237173071,677473176,310432426,517350609,519164751,694276927,448982641,64685419,974975446,820353901,120704072,349187066,694049966,811386207,533414583,962820706,844007880,665402350,651284026,539865261,789989017,101356214,611202047,8168715,489388533,935941692,509840506,582373452,238216312,630014017,446025706,891751537,130209415,299560121,976614524,378434897,574178431,231132738,992472749,909426304,116377349,162162272,245648474,549686534,179141462,692075007,723182056,645909658,14361269,617087262,221974377,552612255,188092602,755557517,587768898,490498711,2518894,715336312,617125067,409501829,148222348,722287756,508186616,528470793,627551947,899326934,634401256,327358565,78436810,826493637,684726740,956508730,891606217,24526892,634647594,647963390,214891455,196610805,452841546,356077803,4323457,367511689,991876200,633457395,378659254,278694471,670724606,433109360,739295420,209242515,386770185,550529210,904322367,527416662,814136345,373111996,365234797,151071261,685657738,53651484,931164748,93186558,555823348,111861661,776517468,598181114,619236678,548386249,600525000,378050148,33611038,905478451,470705373,304656170,860612697,82680671,865826222,106558866,254293989,779341172,318337985,295779765,407502933,57702521,699658590,660049600,829841368,880536179,883869765,432693983,106831719,148045131,53887459,184474494,145351750,35022472,141036939,262960580,456944085,115872927,608860422,682610474,115500378,482559979,121898583,861532144,765811000,880101873,905483679,907172730,333143286,761140231,807972606,138875294,418648634,676227013,598926412,375313855,715298791,296012865,655324878,355854564,152052376,511527571,417942243,173805349,545508711,344954037,34947151,804917160,537477802,751857389,185026438,350419106,834011373,567123736,22361163,181073787,543764704,680150069,710782765,955531522,973001971,669741659,675655237,511270945,480581735,615498095,170682731,523408699,821654522,709032736,252522089,904554520,654102893,131097076,221302521,927279810,923491368,86616826,687201950,554754405,878915101,511529829,43413539,407864622,116006459,239702197,596618750,916490891,969731953,921601053,92532785,398398256,453697426,798979828,574852861,216671430,300870037,996615050,258063469,654525871,619017586,145506046,270193064,426684029,385546407,777211607,951807402,339223774,621988781,269055691,625486075,361791045,448311220,961238575,535553496,666417665,444784348,389373972,57979066,475494691,659372113,123635917,889415462,575193533,780578990,785468049,771405474,613682881,127399906,40840472,434189404,735173309,474310924,981025742,324247277,557857531,368189481,412319831,261993377,453538551,242879395,711877703,569702475,818774366,979498092,600728728,224291451,926126921,104464452,857191057,91724657,774437499,612971479,158509683,370833131,991090250,385951656,919657018,580717489,807463113,710456090,172460066,854955598,672811723,63379882,553030831,511444696,691004658,959690501,781368219,712682648,360602535,929177297,508814672,234330508,744377515,847436226,422589793,950782861,443011305,168735043,616630620,28827177,119244586,594431974,771026430,189931400,832335061,220429978,302134071,658579350,847038139,583311124,747025673,171830470,238775552,207300957,950749926,203259769,697647495,128172635,263602646,185283993,883638538,327150593,36041829,517790834,132288416,37902014,21518231,610392590,475220766,384626212,191096660,194550893,909644220,953413272,971006951,179787731,908308219,396757903,824774664,876150410,986286831,308140727,540781658,926767129,533278162,722573342,56026574,611604893,109919736,437683625,200315749,770598688,609721024,700604695,261566604,166939092,9959186,201831074,595061292,716505318,848609482,366086462,46606148,524463360,990603495,112642505,353389331,735898752,443800922,441382435,971945462,329506788,411143669,324276788,318585069,208516192,200608203,224584870,82693343,784863891,661703374,242587918,683527198,442136238,221100691,388720469,828745928,137123829,528521241,201099308,269232369,467440755,965962321,193320515,171891902,449277917,970822335,365374472,591997015,966483437,628994597,787763358,127630923,949533138,216462626,562230620,200631051,362321298,721627745,714766892,961744988,901768295,898563073,764651347,141780402,188914501,158235464,883243234,176525028,100365645,314270174,228867607,768389484,571272970,603649195,579276176,825191730,567181599,748431239,914375200,852618562,575487237,593162547,350346189,878396876,760161766,581974874,959210169,794481973,840309244,21974649,796688439,733961890,308266398,696203370,232620986,229886292,592712649,224241626,184071301,946358352,473972071,237884640,746378118,974017758,830094222,658012251,260535440,164193446,544067513,408074471,116687148,831857844,872792999,507482941,628269783,32578063,232950483,355650966,568486961,113984103,702455271,934743803,194569320,179424579,673308764,178380019,900476812,552570043,829917162,477479926,681610623,238757801,23840226,726267959,696057438,574677282,186381880,35485698,889222427,539179043,821951783,511698146,171449150,306487594,927560548,177983126,212306916,494296811,896705972,976896293,732382445,621422605,979355458,802200321,571346343,946088899,940072333,525327115,582233281,677737200,543326340,286785472,133019909,738261012,727900737,310131795,841315981,427990858,462400646,732466357,777501341,656856278,836604083,828195985,395025599,102692137,603174275,85844851,188945295,857464733,670624315,226531488,416736089,896956498,987691169,639227198,147949944,374797132,178150646,48999152,839075399,510992241,560735414,864160045,119678346,631224380,750339888,930673449,900385260,790107707,743746671,973743118,818491268,389353522,808802015,939386039,670345979,729437156,87208405,320910710,882349386,464047143,62705137,646621257,116748804,917896345,123887811,988238488,955533834,210758100,240071640,382851200,592070556,320863411,960031749,783694175,393071961,748270549,964296637,954789954,959569135,610934717,602197819,672310953,805672385,242036374,974231469,73317689,707495636,812385954,152586963,718789308,816234642,17031169,799805135,68043121,378715813,101997531,370724951,379199558,118109713,995929225,431341092,750709870,670219199,182709465,892362356,933232431,848800901,511329206,802284988,574599681,704877501,86538070,950231489,915552654,332057375,203789714,40465807,272825608,327341856,65871676,737006797,564001606,117271754,42366756,559314887,72080910,16332576,518496681,178460080,922835669,85853831,289844495,114678009,888735061,636817795,994800442,634170402,81387460,389851236,385318248,616434278,164064665,58527489,899289944,780921080,746492224,321201262,774927097,331355371,323578389,464788611,439530943,381191621,307493928,544419454,189115951,888179722,56027054,400162259,492572749,570922540,50044808,215440608,939002974,722116659,506389393,522781470,577382527,975750661,196920209,110476437,378088881,602038543,843360858,248647300,20368720,694617749,70673631,36350582,105955049,625577110,626598387,795310078,887715330,349947783,686546994,25161376,125463051,652276150,662037486,595549690,718629428,781857227,435085264,355204932,469209929,121108565,797128380,955454823,818408085,882286707,437088869,418580397,389415090,366167084,344077692,866730359,406913407,766604223,751773745,455849570,218126777,673152505,545689875,847077339,637717539,701057595,466037197,381085766,57548409,594551854,530621083,690872937,920194031,423902550,959482076,921554933,859646318,730912936,644586671,440798612,580905887,900883897,627969908,7224353,710662547,951043097,178313806,799487853,587235700,362545847,969286261,835552372,557893781,713002969,638126879,348209223,611703675,356160228,473805793,891795539,626114561,521722743,696652030,743632248,737132059,533440828,687481424,130327262,707480981,37477429,738084106,49372472,959286577,903360150,76895080,644809401,274597234,173910265,425631910,46188770,657727345,176228111,811963776,270654659,19177072,977422478,324751345,452452633,712043546,478047692,948121659,875206020,215136857,54756708,704283961,569515206,317180497,196343809,80152929,231235994,652206552,860988182,339891870,990648286,46638763,509149276,541939348,355904452,431325298,357549879,549943697,474564051,162716659,963090407,647842561,772624310,369470387,84034776,592879970,951519687,953129351,88447823,355811270,262410819,122874675,324874139,427752611,966515031,89544957,490043087,514702039,593866856,168367087,644950238,234858331,120499562,727750147,300432587,358531606,837951330,555717474,833618568,749833609,687809699,594318929,382324387,922817996,752791004,138103251,493853550,72041429,300412849,811511206,524951630,444956540,657742723,41964071,115222465,18151787,503137364,742459967,290436603,291850913,707084680,845615216,544193854,838816685,820365504,64821808,958641055,521245547,626401031,826921769,376015807,23365585,127208963,222201708,397679385,704521093,398003266,367632312,560201311,959095835,518490388,782459134,85411514,363544205,898645481,642423170,356964076,218770908,101398744,149838090,847676333,658844131,66455878,967449330,921735030,608517334,501977444,370764256,932365136,842116001,2414808,363210962,468920751,163861001,885803673,639058145,446132418,402067874,794603245,321367393,633937175,752437584,89831570,777480614,1875666,446948540,607778609,895163736,654319771,56282607,953825487,322366231,857703755,40904649,611285125,973715621,685339249,58869526,750073307,286265907,174980597,937499408,885979049,169542536,859733362,993160596,36179133,99723628,300577098,119273185,895361237,321883362,666141940,241183990,611545116,598039345,942688158,648305554,976484452,909040395,639505417,717880425,258364578,177731935,331433241,644072879,835125078,437946030,732730195,263084996,227710431,634360769,949793998,673705291,929116367,780620265,396385982,636792029,981415232,534698667,605385771,446440726,846286425,170393385,865408351,535702043,91059914,396396595,978353795,909026952,193229763,332588600,947659377,659231379,21658695,908909731,930701976,169444090,242105422,211346541,280700862,419568817,565028991,410179813,947115493,162947610,353283845,440000302,555403642,967699788,939284378,26563328,808244694,628818450,464570707,613515466,816227814,798592997,139960087,611289279,84099181,767531938,309790621,725213859,101876198,339117512,560452243,695943492,482097635,696268438,33261687,549042129,227726089,324472676,889008129,433042127,121540726,256202561,466427373,253057484,582185803,12967232,365976221,1001525,843332554,557829538,816545092,17260454,45247051,117768503,97334544,142496898,511333733,432449646,539910489,752822850,319965495,857056169,748503998,709859995,43212619,215123872,763386790,167320288,584036346,431950841,657125650,47836908,931587780,624620056,214312432,650854133,138350471,695691723,818005740,800549557,453278187,704208506,161679109,21228857,24799573,523890408,644772103,703815094,273840418,255182503,451051671,765402838,276461433,817763339,311617014,56463857,173174288,985489261,364879760,260289777,866138754,444165753,814280531,665038276,301803455,959789371,700429559,566854653,152240081,211426797,960298,230714841,36233184,269379666,489824611,914246569,385971337,351582326,588477371,891226054,658857137,819038771,551105910,907928307,409262069,270013431,94369267,383868816,550427912,563194105,462941349,484982153,904457766,192247167,381460272,970265030,481977727,31384204,550046603,922412185,814116989,722990797,245899471,637663524,160142774,468353543,438206607,772758812,544546780,544896635,116902729,711349637,991251853,994312234,957097261,412924284,175915003,689039777,818561243,741321533,538140579,281833152,679071114,57304296,833699278,707474921,62014389,120960628,172686671,848769176,927259833,589949390,807541116,181697612,334825796,986129478,59148373,119891371,73571388,74981386,827459594,634033443,904106237,805784045,42592013,13913474,335897837,481916336,598553686,218288615,420595899,842333638,105897102,275003777,283689245,218844471,756122698,252407474,829890821,653416861,368228913,59776635,531136583,47966437,827773479,904112376,898657123,115622291,743558,8828680,860518048,777455376,971624304,635482863,511862704,639631999,438768263,901901225,196727914,228846332,683559026,314126432,1806760,214540782,658500415,214746490,608268120,158011813,934741554,940540029,155900422,939640865,651516855,620660513,386136335,745327884,184835166,788977403,243849317,935550155,377688755,32165748,172100122,755822381,999829632,354024371,949379942,411448871,895625714,875439951,926343731,221188948,544617857,290381100,878249839,843386003,120327277,599441531,626324309,222677418,284201958,54461302,576857817,459925304,239808803,254268736,112223863,23598162,687569821,898753792,250518185,143988237,47361625,861946417,779538942,459568395,136709445,556023371,207252924,283891715,777970421,601703155,268933499,562239349,644182771,790868861,383170492,819558870,161660156,71891404,868527522,221592101,545660152,741329109,492560139,333418180,435874670,747603335,289108386,748335689,149258814,947775920,305799873,691745662,859773837,107234823,956564497,619391212,703591889,938772236,739299002,85626843,429657017,880977489,480485548,262991906,6951837,169090857,52743047,668398208,189604863,792261239,245121057,351830780,475786287,298968521,854649380,841402304,705058352,643408174,451190291,106238922,905773250,556348580,833422618,660705083,321237184,837596708,612787020,472721787,312244517,616099679,518429803,244784641,258499452,36214998,60302259,133990319,360391216,503581979,672913924,583093439,550942660,250979125,940247510,652858459,675878546,797466841,370674995,907745476,588883865,987383089,218448226,449737002,955307454,585163662,699903733,105920007,731369808,740798623,732815063,955069657,912907186,197692808,955042514,945946070,849264882,370954232,838048808,299015263,472283529,79267470,314511120,164725792,389039359,173690840,816568260,483994943,820870927,376726741,251514316,51302942,615552918,877972951,860217092,843254111,673189570,27294194,673071999,795723031,758712484,935436811,338815770,883286020,37036329,817487284,363687397,501326546,406242075,412047561,466907683,521730345,887830119,645973608,572743108,627707705,639840156,652240338,640176912,825286131,371748226,535745681,760583377,383534127,366576210,849032156,398519118,755697805,230126756,873857996,596624149,313413445,917211514,268976357,940260428,184998150,343332488,895030555,16762969,293942000,61558881,102830492,276975461,171586002,255821416,397765975,465541436,942936259,901676852,166714611,392758236,685709975,805075316,587042608,808975676,446219613,924221182,717855804,15861100,644071222,797042841,247404499,716210868,160723295,402081695,469917635,28585240,653821167,10364285,208063293,102556082,540148245,666014613,667552029,822004563,166994102,334528303,122406032,697720617,316059644,972708995,726071977,462361745,224085543,572856784,15957789,963335493,927695057,176379245,383462849,865550856,810104898,289052741,20714571,35324294,832466091,743055358,790404115,80236396,795827061,395369878,252255602,184874192,23530816,506336207,658529903,592654716,556715519,822615331,809520025,787957548,139736444,548229608,666322128,72657315,992131036,916436220,768152482,120580894,349515729,528627236,449845586,460148110,371078849,605223863,752665040,1624779,644242679,985944307,858571182,461684752,810675957,993351100,382520483,250821716,977534286,508168386,246241034,609693247,743320473,146607662,998445214,431759341,343673635,640794075,262660065,878625869,897437609,516489488,23659927,759999147,655412155,503783506,667819834,551718218,605276486,57914865,419059158,46776049,804175213,960309116,623584323,753818347,91180671,886695514,802544874,178110089,143529344,505623920,720477855,80630633,63261778,317677628,454032332,240724484,186782768,536920726,899201547,923187729,845529381,295331561,895582663,595645523,82038737,267747183,796913715,122804438,49897344,362714249,862665025,396997686,604625458,37112088,976519680,446432499,748095242,429003830,291811017,677603270,505978357,9432426,387257732,739252457,905769562,480866202,114477162,910290154,964097748,975047101,558505018,397606795,320449623,674423851,567300118,96600383,149970539,81408680,943126359,618538215,902294691,538833948,516910200,175195207,164991807,613271994,282270752,195159923,182691277,893377616,350962890,378185065,165520304,736097983,104275527,107760395,496223166,392774298,339005193,6415884,852198248,869760630,57337377,328642311,313491466,473943256,761334845,163974456,805443890,454791777,655688589,217832409,48206873,250729512,650171495,668474483,645785673,828763867,638317152,787083774,304210226,761376754,998417863,114437701,179152011,856498178,895998969,375283462,756451234,63585213,746100628,352262217,685049322,41368875,185621781,193116004,704542713,613788001,712282785,133675350,36342676,127889371,885675751,150684097,935926548,457679454,908239676,46086256,363721489,148164239,493754728,991370249,574494584,10015428,949112564,670563791,506987577,373557253,422937350,707248469,738375556,170359517,504522488,822839646,971251884,14295245,6364559,829528560,31902055,509183036,190031100,209870102,452967833,456964275,743009770,951211379,933702078,78834235,324014730,139963002,928413345,526681054,322007744,800710829,525191165,830508742,525334945,99767615,190439097,150011682,869931254,195895108,642716041,472372818,845969378,891314830,756420050,48906613,622902626,55143732,131611764,37731551,299498677,640694188,842798821,526134613,706085903,187560670,871101937,458380397,376491783,258403652,497475041,92698088,58099292,798700283,160237119,420795881,715071206,382414136,647275638,598995012,116058943,342151526,611720254,575486020,397160465,573871310,804763794,855872322,662992488,811636563,484712697,785331707,394682840,540399090,628990032,459093333,905606245,300709259,285160187,107113222,57562713,785917963,944928720,215790782,159729073,314679186,484363600,220810932,193756864,176113742,653956340,385162015,613321758,655032622,595475307,963064968,575934821,565366446,339412611,420269925,853822178,621890905,341799536,730085337,669687144,43038664,190723760,520007694,397191752,242741101,295273112,911553855,420256891,134534726,229041960,288039667,912665239,952930369,420783608,759505883,355080139,13776242,725047982,766014613,348574940,279003328,249479481,895297500,190353452,999650409,673605968,308743105,923509648,610816753,868217020,502437344,785101081,683997286,190190426,14850091,628445902,441409418,361000413,482358408,402504037,416870733,249891590,406197948,221484197,989497991,210224657,35396951,560021235,76667846,849870082,830692370,990522851,183760025,844165424,799741184,751900362,312616925,845225615,371369299,912379072,977692978,464715793,272736508,409713958,661250225,355611695,602025484,655098052,791858343,935074244,363351667,660633695,830681132,207979827,766178018,314428742,291425335,249769039,382582132,176838020,531553490,339637176,171182908,867642857,564528401,750769745,600414104,894717790,100220991,558039019,986383097,729964739,105290652,584230942,928474519,731654431,704603911,359730029,568522294,752842834,632601136,5043193,663508854,927237848,469651192,496701127,750913782,564220277,26335023,523313806,906775254,972081105,77997445,356067959,448714422,714021267,864595306,865545519,612006278,769170204,155531347,410127755,951372818,594730385,248994712,771421275,185158093,499376011,662863317,413001393,805887756,473324595,921297057,18735813,386934464,146972891,560627347,903669593,967094539,386758849,737091463,755426664,220579995,435711349,887741198,883209694,478560592,9832118,930618930,163415091,240446492,132759678,134081914,702601410,909768461,660176441,680440363,57179043,900412868,646477707,534303308,997628154,282709724,402700228,997064274,785650024,436878044,977972319,780587881,124834909,341934157,954694394,87908701,106129323,139683610,20911809,523176936,313575704,425796257,629367793};\n\nint main(){\n scanf(\"%d\",&n);\n printf(\"%d\\n\",ar[n]);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "4ccb599cdcd218c202d005632d592c42", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "// Author: Param Singh \n// Symmetric and Transitive: http://codeforces.com/contest/568/problem/B\n\n#include \n#include \n#define BIG 1000000007\n\nint main(void) {\n int n;\n int i, j;\n scanf(\"%d\", &n);\n int** dp = (int **) calloc(n+1, sizeof(int *));\n int* eq = (int *) calloc(n, sizeof(int));\n eq[0] = eq[1] = 1;\n for (i = 0; i <= n; i++) {\n dp[i] = (int *) calloc(n+1, sizeof(int));\n if (i == 1)\n dp[i][1] = 1;\n else if (i != 0) {\n for (j = 1; j <= n; j++) {\n dp[i][j] = (dp[i-1][j-1] +(((long long)(j) * dp[i-1][j]) % BIG)) % BIG;\n eq[i] = (eq[i] + dp[i][j]) % BIG;\n }\n }\n }\n\n int **c = (int **) calloc(n+1, sizeof(int *));\n for (i = 0; i <= n; i++) {\n c[i] = (int *) calloc(n+1, sizeof(int));\n c[i][0] = 0;\n c[i][1] = i;\n if (i == 0)\n continue;\n for (j = 2; j <= n; j++) {\n c[i][j] = (c[i-1][j-1] + c[i-1][j]) % BIG;\n }\n }\n\n int ans = 0;\n for (i = 1; i <= n; i++) {\n int x = ((long long)(c[n][i]) * eq[n-i]) % BIG;\n ans = (ans + x) % BIG;\n }\n\n printf(\"%d\\n\", ans);\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9f54c536584c57bd87e78f5213b424c2", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a30e58b51d1c8b41a8fbde18e2f0828c", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700.0} {"lang": "GNU C", "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 {\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 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 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 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "dde53789451bd495e54ea6fabefe9395", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c4baaa2746c6e6983611332b2c233793", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "59d86f129a156cce62c0459dd555dfae", "src_uid": "87d869a0fd4a510c5e7e310886b86a57", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nchar dp[23][1 << 23];\n\nint main()\n{\n int n, ans = 1e9, i, j, k;\n int a[23];\n int b[23][23] = {0};\n \n scanf(\"%d\", &n);\n \n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n \n for (i = 1; i < n; i++) {\n int f = 0;\n \n for (j = 0; j < i; j++) {\n for (k = j; k < i; k++) {\n if (a[j] + a[k] == a[i]) {\n b[i][j] = 1 << k;\n \n f = 1;\n }\n }\n }\n \n if (f == 0) {\n puts(\"-1\");\n \n return 0;\n }\n }\n \n dp[0][1] = 1;\n \n for (i = 1; i < n; i++) {\n for (j = 0; j < (1 << i); j++) {\n int f = 0;\n \n if (dp[i - 1][j] == 0) continue;\n \n for (k = 0; k < i; k++) {\n if ((j >> k) & 1) {\n if (j & b[i][k]) {\n f = 1;\n \n break;\n }\n }\n }\n \n if (f == 1) {\n for (k = 0; k < i; k++) {\n if ((j >> k) & 1) dp[i][j ^ (1 << k) ^ (1 << i)] = 1;\n }\n \n dp[i][j ^ (1 << i)] = 1;\n }\n }\n }\n \n for (i = 0; i < (1 << n); i++) {\n if (dp[n - 1][i] == 1) {\n int c = 0;\n \n for (j = 0; j < n; j++) {\n if ((i >> j) & 1) c++;\n }\n \n if (c < ans) ans = c;\n }\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8f55fb872973cb40fc7fce5b16c5226", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\n#define N\t23\n#define A\t4194304\n\nint bcnt(int b) {\n\treturn b == 0 ? 0 : 1 + bcnt(b & (b - 1));\n}\n\nint main() {\n\tstatic int aa[N];\n\tstatic char ii[A + 1], dp[(1 << N) - 1];\n\tint n, i, i_, a, b, b_, j, min, good;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (i = 0; i < n; i++)\n\t\tif (aa[i] % aa[0] != 0) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\treturn 0;\n\t\t}\n\tfor (i = 1; i < n; i++)\n\t\taa[i] /= aa[0];\n\taa[0] = 1;\n\tfor (a = 0; a <= A; a++)\n\t\tii[a] = -1;\n\tfor (i = 0; i < n; i++) {\n\t\tif (aa[i] > A) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tii[aa[i]] = i;\n\t}\n\tmin = n + 1;\n\tdp[1] = 1;\n\tfor (b = 1, j = 0; b < 1 << n; b++) {\n\t\tif (1 << (j + 1) == b)\n\t\t\tj++;\n\t\tif (dp[b]) {\n\t\t\tif (j == n - 1) {\n\t\t\t\tif (min > bcnt(b))\n\t\t\t\t\tmin = bcnt(b);\n\t\t\t} else {\n\t\t\t\tgood = 0;\n\t\t\t\tfor (i = 0; i <= j; i++)\n\t\t\t\t\tif (aa[i] <= aa[j + 1] && (i_ = ii[aa[j + 1] - aa[i]]) != -1\n\t\t\t\t\t\t\t&& (b & 1 << i) > 0 && (b & 1 << i_) > 0) {\n\t\t\t\t\t\tgood = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (good) {\n\t\t\t\t\tb_ = (b | 1 << (j + 1));\n\t\t\t\t\tdp[b_] = 1;\n\t\t\t\t\tfor (i = 0; i <= j; i++)\n\t\t\t\t\t\tif ((b & 1 << i) > 0)\n\t\t\t\t\t\t\tdp[b_ ^ 1 << i] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", min == n + 1 ? -1 : min);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e0b00879d907993edaaa2fedcab21a84", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\n#define N\t23\n#define A 4194304\n\nint bcnt(int b) {\n\treturn b == 0 ? 0 : 1 + bcnt(b & (b - 1));\n}\n\nint main() {\n\tstatic int aa[N];\n\tstatic char ii[A + 1], dp[(1 << N) - 1];\n\tint n, i, i_, a, b, b_, j, min, good;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (i = 0; i < n; i++)\n\t\tif (aa[i] % aa[0] != 0) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\treturn 0;\n\t\t}\n\tfor (i = 1; i < n; i++)\n\t\taa[i] /= aa[0];\n\taa[0] = 1;\n\tfor (a = 0; a <= A; a++)\n\t\tii[a] = -1;\n\tfor (i = 0; i < n; i++) {\n\t\tif (aa[i] > A) {\n\t\t\tprintf(\"-1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tii[aa[i]] = i;\n\t}\n\tmin = n + 1;\n\tdp[1] = 1;\n\tfor (b = 1, j = 0; b < 1 << n; b++) {\n\t\tif (1 << (j + 1) == b)\n\t\t\tj++;\n\t\tif (dp[b]) {\n\t\t\tif (j == n - 1) {\n\t\t\t\tif (min > bcnt(b))\n\t\t\t\t\tmin = bcnt(b);\n\t\t\t} else {\n\t\t\t\tgood = 0;\n\t\t\t\tfor (i = 0; i <= j; i++)\n\t\t\t\t\tif (aa[i] <= aa[j + 1] && (i_ = ii[aa[j + 1] - aa[i]]) != -1\n\t\t\t\t\t\t\t&& (b & 1 << i) > 0 && (b & 1 << i_) > 0) {\n\t\t\t\t\t\tgood = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tif (good) {\n\t\t\t\t\tb_ = (b | 1 << (j + 1));\n\t\t\t\t\tdp[b_] = 1;\n\t\t\t\t\tfor (i = 0; i <= j; i++)\n\t\t\t\t\t\tif ((b & 1 << i) > 0)\n\t\t\t\t\t\t\tdp[b_ ^ 1 << i] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", min == n + 1 ? -1 : min);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2df01a7f7186f15fb2e5ca5f5be7e5a5", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\nint dp[23][1 << 23];\n\nint main()\n{\n int n, ans = 1e9, i, j, k;\n int a[23];\n int b[23][23] = {0};\n \n scanf(\"%d\", &n);\n \n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n \n for (i = 1; i < n; i++) {\n int f = 0;\n \n for (j = 0; j < i; j++) {\n for (k = j; k < i; k++) {\n if (a[j] + a[k] == a[i]) {\n b[i][j] = 1 << k;\n \n f = 1;\n }\n }\n }\n \n if (f == 0) {\n puts(\"-1\");\n \n return 0;\n }\n }\n \n dp[0][1] = 1;\n \n for (i = 1; i < n; i++) {\n for (j = 0; j < (1 << i); j++) {\n int f = 0;\n \n if (dp[i - 1][j] == 0) continue;\n \n for (k = 0; k < i; k++) {\n if ((j >> k) & 1) {\n if (j & b[i][k]) {\n f = 1;\n \n break;\n }\n }\n }\n \n if (f == 1) {\n for (k = 0; k < i; k++) {\n if ((j >> k) & 1) dp[i][j ^ (1 << k) ^ (1 << i)] = 1;\n }\n \n dp[i][j ^ (1 << i)] = 1;\n }\n }\n }\n \n for (i = 0; i < (1 << n); i++) {\n if (dp[n - 1][i] == 1) {\n int c = 0;\n \n for (j = 0; j < n; j++) {\n if ((i >> j) & 1) c++;\n }\n \n if (c < ans) ans = c;\n }\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4cb356f0e8701667d4adbe7ca4a4417e", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "difficulty": 2200.0} {"lang": "GNU C", "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},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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8b82ed11c27a6b0e317e3c17ce0f2965", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.0} {"lang": "GNU C", "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},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#define MAXN 53\n#define MAXW 500003\nint dp[MAXW]={1};\nint n,d,c[MAXN];\nint ans,day;\n\nint main()\n{\n\tint i,j,k,sum=0;\n\n\tscanf(\"%d%d\",&n,&d);\n\tfor(i=0;i=c[i];j--,k--)\n\t\t\tif(dp[j]==0 && dp[k]==1)dp[j]=1;\n\t}\n\n\tans=day=0;\n\twhile(1)\n\t{\n\t\ti=ans+d;\n\t\tif(i>sum)i=sum;\n\t\tfor(;i>ans;i--)\n\t\t{\n\t\t\t//printf(\"now i %d %d\\n\",ans,i);\n\t\t\tif(dp[i]==1)break;\n\t\t}\n\t\tif(i==ans)break;\n\t\tans=i;\n\t\t++day;\n\t}\n\tprintf(\"%d %d\\n\",ans,day);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "77fa672119769d7abd24fb6af8889e5d", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\nint a[60];\nint dp[500100];\nint ans[500100];\nint main(void)\n{\n\tint n ,d;\n\tint i ,j;\n\tint sum;\n\tint aa;\n\tint p ,pans;\n\tint k;\n\t\n\twhile (scanf(\"%d %d\" ,&n ,&d)!=EOF)\n\t{\n\t\tsum=0;\n\t\tfor (i=1 ; i<=n ; i++)\t\n\t\t{\n\t\t\tscanf(\"%d\" ,&a[i]);\n\t\t\tsum+=a[i];\n\t\t}\n\t\tfor (j=1 ; j<=sum ; j++)\n\t\t{\n\t\t\tdp[j]=0;\t\n\t\t\tans[j]=0;\n\t\t}\n\t\tdp[0]=1;\n\t\tfor (i=1 ; i<=n ; i++)\n\t\t{\n\t\t\taa=a[i];\n\t\t\tfor (j=sum-aa ; j>=0 ; j--)\n\t\t\t{\n\t\t\t\tif (dp[j])\n\t\t\t\t{\n\t\t\t\t\tdp[j+aa]=1;\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\t\t\n\t\tans[0]=1;\n\t\tp=0;\n\t\tpans=2;\n\t\tfor (i=1 ; i<=sum ; i++)\n\t\t{\n\t\t\tif (dp[i])\n\t\t\t{\n\t\t\t\tk=i-d;\n\t\t\t\tif (k<=p)\n\t\t\t\t{\n\t\t\t\t\tans[i]=pans;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfor (j=k ; j\nint dp[51*10010];\nint main()\n{\n int n,d,i,x,sum,ans,ans1,j;\n scanf(\"%d%d\",&n,&d);\n sum=0;\n dp[0]=1;\n for(i=0;i=x;j--){\n if(dp[j-x])\n dp[j]=1;\n }\n }\n ans=ans1=0;\n while(1)\n {\n j=ans+d;\n while(j>ans&&!dp[j])\n j--;\n if(j==ans)\n break;\n ans=j;\n ans1++;\n }\n printf(\"%d %d\\n\",ans,ans1);\n \n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "05a2261fdf029118f4246dbd94723aea", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\nint a[60];\nint z[60];\nint dp0[500100] ,la0[500100];\nint dp1[500100] ,la1[500100];\nint main(void)\n{\n\tint n ,d;\n\tint ans1 ,ans2;\n\tint sum;\n\tint i ,j ,j2;\n\tint aa;\n\tint gg;\n\t\n\twhile (scanf(\"%d %d\" ,&n ,&d)!=EOF)\n\t{\n\t\tsum=0;\n\t\tfor (i=1 ; i<=n ; i++)\t\n\t\t{\n\t\t\tscanf(\"%d\" ,&a[i]);\n\t\t\tsum+=a[i];\n\t\t\tz[i]=1;\n\t\t}\n\t\tans1=0;\n\t\tans2=0;\n\t\twhile (1)\n\t\t{\n\t\t\tfor (j=1 ; j<=sum ; j++)\n\t\t\t{\n\t\t\t\tdp1[j]=0;\t\n\t\t\t}\n\t\t\tdp1[0]=-1;\n\t\t\tfor (i=1 ; i<=n ; i++)\n\t\t\t{\n\t\t\t\tif (z[i])\n\t\t\t\t{\n\t\t\t\t\taa=a[i];\n\t\t\t\t\tfor (j=sum-aa ; j>=0 ; j--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (dp1[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!dp1[j+aa])\t\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdp1[j+aa]=i;\n\t\t\t\t\t\t\t\tla1[j+aa]=j;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (j=1 ; j<=sum ; j++)\n\t\t\t{\n\t\t\t\tdp0[j]=0;\t\n\t\t\t}\n\t\t\tdp0[0]=-1;\n\t\t\tfor (i=1 ; i<=n ; i++)\n\t\t\t{\n\t\t\t\tif (!z[i])\n\t\t\t\t{\n\t\t\t\t\taa=a[i];\n\t\t\t\t\tfor (j=sum-aa ; j>=0 ; j--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (dp0[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!dp0[j+aa])\t\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdp0[j+aa]=i;\n\t\t\t\t\t\t\t\tla0[j+aa]=j;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\tgg=ans1;\t\n\t\t\tfor (i=ans1+d ; i ; i--)\n\t\t\t{\n\t\t\t\tif (i>sum)continue;\n\t\t\t\tif (dp1[i])\n\t\t\t\t{\n\t\t\t\t\tfor (j=i-d ;; j++)\t\n\t\t\t\t\t{\n\t\t\t\t\t\tif (j>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (dp0[j])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\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\tprintf(\"%d %d %d\\n%d %d %d %d\\n%d %d\\n\" ,ans1 ,i ,j ,dp1[1] ,dp1[2] ,dp1[3] ,dp1[4] ,z[1] ,z[2]);\t\t\t\t\t\n\t\t\t\t\tans1+=(i-j);\n\t\t\t\t\tans2++;\n\t\t\t\t\tj2=i;\n\t\t\t\t\twhile (dp1[j2]!=-1) \n\t\t\t\t\t{\n\t\t\t\t\t\tz[dp1[j2]]=0;\n\t\t\t\t\t\tj2=la1[j2];\t\n\t\t\t\t\t}\n\t\t\t\t\tj2=j;\n\t\t\t\t\twhile (dp0[j2]!=-1) \n\t\t\t\t\t{\n\t\t\t\t\t\tz[dp0[j2]]=1;\n\t\t\t\t\t\tj2=la0[j2];\t\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ans1==gg)\n\t\t\t{\n\t\t\t\tbreak;\t\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d %d\\n\" ,ans1 ,ans2);\n\t}\n\t\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "07627a69bd7b80a95f975d98364bd2fa", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n\nint a[60];\nint z[60];\nint dp0[500100] ,la0[500100];\nint dp1[500100] ,la1[500100];\nint main(void)\n{\n\tint n ,d;\n\tint ans1 ,ans2;\n\tint sum;\n\tint i ,j ,j2;\n\tint aa;\n\tint gg;\n\t\n\twhile (scanf(\"%d %d\" ,&n ,&d)!=EOF)\n\t{\n\t\tsum=0;\n\t\tfor (i=1 ; i<=n ; i++)\t\n\t\t{\n\t\t\tscanf(\"%d\" ,&a[i]);\n\t\t\tsum+=a[i];\n\t\t\tz[i]=1;\n\t\t}\n\t\tans1=0;\n\t\tans2=0;\n\t\twhile (1)\n\t\t{\n\t\t\tfor (j=1 ; j<=sum ; j++)\n\t\t\t{\n\t\t\t\tdp1[j]=0;\t\n\t\t\t}\n\t\t\tdp1[0]=-1;\n\t\t\tfor (i=1 ; i<=n ; i++)\n\t\t\t{\n\t\t\t\tif (z[i])\n\t\t\t\t{\n\t\t\t\t\taa=a[i];\n\t\t\t\t\tfor (j=sum-aa ; j>=0 ; j--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (dp1[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!dp1[j+aa])\t\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdp1[j+aa]=i;\n\t\t\t\t\t\t\t\tla1[j+aa]=j;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (j=1 ; j<=sum ; j++)\n\t\t\t{\n\t\t\t\tdp0[j]=0;\t\n\t\t\t}\n\t\t\tdp0[0]=-1;\n\t\t\tfor (i=1 ; i<=n ; i++)\n\t\t\t{\n\t\t\t\tif (!z[i])\n\t\t\t\t{\n\t\t\t\t\taa=a[i];\n\t\t\t\t\tfor (j=sum-aa ; j>=0 ; j--)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (dp0[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!dp0[j+aa])\t\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdp0[j+aa]=i;\n\t\t\t\t\t\t\t\tla0[j+aa]=j;\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\tgg=ans1;\t\n\t\t\tfor (i=ans1+d ; i ; i--)\n\t\t\t{\n\t\t\t\tif (i>sum)continue;\n\t\t\t\tif (dp1[i])\n\t\t\t\t{\n\t\t\t\t\tfor (j=i-d ;; j++)\t\n\t\t\t\t\t{\n\t\t\t\t\t\tif (j>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (dp0[j])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\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\tif (j>i)\n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\t\n\t\t\t\t\t}\n//\t\t\t\t\tprintf(\"%d %d %d\\n%d %d %d %d\\n%d %d\\n\" ,ans1 ,i ,j ,dp1[1] ,dp1[2] ,dp1[3] ,dp1[4] ,z[1] ,z[2]);\t\t\t\t\t\n\t\t\t\t\tans1+=(i-j);\n\t\t\t\t\tans2++;\n\t\t\t\t\tj2=i;\n\t\t\t\t\twhile (dp1[j2]!=-1) \n\t\t\t\t\t{\n\t\t\t\t\t\tz[dp1[j2]]=0;\n\t\t\t\t\t\tj2=la1[j2];\t\n\t\t\t\t\t}\n\t\t\t\t\tj2=j;\n\t\t\t\t\twhile (dp0[j2]!=-1) \n\t\t\t\t\t{\n\t\t\t\t\t\tz[dp0[j2]]=1;\n\t\t\t\t\t\tj2=la0[j2];\t\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n//\t\t\tprintf(\"%d %d %d %d\\n\" ,ans1 ,z[1] ,z[2] ,z[3]);\n\t\t\tif (ans1==gg)\n\t\t\t{\n\t\t\t\tbreak;\t\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d %d\\n\" ,ans1 ,ans2);\n\t}\n\t\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8993a83e2e9efaa5d6eadf886d913e88", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "difficulty": 2200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c16ed135e76ef4f020ffe474f1c34c12", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0022e09c1a0c9a9ec2775aca027fcf25", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "difficulty": 1800.0} {"lang": "GNU C11", "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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "1aef5df7189cf2cc9aa36293cbe6a9de", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "difficulty": 1800.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d7cfe3bbcfc3823957ca7968b73e467", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0a87ef810db63f2e163901d8454a87f9", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0} {"lang": "GNU C", "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 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 for(k=0;k<=a;k+=2)\n {\n if(2*i+j+(k/2)==n)count++;\n }\n }\n\n }printf(\"%d\",count);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "039877eba897a4dbba2f73bd7ae66626", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "557b630e7ac00a97ba22f050af4f3af5", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d2d1bebc0eba0c2ec704572b57eed7b", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a5818b6bfaa9289a5d415d1b781cda7b", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0} {"lang": "GNU C", "source_code": "#include \n#define M 1000000007\n\nint n,k,i,c,d;\nlong long y,z,u,v,r;\nint F(int a,int b){\n int r=1;\n for (;b;b>>=1,a=(long long)a*a%M){\n if (b&1)r=(long long)r*a%M;\n }\n return r;\n}\nint main(){\n scanf(\"%d%d\",&n,&k);\n if (!k)r=n;\n else{\n if (n<=++k){\n for(i=1;i<=n;i++)r+=F(i,k-1);\n }\n else{\n for (u=v=1;i<=k;i++){\n u=(u*(n-i))%M;\n if (i)v=((v*-i)%M+M)%M;\n }\n for (i=0,c=1,d=k;i<=k;i++,c++,d--){\n z=(z+F(i,k-1))%M;\n y=u*z%M*F(n-i,M-2)%M*F(v,M-2)%M;\n v=v*c%M*F(d,M-2)%M;\n if(i&1)y=M-y;\n r+=y;\n }\n }\n }\n printf(\"%lld\\n\",r%M);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "90deda3e0310d21a917bbef2ae0bf2d9", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#define M 1000000007LL\nconst long long MSQ = M * M;\ninline int mul(int a, int b) { return (int)(a * 1LL * b % M); }\ninline int powr(int a, int b) {\n int ans = 1;\n while (b) {if (b & 1) ans = mul(ans, a); a = mul(a, a); b >>= 1;}\n return ans;\n}\nint main(){\n int n, k, i, c, d;\n long long x, y, z, u, v, res;\n scanf(\"%d %d\", &n, &k);\n if (k == 0) res = n;\n else{\n if (n <= (k + 1)){\n for (i = 1, res = 0; i <= n; i++) res += powr(i, k);\n }\n else{\n res = 0;\n u = 1, v = 1, z = 0;\n for (i = 0; i <= (k + 1); i++){\n u = (u * (n - i)) % M;\n if (i) v = ((v * -i) + MSQ) % M;\n }\n for (i = 0, c = 1, d = k + 1; i <= (k + 1); i++, c++, d--){\n z = (z + powr(i, k)) % M;\n x = (u * z) % M;\n x = (x * powr(n - i, M - 2)) % M;\n y = ((x * powr(v, M - 2)) % M);\n v = (v * c) % M;\n if (d) v = (v * powr(d, M - 2)) % M;\n if (i & 1) y = M - y;\n res += y;\n }\n }\n }\n printf(\"%lld\\n\", res % M);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d155831ba407a160b7986b97b4d1f71c", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define M 1000000007\n\nint F(int a, int b){\n int r = 1;\n for (; b; b >>= 1, a = (long long)a * a % M){\n if (b & 1) r = (long long)r * a % M;\n }\n return r;\n}\n\nint main(){\n int n, k, i, c, d;\n long long y, z, u, v, r;\n\n scanf(\"%d %d\", &n, &k);\n if (!k) r = n;\n else{\n if (n <= ++k){\n for (i = 1, r = 0; i <= n; i++) r += F(i, k-1);\n }\n else{\n for (i = z = r = 0, u = v = 1; i <= k; i++){\n u = (u * (n - i)) % M;\n if (i) v = ((v * -i) + 1000000014000000049) % M;\n }\n\n for (i = 0, c = 1, d = k; i <= k; i++, c++, d--){\n z = (z + F(i, k-1)) % M;\n y = u * z % M * F(n - i, M - 2) % M * F(v, M - 2) % M;\n v = v * c % M * F(d, M - 2) % M;\n if (i & 1) y = M - y;\n r += y;\n }\n }\n }\n printf(\"%lld\\n\", r % M);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "573d0c856c07e25ef8b5b998c17c769c", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#define M 1000000007\nint n,k,i,c,d;\nlong long y,z,u,v,r;\nint F(int a,int b){\n int r=1;\n for (;b;b>>=1,a=(long long)a*a%M){\n if (b&1)r=(long long)r*a%M;\n }\n return r;\n}\nint main(){\n scanf(\"%d%d\",&n,&k);\n if (n<=++k){for(i=1;i<=n;i++)r+=F(i,k-1);}\n else{\n for (u=v=1;i<=k;i++){u=(u*(n-i))%M;if (i)v=((v*-i)%M+M)%M;}\n for (i=0,c=1,d=k;i<=k;i++,c++,d--){\n z=(z+F(i,k-1))%M;\n y=u*z%M*F(n-i,M-2)%M*F(v,M-2)%M;\n v=v*c%M*F(d,M-2)%M;\n if(i&1)y=M-y;\n r+=y;\n }\n }\n if (!--k)r--;\n printf(\"%lld\\n\",r%M);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f3e226350f42d9b4caf03d05c2f85edf", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 1000010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint ar[MAX];\nconst long long MODSQ = (long long)MOD * MOD;\n\nint expo(int a, int b){\n long long res = 1;\n\n while (b){\n if (b & 1) res = res * a % MOD;\n a = (long long)a * a % MOD;\n b >>= 1;\n }\n return res;\n}\n\nint main(){\n int n, k, i, j, c, d;\n long long x, y, z, u, v, res;\n\n while (scanf(\"%d %d\", &n, &k) != EOF){\n if (n == 0 && k == 0) break;\n\n for (i = 0; i <= (k + 1); i++){\n ar[i] = expo(i, k);\n if (i){\n ar[i] += ar[i - 1];\n if (ar[i] >= MOD) ar[i] -= MOD;\n }\n }\n if (n <= (k + 1)) res = ar[n];\n else{\n res = 0;\n u = 1, v = 1;\n for (i = 0; i <= (k + 1); i++){\n u = (u * (n - i)) % MOD;\n if (i) v = ((v * -i) + MODSQ) % MOD;\n }\n\n for (i = 0, c = 1, d = k + 1; i <= (k + 1); i++, c++, d--){\n x = (u * ar[i]) % MOD;\n x = (x * expo(n - i, MOD - 2)) % MOD;\n y = ((x * expo(v, MOD - 2)) % MOD);\n v = (v * c) % MOD;\n if (d) v = (v * expo(d, MOD - 2)) % MOD;\n if (i & 1) y = MOD - y;\n res += y;\n }\n }\n printf(\"%lld\\n\", res % MOD);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "82cc8afda4e613336e937530c0b1f5b1", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#define min(x,y) ((x) < (y) ? (x) : (y))\n\nint n;\n\nint gcd(int x, int y, int *ti) {\n return y ? (*ti += x/y, gcd(y, x%y, ti)) : x;\n}\n\n\nint main(void)\n{\n int ans = 0x3f3f3f3f;\n int ti, i;\n\n scanf(\"%d\", &n);\n for (i = 1; i <= n; ++i) {\n ti = 0;\n if (gcd(n, i, &ti) == 1)\n ans = min(ans, ti);\n }\n\n printf(\"%d\\n\", ans-1);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3510b7561db5a04ab325738413d6eba9", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include\nint ss,s[1000];\nint main(void){\n int n;scanf(\"%d\",&n);\n int x=n-1;\n int i=2,m=n;\n while (m>1){\n if(m%i==0){s[ss]=i;ss++;}\n while(m%i==0)m/=i;\n i++;}\n for(i=2;i<=n;i++){\n int c=0;\n int j;for(j=0;j1&&cnt=v){y=u;z=v;}\n else{y=v;z=u;}}\n if(cnt\n\nint main()\n{\n int n, m = 1e9, i;\n\n scanf(\"%d\", &n);\n\n for (i = 1; i <= n; i++) {\n\t int p = n, q = i, c = 0;\n\n\t while (1) {\n\t if (p == q) {\n\t\t if (p > 1) c = -1;\n\n\t\t break;\n\t }\n\n\t if (p > q) {\n\t\t if (q == 1) {\n\t\t\t c += p - 1;\n\n\t\t\t break;\n\t\t }\n\n\t\t p -= q;\n\t } else {\n\t\t if (p == 1) {\n\t\t\t c += q - 1;\n\n\t\t\t break;\n\t\t }\n\n\t\t q -= p;\n\t }\n\n\t c++;\n\t }\n\n\t if (c >= 0 && c < m) m = c;\n }\n\n printf(\"%d\\n\", m);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "873e1a8b4c9291f21d1070d90598b969", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nconst int inf = 1000000000;\n\nint count(int a, int b) {\n\tif (b == 0)\n\t\tif (a == 1)\n\t\t\treturn 0;\n\t\telse\n\t\t\treturn inf;\n\n\treturn count(b, a%b) + a/b;\n}\n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tint i, m = inf;\n\tfor (i = 1; i <= n; i++) {\n\t\tint c = count(i, n);\n\t\tif (c < m)\n\t\t\tm = c;\n\t}\n\n\tprintf(\"%d\\n\", m-1);\n\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "baf582ebcfb7e870ec27f01bd1e143e6", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nint gcm(int a, int b) // a<=b\u3067\u3042\u308b\u3053\u3068\uff0e\n{\n if(a == 0)\n return b;\n else\n return gcm(b%a, a);\n}\n\nint rec(int a, int b) // a\n\n\n\nint numberOfWalls(int n,int c,int N ,int C, int dp[N+1][C+1]){\n\tint i,count = 0;\n\tif(dp[n][c]!=-1){\n\t\treturn dp[n][c];\n\t}\n\tfor(i=0;i<=n;i++){\n\t\tcount+=numberOfWalls(n-i,c-1,N,C,dp);\n\t\tif(count>=1000003){\n\t\t\tcount%=1000003;\n\t\t}\n\t}\n\tdp[n][c]=count;\n\treturn count;\n}\n\nint main(){\n\tint n,c,i,j;\n\tscanf(\"%d %d\",&n,&c);\n\tint dp[n+1][c+1];\n\tfor(i=0;i<=n;i++){\n\t\tfor(j=0;j<=c;j++){\n\t\t\tdp[i][j]=-1;\n\t\t}\n\t} \n\tfor(i=0;i<=n;i++){\n\t\tdp[i][1]=i+1;\n\t}\n\t\n\tprintf(\"%d\\n\",numberOfWalls(n,c,n,c,dp)-1);\n\treturn 0;\n\t}\n\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "77c16fe5b576b4ed8d5d2ba78e826d59", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 1000000\n#define MOD 1000003\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long fact[MAX], inv[MAX];\n\nvoid Generate(){\n int i, x;\n fact[0] = 1, inv[MAX - 1] = 6;\n for (i = 1; i < MAX; i++) fact[i] = ((long long)i * fact[i - 1]) % MOD;\n for (i = MAX - 2; i >= 0; i--) inv[i] = ((long long)inv[i + 1] * (i + 1)) % MOD;\n}\n\nlong long binomial(long long n, long long k){\n if (k > n) return 0;\n return (fact[n] * inv[n - k] * inv[k]) % MOD;\n}\n\nint main(){\n Generate();\n long long n, m, i, j, res;\n while (scanf(\"%lld %lld\", &n, &m) != EOF){\n m--, res = 0;\n for (i = 0; i <= (n + m); i++) res += binomial(i, m);\n printf(\"%lld\\n\", (res - 1 + MOD) % MOD);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8a00f4ecb2df2cb7f7855d6e26c9615", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 1000000007\n\nint dar[252][252], k, n, fact[252], inv[252];\n\nint add(int a, int b){\n a += b;\n if(a >= MOD)a -= MOD;\n return a;\n}\n\nint mul(int a, int b){\n return (a*1ll*b)%MOD;\n}\nint powmod(int base, long long p){\n int toret = 1;\n while(p){\n if(p&1)toret = mul(toret, base);\n base = mul(base, base);\n p >>= 1;\n }\n return toret;\n}\n\nint ncr(int n, int r){\n return mul(mul(fact[n], inv[r]), inv[n - r]);\n}\n\nint dp(int r, int c){\n // printf(\"dp(%d, %d)\\n\", r, c);\n if(dar[r][c] == -1){\n int toret = 0;\n if(r == 0){\n dar[r][c] = (c == 0);\n return dar[r][c];\n }\n\n int sat = n - c;\n int i;\n for(i = 0;i <= c;i++)if(i + sat){\n int f1 = powmod(k - 1, c - i);\n f1 = mul(f1, ncr(c, i));\n int f2 = powmod(k, sat);\n if(i == 0){\n\tf2 = add(f2, MOD - powmod(k - 1, sat));\n }\n toret = add(toret, mul(dp(r - 1, c - i), mul(f1, f2)));\n }\n dar[r][c] = toret;\n }\n return dar[r][c];\n}\n\nint main(){\n scanf(\"%d %d\", &n, &k);\n int i,j;\n fact[0] = 1;\n for(i = 1;i < 252;i++)fact[i] = mul(fact[i - 1], i);\n for(i = 0;i < 252;i++) inv[i] = powmod(fact[i], MOD - 2);\n for(i = 0;i <= n;i++)for(j = 0;j <= n;j++){\n dar[i][j] = -1;\n }\n printf(\"%d\\n\", dp(n, n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aeaee555eba2c2163df15d0ade77136e", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 1000000007\n\nint dar[252][252], k, n, fact[252];\n\nint add(int a, int b){\n a += b;\n if(a >= MOD)a -= MOD;\n return a;\n}\n\nint mul(int a, int b){\n return (a*1ll*b)%MOD;\n}\nint powmod(int base, long long p){\n int toret = 1;\n while(p){\n if(p&1)toret = mul(toret, base);\n base = mul(base, base);\n p >>= 1;\n }\n return toret;\n}\n\nint inv(int x){\n return powmod(x, MOD - 2);\n}\nint ncr(int n, int r){\n return mul(mul(fact[n], inv(fact[r])), inv(fact[n - r]));\n}\n\nint dp(int r, int c){\n // printf(\"dp(%d, %d)\\n\", r, c);\n if(dar[r][c] == -1){\n int toret = 0;\n if(r == 0){\n dar[r][c] = (c == 0);\n return dar[r][c];\n }\n\n int sat = n - c;\n int i;\n for(i = 0;i <= c;i++)if(i + sat){\n int f1 = powmod(k - 1, c - i);\n f1 = mul(f1, ncr(c, i));\n int f2 = powmod(k, sat);\n if(i == 0){\n\tf2 = add(f2, MOD - powmod(k - 1, sat));\n }\n toret = add(toret, mul(dp(r - 1, c - i), mul(f1, f2)));\n }\n dar[r][c] = toret;\n }\n return dar[r][c];\n}\n\nint main(){\n scanf(\"%d %d\", &n, &k);\n int i,j;\n fact[0] = 1;\n for(i = 1;i < 252;i++)fact[i] = mul(fact[i - 1], i);\n for(i = 0;i <= n;i++)for(j = 0;j <= n;j++){\n dar[i][j] = -1;\n }\n printf(\"%d\\n\", dp(n, n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4d49d24f95f39540eda34115de73fa69", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/blog/entry/70162 */\n#include \n\n#define N\t250\n#define MD\t1000000007\n\nlong long power(int a, int k) {\n\tlong long b = a, p = 1;\n\n\twhile (k > 0) {\n\t\tif (k & 1)\n\t\t\tp = p * b % MD;\n\t\tb = b * b % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint ff[N + 1], gg[N + 1];\n\nvoid init() {\n\tint i;\n\tlong long f = 1;\n\n\tfor (i = 0; i <= N; i++) {\n\t\tgg[i] = power(ff[i] = f, MD - 2);\n\t\tf = f * (i + 1) % MD;\n\t}\n}\n\nlong long choose(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nint main() {\n\tint n, k, r, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tans = 0;\n\tfor (r = 0; r <= n; r++)\n\t\tans = (ans + (r % 2 == 0 ? 1 : -1) * choose(n, r) * power(power(k - 1, r) * (power(k, n - r) - power(k - 1, n - r)) % MD, n)) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4b89a1b9791aa477f5393f08b391c06d", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 1000000007\n\nint dar[252][252], k, n, fact[252], inv[252], precomp[2][252];\n\nint add(int a, int b){\n a += b;\n if(a >= MOD)a -= MOD;\n return a;\n}\n\nint mul(int a, int b){\n return (a*1ll*b)%MOD;\n}\nint powmod(int base, long long p){\n int toret = 1;\n while(p){\n if(p&1)toret = mul(toret, base);\n base = mul(base, base);\n p >>= 1;\n }\n return toret;\n}\n\nint ncr(int n, int r){\n return mul(mul(fact[n], inv[r]), inv[n - r]);\n}\n\nint dp(int r, int c){\n // printf(\"dp(%d, %d)\\n\", r, c);\n if(dar[r][c] == -1){\n int toret = 0;\n if(r == 0){\n dar[r][c] = (c == 0);\n return dar[r][c];\n }\n\n int sat = n - c;\n int i;\n for(i = 0;i <= c;i++)if(i + sat){\n int f1 = precomp[0][c - i];\n f1 = mul(f1, ncr(c, i));\n int f2 = precomp[1][sat];\n if(i == 0){\n\tf2 = add(f2, MOD - precomp[0][sat]);\n }\n toret = add(toret, mul(dp(r - 1, c - i), mul(f1, f2)));\n }\n dar[r][c] = toret;\n }\n return dar[r][c];\n}\n\nint main(){\n scanf(\"%d %d\", &n, &k);\n if(k == 1){\n printf(\"1\\n\");\n return 0;\n }\n int i,j;\n fact[0] = 1;\n inv[0] = 1;\n precomp[0][0] = precomp[1][0] = 1;\n for(i = 1;i < 252;i++){\n fact[i] = mul(fact[i - 1], i);\n inv[i] = powmod(fact[i], MOD - 2);\n precomp[0][i] = powmod(k - 1, i);\n precomp[1][i] = powmod(k, i);\n }\n for(i = 0;i <= n;i++)for(j = 0;j <= n;j++){\n dar[i][j] = -1;\n }\n printf(\"%d\\n\", dp(n, n));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7f5af34a12251b591726a5e1977c21d4", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t250\n#define MD\t1000000007\n\nlong long power(int a, int k) {\n\tlong long b = a, p = 1;\n\n\twhile (k > 0) {\n\t\tif (k & 1)\n\t\t\tp = p * b % MD;\n\t\tb = b * b % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint ff[N + 1], gg[N + 1];\n\nvoid init() {\n\tint i;\n\tlong long f = 1;\n\n\tfor (i = 0; i <= N; i++) {\n\t\tgg[i] = power(ff[i] = f, MD - 2);\n\t\tf = f * (i + 1) % MD;\n\t}\n}\n\nlong long choose(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nint main() {\n\tstatic int pk[N * N + 1], pk_[N * N + 1];\n\tint n, k, r, c, i, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tpk[0] = pk_[0] = 1;\n\tfor (i = 1; i <= n * n; i++) {\n\t\tpk[i] = (long long) pk[i - 1] * k % MD;\n\t\tpk_[i] = (long long) pk_[i - 1] * (k - 1) % MD;\n\t}\n\tans = 0;\n\tfor (r = 0; r <= n; r++)\n\t\tfor (c = 0; c <= n; c++) {\n\t\t\tint x = choose(n, r) * choose(n, c) % MD\n\t\t\t\t* pk_[n * n - (n - r) * (n - c)] % MD * pk[(n - r) * (n - c)] % MD;\n\n\t\t\tans = (ans + ((r + c) % 2 == 0 ? x : -x)) % MD;\n\t\t}\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "34c50ba06e43bd5497c77a36907569f4", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define A 100000000\n#define B 1000\n#define PMAX 316223\n#define P 27293\n#define P3 10000\n#define L1 32000\n#define min(a,b) (((a) < (b)) ? (a) : (b))\n#define max(a,b) (((a) > (b)) ? (a) : (b))\n\nint a[A+1];\nunsigned int b[B] = {\n 0, 5761455, 11078937, 16252325, 21336326, 26355867, 31324703, 36252931, 41146179, 46009215,\n 50847534, 55662470, 60454705, 65228333, 69985473, 74726528, 79451833, 84163019, 88862422, 93547928,\n 98222287, 102886526, 107540122, 112184940, 116818447, 121443371, 126062167, 130670192, 135270258, 139864011,\n 144449537, 149028641, 153600805, 158165829, 162725196, 167279333, 171827136, 176369517, 180906194, 185436625,\n 189961812, 194481069, 198996103, 203507248, 208013454, 212514323, 217011319, 221504167, 225991743, 230475545,\n 234954223, 239429993, 243902342, 248370960, 252834065, 257294520, 261751864, 266206294, 270655552, 275101551,\n 279545368, 283984956, 288422869, 292856421, 297285198, 301711468, 306137611, 310558733, 314977166, 319391721,\n 323804352, 328215206, 332620900, 337024801, 341426904, 345826612, 350221825, 354615116, 359006517, 363395981,\n 367783654, 372168766, 376549859, 380930729, 385307831, 389682427, 394055910, 398425675, 402793457, 407159590,\n 411523195, 415885628, 420243162, 424603409, 428958595, 433311792, 437663672, 442014876, 446362736, 450708777,\n 455052511, 459394441, 463733626, 468072089, 472408200, 476741968, 481074475, 485405902, 489736021, 494062787,\n 498388617, 502712575, 507036251, 511354887, 515673696, 519991125, 524309392, 528624525, 532936342, 537247292,\n 541555851, 545864306, 550170437, 554476170, 558778993, 563082532, 567382703, 571680924, 575978253, 580275482,\n 584570200, 588863345, 593155089, 597445378, 601735269, 606022680, 610308664, 614594106, 618878615, 623159296,\n 627440336, 631717982, 635997249, 640275231, 644550922, 648825715, 653099304, 657371139, 661643304, 665911851,\n 670180516, 674447835, 678714823, 682979568, 687242934, 691504332, 695766925, 700028114, 704286233, 708543557,\n 712799821, 717055212, 721310048, 725563140, 729813991, 734065508, 738315156, 742564929, 746813071, 751060249,\n 755305935, 759550004, 763794029, 768035554, 772276773, 776516528, 780756650, 784994469, 789230673, 793467703,\n 797703398, 801937611, 806169530, 810401956, 814633249, 818864199, 823092766, 827320850, 831548431, 835773764,\n 840000027, 844224822, 848450250, 852673966, 856895823, 861116918, 865335133, 869555570, 873772692, 877989808,\n 882206716, 886422213, 890636921, 894850907, 899064419, 903275849, 907487780, 911698381, 915907322, 920117006,\n 924324489, 928532509, 932738007, 936943763, 941147666, 945351970, 949555347, 953758330, 957958052, 962158684,\n 966358351, 970556800, 974755898, 978951680, 983147464, 987343369, 991538483, 995733104, 999926054, 1004118104,\n 1008309544, 1012500258, 1016690917, 1020879037, 1025067175, 1029256469, 1033444454, 1037631294, 1041815774, 1046001482,\n 1050186367, 1054370637, 1058552429, 1062734476, 1066916147, 1071094927, 1075274949, 1079454128, 1083631538, 1087809564,\n 1091987405, 1096163370, 1100339660, 1104513787, 1108687177, 1112860305, 1117034447, 1121205592, 1125376629, 1129547281,\n 1133717820, 1137887191, 1142056097, 1146225390, 1150393648, 1154560299, 1158727002, 1162892823, 1167057747, 1171221046,\n 1175385155, 1179549444, 1183711384, 1187874380, 1192034212, 1196195238, 1200356153, 1204515304, 1208673910, 1212829795,\n 1216987937, 1221145073, 1225300872, 1229455037, 1233609164, 1237764170, 1241917157, 1246070670, 1250224878, 1254376178,\n 1258528162, 1262678524, 1266827683, 1270976954, 1275125632, 1279274172, 1283421484, 1287567873, 1291715676, 1295861693,\n 1300005926, 1304150462, 1308296664, 1312440578, 1316583470, 1320724811, 1324868019, 1329010956, 1333151863, 1337291809,\n 1341430624, 1345570079, 1349708221, 1353846756, 1357984935, 1362122305, 1366257814, 1370393786, 1374528892, 1378664634,\n 1382799415, 1386933522, 1391065576, 1395199789, 1399331489, 1403463860, 1407594647, 1411724086, 1415855689, 1419985631,\n 1424115489, 1428244053, 1432371870, 1436498522, 1440625629, 1444751745, 1448877006, 1453002152, 1457125036, 1461250000,\n 1465374659, 1469497594, 1473620220, 1477744125, 1481866173, 1485988244, 1490109683, 1494229934, 1498349689, 1502469332,\n 1506589876, 1510706235, 1514824921, 1518942965, 1523061505, 1527178351, 1531294454, 1535409890, 1539526326, 1543640517,\n 1547756812, 1551870851, 1555985016, 1560097442, 1564208549, 1568320054, 1572432177, 1576544661, 1580654270, 1584764017,\n 1588873108, 1592982840, 1597091049, 1601199712, 1605308326, 1609414491, 1613521803, 1617628777, 1621733835, 1625839726,\n 1629945987, 1634052052, 1638156927, 1642258972, 1646361787, 1650465128, 1654567808, 1658669200, 1662770302, 1666869794,\n 1670972264, 1675072419, 1679170566, 1683270249, 1687369711, 1691467151, 1695565190, 1699662748, 1703761548, 1707858902,\n 1711955433, 1716050469, 1720144848, 1724241897, 1728336282, 1732430410, 1736526180, 1740619156, 1744713632, 1748805530,\n 1752898084, 1756987393, 1761078122, 1765169921, 1769260641, 1773351175, 1777442877, 1781530474, 1785621307, 1789709560,\n 1793798703, 1797887260, 1801975182, 1806062390, 1810149996, 1814236123, 1818322676, 1822407623, 1826489988, 1830575906,\n 1834658067, 1838742792, 1842825653, 1846909270, 1850992005, 1855074218, 1859156347, 1863238351, 1867320859, 1871402335,\n 1875482847, 1879562930, 1883642470, 1887722398, 1891800587, 1895879932, 1899958276, 1904036638, 1908114573, 1912191800,\n 1916268743, 1920347116, 1924422570, 1928498011, 1932573349, 1936646486, 1940721696, 1944797174, 1948871367, 1952945594,\n 1957018338, 1961089383, 1965161808, 1969233350, 1973304195, 1977376665, 1981447779, 1985519033, 1989588548, 1993659289,\n 1997729452, 2001796366, 2005864843, 2009933793, 2014002593, 2018069377, 2022137196, 2026204289, 2030270517, 2034337796,\n 2038404475, 2042469434, 2046534053, 2050598713, 2054662457, 2058727455, 2062791593, 2066855115, 2070918071, 2074981871,\n 2079045540, 2083107257, 2087170358, 2091232421, 2095293756, 2099353852, 2103414866, 2107473358, 2111533438, 2115593696,\n 2119654578, 2123711202, 2127769041, 2131828079, 2135887473, 2139945263, 2144002868, 2148061201, 2152118222, 2156173876,\n 2160230408, 2164287399, 2168343450, 2172397905, 2176451935, 2180506650, 2184561319, 2188616526, 2192670595, 2196723874,\n 2200777436, 2204828910, 2208879508, 2212930015, 2216982800, 2221034120, 2225087204, 2229138005, 2233188780, 2237237738,\n 2241286680, 2245337711, 2249386635, 2253437044, 2257486659, 2261534669, 2265582088, 2269630722, 2273677293, 2277723942,\n 2281770277, 2285816118, 2289861391, 2293908247, 2297955870, 2301999709, 2306044120, 2310088597, 2314134053, 2318177990,\n 2322223112, 2326266900, 2330308778, 2334351201, 2338393413, 2342436031, 2346478314, 2350519355, 2354560561, 2358602447,\n 2362642765, 2366683716, 2370724495, 2374763504, 2378804084, 2382843532, 2386880413, 2390919906, 2394959109, 2398996112,\n 2403034927, 2407071577, 2411110078, 2415147307, 2419181034, 2423219093, 2427255367, 2431292536, 2435327045, 2439361501,\n 2443396396, 2447431831, 2451466331, 2455500451, 2459534282, 2463565779, 2467597919, 2471632122, 2475665529, 2479696435,\n 2483729191, 2487761399, 2491793997, 2495825196, 2499856755, 2503887935, 2507918465, 2511947717, 2515978063, 2520007177,\n 2524038155, 2528067401, 2532097043, 2536126664, 2540155255, 2544183491, 2548211228, 2552238285, 2556266399, 2560294002,\n 2564319542, 2568345835, 2572372442, 2576397670, 2580421933, 2584447929, 2588472785, 2592497820, 2596522622, 2600546330,\n 2604571471, 2608595062, 2612618628, 2616643294, 2620665663, 2624687920, 2628709369, 2632732626, 2636754699, 2640776029,\n 2644799757, 2648820585, 2652840994, 2656861044, 2660881979, 2664902170, 2668922912, 2672943760, 2676963401, 2680982125,\n 2685000601, 2689021011, 2693039441, 2697057353, 2701075683, 2705092716, 2709109210, 2713125397, 2717143223, 2721159932,\n 2725176643, 2729193507, 2733210696, 2737225536, 2741242121, 2745257057, 2749272015, 2753286718, 2757299847, 2761314795,\n 2765327756, 2769341791, 2773356225, 2777369850, 2781383306, 2785394924, 2789408169, 2793419860, 2797431717, 2801443922,\n 2805454432, 2809465484, 2813477356, 2817487436, 2821497837, 2825509231, 2829520068, 2833530738, 2837539518, 2841549369,\n 2845558213, 2849566042, 2853574755, 2857584531, 2861594266, 2865601989, 2869610768, 2873619181, 2877625961, 2881633373,\n 2885641353, 2889648502, 2893654733, 2897660376, 2901667770, 2905672946, 2909678043, 2913685600, 2917689568, 2921695146,\n 2925699539, 2929702761, 2933706263, 2937709465, 2941713524, 2945717900, 2949719949, 2953724092, 2957726064, 2961727364,\n 2965730599, 2969734593, 2973737899, 2977740005, 2981742619, 2985744869, 2989743222, 2993744024, 2997743403, 3001742385,\n 3005740846, 3009740083, 3013740632, 3017740443, 3021739912, 3025737894, 3029738266, 3033736354, 3037734260, 3041732620,\n 3045730736, 3049728863, 3053726975, 3057724728, 3061722012, 3065718156, 3069714416, 3073709903, 3077706121, 3081700773,\n 3085694966, 3089690887, 3093686041, 3097682212, 3101677762, 3105672385, 3109665704, 3113660777, 3117654258, 3121648738,\n 3125641477, 3129636165, 3133628489, 3137621629, 3141615091, 3145607391, 3149600532, 3153593186, 3157583551, 3161575400,\n 3165568071, 3169558897, 3173549966, 3177541505, 3181531857, 3185524100, 3189515502, 3193505484, 3197494480, 3201485771,\n 3205474366, 3209464223, 3213453462, 3217442657, 3221430632, 3225418712, 3229406344, 3233394790, 3237380550, 3241367601,\n 3245353518, 3249340672, 3253327262, 3257314501, 3261302137, 3265288786, 3269274318, 3273261676, 3277246756, 3281232235,\n 3285218896, 3289205184, 3293189136, 3297172860, 3301158042, 3305141278, 3309125457, 3313108871, 3317092589, 3321076365,\n 3325059246, 3329042269, 3333024320, 3337007745, 3340990584, 3344973656, 3348954479, 3352936965, 3356918381, 3360899212,\n 3364880246, 3368861514, 3372843128, 3376824341, 3380804536, 3384785252, 3388764045, 3392744352, 3396724969, 3400703302,\n 3404683449, 3408661629, 3412641191, 3416621174, 3420600239, 3424577712, 3428556536, 3432533925, 3436512942, 3440489299,\n 3444467709, 3448443650, 3452420745, 3456398055, 3460376073, 3464354329, 3468330724, 3472306712, 3476280273, 3480257644,\n 3484232867, 3488208449, 3492182057, 3496156616, 3500132047, 3504107018, 3508083271, 3512056531, 3516031243, 3520004496,\n 3523979003, 3527952545, 3531925382, 3535899657, 3539873170, 3543843428, 3547815425, 3551789160, 3555761507, 3559733867,\n 3563706203, 3567677571, 3571648151, 3575618333, 3579587822, 3583559953, 3587530335, 3591499540, 3595471441, 3599441281,\n 3603412533, 3607382383, 3611353499, 3615323157, 3619293204, 3623260438, 3627230054, 3631199924, 3635167788, 3639133977,\n 3643101671, 3647069932, 3651037811, 3655006291, 3658974043, 3662941495, 3666909363, 3670877228, 3674842642, 3678809724,\n 3682776125, 3686743894, 3690708635, 3694674136, 3698640744, 3702607660, 3706572805, 3710536268, 3714502398, 3718465031,\n 3722428991, 3726394088, 3730358421, 3734323031, 3738287024, 3742250941, 3746214561, 3750179004, 3754141753, 3758105608,\n 3762067054, 3766030492, 3769992222, 3773955567, 3777917868, 3781881979, 3785842285, 3789803781, 3793766088, 3797726848,\n 3801688660, 3805649459, 3809611918, 3813571463, 3817534298, 3821493048, 3825453351, 3829412874, 3833371480, 3837330842,\n 3841291749, 3845250279, 3849209920, 3853169493, 3857129155, 3861088365, 3865047067, 3869005617, 3872964725, 3876923182,\n 3880881273, 3884839528, 3888796569, 3892753631, 3896710330, 3900667023, 3904623253, 3908580398, 3912536328, 3916492455,\n 3920449831, 3924406577, 3928362015, 3932316075, 3936271016, 3940227600, 3944182809, 3948137829, 3952093061, 3956048108,\n 3960003559, 3963957671, 3967911833, 3971865657, 3975818018, 3979772869, 3983725586, 3987677658, 3991630533, 3995584016,\n 3999537962, 4003491500, 4007444082, 4011396563, 4015348558, 4019300356, 4023253116, 4027204376, 4031157206, 4035109071,\n 4039061553, 4043014010, 4046965198, 4050915644, 4054865513, 4058816261, 4062767391, 4066716906, 4070666662, 4074616057,\n 4078566781, 4082514143, 4086464266, 4090414411, 4094363532, 4098312828, 4102261058, 4106208569, 4110157418, 4114105592\n};\nint p[P];\nlong long y[P];\n\nint main()\n{\n\tlong long n, n2, n3, bl, bh, ans = 0, k, kl, kh;\n\tint i, j, b1=-1, b2, q2, c;\n\n\tscanf(\"%I64d\", &n);\n\n\t// p\n\tp[0] = 2; k = 1;\n\tfor (i = 3; i <= PMAX; i += 2)\n\t{\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\tp[k++] = i;\n\t\t\tif (i <= PMAX/i)\n\t\t\t\tfor (j = i * i; j <= PMAX; j += i) \n\t\t\t\t\ta[j] = 1;\n\t\t};\n\t}\n\n\t// 2\n\tfor (i = 0; i < P; i++)\n\t{\n\t\tn2 = n / p[i];\n\t\tif (n2 == 0 || n2 < p[i]) break;\n\t\tb2 = (int) (n2 / A); \n\t\tq2 = n2 % A;\n\t\tif (b1 != b2)\n\t\t{\n\t\t\tmemset(a, 0, sizeof(a));\n\t\t\tb1 = b2;\n\t\t\tbl = 1ll * b1 * A;\n\t\t\tbh = bl + q2 + 1;\n\t\t\tc = (b1 == 0? 1: 0);\n\t\t\ty[0] = -1;\n\t\t\tfor (j = 1; j < P; j++)\n\t\t\t{\n\t\t\t\ty[j] = max(bl + bl/p[j]*p[j] + p[j], 1ll * p[j] * p[j]) - bl;\n\t\t\t\tif ((y[j] & 1) == 0) y[j] += p[j];\n\t\t\t}\n\t\t\tfor (kl = bl; kl < bh; kl += L1)\n\t\t\t{\n\t\t\t\tkh = min(kl + L1, bh) - bl;\n\t\t\t\tfor (j = 1; j < P; j++)\n\t\t\t\t{\n \t\t\t\t\tfor (k = y[j]; k < kh; k += 2ll*p[j]) \n\t\t\t\t\t\ta[k] = 1;\n\t\t\t\t\ty[j] = k;\n\t\t\t\t}\n\t\t\t\tif (kl == 0)\n\t\t\t\t{\n\t\t\t\t\tk = 3;\n\t\t\t\t\ta[2] = 1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tk = kl - bl + 1;\n\t\t\t\t}\n \t\t\t\tfor (; k < kh; k+=2)\n\t\t\t\t\ta[k] = a[k+1] = (a[k]==0? ++c: c);\n\t\t\t}\n\t\t} // b\n\t\tans = ans + b[b1] + a[q2] - (i + 1);\n\t}\n\n\t// 3\n\ti = 0; j = P;\n\tfor (;;)\n\t{\n\t\tk = i + (j - i) / 2;\n\t\tif (k == i)\n\t\t\tbreak;\n\t\tif (p[k] > P3)\n\t\t\tn3 = n + 1;\n\t\telse\n\t\t\tn3 = (long long) p[k] * p[k] * p[k];\n\t\tif (n3 > n)\n\t\t\tj = (int) k;\n\t\telse if (n3 < n)\n\t\t\ti = (int) k;\n\t\telse \n\t\t\tbreak;\n\t}\n\tif (p[k]*p[k]*p[k]<=n)\n\t\tans += k + 1;\n\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6001520cf65c6ff727768c6c2c65d5c8", "src_uid": "ffb7762f1d60dc3f16e9b27ea0ecdd7d", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define A 100000000\n#define B 1000\n#define PMAX 316223\n#define P 27293\n#define P3 10000\n#define L1 32000\n#define min(a,b) (((a) < (b)) ? (a) : (b))\n#define max(a,b) (((a) > (b)) ? (a) : (b))\n\nint a[A+1];\nunsigned int b[B] = {\n 0, 5761455, 11078937, 16252325, 21336326, 26355867, 31324703, 36252931, 41146179, 46009215,\n 50847534, 55662470, 60454705, 65228333, 69985473, 74726528, 79451833, 84163019, 88862422, 93547928,\n 98222287, 102886526, 107540122, 112184940, 116818447, 121443371, 126062167, 130670192, 135270258, 139864011,\n 144449537, 149028641, 153600805, 158165829, 162725196, 167279333, 171827136, 176369517, 180906194, 185436625,\n 189961812, 194481069, 198996103, 203507248, 208013454, 212514323, 217011319, 221504167, 225991743, 230475545,\n 234954223, 239429993, 243902342, 248370960, 252834065, 257294520, 261751864, 266206294, 270655552, 275101551,\n 279545368, 283984956, 288422869, 292856421, 297285198, 301711468, 306137611, 310558733, 314977166, 319391721,\n 323804352, 328215206, 332620900, 337024801, 341426904, 345826612, 350221825, 354615116, 359006517, 363395981,\n 367783654, 372168766, 376549859, 380930729, 385307831, 389682427, 394055910, 398425675, 402793457, 407159590,\n 411523195, 415885628, 420243162, 424603409, 428958595, 433311792, 437663672, 442014876, 446362736, 450708777,\n 455052511, 459394441, 463733626, 468072089, 472408200, 476741968, 481074475, 485405902, 489736021, 494062787,\n 498388617, 502712575, 507036251, 511354887, 515673696, 519991125, 524309392, 528624525, 532936342, 537247292,\n 541555851, 545864306, 550170437, 554476170, 558778993, 563082532, 567382703, 571680924, 575978253, 580275482,\n 584570200, 588863345, 593155089, 597445378, 601735269, 606022680, 610308664, 614594106, 618878615, 623159296,\n 627440336, 631717982, 635997249, 640275231, 644550922, 648825715, 653099304, 657371139, 661643304, 665911851,\n 670180516, 674447835, 678714823, 682979568, 687242934, 691504332, 695766925, 700028114, 704286233, 708543557,\n 712799821, 717055212, 721310048, 725563140, 729813991, 734065508, 738315156, 742564929, 746813071, 751060249,\n 755305935, 759550004, 763794029, 768035554, 772276773, 776516528, 780756650, 784994469, 789230673, 793467703,\n 797703398, 801937611, 806169530, 810401956, 814633249, 818864199, 823092766, 827320850, 831548431, 835773764,\n 840000027, 844224822, 848450250, 852673966, 856895823, 861116918, 865335133, 869555570, 873772692, 877989808,\n 882206716, 886422213, 890636921, 894850907, 899064419, 903275849, 907487780, 911698381, 915907322, 920117006,\n 924324489, 928532509, 932738007, 936943763, 941147666, 945351970, 949555347, 953758330, 957958052, 962158684,\n 966358351, 970556800, 974755898, 978951680, 983147464, 987343369, 991538483, 995733104, 999926054, 1004118104,\n 1008309544, 1012500258, 1016690917, 1020879037, 1025067175, 1029256469, 1033444454, 1037631294, 1041815774, 1046001482,\n 1050186367, 1054370637, 1058552429, 1062734476, 1066916147, 1071094927, 1075274949, 1079454128, 1083631538, 1087809564,\n 1091987405, 1096163370, 1100339660, 1104513787, 1108687177, 1112860305, 1117034447, 1121205592, 1125376629, 1129547281,\n 1133717820, 1137887191, 1142056097, 1146225390, 1150393648, 1154560299, 1158727002, 1162892823, 1167057747, 1171221046,\n 1175385155, 1179549444, 1183711384, 1187874380, 1192034212, 1196195238, 1200356153, 1204515304, 1208673910, 1212829795,\n 1216987937, 1221145073, 1225300872, 1229455037, 1233609164, 1237764170, 1241917157, 1246070670, 1250224878, 1254376178,\n 1258528162, 1262678524, 1266827683, 1270976954, 1275125632, 1279274172, 1283421484, 1287567873, 1291715676, 1295861693,\n 1300005926, 1304150462, 1308296664, 1312440578, 1316583470, 1320724811, 1324868019, 1329010956, 1333151863, 1337291809,\n 1341430624, 1345570079, 1349708221, 1353846756, 1357984935, 1362122305, 1366257814, 1370393786, 1374528892, 1378664634,\n 1382799415, 1386933522, 1391065576, 1395199789, 1399331489, 1403463860, 1407594647, 1411724086, 1415855689, 1419985631,\n 1424115489, 1428244053, 1432371870, 1436498522, 1440625629, 1444751745, 1448877006, 1453002152, 1457125036, 1461250000,\n 1465374659, 1469497594, 1473620220, 1477744125, 1481866173, 1485988244, 1490109683, 1494229934, 1498349689, 1502469332,\n 1506589876, 1510706235, 1514824921, 1518942965, 1523061505, 1527178351, 1531294454, 1535409890, 1539526326, 1543640517,\n 1547756812, 1551870851, 1555985016, 1560097442, 1564208549, 1568320054, 1572432177, 1576544661, 1580654270, 1584764017,\n 1588873108, 1592982840, 1597091049, 1601199712, 1605308326, 1609414491, 1613521803, 1617628777, 1621733835, 1625839726,\n 1629945987, 1634052052, 1638156927, 1642258972, 1646361787, 1650465128, 1654567808, 1658669200, 1662770302, 1666869794,\n 1670972264, 1675072419, 1679170566, 1683270249, 1687369711, 1691467151, 1695565190, 1699662748, 1703761548, 1707858902,\n 1711955433, 1716050469, 1720144848, 1724241897, 1728336282, 1732430410, 1736526180, 1740619156, 1744713632, 1748805530,\n 1752898084, 1756987393, 1761078122, 1765169921, 1769260641, 1773351175, 1777442877, 1781530474, 1785621307, 1789709560,\n 1793798703, 1797887260, 1801975182, 1806062390, 1810149996, 1814236123, 1818322676, 1822407623, 1826489988, 1830575906,\n 1834658067, 1838742792, 1842825653, 1846909270, 1850992005, 1855074218, 1859156347, 1863238351, 1867320859, 1871402335,\n 1875482847, 1879562930, 1883642470, 1887722398, 1891800587, 1895879932, 1899958276, 1904036638, 1908114573, 1912191800,\n 1916268743, 1920347116, 1924422570, 1928498011, 1932573349, 1936646486, 1940721696, 1944797174, 1948871367, 1952945594,\n 1957018338, 1961089383, 1965161808, 1969233350, 1973304195, 1977376665, 1981447779, 1985519033, 1989588548, 1993659289,\n 1997729452, 2001796366, 2005864843, 2009933793, 2014002593, 2018069377, 2022137196, 2026204289, 2030270517, 2034337796,\n 2038404475, 2042469434, 2046534053, 2050598713, 2054662457, 2058727455, 2062791593, 2066855115, 2070918071, 2074981871,\n 2079045540, 2083107257, 2087170358, 2091232421, 2095293756, 2099353852, 2103414866, 2107473358, 2111533438, 2115593696,\n 2119654578, 2123711202, 2127769041, 2131828079, 2135887473, 2139945263, 2144002868, 2148061201, 2152118222, 2156173876,\n 2160230408, 2164287399, 2168343450, 2172397905, 2176451935, 2180506650, 2184561319, 2188616526, 2192670595, 2196723874,\n 2200777436, 2204828910, 2208879508, 2212930015, 2216982800, 2221034120, 2225087204, 2229138005, 2233188780, 2237237738,\n 2241286680, 2245337711, 2249386635, 2253437044, 2257486659, 2261534669, 2265582088, 2269630722, 2273677293, 2277723942,\n 2281770277, 2285816118, 2289861391, 2293908247, 2297955870, 2301999709, 2306044120, 2310088597, 2314134053, 2318177990,\n 2322223112, 2326266900, 2330308778, 2334351201, 2338393413, 2342436031, 2346478314, 2350519355, 2354560561, 2358602447,\n 2362642765, 2366683716, 2370724495, 2374763504, 2378804084, 2382843532, 2386880413, 2390919906, 2394959109, 2398996112,\n 2403034927, 2407071577, 2411110078, 2415147307, 2419181034, 2423219093, 2427255367, 2431292536, 2435327045, 2439361501,\n 2443396396, 2447431831, 2451466331, 2455500451, 2459534282, 2463565779, 2467597919, 2471632122, 2475665529, 2479696435,\n 2483729191, 2487761399, 2491793997, 2495825196, 2499856755, 2503887935, 2507918465, 2511947717, 2515978063, 2520007177,\n 2524038155, 2528067401, 2532097043, 2536126664, 2540155255, 2544183491, 2548211228, 2552238285, 2556266399, 2560294002,\n 2564319542, 2568345835, 2572372442, 2576397670, 2580421933, 2584447929, 2588472785, 2592497820, 2596522622, 2600546330,\n 2604571471, 2608595062, 2612618628, 2616643294, 2620665663, 2624687920, 2628709369, 2632732626, 2636754699, 2640776029,\n 2644799757, 2648820585, 2652840994, 2656861044, 2660881979, 2664902170, 2668922912, 2672943760, 2676963401, 2680982125,\n 2685000601, 2689021011, 2693039441, 2697057353, 2701075683, 2705092716, 2709109210, 2713125397, 2717143223, 2721159932,\n 2725176643, 2729193507, 2733210696, 2737225536, 2741242121, 2745257057, 2749272015, 2753286718, 2757299847, 2761314795,\n 2765327756, 2769341791, 2773356225, 2777369850, 2781383306, 2785394924, 2789408169, 2793419860, 2797431717, 2801443922,\n 2805454432, 2809465484, 2813477356, 2817487436, 2821497837, 2825509231, 2829520068, 2833530738, 2837539518, 2841549369,\n 2845558213, 2849566042, 2853574755, 2857584531, 2861594266, 2865601989, 2869610768, 2873619181, 2877625961, 2881633373,\n 2885641353, 2889648502, 2893654733, 2897660376, 2901667770, 2905672946, 2909678043, 2913685600, 2917689568, 2921695146,\n 2925699539, 2929702761, 2933706263, 2937709465, 2941713524, 2945717900, 2949719949, 2953724092, 2957726064, 2961727364,\n 2965730599, 2969734593, 2973737899, 2977740005, 2981742619, 2985744869, 2989743222, 2993744024, 2997743403, 3001742385,\n 3005740846, 3009740083, 3013740632, 3017740443, 3021739912, 3025737894, 3029738266, 3033736354, 3037734260, 3041732620,\n 3045730736, 3049728863, 3053726975, 3057724728, 3061722012, 3065718156, 3069714416, 3073709903, 3077706121, 3081700773,\n 3085694966, 3089690887, 3093686041, 3097682212, 3101677762, 3105672385, 3109665704, 3113660777, 3117654258, 3121648738,\n 3125641477, 3129636165, 3133628489, 3137621629, 3141615091, 3145607391, 3149600532, 3153593186, 3157583551, 3161575400,\n 3165568071, 3169558897, 3173549966, 3177541505, 3181531857, 3185524100, 3189515502, 3193505484, 3197494480, 3201485771,\n 3205474366, 3209464223, 3213453462, 3217442657, 3221430632, 3225418712, 3229406344, 3233394790, 3237380550, 3241367601,\n 3245353518, 3249340672, 3253327262, 3257314501, 3261302137, 3265288786, 3269274318, 3273261676, 3277246756, 3281232235,\n 3285218896, 3289205184, 3293189136, 3297172860, 3301158042, 3305141278, 3309125457, 3313108871, 3317092589, 3321076365,\n 3325059246, 3329042269, 3333024320, 3337007745, 3340990584, 3344973656, 3348954479, 3352936965, 3356918381, 3360899212,\n 3364880246, 3368861514, 3372843128, 3376824341, 3380804536, 3384785252, 3388764045, 3392744352, 3396724969, 3400703302,\n 3404683449, 3408661629, 3412641191, 3416621174, 3420600239, 3424577712, 3428556536, 3432533925, 3436512942, 3440489299,\n 3444467709, 3448443650, 3452420745, 3456398055, 3460376073, 3464354329, 3468330724, 3472306712, 3476280273, 3480257644,\n 3484232867, 3488208449, 3492182057, 3496156616, 3500132047, 3504107018, 3508083271, 3512056531, 3516031243, 3520004496,\n 3523979003, 3527952545, 3531925382, 3535899657, 3539873170, 3543843428, 3547815425, 3551789160, 3555761507, 3559733867,\n 3563706203, 3567677571, 3571648151, 3575618333, 3579587822, 3583559953, 3587530335, 3591499540, 3595471441, 3599441281,\n 3603412533, 3607382383, 3611353499, 3615323157, 3619293204, 3623260438, 3627230054, 3631199924, 3635167788, 3639133977,\n 3643101671, 3647069932, 3651037811, 3655006291, 3658974043, 3662941495, 3666909363, 3670877228, 3674842642, 3678809724,\n 3682776125, 3686743894, 3690708635, 3694674136, 3698640744, 3702607660, 3706572805, 3710536268, 3714502398, 3718465031,\n 3722428991, 3726394088, 3730358421, 3734323031, 3738287024, 3742250941, 3746214561, 3750179004, 3754141753, 3758105608,\n 3762067054, 3766030492, 3769992222, 3773955567, 3777917868, 3781881979, 3785842285, 3789803781, 3793766088, 3797726848,\n 3801688660, 3805649459, 3809611918, 3813571463, 3817534298, 3821493048, 3825453351, 3829412874, 3833371480, 3837330842,\n 3841291749, 3845250279, 3849209920, 3853169493, 3857129155, 3861088365, 3865047067, 3869005617, 3872964725, 3876923182,\n 3880881273, 3884839528, 3888796569, 3892753631, 3896710330, 3900667023, 3904623253, 3908580398, 3912536328, 3916492455,\n 3920449831, 3924406577, 3928362015, 3932316075, 3936271016, 3940227600, 3944182809, 3948137829, 3952093061, 3956048108,\n 3960003559, 3963957671, 3967911833, 3971865657, 3975818018, 3979772869, 3983725586, 3987677658, 3991630533, 3995584016,\n 3999537962, 4003491500, 4007444082, 4011396563, 4015348558, 4019300356, 4023253116, 4027204376, 4031157206, 4035109071,\n 4039061553, 4043014010, 4046965198, 4050915644, 4054865513, 4058816261, 4062767391, 4066716906, 4070666662, 4074616057,\n 4078566781, 4082514143, 4086464266, 4090414411, 4094363532, 4098312828, 4102261058, 4106208569, 4110157418, 4114105592\n};\nint p[P];\nlong long y[P];\n\nint main()\n{\n\tlong long n, n2, n3, bl, bh, ans = 0, k, kl, kh;\n\tint i, j, b1=-1, b2, q2, c;\n\n\tscanf(\"%I64d\", &n);\n\n\t// p\n\tp[0] = 2; k = 1;\n\tfor (i = 3; i <= PMAX; i += 2)\n\t{\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\tp[k++] = i;\n\t\t\tif (i <= PMAX/i)\n\t\t\t\tfor (j = i * i; j <= PMAX; j += i) \n\t\t\t\t\ta[j] = 1;\n\t\t};\n\t}\n\n\t// 2\n\tfor (i = 0; i < P; i++)\n\t{\n\t\tn2 = n / p[i];\n\t\tif (n2 == 0 || n2 < p[i]) break;\n\t\tb2 = (int) (n2 / A); \n\t\tq2 = n2 % A;\n\t\tif (b1 != b2)\n\t\t{\n\t\t\tmemset(a, 0, sizeof(a));\n\t\t\tb1 = b2;\n\t\t\tbl = 1ll * b1 * A;\n\t\t\tbh = bl + q2 + 1; // + A\n\t\t\tc = (b1 == 0? 1: 0);\n\t\t\ty[0] = -1;\n\t\t\tfor (j = 1; j < P; j++)\n\t\t\t{\n\t\t\t\ty[j] = max(bl + bl/p[j]*p[j] + p[j], 1ll * p[j] * p[j]) - bl;\n\t\t\t\tif ((y[j] & 1) == 0) y[j] += p[j];\n\t\t\t}\n\t\t\tfor (kl = bl; kl < bh; kl += L1)\n\t\t\t{\n\t\t\t\tkh = min(kl + L1, bh) - bl;\n\t\t\t\tfor (j = 1; j < P; j++)\n\t\t\t\t{\n \t\t\t\t\tfor (k = y[j]; k < kh; k += 2ll*p[j]) \n\t\t\t\t\t\ta[k] = 1;\n\t\t\t\t\ty[j] = k;\n\t\t\t\t}\n\t\t\t\tif (kl == 0)\n\t\t\t\t{\n\t\t\t\t\tk = 3;\n\t\t\t\t\ta[2] = 1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tk = kl - bl + 1;\n\t\t\t\t}\n \t\t\t\tfor (; k < kh; k+=2)\n\t\t\t\t\ta[k] = a[k+1] = (a[k]==0? ++c: c);\n\t\t\t}\n\t\t} // b\n\t\tans = ans + b[b1] + a[q2] - (i + 1);\n\t}\n\n\t// 3\n\ti = 0; j = P;\n\tfor (;;)\n\t{\n\t\tk = i + (j - i) / 2;\n\t\tif (k == i)\n\t\t\tbreak;\n\t\tif (p[k] > P3)\n\t\t\tn3 = n + 1;\n\t\telse\n\t\t\tn3 = (long long) p[k] * p[k] * p[k];\n\t\tif (n3 > n)\n\t\t\tj = (int) k;\n\t\telse if (n3 < n)\n\t\t\ti = (int) k;\n\t\telse \n\t\t\tbreak;\n\t}\n\tans += k + 1;\n\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3c3a72047e88d0980fbad1661680f118", "src_uid": "ffb7762f1d60dc3f16e9b27ea0ecdd7d", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n\n#define A 100000000\n#define B 1000\n#define PMAX 316223\n#define P 27293\n#define P3 10000\n#define L1 32000\n#define min(a,b) (((a) < (b)) ? (a) : (b))\n#define max(a,b) (((a) > (b)) ? (a) : (b))\n\nint a[A+1];\nunsigned int b[B] = {\n 0, 5761455, 11078937, 16252325, 21336326, 26355867, 31324703, 36252931, 41146179, 46009215,\n 50847534, 55662470, 60454705, 65228333, 69985473, 74726528, 79451833, 84163019, 88862422, 93547928,\n 98222287, 102886526, 107540122, 112184940, 116818447, 121443371, 126062167, 130670192, 135270258, 139864011,\n 144449537, 149028641, 153600805, 158165829, 162725196, 167279333, 171827136, 176369517, 180906194, 185436625,\n 189961812, 194481069, 198996103, 203507248, 208013454, 212514323, 217011319, 221504167, 225991743, 230475545,\n 234954223, 239429993, 243902342, 248370960, 252834065, 257294520, 261751864, 266206294, 270655552, 275101551,\n 279545368, 283984956, 288422869, 292856421, 297285198, 301711468, 306137611, 310558733, 314977166, 319391721,\n 323804352, 328215206, 332620900, 337024801, 341426904, 345826612, 350221825, 354615116, 359006517, 363395981,\n 367783654, 372168766, 376549859, 380930729, 385307831, 389682427, 394055910, 398425675, 402793457, 407159590,\n 411523195, 415885628, 420243162, 424603409, 428958595, 433311792, 437663672, 442014876, 446362736, 450708777,\n 455052511, 459394441, 463733626, 468072089, 472408200, 476741968, 481074475, 485405902, 489736021, 494062787,\n 498388617, 502712575, 507036251, 511354887, 515673696, 519991125, 524309392, 528624525, 532936342, 537247292,\n 541555851, 545864306, 550170437, 554476170, 558778993, 563082532, 567382703, 571680924, 575978253, 580275482,\n 584570200, 588863345, 593155089, 597445378, 601735269, 606022680, 610308664, 614594106, 618878615, 623159296,\n 627440336, 631717982, 635997249, 640275231, 644550922, 648825715, 653099304, 657371139, 661643304, 665911851,\n 670180516, 674447835, 678714823, 682979568, 687242934, 691504332, 695766925, 700028114, 704286233, 708543557,\n 712799821, 717055212, 721310048, 725563140, 729813991, 734065508, 738315156, 742564929, 746813071, 751060249,\n 755305935, 759550004, 763794029, 768035554, 772276773, 776516528, 780756650, 784994469, 789230673, 793467703,\n 797703398, 801937611, 806169530, 810401956, 814633249, 818864199, 823092766, 827320850, 831548431, 835773764,\n 840000027, 844224822, 848450250, 852673966, 856895823, 861116918, 865335133, 869555570, 873772692, 877989808,\n 882206716, 886422213, 890636921, 894850907, 899064419, 903275849, 907487780, 911698381, 915907322, 920117006,\n 924324489, 928532509, 932738007, 936943763, 941147666, 945351970, 949555347, 953758330, 957958052, 962158684,\n 966358351, 970556800, 974755898, 978951680, 983147464, 987343369, 991538483, 995733104, 999926054, 1004118104,\n 1008309544, 1012500258, 1016690917, 1020879037, 1025067175, 1029256469, 1033444454, 1037631294, 1041815774, 1046001482,\n 1050186367, 1054370637, 1058552429, 1062734476, 1066916147, 1071094927, 1075274949, 1079454128, 1083631538, 1087809564,\n 1091987405, 1096163370, 1100339660, 1104513787, 1108687177, 1112860305, 1117034447, 1121205592, 1125376629, 1129547281,\n 1133717820, 1137887191, 1142056097, 1146225390, 1150393648, 1154560299, 1158727002, 1162892823, 1167057747, 1171221046,\n 1175385155, 1179549444, 1183711384, 1187874380, 1192034212, 1196195238, 1200356153, 1204515304, 1208673910, 1212829795,\n 1216987937, 1221145073, 1225300872, 1229455037, 1233609164, 1237764170, 1241917157, 1246070670, 1250224878, 1254376178,\n 1258528162, 1262678524, 1266827683, 1270976954, 1275125632, 1279274172, 1283421484, 1287567873, 1291715676, 1295861693,\n 1300005926, 1304150462, 1308296664, 1312440578, 1316583470, 1320724811, 1324868019, 1329010956, 1333151863, 1337291809,\n 1341430624, 1345570079, 1349708221, 1353846756, 1357984935, 1362122305, 1366257814, 1370393786, 1374528892, 1378664634,\n 1382799415, 1386933522, 1391065576, 1395199789, 1399331489, 1403463860, 1407594647, 1411724086, 1415855689, 1419985631,\n 1424115489, 1428244053, 1432371870, 1436498522, 1440625629, 1444751745, 1448877006, 1453002152, 1457125036, 1461250000,\n 1465374659, 1469497594, 1473620220, 1477744125, 1481866173, 1485988244, 1490109683, 1494229934, 1498349689, 1502469332,\n 1506589876, 1510706235, 1514824921, 1518942965, 1523061505, 1527178351, 1531294454, 1535409890, 1539526326, 1543640517,\n 1547756812, 1551870851, 1555985016, 1560097442, 1564208549, 1568320054, 1572432177, 1576544661, 1580654270, 1584764017,\n 1588873108, 1592982840, 1597091049, 1601199712, 1605308326, 1609414491, 1613521803, 1617628777, 1621733835, 1625839726,\n 1629945987, 1634052052, 1638156927, 1642258972, 1646361787, 1650465128, 1654567808, 1658669200, 1662770302, 1666869794,\n 1670972264, 1675072419, 1679170566, 1683270249, 1687369711, 1691467151, 1695565190, 1699662748, 1703761548, 1707858902,\n 1711955433, 1716050469, 1720144848, 1724241897, 1728336282, 1732430410, 1736526180, 1740619156, 1744713632, 1748805530,\n 1752898084, 1756987393, 1761078122, 1765169921, 1769260641, 1773351175, 1777442877, 1781530474, 1785621307, 1789709560,\n 1793798703, 1797887260, 1801975182, 1806062390, 1810149996, 1814236123, 1818322676, 1822407623, 1826489988, 1830575906,\n 1834658067, 1838742792, 1842825653, 1846909270, 1850992005, 1855074218, 1859156347, 1863238351, 1867320859, 1871402335,\n 1875482847, 1879562930, 1883642470, 1887722398, 1891800587, 1895879932, 1899958276, 1904036638, 1908114573, 1912191800,\n 1916268743, 1920347116, 1924422570, 1928498011, 1932573349, 1936646486, 1940721696, 1944797174, 1948871367, 1952945594,\n 1957018338, 1961089383, 1965161808, 1969233350, 1973304195, 1977376665, 1981447779, 1985519033, 1989588548, 1993659289,\n 1997729452, 2001796366, 2005864843, 2009933793, 2014002593, 2018069377, 2022137196, 2026204289, 2030270517, 2034337796,\n 2038404475, 2042469434, 2046534053, 2050598713, 2054662457, 2058727455, 2062791593, 2066855115, 2070918071, 2074981871,\n 2079045540, 2083107257, 2087170358, 2091232421, 2095293756, 2099353852, 2103414866, 2107473358, 2111533438, 2115593696,\n 2119654578, 2123711202, 2127769041, 2131828079, 2135887473, 2139945263, 2144002868, 2148061201, 2152118222, 2156173876,\n 2160230408, 2164287399, 2168343450, 2172397905, 2176451935, 2180506650, 2184561319, 2188616526, 2192670595, 2196723874,\n 2200777436, 2204828910, 2208879508, 2212930015, 2216982800, 2221034120, 2225087204, 2229138005, 2233188780, 2237237738,\n 2241286680, 2245337711, 2249386635, 2253437044, 2257486659, 2261534669, 2265582088, 2269630722, 2273677293, 2277723942,\n 2281770277, 2285816118, 2289861391, 2293908247, 2297955870, 2301999709, 2306044120, 2310088597, 2314134053, 2318177990,\n 2322223112, 2326266900, 2330308778, 2334351201, 2338393413, 2342436031, 2346478314, 2350519355, 2354560561, 2358602447,\n 2362642765, 2366683716, 2370724495, 2374763504, 2378804084, 2382843532, 2386880413, 2390919906, 2394959109, 2398996112,\n 2403034927, 2407071577, 2411110078, 2415147307, 2419181034, 2423219093, 2427255367, 2431292536, 2435327045, 2439361501,\n 2443396396, 2447431831, 2451466331, 2455500451, 2459534282, 2463565779, 2467597919, 2471632122, 2475665529, 2479696435,\n 2483729191, 2487761399, 2491793997, 2495825196, 2499856755, 2503887935, 2507918465, 2511947717, 2515978063, 2520007177,\n 2524038155, 2528067401, 2532097043, 2536126664, 2540155255, 2544183491, 2548211228, 2552238285, 2556266399, 2560294002,\n 2564319542, 2568345835, 2572372442, 2576397670, 2580421933, 2584447929, 2588472785, 2592497820, 2596522622, 2600546330,\n 2604571471, 2608595062, 2612618628, 2616643294, 2620665663, 2624687920, 2628709369, 2632732626, 2636754699, 2640776029,\n 2644799757, 2648820585, 2652840994, 2656861044, 2660881979, 2664902170, 2668922912, 2672943760, 2676963401, 2680982125,\n 2685000601, 2689021011, 2693039441, 2697057353, 2701075683, 2705092716, 2709109210, 2713125397, 2717143223, 2721159932,\n 2725176643, 2729193507, 2733210696, 2737225536, 2741242121, 2745257057, 2749272015, 2753286718, 2757299847, 2761314795,\n 2765327756, 2769341791, 2773356225, 2777369850, 2781383306, 2785394924, 2789408169, 2793419860, 2797431717, 2801443922,\n 2805454432, 2809465484, 2813477356, 2817487436, 2821497837, 2825509231, 2829520068, 2833530738, 2837539518, 2841549369,\n 2845558213, 2849566042, 2853574755, 2857584531, 2861594266, 2865601989, 2869610768, 2873619181, 2877625961, 2881633373,\n 2885641353, 2889648502, 2893654733, 2897660376, 2901667770, 2905672946, 2909678043, 2913685600, 2917689568, 2921695146,\n 2925699539, 2929702761, 2933706263, 2937709465, 2941713524, 2945717900, 2949719949, 2953724092, 2957726064, 2961727364,\n 2965730599, 2969734593, 2973737899, 2977740005, 2981742619, 2985744869, 2989743222, 2993744024, 2997743403, 3001742385,\n 3005740846, 3009740083, 3013740632, 3017740443, 3021739912, 3025737894, 3029738266, 3033736354, 3037734260, 3041732620,\n 3045730736, 3049728863, 3053726975, 3057724728, 3061722012, 3065718156, 3069714416, 3073709903, 3077706121, 3081700773,\n 3085694966, 3089690887, 3093686041, 3097682212, 3101677762, 3105672385, 3109665704, 3113660777, 3117654258, 3121648738,\n 3125641477, 3129636165, 3133628489, 3137621629, 3141615091, 3145607391, 3149600532, 3153593186, 3157583551, 3161575400,\n 3165568071, 3169558897, 3173549966, 3177541505, 3181531857, 3185524100, 3189515502, 3193505484, 3197494480, 3201485771,\n 3205474366, 3209464223, 3213453462, 3217442657, 3221430632, 3225418712, 3229406344, 3233394790, 3237380550, 3241367601,\n 3245353518, 3249340672, 3253327262, 3257314501, 3261302137, 3265288786, 3269274318, 3273261676, 3277246756, 3281232235,\n 3285218896, 3289205184, 3293189136, 3297172860, 3301158042, 3305141278, 3309125457, 3313108871, 3317092589, 3321076365,\n 3325059246, 3329042269, 3333024320, 3337007745, 3340990584, 3344973656, 3348954479, 3352936965, 3356918381, 3360899212,\n 3364880246, 3368861514, 3372843128, 3376824341, 3380804536, 3384785252, 3388764045, 3392744352, 3396724969, 3400703302,\n 3404683449, 3408661629, 3412641191, 3416621174, 3420600239, 3424577712, 3428556536, 3432533925, 3436512942, 3440489299,\n 3444467709, 3448443650, 3452420745, 3456398055, 3460376073, 3464354329, 3468330724, 3472306712, 3476280273, 3480257644,\n 3484232867, 3488208449, 3492182057, 3496156616, 3500132047, 3504107018, 3508083271, 3512056531, 3516031243, 3520004496,\n 3523979003, 3527952545, 3531925382, 3535899657, 3539873170, 3543843428, 3547815425, 3551789160, 3555761507, 3559733867,\n 3563706203, 3567677571, 3571648151, 3575618333, 3579587822, 3583559953, 3587530335, 3591499540, 3595471441, 3599441281,\n 3603412533, 3607382383, 3611353499, 3615323157, 3619293204, 3623260438, 3627230054, 3631199924, 3635167788, 3639133977,\n 3643101671, 3647069932, 3651037811, 3655006291, 3658974043, 3662941495, 3666909363, 3670877228, 3674842642, 3678809724,\n 3682776125, 3686743894, 3690708635, 3694674136, 3698640744, 3702607660, 3706572805, 3710536268, 3714502398, 3718465031,\n 3722428991, 3726394088, 3730358421, 3734323031, 3738287024, 3742250941, 3746214561, 3750179004, 3754141753, 3758105608,\n 3762067054, 3766030492, 3769992222, 3773955567, 3777917868, 3781881979, 3785842285, 3789803781, 3793766088, 3797726848,\n 3801688660, 3805649459, 3809611918, 3813571463, 3817534298, 3821493048, 3825453351, 3829412874, 3833371480, 3837330842,\n 3841291749, 3845250279, 3849209920, 3853169493, 3857129155, 3861088365, 3865047067, 3869005617, 3872964725, 3876923182,\n 3880881273, 3884839528, 3888796569, 3892753631, 3896710330, 3900667023, 3904623253, 3908580398, 3912536328, 3916492455,\n 3920449831, 3924406577, 3928362015, 3932316075, 3936271016, 3940227600, 3944182809, 3948137829, 3952093061, 3956048108,\n 3960003559, 3963957671, 3967911833, 3971865657, 3975818018, 3979772869, 3983725586, 3987677658, 3991630533, 3995584016,\n 3999537962, 4003491500, 4007444082, 4011396563, 4015348558, 4019300356, 4023253116, 4027204376, 4031157206, 4035109071,\n 4039061553, 4043014010, 4046965198, 4050915644, 4054865513, 4058816261, 4062767391, 4066716906, 4070666662, 4074616057,\n 4078566781, 4082514143, 4086464266, 4090414411, 4094363532, 4098312828, 4102261058, 4106208569, 4110157418, 4114105592\n};\nint p[P];\nlong long y[P];\n\nint main()\n{\n\tlong long n, n2, n3, bl, bh, ans = 0, k, kl, kh;\n\tint i, j, b1=-1, b2, q2, c;\n\n\tscanf(\"%I64d\", &n);\n\n\t// p\n\tp[0] = 2; k = 1;\n\tfor (i = 3; i <= PMAX; i += 2)\n\t{\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\tp[k++] = i;\n\t\t\tif (i <= PMAX/i)\n\t\t\t\tfor (j = i * i; j <= PMAX; j += i) \n\t\t\t\t\ta[j] = 1;\n\t\t};\n\t}\n\n\t// 2\n\tfor (i = 0; i < P; i++)\n\t{\n\t\tn2 = n / p[i];\n\t\tif (n2 == 0 || n2 < p[i]) break;\n\t\tb2 = (int) (n2 / A); \n\t\tq2 = n2 % A;\n\t\tif (b1 != b2)\n\t\t{\n\t\t\tmemset(a, 0, sizeof(a));\n\t\t\tb1 = b2;\n\t\t\tbl = 1ll * b1 * A;\n\t\t\tbh = bl + q2 + 1;\n\t\t\tc = (b1 == 0? 1: 0);\n\t\t\ty[0] = -1;\n\t\t\tfor (j = 1; j < P; j++)\n\t\t\t{\n\t\t\t\ty[j] = max(bl/p[j]*p[j] + p[j], 1ll * p[j] * p[j]) - bl;\n\t\t\t\tif ((y[j] & 1) == 0) y[j] += p[j];\n\t\t\t}\n\t\t\tfor (kl = bl; kl < bh; kl += L1)\n\t\t\t{\n\t\t\t\tkh = min(kl + L1, bh) - bl;\n\t\t\t\tfor (j = 1; j < P; j++)\n\t\t\t\t{\n \t\t\t\t\tfor (k = y[j]; k < kh; k += 2ll*p[j]) \n\t\t\t\t\t\ta[k] = 1;\n\t\t\t\t\ty[j] = k;\n\t\t\t\t}\n\t\t\t\tif (kl == 0)\n\t\t\t\t{\n\t\t\t\t\tk = 3;\n\t\t\t\t\ta[2] = 1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tk = kl - bl + 1;\n\t\t\t\t}\n \t\t\t\tfor (; k < kh; k+=2)\n\t\t\t\t\ta[k] = a[k+1] = (a[k]==0? ++c: c);\n\t\t\t}\n\t\t} // b\n\t\tans = ans + b[b1] + a[q2] - (i + 1);\n\t}\n\n\t// 3\n\ti = 0; j = P;\n\tfor (;;)\n\t{\n\t\tk = i + (j - i) / 2;\n\t\tif (k == i)\n\t\t\tbreak;\n\t\tif (p[k] > P3)\n\t\t\tn3 = n + 1;\n\t\telse\n\t\t\tn3 = (long long) p[k] * p[k] * p[k];\n\t\tif (n3 > n)\n\t\t\tj = (int) k;\n\t\telse if (n3 < n)\n\t\t\ti = (int) k;\n\t\telse \n\t\t\tbreak;\n\t}\n\tif (p[k]*p[k]*p[k]<=n)\n\t\tans += k + 1;\n\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "745b2fdd089273597958df54dd83c628", "src_uid": "ffb7762f1d60dc3f16e9b27ea0ecdd7d", "difficulty": 2400.0} {"lang": "GNU C", "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#define oo 1000000000\n\nstruct case1\n{\n long next[35];\n long num;\n}trie[50005]={{{0},0}};\n\nlong tot=1;\n\nchar str[35][35]={'\\0'};\nlong a[35][35][35]={0};\n\nlong e[2000005]={0};\nlong last[2000005]={0};\nlong now[50005]={0};\nlong totm=0;\n\nstruct case2\n{\n long max;\n long min;\n long win;\n long cost;\n}tree[50005]={{0,0,0,0}};\n\nlong o=1;\nlong hash[50005]={0};\n\nlong find(long x,long st,long en)\n{\n long p=1,i,j;\n long s=0;\n long max=0;\n \n for(;st<=en;st++)\n {\n s+=str[x][st]-'a'+1;\n if(str[x][st]-'a'+1>max)\n max=str[x][st]-'a'+1;\n if(!trie[p].next[str[x][st]-'a'])\n trie[p].next[str[x][st]-'a']=++tot;\n p=trie[p].next[str[x][st]-'a'];\n }\n if(trie[p].num==0)\n {\n trie[p].num=++o;\n tree[o].cost=s*max;\n }\n return trie[p].num;\n}\n\nvoid addedge(long x,long y)\n{\n if(x<=0)\n x=1;\n if(y<=0)\n y=1;\n e[++totm]=y;\n last[totm]=now[x];now[x]=totm;\n}\n\nvoid dfs(long x)\n{\n long i;\n \n if(tree[x].max)\n return;\n \n tree[x].max=0;\n tree[x].min=0;\n \n for(i=now[x];i;i=last[i])\n {\n dfs(e[i]);\n if(tree[e[i]].win==0)\n tree[x].win=1;\n }\n for(i=now[x];i;i=last[i])\n {\n if(tree[x].win==1&&tree[e[i]].win==1)\n continue;\n if(tree[e[i]].min+tree[e[i]].cost>tree[x].max||tree[e[i]].min+tree[e[i]].cost==tree[x].max&&tree[e[i]].max\n#include\n#include\n#include\n#include\n#define oo 1000000000\n#define pi 3.14159265359\n#define zero(a) (abb(a)<=1e-7)\n#define lowbit(a) ((a)&(-(a)))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nlong head[27001]={0},e[1000001]={0},next[1000001]={0},num[27001]={0},p[2][27001]={0};\nchar rec[27001][35]={0},str[31][35]={0},tmp[35]={0},flag[27001]={0},visit[27001]={0};\nlong tot=1,totm=0;\n\nvoid add(long a,long b)\n{\n e[++totm]=b;\n next[totm]=head[a];\n head[a]=totm;\n}\n\nvoid qs(long x,long y)\n{\n long i=x,j=y;\n char t[35];\n strcpy(t,rec[(x+y)>>1]+1);\n if (x>=y)\n return;\n strcpy(rec[(x+y)>>1]+1,rec[x]+1);\n while (i0)\n j--;\n if (i>1;\n if (strcmp(rec[m]+1,tmp+1)>=0)\n r=m;\n else\n l=m;\n }\n if (!strcmp(rec[r]+1,tmp+1))\n add(x,r);\n}\n\nvoid dfs(long now)\n{\n long i;\n visit[now]=1;\n p[0][now]=p[1][now]=flag[now]=0;\n for (i=head[now];i;i=next[i])\n {\n if (!visit[e[i]])\n dfs(e[i]);\n if (!flag[e[i]]&&!flag[now]||!flag[e[i]]==flag[now]&&p[1][e[i]]+num[e[i]]>p[0][now]||!flag[e[i]]==flag[now]&&p[1][e[i]]+num[e[i]]==p[0][now]&&p[0][e[i]]\n#include \n\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define oo 1000000000\n\nstruct case1\n{\n long next[35];\n long num;\n}trie[5005]={{{0},0}};\n\nlong tot=1;\n\nchar str[35][35]={'\\0'};\nlong a[35][35][35]={0};\n\nlong e[500005]={0};\nlong last[500005]={0};\nlong now[5005]={0};\nlong totm=0;\n\nstruct case2\n{\n long max;\n long min;\n long win;\n long cost;\n}tree[5005]={{0,0,0,0}};\n\nlong o=1;\nlong hash[5005]={0};\n\nlong find(long x,long st,long en)\n{\n long p=1,i,j;\n long s=0;\n long max=0;\n \n for(;st<=en;st++)\n {\n s+=str[x][st]-'a'+1;\n if(str[x][st]-'a'+1>max)\n max=str[x][st]-'a'+1;\n if(!trie[p].next[str[x][st]-'a'])\n trie[p].next[str[x][st]-'a']=++tot;\n p=trie[p].next[str[x][st]-'a'];\n }\n if(trie[p].num==0)\n {\n trie[p].num=++o;\n tree[o].cost=s*max;\n }\n return trie[p].num;\n}\n\nvoid addedge(long x,long y)\n{\n if(x<=0)\n x=1;\n if(y<=0)\n y=1;\n e[++totm]=y;\n last[totm]=now[x];now[x]=totm;\n}\n\nvoid dfs(long x)\n{\n long i;\n \n tree[x].max=0;\n tree[x].min=0;\n \n for(i=now[x];i;i=last[i])\n {\n dfs(e[i]);\n if(tree[e[i]].win==0)\n tree[x].win=1;\n }\n for(i=now[x];i;i=last[i])\n {\n if(tree[x].win==1&&tree[e[i]].win==1)\n continue;\n if(tree[e[i]].min+tree[e[i]].cost>tree[x].max||tree[e[i]].min+tree[e[i]].cost==tree[x].max&&tree[e[i]].max\n#include\n#include\n#include\n#include\n#define oo 1000000000\n#define pi 3.14159265359\n#define zero(a) (abb(a)<=1e-7)\n#define lowbit(a) ((a)&(-(a)))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nlong head[27001]={0},e[1000001]={0},next[1000001]={0},num[27001]={0},p[2][27001]={0};\nchar rec[27001][35]={0},str[31][35]={0},tmp[35]={0},flag[27001]={0};\nlong tot=1,totm=0;\n\nvoid add(long a,long b)\n{\n e[++totm]=b;\n next[totm]=head[a];\n head[a]=totm;\n}\n\nvoid qs(long x,long y)\n{\n long i=x,j=y;\n char t[35];\n strcpy(t,rec[(x+y)>>1]+1);\n if (x>=y)\n return;\n strcpy(rec[(x+y)>>1]+1,rec[x]+1);\n while (i0)\n j--;\n if (i>1;\n if (strcmp(rec[m]+1,tmp+1)>=0)\n r=m;\n else\n l=m;\n }\n if (!strcmp(rec[r]+1,tmp+1))\n add(x,r);\n}\n\nvoid dfs(long now)\n{\n long i;\n p[0][now]=p[1][now]=flag[now]=0;\n for (i=head[now];i;i=next[i])\n {\n dfs(e[i]);\n if (!flag[e[i]]&&!flag[now]||!flag[e[i]]==flag[now]&&p[1][e[i]]+num[e[i]]>p[0][now]||!flag[e[i]]==flag[now]&&p[1][e[i]]+num[e[i]]==p[0][now]&&p[0][e[i]]\n#include \n#include \n\n#define N\t30\n#define T\t(30 * 31 / 2)\n#define NU\t(N * T)\n#define NV\t(NU * 3)\n\nchar *strndup_(char *s, int n) {\n\tchar *s_ = malloc(n + 1);\n\n\tstrncpy(s_, s, n);\n\ts_[n] = 0;\n\treturn s_;\n}\n\nstruct V {\n\tchar *s;\n\tint i, h;\n} vv_[NV], *vv[NV];\n\nint compare(const void *a, const void *b) {\n\tstruct V *u = *(struct V **) a;\n\tstruct V *v = *(struct V **) b;\n\tint mu = strlen(u->s), mv = strlen(v->s);\n\tint c;\n\n\tif (mu != mv)\n\t\treturn mu - mv;\n\tc = strcmp(u->s, v->s);\n\treturn c != 0 ? c : u->i - v->i;\n}\n\nint score(char *s) {\n\tint n = strlen(s), i;\n\tint sum, max;\n\n\tsum = max = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tint a = s[i] - 'a' + 1;\n\n\t\tsum += a;\n\t\tif (max < a)\n\t\t\tmax = a;\n\t}\n\treturn sum * max;\n}\n\nint xx[NU + 1];\nchar ww[NU + 1];\nint ss[NU + 1], tt[NU + 1];\n\nvoid push(int p, int i) {\n\tint s = tt[i] + xx[i], t = ss[i];\n\n\tif (!ww[p]) {\n\t\tif (!ww[i])\n\t\t\tww[p] = 1, ss[p] = s, tt[p] = t;\n\t\telse if (ss[p] < s || ss[p] == s && tt[p] > t)\n\t\t\tss[p] = s, tt[p] = t;\n\t} else if (!ww[i] && (ss[p] < s || ss[p] == s && tt[p] > t))\n\t\tss[p] = s, tt[p] = t;\n}\n\nint main() {\n\tstatic int pp[NU + 1], qq[NU + 1];\n\tint n, nv, k, i;\n\n\tscanf(\"%d\", &n);\n\tnv = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tstatic char s[32];\n\t\tint m, l, r;\n\n\t\tscanf(\"%s\", s), m = strlen(s);\n\t\tfor (l = 0; l < m; l++)\n\t\t\tfor (r = l; r < m; r++) {\n\t\t\t\tstruct V *v, *p, *q;\n\t\t\t\tchar *t = strndup_(s + l, r - l + 1);\n\n\t\t\t\tv = vv[nv] = &vv_[nv], nv++;\n\t\t\t\tv->s = t, v->i = i;\n\t\t\t\tp = vv[nv] = &vv_[nv], nv++;\n\t\t\t\tp->s = strndup_(t + 1, r - l), p->i = -1;\n\t\t\t\tq = vv[nv] = &vv_[nv], nv++;\n\t\t\t\tq->s = strndup_(t, r - l), p->i = -1;\n\t\t\t}\n\t}\n\tqsort(vv, nv, sizeof *vv, compare);\n\tk = 0;\n\tfor (i = 0; i < nv; ) {\n\t\tchar *s = vv[i]->s;\n\t\tint x, j;\n\n\t\tfor (j = i; j < nv && strcmp(vv[j]->s, s) == 0; j++)\n\t\t\tvv[j]->h = k;\n\t\tx = score(s);\n\t\twhile (i < j) {\n\t\t\tif (vv[i]->i != -1 && (i + 1 == j || vv[i]->i != vv[i + 1]->i))\n\t\t\t\tx++;\n\t\t\ti++;\n\t\t}\n\t\txx[k++] = x;\n\t}\n\tfor (i = 0; i < nv; i += 3) {\n\t\tstruct V *v = &vv_[i + 0];\n\t\tstruct V *p = &vv_[i + 1];\n\t\tstruct V *q = &vv_[i + 2];\n\n\t\tpp[v->h] = p->h;\n\t\tqq[v->h] = q->h;\n\t}\n\tfor (i = k - 1; i > 0; i--) {\n\t\tpush(pp[i], i);\n\t\tpush(qq[i], i);\n\t}\n\tprintf(ww[0] ? \"First\\n\" : \"Second\\n\");\n\tprintf(\"%d %d\\n\", ss[0], tt[0]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb8436dcb6a42a630f1948293ae208b3", "src_uid": "d0f8976d9b847f7426dc56cb59b5b5b9", "difficulty": 2100.0} {"lang": "GNU C11", "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-(s2-j-1); 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 >= s1-s2) 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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae9c8887eb5ee9d37e86da67778d7aa6", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0} {"lang": "GNU C11", "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(dp[j][0]==-1 && dp[j][1] == -1) return -1;\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "22627f762602779e39d992f32b9803ad", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0} {"lang": "GNU C11", "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 >= s1-s2) 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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "66dd882df94b5c3aac05485e92c45c72", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0} {"lang": "GNU C11", "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 }\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "368c0a256b3233cfd3223caa75e6f3f5", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#define size 101\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 \n\n#define N 2000000\n#define MOD 1000000007\n\nint maxp[N + 1];\nint lcm[N + 1];\nint lcm_cnt[N + 1];\nint p[200000];\nint q[200000], qp;\n\nint max(int x, int y) {\n return x > y ? x : y;\n}\n\nint cmp(const void *a, const void *b) {\n return *(int *)b - *(int *)a;\n}\n\nint main(void) {\n for (int i = 0; i <= N; i++) {\n maxp[i] = i;\n }\n for (int i = 2; i <= N; i++) {\n if (maxp[i] == i) {\n for (int j = i * 2; j <= N; j += i) {\n maxp[j] = i;\n }\n }\n }\n \n int n;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &p[i]);\n }\n qsort(p, n, sizeof(int), cmp);\n int one = 0;\n for (int i = 0; i < n; i++) {\n int x = p[i];\n if (lcm[x] == 0) {\n lcm[x] = 1;\n continue;\n }\n q[qp++] = x;\n x--;\n while (x != 1) {\n int p = maxp[x];\n int e = 0;\n while (x % p == 0) {\n x /= p;\n e++;\n }\n if (lcm[p] < e) {\n lcm[p] = e;\n lcm_cnt[p] = 1;\n } else if (lcm[p] == e) {\n lcm_cnt[p]++;\n }\n }\n }\n for (int i = 0; i < qp; i++) {\n int x = q[i] - 1;\n bool forall = true;\n while (x != 1) {\n int p = maxp[x];\n int e = 0;\n while (x % p == 0) {\n x /= p;\n e++;\n }\n if (lcm[p] == e && lcm_cnt[p] == 1) {\n forall = false;\n }\n }\n if (forall) {\n one = 1;\n }\n }\n long long ans = 1;\n for (int i = 0; i <= N; i++) {\n for (int j = 0; j < lcm[i]; j++) {\n ans *= i;\n ans %= MOD;\n }\n }\n ans += one;\n ans %= MOD;\n printf(\"%lld\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f96b65468d75e6756a7d75a793ad0119", "src_uid": "816a82bee65cf79ba8e4d61babcd0301", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define N 2000000\n#define MOD 1000000007\n\nint maxp[N + 1];\nint lcm[N + 1];\nint p[200000];\n\nint max(int x, int y) {\n return x > y ? x : y;\n}\n\nint cmp(const void *a, const void *b) {\n return *(int *)b - *(int *)a;\n}\n\nint main(void) {\n for (int i = 0; i <= N; i++) {\n maxp[i] = i;\n }\n for (int i = 2; i <= N; i++) {\n if (maxp[i] == i) {\n for (int j = i * 2; j <= N; j += i) {\n maxp[j] = i;\n }\n }\n }\n \n int n;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &p[i]);\n }\n qsort(p, n, sizeof(int), cmp);\n int one = 0;\n for (int i = 0; i < n; i++) {\n int x = p[i];\n if (lcm[x] == 0) {\n lcm[x] = 1;\n continue;\n }\n bool any = false;\n x--;\n while (x != 1) {\n int p = maxp[x];\n int e = 0;\n while (x % p == 0) {\n x /= p;\n e++;\n }\n if (lcm[p] < e) {\n lcm[p] = e;\n any = true;\n }\n }\n if (!any) {\n one = 1;\n }\n }\n long long ans = 1;\n for (int i = 0; i <= N; i++) {\n for (int j = 0; j < lcm[i]; j++) {\n ans *= i;\n ans %= MOD;\n }\n }\n ans += one;\n ans %= MOD;\n printf(\"%lld\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "57ea34a27b431592118af18ad682f13c", "src_uid": "816a82bee65cf79ba8e4d61babcd0301", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/blog/entry/89260 */\n#include \n\n#define M\t16\n\nint main() {\n\tstatic char used[M];\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\twhile (n > 0) {\n\t\tif (used[n % m]) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tused[n % m] = 1;\n\t\tn /= m;\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8182c4be42802236cfbd8d18cf4ddd11", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \r\n \r\n#define M\t16\r\n \r\nint main() {\r\n\tstatic char used[M];\r\n\tint n, m;\r\n \r\n\tscanf(\"%d%d\", &n, &m);\r\n\twhile (n > 0) {\r\n\t\tif (used[n % m]) {\r\n\t\t\tprintf(\"NO\\n\");\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tused[n % m] = 1;\r\n\t\tn /= m;\r\n\t}\r\n\tprintf(\"YES\\n\");\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c1fe402827105de282dd324e4b7bdc3b", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n \r\nint main() {\r\n int n, m;\r\n scanf(\"%d %d\", &n, &m);\r\n \r\n int digits[14] = {0};\r\n bool dup = true;\r\n while (n) {\r\n int d = n % m;\r\n if (digits[d]) {\r\n dup = false;\r\n break;\r\n } else {\r\n digits[d] = 1;\r\n }\r\n \r\n n /= m;\r\n }\r\n \r\n if (dup) {\r\n puts(\"YES\");\r\n } else {\r\n puts(\"NO\");\r\n }\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "12e71ad83a6977ab72364e736e1d92fc", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n\tint n, b;\n\n\tscanf(\"%d%d\", &n, &b);\n\twhile (n > 0) {\n\t\tif (n % b > 1) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tn /= b;\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5189930a9f015f09d954ab4124a01c3a", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main() {\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n int digits[9] = {0};\n bool dup = true;\n while (n) {\n int d = n % m;\n if (digits[d]) {\n dup = false;\n break;\n } else {\n digits[d] = 1;\n }\n\n n /= m;\n }\n\n if (dup) {\n puts(\"YES\");\n } else {\n puts(\"NO\");\n }\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b0a3c574a9469a1043b5e6e38a69f268", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "c125ca273f950a0ab6f17cd90e0decda", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "861b0196911b880d52501b18889a5a5d", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "707dcdc0fd6d97baf0cd235e99dcb349", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "87e0eb646bf0b634bb5b6b2eeeeb0efb", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a9185dfd12de2ed3b3060a58d638e24c", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \nint main()\n{\nlong long int n,i,p,sum;\nsum=0;\nscanf(\"%I64d\",&n);\nfor(i=1;i<=n;i=i*2)\n{\n p=i*2;\n if(n%p>p/2) p=n/p+1;\n else p=n/p;\n sum=sum+p*i;\n}\nprintf(\"%I64d\",sum);\nreturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6946164e45b7ed2a7945bdf5b56cef0", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\nint main()\n{\nlong long int s=0,t,i=1;\ndouble n;\nscanf (\"%lf\",&n);\nn--;\nt=(long long int)(n/2+0.5);\nwhile (t)\n{\ns+=t*i;\ni*=2;\nt=(long long int)(n/(2*i)+0.5);\n}\nprintf (\"%I64d\\n\",s);\nreturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "2300e7b581fa0aa724674341804c8816", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\\n\",(n/2)+2*((n/2)+(n%2)-1));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "53cba9de9868a471f01e75518ac37d61", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "//set many funcs template\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 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 long long i,j,n,m,k,a[262144],b,c,w,r=0,l,t,u;\n double d;\n char s[262144];\n scanf(\"%lld\",&n);n--;u=0;\n //l=strlen(s);\n k=llpow(2,50);\n for(i=50;i>=0;i--){\n r+=(k*((n/k)-u));\n u+=(n/k);k/=2;\n }\n //qsort(a,n,sizeof(int),sortfncsj);\n printf(\"%lld\\n\",r);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ee0c3efbab4acf2418dd5325e9f2dfc6", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include\n\nint main()\n{\n long long int i=0,n,count=0,temp,mod;\n scanf(\"%lld\",&n);\n while(1)\n {\n mod=n%(1<<(i+1));\n temp=n/(1<<(i+1));\n // printf(\"%lld %lld\\n\",temp , mod);\n if(mod>(1<\n#include \n\n#define N\t100000\n#define M\t100000\n#define A\t200000\n#define L_\t18\t/* L_ = ceil(log2(A + 1)) */\n#define N_\t(1 << L_)\n#define M0\t469762049\t/* M0 = 56 * 2^23 + 1 */\n#define M1\t595591169\t/* M1 = 71 * 2^23 + 1 */\n\nint MM[2] = { M0, M1 };\n\nlong long power(int a, int k, int md) {\n\tlong long b = a, p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * b % md;\n\t\tb = b * b % md;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint wu[2][L_ + 1], wv[2][L_ + 1], VV[2], V01;\n\nvoid init() {\n\tint g, l, u, v;\n\n\tV01 = power(M0, M1 - 2, M1);\n\tfor (g = 0; g < 2; g++) {\n\t\tint md = MM[g];\n\n\t\tu = power(3, md - 1 >> L_, md), v = power(u, md - 2, md);\n\t\tVV[g] = power(N_, md - 2, md);\n\t\tfor (l = L_; l > 0; l--) {\n\t\t\twu[g][l] = u, wv[g][l] = v;\n\t\t\tu = (long long) u * u % md, v = (long long) v * v % md;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int g, int inverse) {\n\tint md = MM[g], i, j, l, r;\n\n\tfor (i = 0, j = 1; j < N_; j++) {\n\t\tint n, tmp;\n\n\t\tn = N_ >> 1;\n\t\twhile ((i ^= n) < n)\n\t\t\tn >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (l = 1; l <= L_; l++) {\n\t\tint n = 1 << l, m = n >> 1;\n\t\tlong long u = inverse ? wv[g][l] : wu[g][l], w = 1;\n\n\t\tfor (r = 0; r < m; r++) {\n\t\t\tfor (i = r; (j = i + m) < N_; i += n) {\n\t\t\t\tint a = aa[i], b = aa[j] * w % md;\n\n\t\t\t\tif ((aa[i] = a + b) >= md)\n\t\t\t\t\taa[i] -= md;\n\t\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\t\taa[j] += md;\n\t\t\t}\n\t\t\tw = w * u % md;\n\t\t}\n\t}\n}\n\nlong long garner(int r0, int r1) {\n\tr1 = (long long) (r1 - r0) * V01 % M1;\n\tif (r1 < 0)\n\t\tr1 += M1;\n\treturn (long long) r1 * M0 + r0;\n}\n\nint main() {\n\tstatic long long ans[A + 1];\n\tstatic int aa[N], bb[M], aaa[2][2][N_], bbb[2][2][N_], cc[2][N_];\n\tint n, m, q, g, h, h1, h2, i, j, x, y, z, c;\n\n\tinit();\n\tscanf(\"%d%d%d\", &n, &m, &q);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (j = 0; j < m; j++)\n\t\tscanf(\"%d\", &bb[j]);\n\tif (n == 1 && m == 1)\n\t\tans[aa[0] + bb[0]] = 1;\n\telse if (n == 1) {\n\t\tif (bb[0] > bb[1])\n\t\t\tans[aa[0] + bb[0]]--;\n\t\tif (bb[m - 1] >= bb[m - 2])\n\t\t\tans[aa[0] + bb[m - 1]]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[0] + bb[j];\n\t\t\tif (!x && !y)\n\t\t\t\tans[c]--;\n\t\t\telse if (x && y)\n\t\t\t\tans[c]++;\n\t\t}\n\t} else if (m == 1) {\n\t\tif (aa[0] > aa[1])\n\t\t\tans[aa[0] + bb[0]]--;\n\t\tif (aa[n - 1] >= aa[n - 2])\n\t\t\tans[aa[n - 1] + bb[0]]--;\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[0];\n\t\t\tif (!x && !y)\n\t\t\t\tans[c]--;\n\t\t\telse if (x && y)\n\t\t\t\tans[c]++;\n\t\t}\n\t} else {\n\t\tz = aa[0] > aa[1];\n\t\ty = bb[0] > bb[1], c = aa[0] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[0] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[0] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = aa[n - 1] >= aa[n - 2];\n\t\ty = bb[0] > bb[1], c = aa[n - 1] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[n - 1] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[n - 1] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[0] > bb[1];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[0];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[m - 1] >= bb[m - 2];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[m - 1];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\tif (!x && !y)\n\t\t\t\taaa[0][0][aa[i]]++;\n\t\t\telse if (x && y)\n\t\t\t\taaa[1][0][aa[i]]++;\n\t\t}\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tif (!x && !y)\n\t\t\t\tbbb[0][0][bb[j]]++;\n\t\t\telse if (x && y)\n\t\t\t\tbbb[1][0][bb[j]]++;\n\t\t}\n\t\tfor (h = 0; h < 2; h++) {\n\t\t\tmemcpy(aaa[h][1], aaa[h][0], sizeof aaa[h][0]);\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tntt(aaa[h][g], g, 0);\n\t\t}\n\t\tfor (h = 0; h < 2; h++) {\n\t\t\tmemcpy(bbb[h][1], bbb[h][0], sizeof bbb[h][0]);\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tntt(bbb[h][g], g, 0);\n\t\t}\n\t\tfor (h1 = 0; h1 < 2; h1++)\n\t\t\tfor (h2 = 0; h2 < 2; h2++)\n\t\t\t\tfor (g = 0; g < 2; g++) {\n\t\t\t\t\tint md = MM[g], d = h1 == h2 ? md - 2 : 2;\n\n\t\t\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\t\t\tcc[g][i] = (cc[g][i] + (long long) aaa[h1][g][i] * bbb[h2][g][i] % md * d) % md;\n\t\t\t\t}\n\t\tfor (g = 0; g < 2; g++) {\n\t\t\tint md = MM[g], v = VV[g];\n\n\t\t\tntt(cc[g], g, 1);\n\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\tcc[g][i] = (long long) cc[g][i] * v % md;\n\t\t}\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tlong long x = garner(cc[0][i], cc[1][i]);\n\n\t\t\tif (x > (long long) M0 * M1 - x)\n\t\t\t\tx -= (long long) M0 * M1;\n\t\t\tans[i] += x;\n\t\t}\n\t}\n\tans[0]++;\n\tfor (i = 1; i <= A; i++)\n\t\tans[i] += ans[i - 1];\n\twhile (q--) {\n\t\tint x;\n\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%lld\\n\", ans[x - 1]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "009b6bde78a9de833912ad66755caff9", "src_uid": "25a6428f57022c12dfabdabbcc69c5a4", "difficulty": 3300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n#define M\t100000\n#define A\t200000\n#define L_\t18\t/* L_ = ceil(log2(A + 1)) */\n#define N_\t(1 << L_)\n#define MD\t469762049\t/* MD = 56 * 2^23 + 1 */\n\nlong long power(int a, int k) {\n\tlong long b = a, p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * b % MD;\n\t\tb = b * b % MD;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint wu[L_ + 1], wv[L_ + 1], V;\n\nvoid init() {\n\tint l, u, v;\n\n\tu = power(3, MD - 1 >> L_), v = power(u, MD - 2);\n\tV = power(N_, MD - 2);\n\tfor (l = L_; l > 0; l--) {\n\t\twu[l] = u, wv[l] = v;\n\t\tu = (long long) u * u % MD, v = (long long) v * v % MD;\n\t}\n}\n\nvoid ntt(int *aa, int inverse) {\n\tint i, j, l, r;\n\n\tfor (i = 0, j = 1; j < N_; j++) {\n\t\tint n, tmp;\n\n\t\tn = N_ >> 1;\n\t\twhile ((i ^= n) < n)\n\t\t\tn >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (l = 1; l <= L_; l++) {\n\t\tint n = 1 << l, m = n >> 1;\n\t\tlong long u = inverse ? wv[l] : wu[l], w = 1;\n\n\t\tfor (r = 0; r < m; r++) {\n\t\t\tfor (i = r; (j = i + m) < N_; i += n) {\n\t\t\t\tint a = aa[i], b = aa[j] * w % MD;\n\n\t\t\t\tif ((aa[i] = a + b) >= MD)\n\t\t\t\t\taa[i] -= MD;\n\t\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\t\taa[j] += MD;\n\t\t\t}\n\t\t\tw = w * u % MD;\n\t\t}\n\t}\n}\n\nint dd[2][2] = \n{\n\t{ -2, 2 },\n\t{ 2, -2 },\n};\n\nint main() {\n\tstatic long long ans[A + 1];\n\tstatic int aa[N], bb[M], aaa[2][N_], bbb[2][N_], cc[N_];\n\tint n, m, q, g, h, i, j, x, y, z, c;\n\n\tinit();\n\tscanf(\"%d%d%d\", &n, &m, &q);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (j = 0; j < m; j++)\n\t\tscanf(\"%d\", &bb[j]);\n\tif (n == 1 && m == 1)\n\t\tans[aa[0] + bb[0]] = 1;\n\telse if (n == 1) {\n\t\tif (bb[0] > bb[1])\n\t\t\tans[aa[0] + bb[0]]--;\n\t\tif (bb[m - 1] >= bb[m - 2])\n\t\t\tans[aa[0] + bb[m - 1]]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[0] + bb[j];\n\t\t\tif (!x && !y)\n\t\t\t\tans[c]--;\n\t\t\telse if (x && y)\n\t\t\t\tans[c]++;\n\t\t}\n\t} else if (m == 1) {\n\t\tif (aa[0] > aa[1])\n\t\t\tans[aa[0] + bb[0]]--;\n\t\tif (aa[n - 1] >= aa[n - 2])\n\t\t\tans[aa[n - 1] + bb[0]]--;\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[0];\n\t\t\tif (!x && !y)\n\t\t\t\tans[c]--;\n\t\t\telse if (x && y)\n\t\t\t\tans[c]++;\n\t\t}\n\t} else {\n\t\tz = aa[0] > aa[1];\n\t\ty = bb[0] > bb[1], c = aa[0] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[0] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[0] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = aa[n - 1] >= aa[n - 2];\n\t\ty = bb[0] > bb[1], c = aa[n - 1] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[n - 1] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[n - 1] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[0] > bb[1];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[0];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[m - 1] >= bb[m - 2];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[m - 1];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\tif (!x && !y)\n\t\t\t\taaa[0][aa[i]]++;\n\t\t\telse if (x && y)\n\t\t\t\taaa[1][aa[i]]++;\n\t\t}\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tif (!x && !y)\n\t\t\t\tbbb[0][bb[j]]++;\n\t\t\telse if (x && y)\n\t\t\t\tbbb[1][bb[j]]++;\n\t\t}\n\t\tfor (h = 0; h < 2; h++)\n\t\t\tntt(aaa[h], 0);\n\t\tfor (h = 0; h < 2; h++)\n\t\t\tntt(bbb[h], 0);\n\t\tfor (i = 0; i < N_; i++)\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tfor (h = 0; h < 2; h++)\n\t\t\t\t\tcc[i] = (cc[i] + (long long) aaa[g][i] * bbb[h][i] % MD * dd[g][h]) % MD;\n\t\tfor (i = 0; i < N_; i++)\n\t\t\tif (cc[i] < 0)\n\t\t\t\tcc[i] += MD;\n\t\tntt(cc, 1);\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tc = (long long) cc[i] * V % MD;\n\t\t\tif (c > MD - c)\n\t\t\t\tc -= MD;\n\t\t\tans[i] += c;\n\t\t}\n\t}\n\tans[0]++;\n\tfor (i = 1; i <= A; i++)\n\t\tans[i] += ans[i - 1];\n\twhile (q--) {\n\t\tint x;\n\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%lld\\n\", ans[x - 1]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "638d7e3240f45750e24b269b01a10d46", "src_uid": "25a6428f57022c12dfabdabbcc69c5a4", "difficulty": 3300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n#define M\t100000\n#define A\t200000\n#define L_\t18\t/* L_ = ceil(log2(A + 1)) */\n#define N_\t(1 << L_)\n#define M0\t469762049\t/* M0 = 56 * 2^23 + 1 */\n#define M1\t595591169\t/* M1 = 71 * 2^23 + 1 */\n\nint MM[2] = { M0, M1 };\n\nlong long power(int a, int k, int md) {\n\tlong long b = a, p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * b % md;\n\t\tb = b * b % md;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint wu[2][L_ + 1], wv[2][L_ + 1], VV[2], V01;\n\nvoid init() {\n\tint g, l, u, v;\n\n\tV01 = power(M0, M1 - 2, M1);\n\tfor (g = 0; g < 2; g++) {\n\t\tint md = MM[g];\n\n\t\tu = power(3, md - 1 >> L_, md), v = power(u, md - 2, md);\n\t\tVV[g] = power(N_, md - 2, md);\n\t\tfor (l = L_; l > 0; l--) {\n\t\t\twu[g][l] = u, wv[g][l] = v;\n\t\t\tu = (long long) u * u % md, v = (long long) v * v % md;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int g, int inverse) {\n\tint md = MM[g], i, j, l, r;\n\n\tfor (i = 0, j = 1; j < N_; j++) {\n\t\tint n, tmp;\n\n\t\tn = N_ >> 1;\n\t\twhile ((i ^= n) < n)\n\t\t\tn >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (l = 1; l <= L_; l++) {\n\t\tint n = 1 << l, m = n >> 1;\n\t\tlong long u = inverse ? wv[g][l] : wu[g][l], w = 1;\n\n\t\tfor (r = 0; r < m; r++) {\n\t\t\tfor (i = r; (j = i + m) < N_; i += n) {\n\t\t\t\tint a = aa[i], b = aa[j] * w % md;\n\n\t\t\t\tif ((aa[i] = a + b) >= md)\n\t\t\t\t\taa[i] -= md;\n\t\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\t\taa[j] += md;\n\t\t\t}\n\t\t\tw = w * u % md;\n\t\t}\n\t}\n}\n\nlong long garner(int r0, int r1) {\n\tr1 = (long long) (r1 - r0) * V01 % M1;\n\tif (r1 < 0)\n\t\tr1 += M1;\n\treturn (long long) r1 * M0 + r0;\n}\n\nint main() {\n\tstatic long long ans[A + 1];\n\tstatic int aa[N], bb[M], aaa[2][2][N_], bbb[2][2][N_], cc[2][N_];\n\tint n, m, q, g, h, h1, h2, i, j, x, y, z, c;\n\n\tinit();\n\tscanf(\"%d%d%d\", &n, &m, &q);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (j = 0; j < m; j++)\n\t\tscanf(\"%d\", &bb[j]);\n\tif (n == 1 && m == 1)\n\t\tans[aa[0] + bb[0]] = 1;\n\telse if (n == 1)\n\t\tans[aa[0] + bb[0]]--, ans[aa[0] + bb[m - 1]]--;\n\telse if (m == 1)\n\t\tans[aa[0] + bb[0]]--, ans[aa[n - 1] + bb[0]]--;\n\telse {\n\t\tz = aa[0] > aa[1];\n\t\ty = bb[0] > bb[1], c = aa[0] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[0] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[0] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = aa[n - 1] >= aa[n - 2];\n\t\ty = bb[0] > bb[1], c = aa[n - 1] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[n - 1] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[n - 1] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[0] > bb[1];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[0];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[m - 1] >= bb[m - 2];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[m - 1];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\tif (!x && !y)\n\t\t\t\taaa[0][0][aa[i]]++;\n\t\t\telse if (x && y)\n\t\t\t\taaa[1][0][aa[i]]++;\n\t\t}\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tif (!x && !y)\n\t\t\t\tbbb[0][0][bb[j]]++;\n\t\t\telse if (x && y)\n\t\t\t\tbbb[1][0][bb[j]]++;\n\t\t}\n\t\tfor (h = 0; h < 2; h++) {\n\t\t\tmemcpy(aaa[h][1], aaa[h][0], sizeof aaa[h][0]);\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tntt(aaa[h][g], g, 0);\n\t\t}\n\t\tfor (h = 0; h < 2; h++) {\n\t\t\tmemcpy(bbb[h][1], bbb[h][0], sizeof bbb[h][0]);\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tntt(bbb[h][g], g, 0);\n\t\t}\n\t\tfor (h1 = 0; h1 < 2; h1++)\n\t\t\tfor (h2 = 0; h2 < 2; h2++)\n\t\t\t\tfor (g = 0; g < 2; g++) {\n\t\t\t\t\tint md = MM[g], d = h1 == h2 ? md - 2 : 2;\n\n\t\t\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\t\t\tcc[g][i] = (cc[g][i] + (long long) aaa[h1][g][i] * bbb[h2][g][i] % md * d) % md;\n\t\t\t\t}\n\t\tfor (g = 0; g < 2; g++) {\n\t\t\tint md = MM[g], v = VV[g];\n\n\t\t\tntt(cc[g], g, 1);\n\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\tcc[g][i] = (long long) cc[g][i] * v % md;\n\t\t}\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tlong long x = garner(cc[0][i], cc[1][i]);\n\n\t\t\tif (x > (long long) M0 * M1 - x)\n\t\t\t\tx -= (long long) M0 * M1;\n\t\t\tans[i] += x;\n\t\t}\n\t}\n\tans[0]++;\n\tfor (i = 1; i <= A; i++)\n\t\tans[i] += ans[i - 1];\n\twhile (q--) {\n\t\tint x;\n\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%lld\\n\", ans[x - 1]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c90edea0e6ddf017dabed134bb709e25", "src_uid": "25a6428f57022c12dfabdabbcc69c5a4", "difficulty": 3300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n#define M\t100000\n#define A\t200000\n#define L_\t18\t/* L_ = ceil(log2(A + 1)) */\n#define N_\t(1 << L_)\n#define M0\t469762049\t/* M0 = 56 * 2^23 + 1 */\n#define M1\t595591169\t/* M1 = 71 * 2^23 + 1 */\n\nint MM[2] = { M0, M1 };\n\nlong long power(int a, int k, int md) {\n\tlong long b = a, p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * b % md;\n\t\tb = b * b % md;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint wu[2][L_ + 1][N_], wv[2][L_ + 1][N_], VV[2], V01;\n\nvoid init() {\n\tint g, l, u, v;\n\n\tV01 = power(M0, M1 - 2, M1);\n\tfor (g = 0; g < 2; g++) {\n\t\tint md = MM[g], i;\n\n\t\tu = power(3, md - 1 >> L_, md), v = power(u, md - 2, md);\n\t\tVV[g] = power(N_, md - 2, md);\n\t\tfor (l = L_; l > 0; l--) {\n\t\t\twu[g][l][0] = wv[g][l][0] = 1;\n\t\t\tfor (i = 1; i < 1 << l; i++)\n\t\t\t\twu[g][l][i] = (long long) wu[g][l][i - 1] * u % md, wv[g][l][i] = (long long) wv[g][l][i - 1] * v % md;\n\t\t\tu = (long long) u * u % md, v = (long long) v * v % md;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int g, int inverse) {\n\tint md = MM[g], h, i, j, l, r;\n\n\tfor (i = 0, j = 1; j < N_; j++) {\n\t\tint n, tmp;\n\n\t\tn = N_ >> 1;\n\t\twhile ((i ^= n) < n)\n\t\t\tn >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (l = 1; l <= L_; l++) {\n\t\tint n = 1 << l, m = n >> 1;\n\n\t\tfor (h = 0; h < N_; h += n)\n\t\t\tfor (r = 0; r < m; r++) {\n\t\t\t\tint a, b;\n\n\t\t\t\ti = h + r, j = i + m;\n\t\t\t\ta = aa[i], b = (long long) aa[j] * (inverse ? wv[g][l][r] : wu[g][l][r]) % md;\n\t\t\t\tif ((aa[i] = a + b) >= md)\n\t\t\t\t\taa[i] -= md;\n\t\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\t\taa[j] += md;\n\t\t\t}\n\t}\n}\n\nlong long garner(int r0, int r1) {\n\tr1 = (long long) (r1 - r0) * V01 % M1;\n\tif (r1 < 0)\n\t\tr1 += M1;\n\treturn (long long) r1 * M0 + r0;\n}\n\nint main() {\n\tstatic long long ans[A + 1];\n\tstatic int aa[N], bb[M], aaa[2][2][N_], bbb[2][2][N_], cc[2][N_];\n\tint n, m, q, g, h, h1, h2, i, j, x, y, z, c;\n\n\tinit();\n\tscanf(\"%d%d%d\", &n, &m, &q);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (j = 0; j < m; j++)\n\t\tscanf(\"%d\", &bb[j]);\n\tif (n == 1 && m == 1)\n\t\tans[aa[0] + bb[0]] = 1;\n\telse if (n == 1)\n\t\tans[aa[0] + bb[0]]--, ans[aa[0] + bb[m - 1]]--;\n\telse if (m == 1)\n\t\tans[aa[0] + bb[0]]--, ans[aa[n - 1] + bb[0]]--;\n\telse {\n\t\tz = aa[0] > aa[1];\n\t\ty = bb[0] > bb[1], c = aa[0] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[0] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[0] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = aa[n - 1] >= aa[n - 2];\n\t\ty = bb[0] > bb[1], c = aa[n - 1] + bb[0];\n\t\tif (z == y)\n\t\t\tans[c]--;\n\t\tx = bb[m - 1] >= bb[m - 2], c = aa[n - 1] + bb[m - 1];\n\t\tif (z == x)\n\t\t\tans[c]--;\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1], c = aa[n - 1] + bb[j];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[0] > bb[1];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[0];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tz = bb[m - 1] >= bb[m - 2];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1], c = aa[i] + bb[m - 1];\n\t\t\tif (!z) {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]--;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]++;\n\t\t\t} else {\n\t\t\t\tif (!x && !y)\n\t\t\t\t\tans[c]++;\n\t\t\t\telse if (x && y)\n\t\t\t\t\tans[c]--;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\tif (!x && !y)\n\t\t\t\taaa[0][0][aa[i]]++;\n\t\t\telse if (x && y)\n\t\t\t\taaa[1][0][aa[i]]++;\n\t\t}\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tif (!x && !y)\n\t\t\t\tbbb[0][0][bb[j]]++;\n\t\t\telse if (x && y)\n\t\t\t\tbbb[1][0][bb[j]]++;\n\t\t}\n\t\tfor (h = 0; h < 2; h++) {\n\t\t\tmemcpy(aaa[h][1], aaa[h][0], sizeof aaa[h][0]);\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tntt(aaa[h][g], g, 0);\n\t\t}\n\t\tfor (h = 0; h < 2; h++) {\n\t\t\tmemcpy(bbb[h][1], bbb[h][0], sizeof bbb[h][0]);\n\t\t\tfor (g = 0; g < 2; g++)\n\t\t\t\tntt(bbb[h][g], g, 0);\n\t\t}\n\t\tfor (h1 = 0; h1 < 2; h1++)\n\t\t\tfor (h2 = 0; h2 < 2; h2++)\n\t\t\t\tfor (g = 0; g < 2; g++) {\n\t\t\t\t\tint md = MM[g], d = h1 == h2 ? md - 2 : 2;\n\n\t\t\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\t\t\tcc[g][i] = (cc[g][i] + (long long) aaa[h1][g][i] * bbb[h2][g][i] % md * d) % md;\n\t\t\t\t}\n\t\tfor (g = 0; g < 2; g++) {\n\t\t\tint md = MM[g], v = VV[g];\n\n\t\t\tntt(cc[g], g, 1);\n\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\tcc[g][i] = (long long) cc[g][i] * v % md;\n\t\t}\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tlong long x = garner(cc[0][i], cc[1][i]);\n\n\t\t\tif (x > (long long) M0 * M1 - x)\n\t\t\t\tx -= (long long) M0 * M1;\n\t\t\tans[i] += x;\n\t\t}\n\t}\n\tans[0]++;\n\tfor (i = 1; i <= A; i++)\n\t\tans[i] += ans[i - 1];\n\twhile (q--) {\n\t\tint x;\n\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%lld\\n\", ans[x - 1]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f36c9f866598c2208964b738b5876637", "src_uid": "25a6428f57022c12dfabdabbcc69c5a4", "difficulty": 3300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n#define M\t100000\n#define A\t200000\n#define L_\t18\t/* L_ = ceil(log2(A + 1)) */\n#define N_\t(1 << L_)\n#define M0\t469762049\t/* M0 = 56 * 2^23 + 1 */\n#define M1\t595591169\t/* M1 = 71 * 2^23 + 1 */\n\nint MM[2] = { M0, M1 };\n\nlong long power(int a, int k, int md) {\n\tlong long b = a, p = 1;\n\n\twhile (k) {\n\t\tif (k & 1)\n\t\t\tp = p * b % md;\n\t\tb = b * b % md;\n\t\tk >>= 1;\n\t}\n\treturn p;\n}\n\nint wu[2][L_ + 1][N_], wv[2][L_ + 1][N_], VV[2], V01;\n\nvoid init() {\n\tint g, l, u, v;\n\n\tV01 = power(M0, M1 - 2, M1);\n\tfor (g = 0; g < 2; g++) {\n\t\tint md = MM[g], i;\n\n\t\tu = power(3, md - 1 >> L_, md), v = power(u, md - 2, md);\n\t\tVV[g] = power(N_, md - 2, md);\n\t\tfor (l = L_; l > 0; l--) {\n\t\t\twu[g][l][0] = wv[g][l][0] = 1;\n\t\t\tfor (i = 1; i < 1 << l; i++)\n\t\t\t\twu[g][l][i] = (long long) wu[g][l][i - 1] * u % md, wv[g][l][i] = (long long) wv[g][l][i - 1] * v % md;\n\t\t\tu = (long long) u * u % md, v = (long long) v * v % md;\n\t\t}\n\t}\n}\n\nvoid ntt(int *aa, int g, int inverse) {\n\tint md = MM[g], h, i, j, l, r;\n\n\tfor (i = 0, j = 1; j < N_; j++) {\n\t\tint n, tmp;\n\n\t\tn = N_ >> 1;\n\t\twhile ((i ^= n) < n)\n\t\t\tn >>= 1;\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (l = 1; l <= L_; l++) {\n\t\tint n = 1 << l, m = n >> 1;\n\n\t\tfor (h = 0; h < N_; h += n)\n\t\t\tfor (r = 0; r < m; r++) {\n\t\t\t\tint a, b;\n\n\t\t\t\ti = h + r, j = i + m;\n\t\t\t\ta = aa[i], b = (long long) aa[j] * (inverse ? wv[g][l][r] : wu[g][l][r]) % md;\n\t\t\t\tif ((aa[i] = a + b) >= md)\n\t\t\t\t\taa[i] -= md;\n\t\t\t\tif ((aa[j] = a - b) < 0)\n\t\t\t\t\taa[j] += md;\n\t\t\t}\n\t}\n}\n\nlong long garner(int r0, int r1) {\n\tr1 = (long long) (r1 - r0) * V01 % M1;\n\tif (r1 < 0)\n\t\tr1 += M1;\n\treturn (long long) r1 * M0 + r0;\n}\n\nint main() {\n\tstatic long long ans[A + 1];\n\tstatic int aa[N], bb[M], aaa[2][N_], bbb[2][N_], cc[2][N_];\n\tint n, m, q, g, i, j, x, y, z;\n\n\tinit();\n\tscanf(\"%d%d%d\", &n, &m, &q);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (j = 0; j < m; j++)\n\t\tscanf(\"%d\", &bb[j]);\n\tif (n == 1 && m == 1)\n\t\tans[aa[0] + bb[0]] = 1;\n\telse if (n == 1)\n\t\tans[aa[0] + bb[0]]--, ans[aa[0] + bb[m - 1]]--;\n\telse if (m == 1)\n\t\tans[aa[0] + bb[0]]--, ans[aa[n - 1] + bb[0]]--;\n\telse {\n\t\tx = bb[m - 1] >= bb[m - 2], y = bb[0] > bb[1];\n\t\tz = aa[0] > aa[1];\n\t\tif (z == y)\n\t\t\tans[aa[0] + bb[0]]--;\n\t\tif (z == x)\n\t\t\tans[aa[0] + bb[m - 1]]--;\n\t\tz = aa[n - 1] >= aa[n - 2];\n\t\tif (z == y)\n\t\t\tans[aa[n - 1] + bb[0]]--;\n\t\tif (z == x)\n\t\t\tans[aa[n - 1] + bb[m - 1]]--;\n\t\tz = aa[0] > aa[1];\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tans[aa[0] + bb[j]] += (z ? -1 : 1) * (x != y ? 0 : (x ? 1 : -1));\n\t\t}\n\t\tz = aa[n - 1] >= aa[n - 2];\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tans[aa[n - 1] + bb[j]] += (z ? -1 : 1) * (x != y ? 0 : (x ? 1 : -1));\n\t\t}\n\t\tz = bb[0] > bb[1];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\tans[aa[i] + bb[0]] += (z ? -1 : 1) * (x != y ? 0 : (x ? 1 : -1));\n\t\t}\n\t\tz = bb[m - 1] >= bb[m - 2];\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\tans[aa[i] + bb[m - 1]] += (z ? -1 : 1) * (x != y ? 0 : (x ? 1 : -1));\n\t\t}\n\t\tfor (i = 1; i < n - 1; i++) {\n\t\t\tx = aa[i] >= aa[i - 1], y = aa[i] > aa[i + 1];\n\t\t\taaa[0][aa[i]] += x != y ? 0 : (x ? -1 : 1);\n\t\t}\n\t\tfor (j = 1; j < m - 1; j++) {\n\t\t\tx = bb[j] >= bb[j - 1], y = bb[j] > bb[j + 1];\n\t\t\tbbb[0][bb[j]] += x != y ? 0 : (x ? -1 : 1);\n\t\t}\n\t\tmemcpy(aaa[1], aaa[0], sizeof aaa[0]);\n\t\tmemcpy(bbb[1], bbb[0], sizeof bbb[0]);\n\t\tfor (g = 0; g < 2; g++) {\n\t\t\tfor (i = 0; i < N_; i++) {\n\t\t\t\tif (aaa[g][i] < 0)\n\t\t\t\t\taaa[g][i] += MM[g];\n\t\t\t\tif (bbb[g][i] < 0)\n\t\t\t\t\tbbb[g][i] += MM[g];\n\t\t\t}\n\t\t\tntt(aaa[g], g, 0);\n\t\t\tntt(bbb[g], g, 0);\n\t\t}\n\t\tfor (g = 0; g < 2; g++) {\n\t\t\tint md = MM[g];\n\n\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\tcc[g][i] = (long long) aaa[g][i] * bbb[g][i] % md * 2 % md;\n\t\t}\n\t\tfor (g = 0; g < 2; g++) {\n\t\t\tint md = MM[g], v = VV[g];\n\n\t\t\tntt(cc[g], g, 1);\n\t\t\tfor (i = 0; i < N_; i++)\n\t\t\t\tcc[g][i] = (long long) cc[g][i] * v % md;\n\t\t}\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tlong long x = garner(cc[0][i], cc[1][i]);\n\n\t\t\tif (x > (long long) M0 * M1 - x)\n\t\t\t\tx -= (long long) M0 * M1;\n\t\t\tans[i] -= x;\n\t\t}\n\t}\n\tans[0]++;\n\tfor (i = 1; i <= A; i++)\n\t\tans[i] += ans[i - 1];\n\twhile (q--) {\n\t\tint x;\n\n\t\tscanf(\"%d\", &x);\n\t\tprintf(\"%lld\\n\", ans[x - 1]);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4929692a1851ad387a382b22e7c6c1ae", "src_uid": "25a6428f57022c12dfabdabbcc69c5a4", "difficulty": 3300.0} {"lang": "GNU C11", "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) {\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "896ed2e183e1fd9f47178e03d9be2477", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "GNU C11", "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) {\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a58c9c4a5cd78f937e47d9a8254ae1e3", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "GNU C11", "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 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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "39663c51f3adf0cc4e356641e52deca8", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0} {"lang": "GNU C11", "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<\r\n\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\nvoid writePositive(int num) {\r\n if (num > 0) {\r\n writePositive(num / 10);\r\n putchar(num % 10 + '0');\r\n }\r\n}\r\n\r\nvoid write(int num) {\r\n if (num == 0) putchar('0');\r\n else if (num < 0) {\r\n putchar('-');\r\n writePositive(-num);\r\n } else writePositive(num);\r\n}\r\n\r\nint read() {\r\n rint sign = 1;\r\n rint num = 0;\r\n rint ch;\r\n while(1) {\r\n ch = getchar();\r\n if (ch == '-') {\r\n sign = -sign;\r\n continue;\r\n }\r\n ch = ch-'0';\r\n if (ch < 0 || 10 < ch) break;\r\n num = num*10+ch;\r\n }\r\n return sign*num;\r\n}\r\n\r\n#define MOD 998244353\r\n\r\nint dp[50001][1024];\r\nint pairs[10][10], masks[10][1024];\r\n\r\nint main() {\r\n rint n = read();\r\n rint m = read();\r\n rep(i,0,m) {\r\n rint u = read();\r\n rint v = read();\r\n pairs[u][v] = 1;\r\n pairs[v][u] = 1;\r\n }\r\n \r\n rep(k,0,10) rep(j,0,1024) {\r\n rint mask = 1<\r\n\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\nvoid writePositive(int num) {\r\n if (num > 0) {\r\n writePositive(num / 10);\r\n putchar(num % 10 + '0');\r\n }\r\n}\r\n\r\nvoid write(int num) {\r\n if (num == 0) putchar('0');\r\n else if (num < 0) {\r\n putchar('-');\r\n writePositive(-num);\r\n } else writePositive(num);\r\n}\r\n\r\nint read() {\r\n rint sign = 1;\r\n rint num = 0;\r\n rint ch;\r\n while(1) {\r\n ch = getchar();\r\n if (ch == '-') {\r\n sign = -sign;\r\n continue;\r\n }\r\n ch = ch-'0';\r\n if (ch < 0 || 10 < ch) break;\r\n num = num*10+ch;\r\n }\r\n return sign*num;\r\n}\r\n\r\n#define MOD 998244353\r\n\r\nint dp[50001][1024];\r\nint pairs[10][10], masks[10][1024];\r\n\r\nint main() {\r\n rint n = read();\r\n rint m = read();\r\n rep(i,0,m) {\r\n rint u = read();\r\n rint v = read();\r\n pairs[u][v] = 1;\r\n pairs[v][u] = 1;\r\n }\r\n \r\n rep(k,0,10) rep(j,0,1024) {\r\n rint mask = 1<\r\n#include \r\n\r\n#define MOD 998244353\r\n\r\nint main() {\r\n\tint n, m;\r\n\tscanf(\"%d%d\", &n, &m);\r\n\r\n\tstatic int c[10];\r\n\r\n\tfor (int i = 0; i < m; ++i) {\r\n\t\tint u, v;\r\n\t\tscanf(\"%d%d\", &u, &v);\r\n\t\tc[u] |= 1 << v;\r\n\t\tc[v] |= 1 << u;\r\n\t}\r\n\r\n\tfor (int u = 0; u < 10; ++u) {\r\n\t\tc[u] |= 1 << u;\r\n\t}\r\n\r\n\tstatic int dp[1024];\r\n\t\r\n\tfor (int u = 0; u < 10; ++u) {\r\n\t\tdp[1 << u] = 1;\r\n\t}\r\n\t\r\n\twhile (--n) {\r\n\t\tstatic int tmp[1024];\r\n\t\t\r\n\t\tmemset(tmp, 0, sizeof(tmp));\r\n\r\n\t\tfor (int i = 0; i < 1024; ++i) {\r\n\t\t\tfor (int x = 0; x < 10; ++x) {\r\n\t\t\t\tint j = i & c[x] | (1 << x);\r\n\t\t\t\tif (j & ((1 << x) - 1)) \r\n\t\t\t\t\tcontinue;\r\n\t\t\t\tif ((tmp[j] += dp[i]) >= MOD) \r\n\t\t\t\t\ttmp[j] -= MOD;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tmemcpy(dp, tmp, sizeof(dp));\r\n\t}\r\n\r\n\tint res = 0;\r\n\tfor (int i = 0; i < 1024; ++i) {\r\n\t\tif ((res += dp[i]) >= MOD) \r\n\t\t\tres -= MOD;\r\n\t}\r\n\r\n\tprintf(\"%d\\n\", res);\r\n}\r\n\r\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e49ef8dc3436d3744bbdc05361b902b4", "src_uid": "60955fc2caa6ec99c7dcc1da5d36b1f8", "difficulty": 2600.0} {"lang": "GNU C11", "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(rll i=(a);i<(b);i++)\r\n#define repe(i,a,b) for(rll i=(a);i<=(b);i++)\r\n#define repr(i,a,b) for(rll i=(a)-1;(b)<=i;i--)\r\n\r\nvoid writePositive(ll num) {\r\n if (num > 0) {\r\n writePositive(num / 10);\r\n putchar(num % 10 + '0');\r\n }\r\n}\r\n\r\nvoid write(ll num) {\r\n if (num == 0) putchar('0');\r\n else if (num < 0) {\r\n putchar('-');\r\n writePositive(-num);\r\n } else writePositive(num);\r\n}\r\n\r\nll read() {\r\n rint sign = 1;\r\n rll num = 0;\r\n rint ch;\r\n while(1) {\r\n ch = getchar();\r\n if (ch == '-') {\r\n sign = -sign;\r\n continue;\r\n }\r\n ch = ch-'0';\r\n if (ch < 0 || 10 < ch) break;\r\n num = num*10+ch;\r\n }\r\n return sign*num;\r\n}\r\n\r\n#define MOD 998244353\r\n\r\nll dp[50001][1024];\r\nint pairs[10][10], masks[10][1024];\r\n\r\nint main() {\r\n rll n = read();\r\n rll m = read();\r\n rep(i,0,m) {\r\n rll u = read();\r\n rll v = read();\r\n pairs[u][v] = 1;\r\n pairs[v][u] = 1;\r\n }\r\n \r\n rep(k,0,10) rep(j,0,1024) {\r\n rint mask = 1<\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}\nint main()\n{\n\tlong long int n, m, l, r;\n\tscanf(\"%lld %lld %lld %lld\", &n, &m, &l, &r);\n\tlong long int p = 998244353;\n\tif (n * m % 2 > 0)\n\t\tprintf(\"%lld\\n\", modpow(r - l + 1, n * m, p));\n\telse if ((r - l) % 2 > 0)\n\t\tprintf(\"%lld\\n\", modpow(r - l + 1, n * m, p) * modpow(2, p - 2, p) % p);\n\telse\n\t\tprintf(\"%lld\\n\", (modpow(r - l + 1, n * m, p) + 1) * modpow(2, p - 2, p) % p);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "72e985ddfacc05a09ea8732a056752a1", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n \n#define MD\t998244353\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 >> 1);\n\tp = p * p % MD;\n\tif (k & 1)\n\t\tp = p * a % MD;\n\treturn p;\n}\n \nvoid mult(int aa[][2], int bb[][2], int cc[][2]) {\n\tint i, j;\n \n\tfor (i = 0; i < 2; i++)\n\t\tfor (j = 0; j < 2; j++)\n\t\t\tcc[i][j] = ((long long) aa[i][0] * bb[0][j] + (long long) aa[i][1] * bb[1][j]) % MD;\n}\n \nvoid power_(int aa[][2], int pp[][2], int tt[][2], long long k) {\n\tif (k == 0) {\n\t\tint i, j;\n \n\t\tfor (i = 0; i < 2; i++)\n\t\t\tfor (j = 0; j < 2; j++)\n\t\t\t\tpp[i][j] = i == j;\n\t\treturn;\n\t}\n\tif ((k & 1) == 0) {\n\t\tpower_(aa, tt, pp, k >> 1);\n\t\tmult(tt, tt, pp);\n\t} else {\n\t\tpower_(aa, pp, tt, k >> 1);\n\t\tmult(pp, pp, tt);\n\t\tmult(tt, aa, pp);\n\t}\n}\n \nint main() {\n\tstatic int aa[2][2], pp[2][2], tt[2][2];\n\tint n, m, l, r, e, o;\n \n\tscanf(\"%d%d%d%d\", &n, &m, &l, &r);\n\tif ((long long) n * m % 2 != 0) {\n\t\tprintf(\"%lld\\n\", power(r - l + 1, (long long) n * m));\n\t\treturn 0;\n\t}\n\te = r / 2 - (l - 1) / 2, o = r - l + 1 - e;\n\taa[0][0] = e, aa[0][1] = o;\n\taa[1][0] = o, aa[1][1] = e;\n\tpower_(aa, pp, tt, (long long) n * m);\n\tprintf(\"%d\\n\", pp[0][0]);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e1fb63345b99667aeb8d837426a32198", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MD\t998244353\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 >> 1);\n\tp = p * p % MD;\n\tif (k & 1)\n\t\tp = p * a % MD;\n\treturn p;\n}\n\nvoid mult(int aa[][2], int bb[][2], int cc[][2]) {\n\tint i, j;\n\n\tfor (i = 0; i < 2; i++)\n\t\tfor (j = 0; j < 2; j++)\n\t\t\tcc[i][j] = ((long long) aa[i][0] * bb[0][j] + (long long) aa[i][1] * bb[1][j]) % MD;\n}\n\nvoid power_(int aa[][2], int pp[][2], int tt[][2], long long k) {\n\tif (k == 0) {\n\t\tint i, j;\n\n\t\tfor (i = 0; i < 2; i++)\n\t\t\tfor (j = 0; j < 2; j++)\n\t\t\t\tpp[i][j] = i == j;\n\t\treturn;\n\t}\n\tif ((k & 1) == 0) {\n\t\tpower_(aa, tt, pp, k >> 1);\n\t\tmult(tt, tt, pp);\n\t} else {\n\t\tpower_(aa, pp, tt, k >> 1);\n\t\tmult(pp, pp, tt);\n\t\tmult(tt, aa, pp);\n\t}\n}\n\nint main() {\n\tstatic int aa[2][2], pp[2][2], tt[2][2];\n\tint n, m, l, r, e, o;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &l, &r);\n\tif ((long long) n * m % 2 != 0) {\n\t\tprintf(\"%lld\\n\", power(r - l + 1, (long long) n * m));\n\t\treturn 0;\n\t}\n\te = r / 2 - (l - 1) / 2, o = r - l + 1 - e;\n\taa[0][0] = e, aa[0][1] = o;\n\taa[1][0] = o, aa[1][1] = e;\n\tpower_(aa, pp, tt, (long long) n * m);\n\tprintf(\"%d\\n\", pp[0][0]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f0df45d1eaa3dce73432d69b4ca24e44", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n\n#define MD\t998244353\n\nvoid mult(int aa[][2], int bb[][2], int cc[][2]) {\n\tint i, j;\n\n\tfor (i = 0; i < 2; i++)\n\t\tfor (j = 0; j < 2; j++)\n\t\t\tcc[i][j] = ((long long) aa[i][0] * bb[0][j] + (long long) aa[i][1] * bb[1][j]) % MD;\n}\n\nvoid power(int aa[][2], int pp[][2], int tt[][2], long long k) {\n\tif (k == 0) {\n\t\tint i, j;\n\n\t\tfor (i = 0; i < 2; i++)\n\t\t\tfor (j = 0; j < 2; j++)\n\t\t\t\tpp[i][j] = i == j;\n\t\treturn;\n\t}\n\tif ((k & 1) == 0) {\n\t\tpower(aa, tt, pp, k / 2);\n\t\tmult(tt, tt, pp);\n\t} else {\n\t\tpower(aa, pp, tt, k / 2);\n\t\tmult(pp, pp, tt);\n\t\tmult(tt, aa, pp);\n\t}\n}\n\nint main() {\n\tstatic int aa[2][2], pp[2][2], tt[2][2];\n\tint n, m, l, r, e, o;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &l, &r);\n\te = r / 2 - (l - 1) / 2, o = r - l + 1 - e;\n\taa[0][0] = e, aa[0][1] = o;\n\taa[1][0] = o, aa[1][1] = e;\n\tpower(aa, pp, tt, (long long) n * m);\n\tprintf(\"%d\\n\", pp[0][0]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "03d52a3b37c7b4369c55bf0d58d1ce1d", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "3aad20210ca615a737d70d74a87283bc", "src_uid": "e809d068b3ae47eb5ecfb9ac69892254", "difficulty": 3200.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "2ce990c814543bc0250271fdfbd8327c", "src_uid": "e809d068b3ae47eb5ecfb9ac69892254", "difficulty": 3200.0} {"lang": "GNU C11", "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\tupdate(ft1, n - i, n + 1, dq[i]);\n\t\t\tupdate(ft2, n - rr_[i], n + 1, dq[i]);\n\t\t}\n\t\tprintf(\"%d\\n\", n + min(dp[n], dq[n]));\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c8ee8ccb1ca19f0f5b8faca56612facb", "src_uid": "e809d068b3ae47eb5ecfb9ac69892254", "difficulty": 3200.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "08d886348263edc4df66f6288b82b745", "src_uid": "e809d068b3ae47eb5ecfb9ac69892254", "difficulty": 3200.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "ad75027170f24e0e7171877cd8694fcd", "src_uid": "87d755df6ee27b381122062659c4a432", "difficulty": 2700.0} {"lang": "GNU C11", "source_code": "https://en.wikipedia.org/wiki/Dada\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "5313817ae71f1c3bd40f07cf5c41924d", "src_uid": "87d755df6ee27b381122062659c4a432", "difficulty": 2700.0} {"lang": "GNU C11", "source_code": "/* https://codeforces.com/blog/entry/451 */\n#include \n\n#define N\t150\n#define M\t50\n#define MD\t51123987\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int next[N][3], dp[N + 1][M + 1][M + 1][M + 1];\n\tint n, m, i, a, ka, kb, kc, ans;\n\n\tscanf(\"%d%s\", &n, cc), m = (n + 2) / 3;\n\tif (n < 3) {\n\t\tprintf(n == 1 || cc[0] != cc[1] ? \"1\\n\" : \"0\\n\");\n\t\treturn 0;\n\t}\n\tfor (i = n - 1; i >= 0; i--)\n\t\tfor (a = 0; a < 3; a++)\n\t\t\tnext[i][a] = cc[i] == a + 'a' ? i : (i + 1 == n ? n : next[i + 1][a]);\n\tdp[0][0][0][0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tfor (ka = 0; ka <= m; ka++)\n\t\t\tfor (kb = 0; kb <= m; kb++)\n\t\t\t\tfor (kc = 0; kc <= m; kc++) {\n\t\t\t\t\tint x = dp[i][ka][kb][kc], j;\n\n\t\t\t\t\tif (x == 0)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (ka < m && (j = next[i][0]) < n)\n\t\t\t\t\t\tdp[j][ka + 1][kb][kc] = (dp[j][ka + 1][kb][kc] + x) % MD;\n\t\t\t\t\tif (kb < m && (j = next[i][1]) < n)\n\t\t\t\t\t\tdp[j][ka][kb + 1][kc] = (dp[j][ka][kb + 1][kc] + x) % MD;\n\t\t\t\t\tif (kc < m && (j = next[i][2]) < n)\n\t\t\t\t\t\tdp[j][ka][kb][kc + 1] = (dp[j][ka][kb][kc + 1] + x) % MD;\n\t\t\t\t}\n\tans = 0;\n\tif (n % 3 == 0) {\n\t\tka = m, kb = m, kc = m;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t} else if (n % 3 == 1) {\n\t\tka = m - 1, kb = m - 1, kc = m;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t\tka = m, kb = m - 1, kc = m - 1;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t\tka = m - 1, kb = m, kc = m - 1;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t} else {\n\t\tka = m - 1, kb = m, kc = m;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t\tka = m, kb = m - 1, kc = m;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t\tka = m, kb = m, kc = m - 1;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tans = (ans + dp[i][ka][kb][kc]) % MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0e85c7c6c62e124b5b2a1e2e1627ea5b", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include\n#define rep(i,l,r) for(register int i=l;i<=r;++i)\nconst int MOD=51123987;\nint dp[151][51][51][51];\nint next[160][3],n,ans;\nchar s[160];\ninline int abs(int x){return x>0?x:-x;}\ninline int pd(int a,int b){return abs(a-b)<2?1:0;}\nint main(){\n scanf(\"%d\",&n);\n scanf(\"%s\",s+1);\n rep(i,0,2) next[n+1][i]=n+1;\n for(register int i=n;i;--i){rep(j,0,2) next[i][j]=next[i+1][j];next[i][s[i]-'a']=i;}\n dp[1][0][0][0]=1;\n //int 50=(n+2)/3;\n rep(i,1,n) rep(j,0,50) rep(k,0,50) rep(l,0,50){\n if(j+k+l==n&&pd(j,k)&&pd(j,l)&&pd(k,l)){ans=(ans+dp[i][j][k][l])%MOD;continue;}\n if(next[i][0]<=n) dp[next[i][0]][j+1][k][l]=(dp[next[i][0]][j+1][k][l]+dp[i][j][k][l])%MOD;\n if(next[i][1]<=n) dp[next[i][1]][j][k+1][l]=(dp[next[i][1]][j][k+1][l]+dp[i][j][k][l])%MOD;\n if(next[i][2]<=n) dp[next[i][2]][j][k][l+1]=(dp[next[i][2]][j][k][l+1]+dp[i][j][k][l])%MOD;\n }\n printf(\"%d\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "b7153bfee3cee4d8b3f144b1223424db", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include\n#define rep(i,l,r) for(register int i=l;i<=r;++i)\nconst int MOD=51123987;\nint dp[160][60][60][60];\nint next[160][3],n,ans;\nchar s[160];\ninline int abs(int x){return x>0?x:-x;}\ninline int pd(int a,int b){return abs(a-b)<2?1:0;}\nint main(){\n scanf(\"%d\",&n);\n scanf(\"%s\",s+1);\n rep(i,0,2) next[n+1][i]=n+1;\n for(register int i=n;i;--i){rep(j,0,2) next[i][j]=next[i+1][j];next[i][s[i]-'a']=i;}\n dp[1][0][0][0]=1;\n //int 50=(n+2)/3;\n rep(i,1,n) rep(j,0,50) rep(k,0,50) rep(l,0,50){\n if(j+k+l==n&&pd(j,k)&&pd(j,l)&&pd(k,l)){ans=(ans+dp[i][j][k][l])%MOD;continue;}\n if(next[i][0]<=n) dp[next[i][0]][j+1][k][l]=(dp[next[i][0]][j+1][k][l]+dp[i][j][k][l])%MOD;\n if(next[i][1]<=n) dp[next[i][1]][j][k+1][l]=(dp[next[i][1]][j][k+1][l]+dp[i][j][k][l])%MOD;\n if(next[i][2]<=n) dp[next[i][2]][j][k][l+1]=(dp[next[i][2]][j][k][l+1]+dp[i][j][k][l])%MOD;\n }\n printf(\"%d\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ca0d6028d97223271050548d371f45a5", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i1 || ab(j-k)>1 || ab(k-i)>1) continue;\n res = (res+dp[m][i][j][k])%M;\n }\n printf(\"%d\\n\",res);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f40c522f7e2b5e577d4033674b518991", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include\n#define rep(i,l,r) for(register int i=l;i<=r;++i)\nconst int MOD=51123987;\nint dp[160][60][60][60];\nint next[160][3],n,ans;\nchar s[160];\ninline int abs(int x){return x>0?x:-x;}\ninline bool pd(int a,int b){return abs(a-b)<2;}\nint main(){\n scanf(\"%d\",&n);\n scanf(\"%s\",s+1);\n rep(i,0,2) next[n+1][i]=n+1;\n for(register int i=n;i;--i){rep(j,0,2) next[i][j]=next[i+1][j];next[i][s[i]-'a']=i;}\n dp[1][0][0][0]=1;\n //int 50=(n+2)/3;\n rep(i,1,n) rep(j,0,50) rep(k,0,50) rep(l,0,50){\n if(j+k+l==n&&pd(j,k)&&pd(j,l)&&pd(k,l)){ans=(ans+dp[i][j][k][l])%MOD;continue;}\n if(next[i][0]<=n) dp[next[i][0]][j+1][k][l]=(dp[next[i][0]][j+1][k][l]+dp[i][j][k][l])%MOD;\n if(next[i][1]<=n) dp[next[i][1]][j][k+1][l]=(dp[next[i][1]][j][k+1][l]+dp[i][j][k][l])%MOD;\n if(next[i][2]<=n) dp[next[i][2]][j][k][l+1]=(dp[next[i][2]][j][k][l+1]+dp[i][j][k][l])%MOD;\n }\n printf(\"%d\",ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "ccee3424cdf8e1017f3547aebdbeda6b", "src_uid": "64fada10630906e052ff05f2afbf337e", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n// program by Mircea Rebengiuc\n// written for codeforces round 740D2\n// written on 2021.08.24\n\n#define MAXN 200000\n\nint psum[1 + MAXN + 1];\n\nint mod;\nint n;\n\nstatic inline int getSum( int l, int r ){\n return (psum[l] - psum[(r < n ? r : n) + 1] + mod) % mod;\n}\n\nint main(){\n int i, j, d;\n\n scanf(\"%d%d\", &n, &mod);\n psum[n] = 1;\n psum[n + 1] = 0;\n for( i = n - 1 ; i > 0 ; i-- ){\n psum[i] = getSum(i + 1, n);\n for( d = 2 ; i * d <= n ; d++ )\n psum[i] = (psum[i] + getSum(i * d, (i + 1) * d - 1)) % mod;\n\n psum[i] = (psum[i + 1] + psum[i]) % mod;\n }\n\n printf(\"%d\\n\", getSum(1, 1));\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fed8ab034fd7aef57f25e6cf432603fc", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\r\nlong long f[400000],s[400000];\r\nint main(){\r\n\tint n,m,i;\r\n\tscanf(\"%d%d\",&n,&m);\r\n\tf[1]=s[1]=1;\r\n\tfor(i=2;i<=n;i++){\r\n\t\tf[i]=s[i-1];\r\n\t\tint l=2,r=0;\r\n\t\tfor(;l<=i;l=r+1){\r\n\t\t\tr=i/(i/l);\r\n\t\t\tf[i]+=(r-l+1)*f[i/l];\r\n\t\t}\r\n\t\ts[i]=(f[i]+s[i-1])%m;\r\n\t}\r\n\r\n\tprintf(\"%d\\n\",f[n]%m);\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1f28a20748bfa2dd4687102ee1af68ab", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t4000000\n\nint main() {\n\tstatic int dp[N + 1], dq[N + 1], dr[N + 1];\n\tint n, md, i, j;\n\n\tscanf(\"%d%d\", &n, &md);\n\tfor (i = 1; i <= n; i++) {\n\t\tif ((dr[i] += dr[i - 1]) >= md)\n\t\t\tdr[i] -= md;\n\t\tif (i == 1)\n\t\t\tdp[i] = 1;\n\t\telse\n\t\t\tif ((dp[i] = dq[i - 1] + dr[i]) >= md)\n\t\t\t\tdp[i] -= md;\n\t\tif ((dq[i] = dp[i] + dq[i - 1]) >= md)\n\t\t\tdq[i] -= md;\n\t\tfor (j = 1; i * j <= n; j++) {\n\t\t\tif ((dr[i * j] += dp[i]) >= md)\n\t\t\t\tdr[i * j] -= md;\n\t\t\tif ((i + 1) * j <= n && (dr[(i + 1) * j] -= dp[i]) < 0)\n\t\t\t\tdr[(i + 1) * j] += md;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", dp[n]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1650446dbee8297b98bc6b627b32e002", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\ntypedef long long ll;\r\n\r\nll dp[200007][7], sum[200007][7];\r\n\r\nint main(){\r\n\tint n, m;\r\n\tscanf(\"%d %d\", &n, &m);\r\n\tfor (register int i = 2; i <= n; i++){\r\n\t\tint half_i = i / 2;\r\n\t\tdp[i][1] = (sum[i - 1][1] + sum[i - 1][2] + 1) % m;\r\n\t\tdp[i][2] = i - half_i;\r\n\t\tfor (register int j = 2, k; j <= half_i; j = k + 1){\r\n\t\t\tint ti = i / j;\r\n\t\t\tk = i / ti;\r\n\t\t\tdp[i][2] = (dp[i][2] + (dp[ti][1] + dp[ti][2]) * (k - j + 1) % m) % m;\r\n\t\t}\r\n\t\tsum[i][1] = (sum[i - 1][1] + dp[i][1]) % m;\r\n\t\tsum[i][2] = (sum[i - 1][2] + dp[i][2]) % m;\r\n\t}\r\n\tprintf(\"%lld\", (dp[n][1] + dp[n][2]) % m);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "84df11b1c6af9c7a12b19915ec31a283", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\n\nlong long MOD=(long long)(1e9+7);\n\nint main(){\n\tint n, m, i, prev, curr;\n\tlong long tab[2][2], res;\n\tscanf(\"%d %d\", &n, &m);\n\tcurr=1;\n\ttab[1][0]=2;\n\ttab[1][1]=0;\n\tfor(i=0;i\n\nlong long MOD=(long long)(1e9+7);\n\nint main(){\n\tint n, m, i, prev, curr;\n\tlong long tab[2][2], res;\n\tscanf(\"%d %d\", &n, &m);\n\tcurr=1;\n\ttab[1][0]=2;\n\ttab[1][1]=0;\n\tfor(i=0;i\n\nlong long MOD=(long long)1e9+7;\n\nint main(){\n\tint n, m, i, prev, curr;\n\tlong long tab[2][2], res;\n\tscanf(\"%d %d\", &n, &m);\n\tcurr=1;\n\ttab[1][0]=2;\n\ttab[1][1]=0;\n\tfor(i=0;i\n\n#define forin(i, start, end) for (auto (i) = (start); (i) != (end); ++(i))\n#define forup(i, end) forin((i), 0, (end))\n\nusing ll = long long;\n\nusing namespace std;\nll N, A, B;\nint main()\n{\n\tios::sync_with_stdio(false);\n\tcin >> N >> A >> B;\n\tstring bitstring;\n\tcin >> bitstring;\n\tll num_adults = 0;\n\tfor (char c : bitstring) {\n\t\tif (c == '1') num_adults++;\n\t}\n\tll mini = LLONG_MAX;\n\tforin (p, 1, num_adults + 1) {\n\t\tll child = N - p;\n\t\tll in_each = child / p;\n\t\tll left = child % p;\n\t\tll total = p * (A + B * in_each * in_each) + B * left * (2*in_each + 1);\n\t\tmini = min(mini, total);\n\t}\n\tcout << mini << endl;\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "334ad7d41fef4703210e5ecfb127dc01", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n//#include \n\n#include \n#include \n#include \nconst int MAXN = 100000;\n\nint n, m, d;\n\nstruct pair\n{\n\tint c;\n\tint w;\n}phys[MAXN], info[MAXN];\n\nuint64_t phys_pref_cost[MAXN], phys_pref_width[MAXN];\nuint64_t info_pref_cost[MAXN], info_pref_width[MAXN];\n\nuint64_t total_cost = 0;\n\nint comp (const void *a, const void *b)\n{\n\tconst struct pair * pa = (struct pair *)a;\n\tconst struct pair * pb = (struct pair *)b;\n\tif (pa->c > pb->c) return -1;\n\tif (pa->c < pb->c) return 1;\n\tif (pa->w < pb->w) return -1;\n\tif (pa->w > pb->w) return 1;\n\treturn 0;\n}\n\nint main()\n{\n\tint i, j;\n\tint phys_width_pos = 0;\n\tint info_width_pos = 0;\n\tscanf(\"%d %d %d\", &n, &m, &d);\n\tfor (i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d %d\", &phys[i].c, &phys[i].w);\n\t}\n\tfor (i = 0; i < m; ++i)\n\t{\n\t\tscanf(\"%d %d\", &info[i].c, &info[i].w);\n\t}\n\tqsort(phys, n, sizeof(phys[0]), comp);\n\tqsort(info, m, sizeof(info[0]), comp);\n\n\tphys_pref_cost[0] = phys[0].c;\n\tphys_pref_width[0] =phys[0].w;\n\tfor (i = 1; i < n; ++i)\n\t{\n\t\tphys_pref_cost[i] = phys_pref_cost[i - 1] + phys[i].c;\n\t\tphys_pref_width[i] = phys_pref_width[i - 1] + phys[i].w;\n\t}\n\tinfo_pref_cost[0] = info[0].c;\n\tinfo_pref_width[0] =info[0].w;\n\tfor (i = 1; i < m; ++i)\n\t{\n\t\tinfo_pref_cost[i] = info_pref_cost[i - 1] + info[i].c;\n\t\tinfo_pref_width[i] = info_pref_width[i - 1] + info[i].w;\n\t}\n\tif (phys[0].w + info[0].w > d)\n\t{\n\t\tprintf (\"0\\n\");\n\t\treturn 0;\n\t}\n\t{\n\t\tuint64_t max_width = d - info[0].w;\n\t\ti = 1;\n\t\twhile (i < n && phys_pref_width[i] <= max_width)\n\t\t{\n\t\t\t++i;\n\t\t}\n\t\tphys_width_pos = --i;\n\t\tif (total_cost < phys_pref_cost[i] + info[0].c)\n\t\t{\n\t\t\ttotal_cost = phys_pref_cost[i] + info[0].c;\n\t\t}\n\t}\n\t{\n\t\tuint64_t max_width = d - phys[0].w;\n\t\ti = 1;\n\t\twhile (i < m && info_pref_width[i] <= max_width)\n\t\t{\n\t\t\t++i;\n\t\t}\n\t\tinfo_width_pos = --i;\n\t\tif (total_cost < info_pref_cost[i]+ phys[0].c)\n\t\t{\n\t\t\ttotal_cost = info_pref_cost[i] + phys[0].c;\n\t\t}\n\t}\n\n\t{\n\t\tint c_info_pos = 1;\n\t\twhile(phys_width_pos &&\n\t\t\t info_pref_width[c_info_pos] +\n\t\t\t phys_pref_width[phys_width_pos] > d)\n\t\t{\n\t\t\t--phys_width_pos;\n\t\t}\n\t\twhile (phys_width_pos && c_info_pos < m)\n\t\t{\n\t\t\twhile (info_pref_width[c_info_pos] +\n\t\t\t\t phys_pref_width[phys_width_pos] <= d)\n\t\t\t{\n\t\t\t\t++c_info_pos;\n\t\t\t}\n\t\t\t--c_info_pos;\n\t\t\tif (info_pref_cost[c_info_pos] +\n\t\t\t\tphys_pref_cost[phys_width_pos] > total_cost)\n\t\t\t{\n\t\t\t\ttotal_cost = info_pref_cost[c_info_pos] +\n\t\t\t\t\t\t\t phys_pref_cost[phys_width_pos];\n\t\t\t}\n\t\t\t--phys_width_pos;\n\t\t}\n\t}\n\t{\n\t\tint c_phys_pos = 1;\n\t\twhile (info_width_pos &&\n\t\t\t (info_pref_width[info_width_pos] +\n\t\t\t\t\t\t\t\t phys_pref_width[c_phys_pos] > d))\n\t\t{\n\t\t\t--info_width_pos;\n\t\t}\n\t\twhile (info_width_pos && c_phys_pos < n)\n\t\t{\n\t\t\twhile (info_pref_width[info_width_pos] +\n\t\t\t\t phys_pref_width[c_phys_pos] <= d)\n\t\t\t{\n\t\t\t\t++c_phys_pos;\n\t\t\t}\n\t\t\t--c_phys_pos;\n\t\t\tif (info_pref_cost[info_width_pos] +\n\t\t\t\tphys_pref_cost[c_phys_pos] > total_cost)\n\t\t\t{\n\t\t\t\ttotal_cost = info_pref_cost[info_width_pos] +\n\t\t\t\t\t\t\t phys_pref_cost[c_phys_pos];\n\t\t\t}\n\t\t\t--info_width_pos;\n\t\t}\n\t}\n\tprintf (\"%I64d\\n\", total_cost);\n}\n\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "795f7efcab0b45244c65e2d1483154a5", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\n#define N 100*1000+7\n\nint a[N], A[N];\nint b[N], B[N];\nint ia[N], ib[N];\n\nint comp1 (const void * elem1, const void * elem2) \n{\n int f = a[*((int*)elem1)];\n int s = a[*((int*)elem2)];\n if (f == s)\n {\n int F = A[*((int*)elem1)];\n int S = A[*((int*)elem2)];\n if (F > S) return -1;\n if (F < S) return 1;\n return 0;\n }\n if (f > s) return 1;\n if (f < s) return -1;\n return 0;\n}\n\nint comp2 (const void * elem1, const void * elem2) \n{\n int f = b[*((int*)elem1)];\n int s = b[*((int*)elem2)];\n if (f == s)\n {\n int F = B[*((int*)elem1)];\n int S = B[*((int*)elem2)];\n if (F > S) return -1;\n if (F < S) return 1;\n return 0;\n }\n if (f > s) return 1;\n if (f < s) return -1;\n return 0;\n}\n\nvoid main()\n{\n int n, m, w;\n scanf(\"%d %d %d\", &n, &m, &w);\n for (int i=0; i=0; i--)\n {\n SUM += A[ia[i]];\n RES += a[ia[i]];\n while (p+1 < m && SUM + sum > w)\n sum -= B[ib[p]], res -= b[ib[p]], p++;\n if (SUM + sum <= w && ans < RES + res)\n ans = RES + res;\n }\n printf(\"%I64d\\n\", ans);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "cc24bac08570373879444216f16095bf", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define ll int64_t\n\n\nstruct pr\n{\n ll f, s;\n} a[100001], b[100001];\n\nint cmp(const void* p1, const void* p2)\n{\n ll d = - ((const struct pr*)p1)->f + ((const struct pr*)p2)->f;\n if (d) return d < 0 ? -1 : 1;\n return ((const struct pr*)p1)->s - ((const struct pr*)p2)->s > 0 ? 1 : -1;\n}\n\nint main()\n{\n int n, m; ll d;\n scanf(\"%d%d%I64d\", &n, &m, &d);\n for(int i = 0; i < n; ++i)\n {\n scanf(\"%I64d%I64d\", &(a[i].f), &(a[i].s));\n }\n for(int i = 0; i < m; ++i)\n {\n scanf(\"%I64d%I64d\", &(b[i].f), &(b[i].s));\n }\n //printf(\"%lld %lld %lld %lld\\n\", a[0].f, a[0].s, b[0].f, b[0].s);\n qsort(a, n, sizeof(struct pr), cmp);\n qsort(b, m, sizeof(struct pr), cmp);\n //printf(\"%lld %lld %lld %lld\\n\", a[0].f, a[0].s, b[0].f, b[0].s);\n for(int i = 1; i < n; ++i)\n {\n a[i].f += a[i-1].f;\n a[i].s += a[i-1].s;\n }\n for(int i = 1; i < m; ++i)\n {\n b[i].f += b[i-1].f;\n b[i].s += b[i-1].s;\n }\n int i = 0, j = 0;\n if (a[0].s + b[0].s > d)\n {\n printf(\"0\");\n return 0;\n }\n while(i < n && a[i].s + b[0].s <= d) ++i;\n ll ans = 0;\n //printf(\"%lld %lld %lld %lld\\n\", a[0].f, a[0].s, b[0].f, b[0].s);\n while(j < m && i >= 0)\n {\n if (a[i].s + b[j].s <= d)\n {\n if (a[i].f + b[j].f > ans) ans = a[i].f + b[j].f;\n ++j;\n }\n else --i;\n }\n printf(\"%I64d\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1bdb298191593f7f4a6a23e69944e15", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define MAXN 100100\n\nstruct cup {\n\tint w;\n\tint v;\n} phys[MAXN], inf[MAXN];\ntypedef struct cup cup;\n\nint cupcmp(const void *a, const void *b)\n{\n\treturn -((const cup *)a)->v + ((const cup *)b)->v;\n}\n\nint main()\n{\n\tint N, M, D;\n\tscanf(\"%d%d%d\", &N, &M, &D);\n\tfor (int i = 0; i < N; ++i) {\n\t\tscanf(\"%d%d\", &phys[i].v, &phys[i].w);\n\t}\n\tfor (int i = 0; i < M; ++i) {\n scanf(\"%d%d\", &inf[i].v, &inf[i].w);\n }\n\tqsort(phys, N, sizeof (phys[0]), cupcmp);\n\tqsort(inf, M, sizeof (inf[0]), cupcmp);\n int f = 0;\n int c = 0;\n long long sum = phys[0].v + inf[0].v;\n long long maxsum = sum;\n long long width = phys[0].w + inf[0].w;\n if (width > D) {\n\t printf(\"0\\n\");\n\t return 0;\n }\n for (f = 1; f < N; ++f) {\n\t if (phys[f].w + width > D) {\n\t\t break;\n\t } else {\n\t\t width += phys[f].w;\n\t\t sum += phys[f].v;\n\t\t maxsum = maxsum < sum ? sum : maxsum;\n\t }\n }\n f--;\n while (1) {\n\t if (c + 1 < M && width + inf[c + 1].w <= D) {\n\t\t c++;\n\t\t width += inf[c].w;\n\t\t sum += inf[c].v;\n maxsum = maxsum < sum ? sum : maxsum;\n\t } else if (f != 0) {\n\t\t width -= phys[f].w;\n\t\t sum -= phys[f].v;\n\t\t f--;\n maxsum = maxsum < sum ? sum : maxsum;\n\t } else {\n\t\t break;\n\t }\n }\n printf(\"%I64d\\n\", maxsum);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "70f1eb1abffc265d31baa41950f50360", "src_uid": "da573a39459087ed7c42f70bc1d0e8ff", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\n\nint slen, tlen, dar[202][202][402], soln[202][202][402];\nchar s[202], t[202], finale[2003];\n\nint dp(int i, int j, int k){\n if(i >= slen && j >= tlen)return k;\n if(dar[i][j][k] == -1){\n int req[2];\n req[0] = req[1] = 0;\n if(i < slen)req[s[i] == ')']++;\n if(j < tlen)req[t[j] == ')']++;\n int toret = 2003;\n if(req[1] && k){\n int got, newi, newj;\n newi = i + (i < slen && s[i] == ')');\n newj = j + (j < tlen && t[j] == ')');\n got = 1 + dp(newi, newj, k - 1);\n if(got < toret){\n\tsoln[i][j][k] = ')';\n\ttoret = got;\n }\n }\n if(req[0] || !k){\n int got, newi, newj;\n newi = i + (i < slen && s[i] == '(');\n newj = j + (j < tlen && t[j] == '(');\n got = 1 + dp(newi, newj, k + 1);\n if(got < toret){\n\tsoln[i][j][k] = '(';\n\ttoret = got;\n }\n }\n dar[i][j][k] = toret;\n }\n return dar[i][j][k];\n}\n\nint main(){\n scanf(\"%s\", s);\n for(slen = 0;s[slen] != '\\0';slen++);\n scanf(\"%s\", t);\n for(tlen = 0;t[tlen] != '\\0';tlen++);\n int i, j , k, idx, ans;\n for(i = 0;i <= slen;i++)for(j = 0;j <= tlen;j++)for(k = 0;k < 402;k++){\n\tdar[i][j][k] = -1;\n\tsoln[i][j][k] = 'X';\n };\n idx = 0;\n ans = dp(0, 0, 0);\n i = j = k = 0;\n while(soln[i][j][k] != 'X'){\n finale[idx++] = soln[i][j][k];\n if(soln[i][j][k] == '('){\n if(i < slen && s[i] == '(')i++;\n if(j < tlen && t[j] == '(')j++;\n k++;\n }\n else{\n if(i < slen && s[i] == ')')i++;\n if(j < tlen && t[j] == ')')j++;\n k--;\n }\n }\n while(idx < ans)finale[idx++] = ')';\n finale[ans] = '\\0';\n i = j = k = 0;\n printf(\"%s\\n\", finale);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "be10f4ab9e5a185839e6c09279ded2db", "src_uid": "cc222aab45b3ad3d0e71227592c883f1", "difficulty": 2200.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "58f5e06b9c346b05c6d76b055964f933", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "difficulty": 3200.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f5a8a247d1d16e2146ed3c2daec3ecbc", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "difficulty": 3200.0} {"lang": "GNU C11", "source_code": "#include \n#define N (10000000 + 5)\nint p, q, pi[N], rub[N], prime[N], mark[N];\nvoid make_prime(){\n\tfor (int i = 2; i < N; ++i){\n\t\tif (!mark[i]) prime[++prime[0]] = i;\n\t\tfor (int j = 1; j <= prime[0] && i * prime[j] < N; ++j){\n\t\t\tmark[i * prime[j]] = 1;\n\t\t\tif (i % prime[j] == 0) break;\n\t\t}\n\t}\n\tint ptr = 1;\n\tfor (int i = 2; i < N; ++i)\n\t\tif (prime[ptr] == i) pi[i] = pi[i - 1] + 1, ++ptr;\n\t\telse pi[i] = pi[i - 1];\n}\nint ispalin(const int x){\n\tint tmp1 = 0, tmp2 = x;\n\tfor (; tmp2; tmp2 /= 10) tmp1 = tmp1 * 10 + tmp2 % 10;\n\treturn x == tmp1;\n}\nvoid make_palin(){\n\tfor (int i = 1; i < N; ++i) rub[i] = rub[i - 1] + ispalin(i);\n}\nint main(int argc, char **argv){\n\tmake_prime();\n\tmake_palin();\n\tscanf(\"%d%d\", &p, &q);\n\tfor (int i = N - 1; i; --i)\n\t\tif (pi[i] <= (double)rub[i] * p / q){\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"Palindromic tree is better than splay tree\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d8bb176c523caf41629e21dcf5ff754", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define MAX (1L << 22)\n\nchar iscomp[MAX];\n\ntypedef long long ll;\nvoid\ndo_comp (void)\n{\n\tint i;\n\n\tiscomp[1] = 1;\n\n for (i = 2; i < MAX; i++) {\n int jx;\n int sx;\n\n if (iscomp[i]) {\n continue;\n }\n\n\t\tif (i * i > MAX) {\n\t\t\tbreak;\n\t\t}\n for (jx = i; (jx * i) < MAX ;jx++) {\n sx = jx * i;\n if (!iscomp[sx]) iscomp[sx] = 1;\n }\n }\n}\n\nint\nispal (int inp)\n{\n\tint\ti, j;\n\tchar\ttmp[32];\n\tint\tlen;\n\n\tsprintf(tmp, \"%d\", inp);\n\tlen = strlen(tmp)-1;\n\t\n\tfor (i = 0, j = len; i <= j; i++, --j) {\n\t\tif (tmp[i] != tmp[j]) {\n\t\t\treturn 0;\n\t\t}\n\t} \n\t\n\treturn 1;\n}\n\nint\nmain ()\n{\n\tint\ti,n = 1;\n\tint\tp, q;\n\tint\tnpr = 0, npa = 0;\n\tint\tans = 0;\n\n\tdo_comp();\n\tscanf (\"%d%d\", &p, &q);\n\n\tfor (i = 1; i < MAX; i++) {\n\t\tnpa += ispal (i);\n\t\tnpr += !(iscomp[i]);\n\n\t\tif ((ll)q * npr <= (ll)p * npa) {\n\t\t\tans = i;\n\t\t}\n\t}\n\tif (ans) {\n\t\tprintf (\"%d\\n\", ans);\n\t} else {\n\t\tputs (\"Palindromic tree is better than splay tree\");\n\t}\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f961a34163faeb1cb93526818c1e7128", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#define max 2000001\nint prime[max],pal[max],digits[10];\n\nint isPalindrome(int a){\n int temp=a,i=0;\n while(temp!=0){\n digits[i++]=temp%10;\n temp/=10;\n }\n int k=i-1;\n i=0;\n while(i\n#include \n#include \n\n#define SQR 1097\n#define MAX 1200000\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n#define chkbit(ar, i) (((ar[(i) >> 6]) & (1 << (((i) >> 1) & 31))))\n#define setbit(ar, i) (((ar[(i) >> 6]) |= (1 << (((i) >> 1) & 31))))\n#define isprime(x) (( (x) && ((x)&1) && (!chkbit(ar, (x)))) || ((x) == 2))\n\nchar str[12];\nlong long p, q;\nunsigned int ar[(MAX >> 6) + 5] = {0};\nint m = 0, counter[MAX] = {0}, P[12010];\n\nvoid Sieve(){\n int i, j, k;\n setbit(ar, 0), setbit(ar, 1);\n\n for (i = 3; i < SQR; i++, i++){\n if (!chkbit(ar, i)){\n k = i << 1;\n for (j = (i * i); j < MAX; j += k) setbit(ar, j);\n }\n }\n\n k = 0, counter[2] = ++k;\n for (i = 3; (i + 1) < MAX; i++, i++){\n if (isprime(i)) k++;\n counter[i] = counter[i + 1] = k;\n }\n}\n\nvoid backtrack(int i, int j){\n if (i > j){\n int x = atoi(str);\n if (x < MAX) P[m++] = x;\n return;\n }\n\n int k;\n for (k = 0; k < 10; k++){\n if (!i && !k) continue;\n str[i] = str[j] = k + 48;\n backtrack(i + 1, j - 1);\n }\n}\n\nvoid Generate(){\n m = 0;\n int i, j;\n for (i = 1; i <= 7; i++){\n str[i] = 0;\n backtrack(0, i - 1);\n }\n}\n\nbool Check(int n, int i){\n long long x = q * counter[n];\n long long y = p * (i + 1);\n return (x <= y);\n}\n\nint main(){\n Sieve();\n Generate();\n int n, i, j, low, high, mid, res;\n\n while (scanf(\"%I64d %I64d\", &p, &q) != EOF){\n\n res = -1;\n for (i = m - 2; i >= 0; i--){\n if (Check(P[i], i)){\n low = P[i], high = P[i + 1] - 1;\n\n while ((low + 1) < high){\n mid = (low + high) >> 1;\n if (Check(mid, i)) low = mid;\n else high = mid;\n }\n\n if (Check(high, i)) res = high;\n else if (Check(low, i)) res = low;\n if (res != -1) break;\n }\n }\n\n if (res == -1) puts(\"Palindromic tree is better than splay tree\");\n else printf(\"%d\\n\", res);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6c3098d6386aa1196f636b09da296d0", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n#include \n\n#define MAX (1L << 22)\n\nchar iscomp[MAX];\n\nvoid\ndo_comp (void)\n{\n\tint i;\n\n\tiscomp[1] = 1;\n\n for (i = 2; i < MAX; i++) {\n int jx;\n int sx;\n\n if (iscomp[i]) {\n continue;\n }\n\n\t\tif (i * i > MAX) {\n\t\t\tbreak;\n\t\t}\n for (jx = i; (jx * i) < MAX ;jx++) {\n sx = jx * i;\n if (!iscomp[sx]) iscomp[sx] = 1;\n }\n }\n}\n\nint\nispal (int inp)\n{\n\tint\ti, j;\n\tchar\ttmp[32];\n\tint\tlen;\n\n\tsprintf(tmp, \"%d\", inp);\n\tlen = strlen(tmp)-1;\n\t\n\tfor (i = 0, j = len; i <= j; i++, --j) {\n\t\tif (tmp[i] != tmp[j]) {\n\t\t\treturn 0;\n\t\t}\n\t} \n\t\n\treturn 1;\n}\n\nint\nmain ()\n{\n\tint\ti,n = 1;\n\tint\tp, q;\n\tint\tnpr = 0, npa = 0;\n\tint\tans = 0;\n\n\tdo_comp();\n\tscanf (\"%d%d\", &p, &q);\n\n\tfor (i = 1; i < MAX; i++) {\n\t\tnpa += ispal (i);\n\t\tnpr += !(iscomp[i]);\n\n\t\tif (q * npr <= p * npa) {\n\t\t\tans = i;\n\t\t}\n\t}\n\tif (ans) {\n\t\tprintf (\"%d\\n\", ans);\n\t} else {\n\t\tputs (\"Palindromic tree is better than splay tree\");\n\t}\n\t\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4ac2b30165097457e4a0f9590801cc45", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "//set many funcs template\n//Ver.20190820\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#define A(x) (x > 0 ? x : -x)\nlong long dC(long long a)\n{\n\tlong long r = 0;\n\ta = A(a);\n\twhile (a)\n\t{\n\t\ta -= a & -a;\n\t\tr++;\n\t}\n\treturn r;\n}\nint main()\n{\n\tlong long t;\n\tlong long n, p;\n\tlong long B = 1;\n\tlong long temp;\n\tscanf(\"%I64d %I64d\", &n, &p);\n\tfor (t = 1; B + t * p <= n; t++)\n\t{\n\t\ttemp = n - t * p;\n\t\tif (t >= dC(temp))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tB++;\n\t\tB <<= 1;\n\t\tB--;\n\t}\n\tif (B + t * p <= n)\n\t{\n\t\tprintf(\"%I64d\", t);\n\t}\n\telse\n\t{\n\t\tprintf(\"-1\");\n\t}\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1d17175aa9cc96cf3db3c2b3ae9c361f", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\n\nint bitc(int x){\n int toret;\n for(toret = 0;x;x&=(x - 1))toret++;\n return toret;\n}\n\nint main(){\n int n, p;\n scanf(\"%d %d\", &n, &p);\n int i, ans;\n ans = -1;\n for(i = 1;i < 900;i++){\n int rem = n - i*p;\n if(rem >= i && bitc(rem) <= i) {ans = i;break;}\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b3b73ea02d2e655d90008145c000ce1f", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include\nint main()\n{\n long long int n,i,k=0,x,d,r,p;\n scanf(\"%lld %lld\",&n,&p);\n i=1;\n while(k==0)\n { \n d=0;\n \n \n x=n-i*p;\n if(x<=0)\n {printf(\"-1\");\n break;\n }\n else\n {\n while(x!=0)\n {\n r=x%2;\n if(r==1)\n {d++;}\n if(d>i)\n {\n break;\n }\n x=x/2;\n }\n x=n-i*p;\n if(d<=i&&i<=x)\n {\n printf(\"%lld\",i);\n break;\n }\n }\n i++;\n }\n return 0;\n}\n \n \n \n \n \n \n \n ", "lang_cluster": "C", "compilation_error": false, "code_uid": "790fbaab02bfb30f4eae4cd1785f64bc", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#define l long long\nl n;\nc;\nf(x) {\n\tfor (c = 0; x; c++) x ^= x & -x;\n\treturn c;\n}\nmain(k, i) {\n\tscanf(\"%lld%d\", &n, &k);\n\tfor (i = 1; i <= 1.1e6; i++)\n\t\tif (n - k * i >= i && f(n - k * i) <= i) return !printf(\"%lld\", i);\n\tputs(\"-1\");\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "fa901e0b8cb50348f9acb316bfbf11eb", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "difficulty": 1600.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define N_LIMIT 1000003 // 1e6+3\ntypedef long long ll;\n\n\nll a_pows[N_LIMIT];\n\nll inv(ll x, ll p)\n{\n ll result = 1, y;\n //printf(\"inverse of %lld is \", x);\n while (x != 1)\n {\n y = (x+p)/x;\n result *= y;\n result %= p;\n x = (x*y)%p;\n }\n //printf(\"%lld\\n\", result);\n return result;\n}\n\nint main(int argc, char *argv)\n{\n ll a, b, p, x, d = 1;\n \n ll n, m, y, z;\n ll pdi;\n ll count;\n int i;\n scanf(\"%lld %lld %lld %lld\", &a, &b, &p, &x);\n a_pows[0] = 1;\n a_pows[1] = a;\n while (a != 1)\n {\n d++;\n a = (a*a_pows[1]) % p;\n a_pows[d] = a;\n }\n //printf(\"d: %lld\\n\", d);\n count = 0;\n pdi = inv(p-d, p);\n for (m=0; m= z*d+m)\n {\n count += 1;\n }\n }\n printf(\"%lld\\n\", count);\n \n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c96aa3ae4fb72b4d8e03de1360befe14", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define N_LIMIT 1000003 // 1e6+3\ntypedef long long ll;\n\n\nll a_pows[N_LIMIT];\n\nll inv(ll x, ll p)\n{\n ll result = 1, y;\n //printf(\"inverse of %lld is \", x);\n while (x != 1)\n {\n y = (x+p)/x;\n result *= y;\n x = (x*y)%p;\n }\n //printf(\"%lld\\n\", result);\n return result;\n}\n\nint main(int argc, char *argv)\n{\n ll a, b, p, x, d = 1;\n \n ll n, m, y, z;\n ll pdi;\n ll count;\n int i;\n scanf(\"%lld %lld %lld %lld\", &a, &b, &p, &x);\n a_pows[0] = 1;\n a_pows[1] = a;\n while (a != 1)\n {\n d++;\n a = (a*a_pows[1]) % p;\n a_pows[d] = a;\n }\n //printf(\"d: %lld\\n\", d);\n count = 0;\n pdi = inv(p-d, p);\n for (m=0; m= z*d+m)\n {\n count += 1;\n }\n }\n printf(\"%lld\\n\", count);\n \n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9a0bd4cf4eec290ed9fb0d9ee8234bc1", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "difficulty": 2100.0} {"lang": "GNU C", "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\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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9d8fcdb9f1faf727ed5d43b60122074e", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "5cd5bce5e39849c3ea8378ea9fa3e3ab", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b99b6dc3702c1c0cb3586a864f2b3bfe", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700.0} {"lang": "GNU C11", "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\nint main (void)\n{\n int *a;\n int b,i,k=100,x=0;\n scanf(\"%d\",&b);\n a = malloc(b*sizeof(int));\n for(i=0;ib/2)\n printf(\"Bob\\n\");\n else\n printf(\"Alice\\n\");\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "dad9ff8e6f1c83ff6234e5f3a835cc13", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\nint main(){\n int n, i;\n scanf(\"%d\", &n);\n int a[n], j;\n for(i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n\n/*\n for(i = 0; i < n - 1; i++){\n for(j = i + 1; j < n; j++){\n if(a[i] < a[j]){\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }\n }\n if(a[0] == a[n/2])\n printf(\"Bob\");\n else\n printf(\"Alice\");\n return 0;\n}\n*/\n int count = 0;\n j = a[0];\n for(i = 0; i < n; i++){\n if(a[i] < j)\n j = a[i];\n }\n for(i = 0; i < n; i++){\n if(a[i] == j)\n count++;\n }\n if(count <= (n/2))\n printf(\"Alice\");\n else\n printf(\"Bob\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e88a87444e1046d2e6b6910157583fd1", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \nint main(void) \n{\n int *a;\n int b,i,k=100,x=0;\n scanf(\"%d\",&b);\n a = malloc(b*sizeof(int));\n for(i=0;ib/2)printf(\"Bob\\n\");\n else printf(\"Alice\\n\");\n\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "604312d71eae39a8c10e0cf1817ffbbe", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main (void)\n{\n\tint pilas, i;\n\tint *numeros;\n\tscanf(\"%d\",&pilas);\n\tnumeros = (int*)malloc(pilas * sizeof(int));\n\tfor(i=0;i\n#include \n#include \n\n#define N\t24\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 int cc[N], ss[N], aa[1 << N - 1], dp[1 << N - 1];\n\tint n, m, i, j, k, b;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &cc[i]);\n\tqsort(cc, n, sizeof *cc, compare);\n\tk = 0;\n\twhile (k < n && cc[k] == 1)\n\t\tk++;\n\tm = n - k;\n\tfor (i = k; i < n; i++)\n\t\tss[i - k] = cc[i] - 1;\n\tfor (j = 1; j < m; j++)\n\t\tss[j] += ss[j - 1];\n\tn--;\n\tfor (b = 1; b < 1 << n; b++) {\n\t\ti = 0;\n\t\twhile ((b & 1 << i) == 0)\n\t\t\ti++;\n\t\taa[b] = aa[b ^ 1 << i] + cc[i];\n\t}\n\tmemset(dp, -1, (1 << n) * sizeof *dp), dp[0] = 0;\n\tfor (b = 0; b < 1 << n; b++) {\n\t\tj = dp[b];\n\t\tif (j == -1 || j == m)\n\t\t\tcontinue;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif ((b & 1 << i) == 0) {\n\t\t\t\tint b_ = b ^ 1 << i;\n\n\t\t\t\tif (aa[b_] < ss[j])\n\t\t\t\t\tdp[b_] = j;\n\t\t\t\telse if (aa[b_] == ss[j] && aa[b] > (j == 0 ? 0 : ss[j - 1]))\n\t\t\t\t\tdp[b_] = j + 1;\n\t\t\t}\n\t}\n\tprintf(dp[(1 << n) - 1] == m ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "674378664d05b525fa2d4663f893816c", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* upsolve using zigzag */\n/* https://codeforces.com/blog/entry/73563 */\n#include \n#include \n\n#define N\t1024\n\nint query(int i) {\n\tif (i == -1) {\n\t\tprintf(\"R\\n\"), fflush(stdout);\n\t\treturn 0;\n\t} else {\n\t\tstatic char s[2];\n\n\t\tprintf(\"? %d\\n\", i + 1), fflush(stdout);\n\t\tscanf(\"%s\", s);\n\t\treturn s[0] == 'N';\n\t}\n}\n\nint main() {\n\tstatic char alive[N];\n\tint n, k, m, g, h, i, ans;\n\n\tscanf(\"%d%d\", &n, &k), m = n / k;\n\tmemset(alive, 1, n * sizeof *alive);\n\tfor (g = 0; g < m; g++) {\n\t\tquery(-1);\n\t\tfor (h = 0; h < m; h++) {\n\t\t\tint g_ = (g + (h % 2 == 0 ? h / 2 : m - (h + 1) / 2)) % m, l = g_ * k, r = (g_ + 1) * k;\n\n\t\t\tfor (i = l; i < r; i++)\n\t\t\t\tif (alive[i] && !query(i))\n\t\t\t\t\talive[i] = 0;\n\t\t}\n\t}\n\tans = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (alive[i])\n\t\t\tans++;\n\tprintf(\"! %d\\n\", ans), fflush(stdout);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f29288528d29ade25ab0b2a51a240059", "src_uid": "11ad68b4375456733526e74e72606d8d", "difficulty": 2800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 2000010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nshort len[MAX];\nchar mu[MAX], flag[MAX];\nint prime[MAX], dp[MAX], sum[MAX], power[MAX], L[MAX], *divisors[MAX];\n\nint expo(int a, int b){\n int res = 1;\n\n while (b){\n if (b & 1) res = (long long)res * a % MOD;\n a = (long long)a * a % MOD;\n b >>= 1;\n }\n return res;\n}\n\nvoid mobius(){\n mu[1] = 1;\n int i, j, k, p = 0;\n\n for (i = 2; i < MAX; i++){\n if (!flag[i]) mu[i] = -1, prime[p++] = i;\n for (j = 0; j < p && (k = i * prime[j]) < MAX; j++){\n\n flag[k] = true;\n if (!(i % prime[j])){\n mu[k] = 0;\n break;\n }\n else mu[k] -= mu[i];\n }\n }\n for (i = 1; i < MAX; i++) sum[i] = sum[i - 1] + mu[i];\n}\n\nvoid generate(){\n mobius();\n int i, j, k, c, d, x;\n\n len[0] = len[1] = L[0] = L[1] = 1;\n for (i = 4; i < MAX; i++, i++) len[i] = 2;\n\n for (i = 3; (i * i) < MAX; i += 2){\n if (!len[i]){\n for (j = (i * i), d = i << 1; j < MAX; j += d){\n if (!len[j]) len[j] = i;\n }\n }\n }\n\n for (i = 2; i < MAX; i++){\n if (!len[i]) L[i] = i;\n else{\n L[i] = len[i];\n x = L[i /len[i]];\n if (x > L[i]) L[i] = x;\n }\n }\n\n divisors[1] = (int *) malloc(sizeof(int));\n divisors[1][0] = 1, len[1] = 1;\n\n for (i = 2; i < MAX; i++){\n c = 0, k = i;\n while (k > 1 && L[k] == L[i]){\n c++;\n k /= L[k];\n }\n\n len[i] = (c + 1) * len[k];\n divisors[i] = (int *) malloc(sizeof(int) * len[i]);\n\n for (x = 1, j = 0, len[i] = 0; j <= c; j++, x *= L[i]){\n for (d = 0; d < len[k]; d++){\n divisors[i][len[i]++] = divisors[k][d] * x;\n }\n }\n }\n}\n\nint count(int n, int m){\n int z, y, x = m;\n long long v, res = 0;\n\n while (x >= 1){\n y = m / x, z = m / (y + 1);\n v = (long long)power[y] * (sum[x] - sum[z]);\n x = z, res += v;\n }\n\n res = (res % MOD + MOD) % MOD;\n return res;\n}\n\nint solve(int n, int k){\n long long res = 0;\n int i, j, v, m, x, y, z;\n for (i = 0; i < MAX; i++) power[i] = expo(i, n);\n\n dp[1] = count(n, 1);\n for (m = 2; m <= k; m++){\n res = dp[m - 1];\n for (j = 0; j < len[m]; j++){\n x = 0, y = 0, z = 0;\n x = divisors[m][j], v = m / x;\n y = power[v] * mu[x];\n z = power[v - 1] * mu[x];\n res = res + y - z;\n }\n dp[m] = ((res % MOD) + MOD) % MOD;\n }\n\n for (m = 1, res = 0; m <= k; m++) res += (m ^ dp[m]);\n return res % MOD;\n}\n\nint main(){\n generate();\n int n, k, res;\n\n while (scanf(\"%d %d\", &n, &k) != EOF){\n printf(\"%d\\n\", solve(n, k));\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "52d0dbef68cf4d199fb78690c219e5c2", "src_uid": "122c08aa91c9a9d6a151ee6e3d0662fa", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define K\t2000000\n#define MD\t1000000007\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 main() {\n\tstatic int cc[K + 1], pp[K + 1], dd[K + 1];\n\tint n, k, a, a2, b, i, ans;\n\t\n\tscanf(\"%d%d\", &n, &k);\n\tfor (a = 2; a <= k; a++) {\n\t\tif (cc[a])\n\t\t\tcontinue;\n\t\tfor (b = a; b <= k; b += a)\n\t\t\tcc[b]++;\n\t}\n\tfor (a = 2; (a2 = a * a) <= k; a++)\n\t\tfor (b = a2; b <= k; b += a2)\n\t\t\tcc[b] = 0;\n\tfor (i = 1; i <= k; i++)\n\t\tpp[i] = power(i, n);\n\tfor (a = 2; a <= k; a++) {\n\t\tif (cc[a] == 0)\n\t\t\tcontinue;\n\t\tfor (i = 1; i * a <= k; i++) {\n\t\t\tint l = i * a, r = (i + 1) * a;\n\t\t\tint p = cc[a] % 2 == 0 ? pp[i] : -pp[i];\n\n\t\t\tdd[l] = (dd[l] + p) % MD;\n\t\t\tif (r <= k)\n\t\t\t\tdd[r] = (dd[r] - p) % MD;\n\t\t}\n\t}\n\tans = 0;\n\tfor (i = 1; i <= k; i++) {\n\t\tint x;\n\n\t\tdd[i] = (dd[i] + dd[i - 1]) % MD;\n\t\tx = (pp[i] + dd[i]) % MD;\n\t\tif (x < 0)\n\t\t\tx += MD;\n\t\tans = (ans + (x ^ i)) % MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bd89fdca705c610a151a788c6657eab6", "src_uid": "122c08aa91c9a9d6a151ee6e3d0662fa", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 2000010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nshort len[MAX];\nchar mu[MAX], flag[MAX];\nint prime[MAX], dp[MAX], sum[MAX], power[MAX], L[MAX], *divisors[MAX];\n\nint expo(int a, int b){\n int res = 1;\n\n while (b){\n if (b & 1) res = (long long)res * a % MOD;\n a = (long long)a * a % MOD;\n b >>= 1;\n }\n return res;\n}\n\nvoid mobius(){\n mu[1] = 1;\n int i, j, k, p = 0;\n\n for (i = 2; i < MAX; i++){\n if (!flag[i]) mu[i] = -1, prime[p++] = i;\n for (j = 0; j < p && (k = i * prime[j]) < MAX; j++){\n\n flag[k] = true;\n if (!(i % prime[j])){\n mu[k] = 0;\n break;\n }\n else mu[k] -= mu[i];\n }\n }\n for (i = 1; i < MAX; i++) sum[i] = sum[i - 1] + mu[i];\n}\n\nvoid generate(){\n mobius();\n int i, j, k, c, d, x;\n\n len[0] = len[1] = L[0] = L[1] = 1;\n for (i = 4; i < MAX; i++, i++) len[i] = 2;\n\n for (i = 3; (i * i) < MAX; i += 2){\n if (!len[i]){\n for (j = (i * i), d = i << 1; j < MAX; j += d){\n if (!len[j]) len[j] = i;\n }\n }\n }\n\n for (i = 2; i < MAX; i++){\n if (!len[i]) L[i] = i;\n else{\n L[i] = len[i];\n x = L[i /len[i]];\n if (x > L[i]) L[i] = x;\n }\n }\n\n divisors[1] = (int *) malloc(sizeof(int));\n divisors[1][0] = 1, len[1] = 1;\n\n for (i = 2; i < MAX; i++){\n c = 0, k = i;\n while (k > 1 && L[k] == L[i]){\n c++;\n k /= L[k];\n }\n\n len[i] = (c + 1) * len[k];\n divisors[i] = (int *) malloc(sizeof(int) * len[i]);\n\n for (x = 1, j = 0, len[i] = 0; j <= c; j++, x *= L[i]){\n for (d = 0; d < len[k]; d++){\n divisors[i][len[i]++] = divisors[k][d] * x;\n }\n }\n }\n}\n\nint count(int n, int m){\n int z, y, x = m;\n long long v, res = 0;\n\n while (x >= 1){\n y = m / x, z = m / (y + 1);\n v = (long long)power[y] * (sum[x] - sum[z]);\n x = z, res += v;\n }\n\n res = (res % MOD + MOD) % MOD;\n return res;\n}\n\nint solve(int n, int k){\n long long res = 0;\n int i, j, v, m, x, y, z;\n for (i = 0; i < MAX; i++) power[i] = expo(i, n);\n\n dp[1] = count(n, 1);\n for (m = 2; m <= k; m++){\n res = dp[m - 1];\n for (j = 0; j < len[m]; j++){\n x = 0, y = 0, z = 0;\n x = divisors[m][j], v = m / x;\n y = power[v] * mu[x];\n z = power[v - 1] * mu[x];\n res = res + y - z;\n }\n dp[m] = ((res % MOD) + MOD) % MOD;\n }\n\n for (m = 1, res = 0; m <= k; m++) res += (m ^ dp[m]);\n return res % MOD;\n}\n\nint main(){\n generate();\n int n, k, res;\n\n while (scanf(\"%d %d\", &n, &k) != EOF){\n printf(\"%d\\n\", solve(n, k));\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "85520d9c2b0566cfe6c97ffda67a56e8", "src_uid": "122c08aa91c9a9d6a151ee6e3d0662fa", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include\n\n#define MIN(x,y) (((x)<(y))?(x):(y))\n\nstruct{\n short com;\n short flg[3];\n short num;\n short bef[199];\n}game[200]={{0}};\n\nint chk_clear(int k,int f);\n\nint main(void){\n int i,j,k,in,n,room;\n int count[3]={0},cleard[3]={0};\n\n scanf(\"%d%*c\",&n);\n for(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\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "e623b435fd622ab76a087a5f92e503bb", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n\nint min(int a, int b)\n{\n if (a < b) {\n return a;\n } else {\n return b;\n }\n}\n\nint dp[360361];\n\nint main()\n{\n long long a, b, sum = 0;\n int k, p = 1, i, j;\n \n scanf(\"%I64d %I64d %d\", &a, &b, &k);\n \n if (k >= 8) {\n p *= 8;\n } else if (k >= 4) {\n p *= 4;\n } else {\n p *= 2;\n }\n \n if (k >= 9) {\n p *= 9;\n } else if (k >= 3) {\n p *= 3;\n }\n \n if (k >= 5) p *= 5;\n if (k >= 7) p *= 7;\n if (k >= 11) p *= 11;\n if (k >= 13) p *= 13;\n \n dp[0] = 0;\n \n for (i = 1; i <= p; i++) {\n dp[i] = dp[i - 1] + 1;\n \n for (j = 2; j <= k; j++) {\n int x = i % j;\n \n if (x > 0) dp[i] = min(dp[i - x] + 1, dp[i]);\n }\n }\n \n if (a / p > b / p) {\n sum += dp[a % p];\n a = a / p * p;\n \n sum += (a / p - b / p - 1) * dp[p];\n a = b / p * p + p;\n }\n \n for (i = 0; i <= p; i++) dp[i] = 1e9;\n \n if (a % p == 0) {\n if (a == b) {\n printf(\"%I64d\\n\", sum);\n \n return 0;\n }\n \n dp[p] = 0;\n } else {\n dp[a % p] = 0;\n }\n \n for (i = p; i >= 0; i--) {\n if (dp[i] == 1e9) continue;\n \n if (i == b % p) {\n printf(\"%I64d\\n\", sum + dp[i]);\n \n return 0;\n }\n \n dp[i - 1] = min(dp[i - 1], dp[i] + 1);\n \n for (j = 2; j <= k; j++) {\n int x = i % j;\n \n if (x > 0) dp[i - x] = min(dp[i - x], dp[i] + 1);\n }\n }\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "0c5638ca3dd9ae1bdfd396f35f5cf3ea", "src_uid": "bd599d76c83cc1f30c1349ffb51b4273", "difficulty": 2000.0} {"lang": "GNU C", "source_code": "#include \n\nint min(int a, int b)\n{\n if (a < b) {\n return a;\n } else {\n return b;\n }\n}\n\nint dp[360361];\n\nint main()\n{\n long long a, b, sum = 0;\n int k, p = 1, i, j;\n \n scanf(\"%I64d %I64d %d\", &a, &b, &k);\n \n if (k >= 8) {\n p *= 8;\n } else if (k >= 4) {\n p *= 4;\n } else {\n p *= 2;\n }\n \n if (k >= 9) {\n p *= 9;\n } else if (k >= 3) {\n p *= 3;\n }\n \n if (k >= 5) p *= 5;\n if (k >= 7) p *= 7;\n if (k >= 11) p *= 11;\n if (k >= 13) p *= 13;\n \n dp[0] = 0;\n \n for (i = 1; i <= p; i++) {\n dp[i] = dp[i - 1] + 1;\n \n for (j = 2; j <= k; j++) {\n int x = i % j;\n \n if (x > 0) dp[i] = min(dp[i - x] + 1, dp[i]);\n }\n }\n \n if (a / p > b / p) {\n sum += dp[a % p];\n a = a / p * p;\n \n sum += (a / p - b / p - 1) * dp[p];\n a = b / p * p + p;\n }\n \n for (i = 0; i <= p; i++) dp[i] = 1e9;\n \n if (a % p == 0) {\n if (a == b) {\n printf(\"%I64d\\n\", sum);\n \n return 0;\n }\n \n dp[p] = 0;\n } else {\n dp[a % p] = 0;\n }\n \n for (i = p; i >= 0; i--) {\n if (dp[i] == 1e9) continue;\n \n if (i == b % p) {\n printf(\"%I64d\\n\", sum + dp[i]);\n \n return 0;\n }\n \n dp[i - 1] = min(dp[i - 1], dp[i] + 1);\n \n for (j = 2; j <= k; j++) {\n int x = i % j;\n \n if (x > 0) dp[i - x] = min(dp[i - x], dp[i] + 1);\n }\n }\n \n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "62248443eb55e02a63e1b7c3980c5a3f", "src_uid": "bd599d76c83cc1f30c1349ffb51b4273", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \"stdbool.h\"\n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"ctype.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#define PI 3.14159265358979323846264338327950288\n#define ll long long\n#define MOD 1000000007\n#define N 1000010\n#define MAX1 1000001\n#define rep(i,n) for (int i=0; ib?a:b;}\nint min(int a,int b) {return ab?a:b;}\n\n\nll n, k, prime[N], v[N], m;\n\n// euler function\nll f(ll n) {\n if (n == 1) return 1;\n ll s = n;\n for (int i=0; i 1) s = s/n*(n-1);\n return s;\n}\n\nll F(ll k, ll n) {\n if (!(k & 1)) k--;\n if (k == 1) return f(n);\n return f(F(k-1, n));\n}\n\n\nvoid primes(int n) {\n for (int i = 2; i <= n; i++) {\n if (!v[i]) {\n v[i] = i;\n prime[m++] = i;\n }\n for (int j = 0; j < m; j++) {\n if (prime[j] > v[i] || prime[j]*i > n) break;\n v[i * prime[j]] = prime[j];\n }\n }\n}\n\nint main() {\n scanf(\"%lld %lld\", &n, &k);\n primes((int) sqrtl(n)+1);\n printf(\"%lld\\n\", F(k, n) % MOD);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f85e314db32e0916a738aa8f6a10549b", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \"stdbool.h\"\n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"ctype.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#define PI 3.14159265358979323846264338327950288\n#define ll long long\n#define MOD 1000000007\n#define N 1000010\n#define MAX1 1000001\n#define rep(i,n) for (int i=0; ib?a:b;}\nint min(int a,int b) {return ab?a:b;}\n\n\nll n, k, prime[N], v[N], m;\n\n// euler function\nll f(ll n) {\n if (n == 1) return 1;\n ll s = n;\n for (int i=0; i 1) s--;\n return s;\n}\n\nll F(ll k, ll n) {\n if (!(k & 1)) k--;\n if (k == 1) return f(n);\n return f(F(k-1, n));\n}\n\n\nvoid primes(int n) {\n for (int i = 2; i <= n; i++) {\n if (!v[i]) {\n v[i] = i;\n prime[m++] = i;\n }\n for (int j = 0; j < m; j++) {\n if (prime[j] > v[i] || prime[j]*i > n) break;\n v[i * prime[j]] = prime[j];\n }\n }\n}\n\nint main() {\n scanf(\"%lld %lld\", &n, &k);\n primes((int) sqrtl(n)+1);\n printf(\"%lld\\n\", F(k, n) % MOD);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c6fa09b56995105b5d526131bb212816", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \"stdbool.h\"\n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"ctype.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#define PI 3.14159265358979323846264338327950288\n#define ll long long\n#define MOD 1000000007\n#define N 1000010\n#define MAX1 1000001\n#define rep(i,n) for (int i=0; ib?a:b;}\nint min(int a,int b) {return ab?a:b;}\n\n\nll n, k, prime[N], v[N], m;\n\n// euler function\nll f(ll n) {\n if (n == 1) return 1;\n ll s = n;\n for (int i=0; i 1) s = s/n*(n-1);\n return s;\n}\n\nll F(ll k, ll n) {\n ll s = n;\n while ((k-=2)>0) s = f(s);\n return s;\n}\n\n\nvoid primes(int n) {\n for (int i = 2; i <= n; i++) {\n if (!v[i]) {\n v[i] = i;\n prime[m++] = i;\n }\n for (int j = 0; j < m; j++) {\n if (prime[j] > v[i] || prime[j]*i > n) break;\n v[i * prime[j]] = prime[j];\n }\n }\n}\n\nint main() {\n scanf(\"%lld %lld\", &n, &k);\n primes((int) sqrtl(n)+1);\n printf(\"%lld\\n\", F(k, n) % MOD);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7138a6b405d793c7f2c9949c31399338", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n\n#define MOD\t((long long) 1e9 + 7)\n\nlong long totient(long long n) {\n\tlong long p, x;\n\n\tx = n;\n\tfor (p = 2; p * p <= n; p++)\n\t\tif (n % p == 0) {\n\t\t\tx = x / p * (p - 1);\n\t\t\twhile (n % p == 0)\n\t\t\t\tn /= p;\n\t\t}\n\tif (n > 1)\n\t\tx = x / n * (n - 1);\n\treturn x;\n}\n\nint main() {\n\tlong long n, k;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tk = (k + 1) / 2;\n\twhile (n > 1 && k > 0) {\n\t\tn = totient(n);\n\t\tk--;\n\t}\n\tprintf(\"%lld\\n\", n % MOD);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "90b8fb45975e4a057795fb8c9a4e1e0f", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \"stdbool.h\"\n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"ctype.h\"\n#include \"stdlib.h\"\n#include \"math.h\"\n\n#define PI 3.14159265358979323846264338327950288\n#define ll long long\n#define MOD 1000000007\n#define N 1000010\n#define MAX1 1000001\n#define rep(i,n) for (int i=0; ib?a:b;}\nint min(int a,int b) {return ab?a:b;}\n\n\nll n, k, prime[N], v[N], m;\n\n// euler function\nll f(ll n) {\n if (n == 1) return 1;\n ll s = n;\n for (int i=0; i 1) s = s/n*(n-1);\n return s;\n}\n\nll F(ll k, ll n) {\n ll s = n;\n while (k>0 && s>1) s = f(s), k-=2;\n return s;\n}\n\n\nvoid primes(int n) {\n for (int i = 2; i <= n; i++) {\n if (!v[i]) {\n v[i] = i;\n prime[m++] = i;\n }\n for (int j = 0; j < m; j++) {\n if (prime[j] > v[i] || prime[j]*i > n) break;\n v[i * prime[j]] = prime[j];\n }\n }\n}\n\nint main() {\n scanf(\"%lld %lld\", &n, &k);\n primes((int) sqrtl(n)+1);\n printf(\"%lld\\n\", F(k, n) % MOD);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7774ecd95a99e3df86c9702566dade0d", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "27c4170e63e05bd1089791a6c2450ad6", "src_uid": "6bf798edef30db7d0ce2130e40084e6b", "difficulty": 2900.0} {"lang": "GNU C", "source_code": "#include \n\nenum {\n M = 4,\n D = 13,\n MAX = M * D + 2\n};\n\ntypedef struct Card {\n int d, m;\n} Card;\n\nCard a[MAX][MAX];\nchar n2m[M] = {'C', 'D', 'H', 'S'};\nchar n2d[D] = {'2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'};\n\nint\nm2n(char m)\n{\n switch (m) {\n case 'C':\n return 0;\n case 'D':\n return 1;\n case 'H':\n return 2;\n case 'S':\n return 3;\n default:\n return -1;\n }\n}\n\nint\nd2n(char d)\n{\n switch (d) {\n case 'T':\n return 8;\n case 'J':\n return 9;\n case 'Q':\n return 10;\n case 'K':\n return 11;\n case 'A':\n return 12;\n default:\n return d - '2';\n }\n}\n\nint\ngood(int r, int c)\n{\n int m = a[r][c].m;\n int goodm = 1;\n int ud[D] = {};\n int goodd = 1;\n int i, j;\n for (i = r; i < r + 3; ++i) {\n for (j = c; j < c + 3; ++j) {\n goodm &= (a[i][j].m == m);\n goodd &= (ud[a[i][j].d] == 0);\n ud[a[i][j].d] = 1;\n }\n }\n return goodm || goodd;\n}\n\nint\nmain(void)\n{\n //freopen(\"input.txt\", \"r\", stdin);\n //freopen(\"output.txt\", \"w\", stdout);\n\n int n, m, i, j;\n char s[MAX];\n int j1r, j1c, j2r, j2c;\n j1r = j1c = j2r = j2c = -1;\n int used[M][D] = {};\n scanf(\"%d %d\", &n, &m);\n for (i = 0; i < n; ++i) {\n for (j = 0; j < m; ++j) {\n scanf(\"%s\", s);\n a[i][j].d = d2n(s[0]);\n a[i][j].m = m2n(s[1]);\n if (s[1] == '1') {\n j1r = i;\n j1c = j;\n } else if (s[1] == '2') {\n j2r = i;\n j2c = j;\n } else {\n used[a[i][j].m][a[i][j].d] = 1;\n }\n }\n }\n\n int m1, d1, m2, d2, r1, c1, r2, c2;\n for (m1 = 0; m1 < M; ++m1) {\n for (d1 = 0; d1 < D; ++d1) {\n if (used[m1][d1]) continue;\n used[m1][d1] = 1;\n if (j1r > -1) {\n a[j1r][j1c].d = d1;\n a[j1r][j1c].m = m1;\n }\n for (m2 = 0; m2 < M; ++m2) {\n for (d2 = 0; d2 < D; ++d2) {\n if (used[m2][d2]) continue;\n used[m2][d2] = 1;\n if (j2r > -1) {\n a[j2r][j2c].d = d2;\n a[j2r][j2c].m = m2;\n }\n\n for (r1 = 0; r1 < n - 2; ++r1) {\n for (c1 = 0; c1 < m - 2; ++c1) {\n for (r2 = r1; r2 < n - 2; ++r2) {\n for (c2 = 0; c2 < m - 2; ++c2) {\n if ((r2 < r1 + 3) && ((c2 >= c1 && c2 < c1 + 3) || (c2 + 2 >= c1 && c2 + 2 < c1 + 3))) continue;\n if (good(r1, c1) && good(r2, c2)) {\n printf(\"Solution exists.\\n\");\n if (j1r == -1 && j2r == -1) {\n printf(\"There are no jokers.\\n\");\n } else if (j1r == -1) {\n printf(\"Replace J2 with %c%c.\\n\", n2d[d2], n2m[m2]);\n } else if (j2r == -1) {\n printf(\"Replace J1 with %c%c.\\n\", n2d[d1], n2m[m1]);\n } else {\n printf(\"Replace J1 with %c%C and J2 with %c%c.\\n\", n2d[d1], n2m[m1], n2d[d2], n2m[m2]);\n }\n printf(\"Put the first square to (%d, %d).\\n\", r1 + 1, c1 + 1);\n printf(\"Put the second square to (%d, %d).\\n\", r2 + 1, c2 + 1);\n return 0;\n }\n }\n }\n }\n }\n used[m2][d2] = 0;\n }\n }\n used[m1][d1] = 0;\n }\n }\n printf(\"No solution.\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "052498e8c6c11aa59c67a50bb1515d37", "src_uid": "b3f29d9c27cbfeadb96b6ac9ffd6bc8f", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "https://en.wikipedia.org/wiki/Dada\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "1fbc28a173bb11b3d1e5561806d1174c", "src_uid": "40002052843ca0357dbd3158b16d59f4", "difficulty": 2700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t1000000\n\nint tt[N + 1];\n\nint compare(const void *a, const void *b) {\n\tint a_ = *(int *) a;\n\tint b_ = *(int *) b;\n\n\treturn tt[a_] != tt[b_] ? tt[a_] - tt[b_] : a_ - b_;\n}\n\nint main() {\n\tstatic int aa[N - 4];\n\tint n, k, a, b, i;\n\tlong long ans;\n\n\tscanf(\"%d%d\", &n, &k);\n\tif (k == 1) {\n\t\tprintf(\"3\\n\");\n\t\treturn 0;\n\t}\n\tfor (a = 2; a <= n; a++)\n\t\ttt[a] = a;\n\tfor (a = 2; a <= n; a++) {\n\t\tif (tt[a] != a)\n\t\t\tcontinue;\n\t\tfor (b = a; b <= n; b += a)\n\t\t\ttt[b] = tt[b] / a * (a - 1);\n\t}\n\tfor (a = 5; a <= n; a++)\n\t\taa[a - 5] = a;\n\tqsort(aa, n - 4, sizeof *aa, compare);\n\tans = 6;\n\tfor (i = 0; i < k - 2; i++)\n\t\tans += tt[aa[i]];\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "f9784f4dd3e0793f8e8c479e569a5f9d", "src_uid": "c2f7012082c84d773c2f4b1858c17110", "difficulty": 2800.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define INF 200000000\n__int64 num[10],dp[500000][105];\n__int64 jie(__int64 p)\n{\n __int64 re,i;\n for(i=1,re=1;i<=p;i++)\n re*=i;\n return re;\n}\nint main()\n{\n __int64 n[20],m,i,j,k,l,wei;\n char s[20];\n while(scanf(\"%s%I64d\",&s,&m)!=EOF)\n {\n wei=strlen(s);\n memset(num,0,sizeof(num));\n for(i=0;i\n#include\n__int64 d[1<<18][100];\nint main(int argc, char const *argv[])\n{\n int m,i,j,l,k; //l:n\u7684\u4f4d\u6570\n int a[18],b[10];\n\n __int64 n;\n memset(d,0,sizeof(int)*100*(1<<18));\n memset(b,0,sizeof(int)*10);\n scanf(\"%I64d%d\",&n,&m);\n for(l=0;n;++l)\n {\n a[l]=n%10;\n n/=10;\n if(a[l] && !b[a[l]])\n {\n d[1<\n#include\n#include\n#include\n#define INF 200000000\n__int64 num[10],dp[500000][105];\n__int64 jie(__int64 p)\n{\n __int64 re,i;\n for(i=1,re=1;i<=p;i++)\n re*=i;\n return re;\n}\nint main()\n{\n __int64 n[20],m,i,j,k,l,wei;\n char s[20];\n while(scanf(\"%s%I64d\",&s,&m)!=EOF)\n {\n wei=strlen(s);\n memset(num,0,sizeof(num));\n for(i=0;i\n#include\nint d[1<<18][100];\nint main(int argc, char const *argv[])\n{\n\tint m,i,j,l,k;\t//l:n\u7684\u4f4d\u6570\n\tint a[18],b[10];\n\n\t__int64 n;\n\tmemset(d,0,sizeof(int)*100*(1<<18));\n\tmemset(b,0,sizeof(int)*10);\n\tscanf(\"%I64d%d\",&n,&m);\n\tfor(l=0;n;++l)\n\t{\n\t\ta[l]=n%10;\n\t\tn/=10;\n\t\tif(a[l] && !b[a[l]])\n\t\t{\n\t\t\td[1<\n\nint num[11],val[11];\n\n__int64 dp[30000][100];\n\nint main()\n{\n __int64 n;int m;\n scanf(\"%I64d%d\",&n,&m);\n while(n)\n {\n num[n%10]++;n/=10;\n }\n val[0] = 1;\n for(int i=1;i<=10;i++)\n val[i] = val[i-1]*(num[i-1]+1);\n dp[0][0] = 1;\n for(int i=0;i=num[j])\n continue;\n for(int k=0;k\n#include \n\nint main(){\n int i, num, flag=0;\n char str[11];\n scanf(\"%s\", str);\n num = strlen(str);\n if(num == 1){\n if(str[0] == '3' || str[0] == '7'){\n printf(\"Yes\\n\");\n }\n else\n printf(\"No\\n\");\n }\n else{\n for(i=0; i\n#include\n#include\nvoid fun(char *);\nvoid fun(char *s)\n{\n int n=strlen(s);\n int i;\n for(i=0;i\n#include \n#include \n\nbool braille(char *a, int len)\n{\n if(len == 1)\n {\n if(a[0] == '3' || a[0] == '7')\n return true;\n else\n return false;\n }\n\n\tint i = 0;\n\tint n = len - 1;\n\n\twhile(i < n)\n\t{\n int old_i = i;\n\n if((a[i] == '4' || a[i] == '6') && (a[i] == '6' || a[i] == '4'))\n i++;\n\n else if((a[i] == '5' || a[i] == '9') && (a[i] == '9' || a[i] == '5'))\n i++;\n\n else if((a[i] == '8' || a[i] == '0') && (a[i] == '0' || a[i] == '8'))\n i++;\n\n else if(a[i] == '3' && a[n] == '3')\n i++;\n\n else if(a[i] == '7' && a[n] == '7')\n i++;\n\n if(i == old_i)\n return false;\n else\n n--;\n }\n\n return true;\n}\n\nint main()\n{\n char num[10];\n scanf(\"%s\", num);\n\n braille(num, strlen(num))? printf(\"Yes\\n\") : printf(\"No\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d3de0e604bd7b2b64d06cefe9b2fe84", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nbool braille(char *a, int len)\n{\n if(len == 1)\n {\n if(a[0] == '3' || a[0] == '7')\n return true;\n else\n return false;\n }\n\n\tint i = 0;\n\tint n = len - 1;\n\n\twhile(i < n)\n\t{\n int old_i = i;\n\n if((a[i] == '4' || a[i] == '6') && (a[i] == '6' || a[i] == '4'))\n i++;\n\n else if((a[i] == '5' || a[i] == '9') && (a[i] == '9' || a[i] == '5'))\n i++;\n\n else if((a[i] == '8' || a[i] == '0') && (a[i] == '0' || a[i] == '8'))\n i++;\n\n else if(a[i] == '3' && a[n] == '3')\n i++;\n\n else if(a[i] == '7' && a[n] == '7')\n i++;\n\n if(i == old_i)\n return false;\n else\n n--;\n }\n\n if(a[i] == '1' || a[i] == '2')\n return false;\n else\n return true;\n}\n\nint main()\n{\n char num[10];\n scanf(\"%s\", num);\n\n braille(num, strlen(num))? printf(\"Yes\\n\") : printf(\"No\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "165b95c64f22067a52d43768b34e31db", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\nbool braille(char *a, int len)\n{\n\tint i = 0;\n\tint n = len - 1;\n\n\twhile(i < n)\n\t{\n int old_i = i;\n\n if((a[i] == '4' || a[i] == '6') && (a[i] == '6' || a[i] == '4'))\n i++;\n\n else if((a[i] == '5' || a[i] == '9') && (a[i] == '9' || a[i] == '5'))\n i++;\n\n else if((a[i] == '8' || a[i] == '0') && (a[i] == '0' || a[i] == '8'))\n i++;\n\n else if(a[i] == '3' && a[n] == '3')\n i++;\n\n else if(a[i] == '7' && a[n] == '7')\n i++;\n\n if(i == old_i)\n return false;\n else\n n--;\n }\n\n return true;\n}\n\nint main()\n{\n char num[10];\n scanf(\"%s\", num);\n\n braille(num, strlen(num))? printf(\"Yes\\n\") : printf(\"No\\n\");\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6d65207226f843a02fe775a30a2dd868", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n\n#define Maxm 100\n#define mod 1000000007\n\n__attribute__((always_inline)) __inline__\nvoid multiply(int m, int A[][Maxm], int B[][Maxm], int C[][Maxm]) {\n\tregister int i, j, k;\n\tfor (i = 0; i < m; i++) {\n\t\tfor (j = 0; j < m; j++) C[i][j] = 0;\n\t\tfor (k = 0; k < m; k++) for (j = 0; j < m; j++)\n\t\t\tC[i][j] = (C[i][j] + (long long)A[i][k] * B[k][j]) % mod;\n\t}\n}\n\nvoid power(int m, int A[][Maxm], int P[][Maxm], int T[][Maxm], long long k) {\n\tif (!k) {\n\t\tregister int i, j;\n\t\tfor (i = 0; i < m; i++)\n\t\t\tfor (j = 0; j < m; j++)\n\t\t\t\tP[i][j] = (i == j);\n\t}\n\telse if (k & 1) {\n\t\tpower(m, A, P, T, k / 2);\n\t\tmultiply(m, P, P, T), multiply(m, T, A, P);\n\t}\n\telse {\n\t\tpower(m, A, T, P, k / 2);\n\t\tmultiply(m, T, T, P);\n\t}\n}\n\nint main() {\n\tregister int i, j;\n\tstatic int A[Maxm][Maxm] = {};\n\tstatic int P[Maxm][Maxm] = {};\n\tstatic int T[Maxm][Maxm] = {};\n\tlong long n;\n\tint m, ans;\n\tscanf(\"%lld%d\", &n, &m);\n\tif (n < m) return puts(\"1\") & 0;\n\tfor (i = 0; i < m - 1; i++) A[i][i + 1] = 1;\n\tA[m - 1][0] = A[m - 1][m - 1] = 1;\n\tpower(m, A, P, T, n - m + 1);\n\tfor (ans = j = 0; j < m; j++)\n\t\tans = (ans + P[m - 1][j]) % mod;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5e752f4b654bf7901916af50933aa799", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n#include\n\ntypedef long long int int64;\n\nstatic void printInt(int64 n){\n if(n<0){putchar('-');n=-n;}\n if(n==0){putchar('0');return;}\n int s[20];int len=0;\n while(n>0){s[len++]=n%10+'0';n/=10;}\n while(len>0){putchar(s[--len]);}\n}\nstatic int64 readInt(void){\n int prev='\\0';int c=getchar();\n while(!('0'<=c && c<='9')){prev=c;c=getchar();}\n int64 res=0;\n while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}\n return prev=='-'?-res:res;\n}\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\n/*\na_k : k \u30de\u30b8\u30c3\u30af\u30b8\u30a7m\u306e\u69cb\u6210\u6570\na_k = 1 (k<=0)\na_1=2\na_n = a_{n-1} + a_(n-m)\n*/\n\nconst int mod=1000000007;\n\n#define POS(i,j) ((i)*m+(j))\n\nvoid matmul(int *c,int *a,int *b,int m){\n static int *tmp=NULL;\n if(tmp==NULL) tmp=calloc(m*m,sizeof(int));\n memset(tmp,0,sizeof(int)*m*m);\n int i,j,k;\n for(i=0;in){\n printInt(1);\n puts(\"\");\n return;\n }\n n-=m-1;\n int *t=(int *)calloc(m*m,sizeof(int));\n int *s=(int *)calloc(m*m,sizeof(int));\n int i;\n for(i=0;i0){\n if(n&1) matmul(t,t,s,m);\n matmul(s,s,s,m);\n n>>=1;\n }\n int64 ans=0;\n for(i=0;i\n#include\n#define INF 1000000007\ntypedef long long LL;\n\nLL N;\nint M;\nLL **matrix_exp;\nLL **matrix;\n\nvoid multiply(LL ***a, LL **b){\n LL **p = *a;\n LL **c = (LL **)calloc(M, sizeof(LL *));\n for(int i = 0; i < M; ++i)\n c[i] = (LL *)calloc(M, sizeof(LL));\n for(int i = 0; i < M; ++i)\n for(int j = 0; j < M; ++j)\n for(int k = 0; k < M; ++k)\n c[i][j] = (c[i][j] + p[i][k] * b[k][j]) % INF;\n for(int i = 0; i < M; ++i)\n free(p[i]);\n free(p);\n *a = c;\n}\n\nint main(){\n LL res = 0LL;\n scanf(\"%I64d %d\", &N, &M);\n matrix_exp = (LL **)calloc(M, sizeof(LL *));\n matrix = (LL **)calloc(M, sizeof(LL *));\n for(int i = 0; i < M; ++i){\n matrix[i] = (LL *)calloc(M, sizeof(LL));\n matrix_exp[i] = (LL *)calloc(M, sizeof(LL));\n matrix_exp[i][i] = 1LL;\n }\n matrix[0][0] = matrix[M - 1][0] = 1LL;\n for(int i = 0; i < M - 1; ++i)\n matrix[i][i + 1] = 1LL;\n while(N){\n if(N & 1LL)\n multiply(&matrix_exp, matrix);\n multiply(&matrix, matrix);\n N >>= 1;\n }\n for(int i = 0; i < M; ++i)\n res = (res + matrix_exp[i][M - 1]) % INF;\n printf(\"%I64d\", res);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d7eba1e8ad8aa65cbaed05ae25d79a2d", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define N\t500\n#define N_\t(1 << 9)\t/* N_ = pow2(ceil(log2(N))) */\n#define INF\t0x3f3f3f3f3f3f3f3fLL\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\n\nint *oh[N][N], *ot[N][N], *ox[N][N], oo[N][N];\n\nvoid link(int i, int j, int h, int t, int x) {\n\tint o = oo[i][j]++;\n\n\tif (o >= 2 && (o & o - 1) == 0) {\n\t\toh[i][j] = (int *) realloc(oh[i][j], o * 2 * sizeof *oh[i][j]);\n\t\tot[i][j] = (int *) realloc(ot[i][j], o * 2 * sizeof *ot[i][j]);\n\t\tox[i][j] = (int *) realloc(ox[i][j], o * 2 * sizeof *ox[i][j]);\n\t}\n\toh[i][j][o] = h, ot[i][j][o] = t, ox[i][j][o] = x;\n}\n\nlong long *st_, *lz_; int h_, n_;\n\nvoid put(int i, long long x) {\n\tst_[i] += x;\n\tif (i < n_)\n\t\tlz_[i] += x;\n}\n\nvoid pus(int i) {\n\tif (lz_[i]) {\n\t\tput(i << 1, lz_[i]), put(i << 1 | 1, lz_[i]);\n\t\tlz_[i] = 0;\n\t}\n}\n\nvoid pul(int i) {\n\tif (!lz_[i])\n\t\tst_[i] = min(st_[i << 1], st_[i << 1 | 1]);\n}\n\nvoid push(int i) {\n\tint h;\n\n\tfor (h = h_; h > 0; h--)\n\t\tpus(i >> h);\n}\n\nvoid pull(int i) {\n\twhile (i > 1)\n\t\tpul(i >>= 1);\n}\n\nvoid update(int l, int r, long long x) {\n\tint l_ = l += n_, r_ = r += n_;\n\n\tpush(l_), push(r_);\n\tfor ( ; l <= r; l >>= 1, r >>= 1) {\n\t\tif ((l & 1) == 1)\n\t\t\tput(l++, x);\n\t\tif ((r & 1) == 0)\n\t\t\tput(r--, x);\n\t}\n\tpull(l_), pull(r_);\n}\n\nvoid update1(int i, long long x) {\n\tpush(i += n_);\n\tst_[i] = x;\n\tpull(i);\n}\n\nlong long query(int l, int r) {\n\tlong long x;\n\n\tpush(l += n_), push(r += n_);\n\tx = INF;\n\tfor ( ; l <= r; l >>= 1, r >>= 1) {\n\t\tif ((l & 1) == 1)\n\t\t\tx = min(x, st_[l++]);\n\t\tif ((r & 1) == 0)\n\t\t\tx = min(x, st_[r--]);\n\t}\n\treturn x;\n}\n\nint main() {\n\tstatic long long xx[N][N], st[N][N_ * 2], lz[N][N_ * 2], sti[N_ * 2], lzi[N_ * 2];\n\tint n, m, k, i, j;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++) {\n\t\t\toh[i][j] = (int *) malloc(2 * sizeof *oh[i][j]);\n\t\t\tot[i][j] = (int *) malloc(2 * sizeof *ot[i][j]);\n\t\t\tox[i][j] = (int *) malloc(2 * sizeof *ox[i][j]);\n\t\t}\n\twhile (k--) {\n\t\tint d, t, x;\n\t\tint meet1, meet2, meet3, meet4;\n\n\t\tscanf(\"%d%d%d%d%d\", &i, &j, &d, &t, &x);\n\t\tmeet1 = meet2 = meet3 = meet4 = 0;\n\t\tif (i + j >= t && (i + j) % 4 == t % 4)\n\t\t\txx[i][j] += x, meet1 = 1;\n\t\tif (i + j >= t && (i + j) % 4 == (t + 1) % 4)\n\t\t\txx[i + d][j - d] += x, meet2 = 1;\n\t\tif (i + j + d >= t && (i + j + d) % 4 == (t + 2) % 4)\n\t\t\txx[i + d][j] += x, meet3 = 1;\n\t\tif (i + j + d >= t && (i + j + d) % 4 == (t + 3) % 4)\n\t\t\txx[i][j + d] += x, meet4 = 1;\n\t\tif (meet1 && meet3)\n\t\t\tlink(i + d, j, i, 0, x);\n\t\tif (meet1 && meet4)\n\t\t\tlink(i, j + d, j, 1, x);\n\t\tif (meet2 && meet3)\n\t\t\tlink(i + d, j, j - d, 1, x);\n\t}\n\th_ = 0;\n\twhile (1 << h_ < n || 1 << h_ < m)\n\t\th_++;\n\tn_ = 1 << h_;\n\tfor (i = 0; i < n; i++) {\n\t\tmemset(sti, 0, n_ * 2 * sizeof *sti);\n\t\tmemset(lzi, 0, n_ * 2 * sizeof *lzi);\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tint o;\n\t\t\tlong long x;\n\n\t\t\tfor (o = 0; o < oo[i][j]; o++) {\n\t\t\t\tint h = oh[i][j][o], t = ot[i][j][o], x = ox[i][j][o];\n\n\t\t\t\tif (t == 0)\n\t\t\t\t\tst_ = st[j], lz_ = lz[j], update(0, h, -x);\n\t\t\t\telse\n\t\t\t\t\tst_ = sti, lz_ = lzi, update(0, h, -x);\n\t\t\t}\n\t\t\tif (i == 0 && j == 0)\n\t\t\t\tx = 0;\n\t\t\telse {\n\t\t\t\tx = INF;\n\t\t\t\tif (i > 0)\n\t\t\t\t\tst_ = st[j], lz_ = lz[j], x = min(x, query(0, i - 1));\n\t\t\t\tif (j > 0)\n\t\t\t\t\tst_ = sti, lz_ = lzi, x = min(x, query(0, j - 1));\n\t\t\t}\n\t\t\tst_ = st[j], lz_ = lz[j], update1(i, x), update(0, i, xx[i][j]);\n\t\t\tst_ = sti, lz_ = lzi, update1(j, x), update(0, j, xx[i][j]);\n\t\t}\n\t}\n\tst_ = st[m - 1], lz_ = lz[m - 1];\n\tprintf(\"%lld\\n\", query(n - 1, n - 1));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "58b637ae39610c37bd148f79fd014be5", "src_uid": "b11cb0c2bf23bf4b4e6f6af61af9c290", "difficulty": 2600.0} {"lang": "GNU C11", "source_code": "/* upsolve with Dukkha */\n#include \n\n#define N\t100\n#define S\t5000\n#define MD\t998244353\n\nint ch[S + N][N];\n\nvoid init(int n, int k) {\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 < k; j++)\n\t\t\tch[i][j] = (ch[i - 1][j - 1] + ch[i - 1][j]) % MD;\n\t}\n}\n\nlong long power(long long 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 == 1)\n\t\tp = p * a % MD;\n\treturn p;\n}\n\nlong long inv(long long a) {\n\treturn power(a, MD - 2);\n}\n\nint main() {\n\t/* dp[a][b]: b balls into a urns of size r - 1 */\n\tstatic int dp[1 + N][1 + S];\n\t/* dq[a][b]: dp[a][b] + dp[a][b - 1] + ... + dp[a][b - (r - 1)] */\n\tstatic int dq[1 + N][1 + S];\n\tint n, s, r, a, b, k, p, q;\n\n\tscanf(\"%d%d%d\", &n, &s, &r);\n\tinit(s + n, n);\n\tfor (a = 0; a <= n; a++) {\n\t\tint sum;\n\n\t\tif (a == 0)\n\t\t\tdp[0][0] = 1;\n\t\telse\n\t\t\tfor (b = 0; b <= s; b++)\n\t\t\t\tdp[a][b] = dq[a - 1][b];\n\t\tsum = 0;\n\t\tfor (b = 0; b <= s; b++) {\n\t\t\tsum = (sum + dp[a][b]) % MD;\n\t\t\tif (b >= r)\n\t\t\t\tsum = (sum - dp[a][b - r] + MD) % MD;\n\t\t\tdq[a][b] = sum;\n\t\t}\n\t}\n\tp = 0;\n\tfor (k = 1; k <= n && k * r <= s; k++)\n\t\tfor (b = 0; b + k * r <= s; b++)\n\t\t\tp = (p + (long long) dp[n - k][b] * ch[s - b - k * r + k - 1][k - 1] % MD * ch[n - 1][k - 1] % MD * inv(k)) % MD;\n\tq = ch[s - r + n - 1][n - 1];\n\tprintf(\"%lld\\n\", p * inv(q) % MD);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c4263d48e547db0b7e96005ddf55eb79", "src_uid": "609195ef4a970c62a8210dafe118580e", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n#include \nint buy[12][105],v[12][105],money[105],sale[12][105],space[105];\nint main()\n{\n int n,m,s,max=0,x,y,t,k,sum,total,i,j;\n char str[105];\n scanf(\"%d%d%d\",&n,&m,&s);\n for(i=0;ibuy[i][k])\n money[k]=sale[j][k]-buy[i][k];\n else\n money[k]=0;\n space[k]=v[i][k];\n }\n for(x=0;x=total)\n {\n sum+=money[k]*total;\n break;\n }\n else\n {\n sum+=money[k]*space[k];\n total-=space[k];\n }\n }\n if(sum>max)\n max=sum;\n }\n }\n printf(\"%d\\n\",max);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a739bbe4a20e7ae017e205dabd262e93", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0} {"lang": "GNU C", "source_code": "#include\n#include\nint x[12][110][5];\nstruct sub{\n int p,n;\n}y[110];\nint cmp(const void *a,const void *b)\n{\n return ((struct sub *)a)->p-((struct sub *)b)->p;\n}\nint main()\n{\n int res=0,sum;\n int i,j,t,U;\n int n,m,k,K,L;\n char s[20];\n scanf(\"%d %d %d\",&n,&m,&K);\n for(t=1;t<=n;t++)\n {\n scanf(\"%s\",s);\n for(i=1;i<=m;i++)\n for(j=1;j<=3;j++)\n scanf(\"%d\",&x[t][i][j]);\n }\n res=0;\n for(i=1;i<=n;i++)\n for(j=1;j<=n;j++)\n {\n if(j==i)\n continue;\n for(k=1;k<=m;k++)\n {\n y[k].n=x[i][k][3];\n y[k].p=x[j][k][2]-x[i][k][1];\n }\n qsort(y+1,m,sizeof(y[0]),cmp);\n t=m;\n k=K;\n sum=0;\n while(k>0&&t>0&&y[t].p>0)\n {\n if(y[t].n<=k)\n {\n k-=y[t].n;\n sum+=y[t].n*y[t].p;\n }\n else if(y[t].n>k)\n {\n sum+=y[t].p*k;\n k=0;\n }\n t--;\n }\n if(sum>res)\n res=sum;\n }\n printf(\"%d\\n\",res);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "97b0101361a893ea69b7917a318aafaa", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define N\t400000\n#define INF\t0x3f3f3f3f3f3f3f3fLL\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\nlong long max(long long a, long long 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\nstruct V {\n\tlong long x, y;\n} vv[N + 1];\n\nint compare(const void *a, const void *b) {\n\tstruct V *u = (struct V *) a;\n\tstruct V *v = (struct V *) b;\n\n\treturn u->x == v->x ? 0 : u->x < v->x ? -1 : 1;\n}\n\nvoid sort(struct V *vv, int n) {\n\tint i;\n\n\tfor (i = 0; i < n; i++) {\n\t\tint j = rand_(i + 1);\n\t\tstruct V tmp;\n\n\t\ttmp = vv[i], vv[i] = vv[j], vv[j] = tmp;\n\t}\n\tqsort(vv, n, sizeof *vv, compare);\n}\n\nint main() {\n\tint t;\n\n\tsrand_();\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tstatic long long gg[N + 1];\n\t\tlong long len, k, lower, upper, lmax, rmin, y, ans;\n\t\tint n, m, i;\n\n\t\tscanf(\"%lld%d%lld\", &len, &n, &k);\n\t\tfor (i = 0; i < n; i++)\n\t\t\tscanf(\"%lld\", &gg[i]);\n\t\tgg[n] = len;\n\t\tfor (i = n; i >= 1; i--)\n\t\t\tgg[i] -= gg[i - 1];\n\t\tlower = 1;\n\t\tupper = len + 1;\n\t\tfor (i = 0; i <= n; i++)\n\t\t\tupper = min(upper, gg[i] + 1);\n\t\twhile (upper - lower > 1) {\n\t\t\tlong long l = (lower + upper) / 2, k_;\n\n\t\t\tk_ = k;\n\t\t\tfor (i = 0; i <= n; i++)\n\t\t\t\tif ((k_ -= gg[i] / l - 1) <= 0)\n\t\t\t\t\tbreak;\n\t\t\tif (k_ <= 0)\n\t\t\t\tlower = l;\n\t\t\telse\n\t\t\t\tupper = l;\n\t\t}\n\t\tlmax = lower;\n\t\tlower = 0, upper = len;\n\t\twhile (upper - lower > 1) {\n\t\t\tlong long r = (lower + upper) / 2, k_;\n\n\t\t\tk_ = k;\n\t\t\tfor (i = 0; i <= n; i++)\n\t\t\t\tif ((k_ -= (gg[i] + r - 1) / r - 1) < 0)\n\t\t\t\t\tbreak;\n\t\t\tif (k_ >= 0)\n\t\t\t\tupper = r;\n\t\t\telse\n\t\t\t\tlower = r;\n\t\t}\n\t\trmin = upper;\n\t\t/* lmax <= rmin must hold */\n\t\tm = 0;\n\t\tfor (i = 0; i <= n; i++) {\n\t\t\tlong long kmin = (gg[i] + rmin - 1) / rmin - 1;\n\t\t\tlong long kmax = gg[i] / lmax - 1;\n\n\t\t\tif (kmin > kmax) {\t/* kmin == kmax + 1 */\n\t\t\t\tstruct V *v = &vv[m++];\n\n\t\t\t\tv->x = lmax - gg[i] / (kmin + 1);\n\t\t\t\tv->y = (gg[i] + kmax) / (kmax + 1) - rmin;\n\t\t\t}\n\t\t}\n\t\tsort(vv, m);\n\t\tans = INF;\n\t\ty = 0;\n\t\tfor (i = m - 1; i >= 0; i--) {\n\t\t\tans = min(ans, rmin - lmax + vv[i].x + y);\n\t\t\ty = max(y, vv[i].y);\n\t\t}\n\t\tans = min(ans, rmin - lmax + y);\n\t\tprintf(\"%lld\\n\", ans);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ea1a480b094ceef3d8925a676d231ba9", "src_uid": "37d912c36aedea1b8f8e78a849062d90", "difficulty": 3300.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\nint64_t gcd(int64_t a, int64_t b){\n\treturn b==0? a: gcd(b, a%b);\n}\n\nint main(){\n\tint n, k, a, b, i, stp[4];\n\tint64_t min_t, max_t, dis, t, l;\n\n\tmin_t = INT64_MAX, max_t = INT64_MIN;\n\n\tscanf(\"%d%d%d%d\", &n, &k, &a, &b);\n\tdis = (int64_t)n * k;\n\tstp[0] = a-b, stp[1] = b-a, stp[2] = a+b, stp[3] = k-a-b;\n\n\tfor(i = 0; i < 4; i++){\n\t\tfor(l = stp[i]; l <= dis; l += k){\n\t\t\tif(l <= 0)\n\t\t\t\tcontinue;\n\t\t\tt = dis / gcd(dis, l);\n\t\t\tmin_t = min_tt? max_t: t;\n\t\t}\n\t}\n\n\tprintf(\"%\" PRIi64 \" %\" PRIi64 \"\\n\", min_t, max_t);\n\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9c461d09581a7284f3b7fad7992a628e", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "GNU C11", "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 MIN(a,b) ((a)<(b)?(a):(b))\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 const i32 n = read_int();\n const i32 k = read_int();\n const i32 a = read_int();\n const i32 b = read_int();\n const i64 m = (i64) n * k;\n i64 min = (i64) n * k;\n i64 max = 1;\n for (i32 i = 0; i < 4; ++i) {\n const i32 s = i >= 2 ? a : (k - a) % k;\n for (i32 j = 0; j < 4; ++j) {\n i32 t = (j & 1) ? (k - b) % k : b;\n if (t <= s) {\n\ti64 d = m - (s - t);\n\ti64 v = m / gcd (d, m);\n\tmin = MIN(min, v);\n\tmax = MAX(max, v);\n\tt += k;\n }\n for (i64 l = t; l < m; l += k) {\n\ti64 d = l - s;\n\ti64 v = m / gcd (d, m);\n\tmin = MIN(min, v);\n\tmax = MAX(max, v);\n }\n }\n }\n print_int (min);\n putchar(' ');\n print_int (max);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c541418cb68b7affb2d92121a576eddd", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define FOR(i, a, b) for (i = (a); i < (b); ++i)\n#define REP(i, n) FOR(i, 0, n)\n\nint cmpfunc (const void * a, const void * b){\n\t//qsort(values, 5, sizeof(int), cmpfunc);\n\treturn ( *(int*)a - *(int*)b );\n}\n\nlong min(long a,long b){\n\treturn a < b ? a : b;\n}\n\nlong max(long a,long b){\n\treturn a > b ? a : b;\n}\n// long ncr(int n, int k) \n// { \n// long C[k+1]; \n// memset(C, 0, sizeof(C)); \n// \tint i;\n// \tint j;\n// C[0] = 1; // nC0 is 1 \n \n// for (i = 1; i <= n; i++) \n// { \n// // Compute next row of pascal triangle using \n// // the previous row \n// for ( j = min(i, k); j > 0; j--) \n// C[j] = C[j] + C[j-1]; \n// } \n// return C[k]; \n// } \n\nvoid solve(int t){\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n];\n\tint i,j;\n\tfor(i = 0;i < n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\t// printf(\"Case #%d: %ld\\n\",t,count);\t\n}\n\nlong gcd(long a , long b)\n{\n if(b==0) return a;\n a%=b;\n return gcd(b,a);\n}\n\nint main(){\n\tint n,k,a,b;\n\tscanf(\"%d%d\",&n,&k);\n\tscanf(\"%d%d\",&a,&b);\n\tint i,j;\n\tlong maximum = LONG_MIN, minimum = LONG_MAX;\n\tlong l = a-b;\n\tlong total = (long)n*k;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = a+b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = k-a+b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = k-a-b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tprintf(\"%I64d %I64d\\n\",minimum,maximum);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "7cd4dde2e73ef5ee837f05be4ff8ffe0", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define FOR(i, a, b) for (i = (a); i < (b); ++i)\n#define REP(i, n) FOR(i, 0, n)\n\nint cmpfunc (const void * a, const void * b){\n\t//qsort(values, 5, sizeof(int), cmpfunc);\n\treturn ( *(int*)a - *(int*)b );\n}\n\nlong min(long a,long b){\n\treturn a < b ? a : b;\n}\n\nlong max(long a,long b){\n\treturn a > b ? a : b;\n}\n// long ncr(int n, int k) \n// { \n// long C[k+1]; \n// memset(C, 0, sizeof(C)); \n// \tint i;\n// \tint j;\n// C[0] = 1; // nC0 is 1 \n \n// for (i = 1; i <= n; i++) \n// { \n// // Compute next row of pascal triangle using \n// // the previous row \n// for ( j = min(i, k); j > 0; j--) \n// C[j] = C[j] + C[j-1]; \n// } \n// return C[k]; \n// } \n\nvoid solve(int t){\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n];\n\tint i,j;\n\tfor(i = 0;i < n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\t// printf(\"Case #%d: %ld\\n\",t,count);\t\n}\n\nlong gcd(long a , long b)\n{\n if(b==0) return a;\n a%=b;\n return gcd(b,a);\n}\n\nint main(){\n\tint n,k,a,b;\n\tscanf(\"%d%d\",&n,&k);\n\tscanf(\"%d%d\",&a,&b);\n\tint i,j;\n\tlong maximum = LONG_MIN, minimum = LONG_MAX;\n\tlong l = a-b;\n\tlong total = (long)n*k;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = a+b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = k-a+b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = k-a-b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong g = ((long)n*k)/gcd((long)n*k,(long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tprintf(\"%ld %ld\\n\",minimum,maximum);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6db0bdd62a2569a69479e7324e70f4b2", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define FOR(i, a, b) for (i = (a); i < (b); ++i)\n#define REP(i, n) FOR(i, 0, n)\n\nint cmpfunc (const void * a, const void * b){\n\t//qsort(values, 5, sizeof(int), cmpfunc);\n\treturn ( *(int*)a - *(int*)b );\n}\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// long long ncr(int n, int k) \n// { \n// long long C[k+1]; \n// memset(C, 0, sizeof(C)); \n// \tint i;\n// \tint j;\n// C[0] = 1; // nC0 is 1 \n \n// for (i = 1; i <= n; i++) \n// { \n// // Compute next row of pascal triangle using \n// // the previous row \n// for ( j = min(i, k); j > 0; j--) \n// C[j] = C[j] + C[j-1]; \n// } \n// return C[k]; \n// } \n\nvoid solve(int t){\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n];\n\tint i,j;\n\tfor(i = 0;i < n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\t// printf(\"Case #%d: %ld\\n\",t,count);\t\n}\n\nlong long gcd(long long a , long long b)\n{\n if(b==0) return a;\n a%=b;\n return gcd(b,a);\n}\n\nint main(){\n\tint n,k,a,b;\n\tscanf(\"%d%d\",&n,&k);\n\tscanf(\"%d%d\",&a,&b);\n\tint i,j;\n\tlong long maximum = LONG long_MIN, minimum = LONG long_MAX;\n\tlong long l = a-b;\n\tlong long total = (long long)n*k;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong long g = ((long long)n*k)/gcd((long long)n*k,(long long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = a+b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong long g = ((long long)n*k)/gcd((long long)n*k,(long long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = k-a+b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong long g = ((long long)n*k)/gcd((long long)n*k,(long long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tl = k-a-b;\n\twhile(l <= total){\n\t\tif(l <= 0){\n\t\t\tl += k;\n\t\t\tcontinue;\n\t\t}\n\t\tlong long g = ((long long)n*k)/gcd((long long)n*k,(long long)l);\n\n\t\tmaximum = max(g,maximum);\n\t\tminimum = min(g,minimum);\n\t\tl += k;\n\t}\n\n\tprintf(\"%I64d %I64d\\n\",minimum,maximum);\n}", "lang_cluster": "C", "compilation_error": true, "code_uid": "561d98eeb73563c8eaa4130c93473d0b", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e691b8b0a027c9911eba026cb4357a3e", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "e7cc3b29c53650d78c0068e18087a710", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "18ee72213ba40a64ed419ddf187bc9cf", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "5bd247068bbe54c9ab6b3190b105518c", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t52\n#define K\t(N * 6)\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nvoid carry(int *aa, int n) {\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tif (aa[i] >= 10)\n\t\t\taa[i + 1] += aa[i] / 10, aa[i] %= 10;\n\t\telse if (aa[i] < 0)\n\t\t\taa[i + 1] -= (-aa[i] + 9) / 10, aa[i] = (aa[i] % 10 + 10) % 10;\n}\n\nint main() {\n\tstatic char aa[N + 1];\n\tstatic int bb[N + 1], dp[K * 2 + 1], dq[K * 2 + 1], dp_[K * 2 + 1], dq_[K * 2 + 1];\n\tint n, i, j, k, ans;\n\tchar tmp;\n\n\tscanf(\"%s\", aa), n = strlen(aa);\n\tfor (i = 0; i < n; i++)\n\t\taa[i] -= '0';\n\tfor (i = 0, j = n - 1; i < j; i++, j--)\n\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\tn += 2;\n\tmemset(dp, 0x3f, (K * 2 + 1) * sizeof *dp), memset(dq, 0x3f, (K * 2 + 1) * sizeof *dq); \n\tdp[K] = 0;\n\tfor (i = n - 2; i >= 0; i--) {\n\t\tmemset(dp_, 0x3f, (K * 2 + 1) * sizeof *dp_), memset(dq_, 0x3f, (K * 2 + 1) * sizeof *dq_); \n\t\tfor (k = 0; k <= K * 2; k++) {\n\t\t\tint x;\n\n\t\t\tfor (j = 0; j <= i + 1; j++)\n\t\t\t\tbb[j] = aa[j] + k - K;\n\t\t\tcarry(bb, i + 2), bb[i + 2] = 0;\n\t\t\tif ((x = dp[k]) != INF) {\n\t\t\t\tint d = bb[i + 1] == 1 ? 10 : bb[i];\n\n\t\t\t\tfor (j = i; j >= 0; j--)\n\t\t\t\t\tbb[j] -= d;\n\t\t\t\tcarry(bb, i + 2);\n\t\t\t\tif (bb[i + 2] < 0)\n\t\t\t\t\td--;\n\t\t\t\tif (d < 10) {\n\t\t\t\t\tdp_[k - d] = min(dp_[k - d], x + d * (i + 1));\n\t\t\t\t\tif (++d < 10)\n\t\t\t\t\t\tdq_[k - d] = min(dq_[k - d], x + d * (i + 1));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (j = 0; j <= i + 1; j++)\n\t\t\t\tbb[j] = -bb[j];\n\t\t\tcarry(bb, i + 2), bb[i + 2] = 0;\n\t\t\tif ((x = dq[k]) != INF) {\n\t\t\t\tint d = bb[i + 1] == 1 ? 10 : bb[i];\n\n\t\t\t\tfor (j = i; j >= 0; j--)\n\t\t\t\t\tbb[j] -= d;\n\t\t\t\tbb[0]--;\n\t\t\t\tcarry(bb, i + 2);\n\t\t\t\tif (bb[i + 2] < 0)\n\t\t\t\t\td--;\n\t\t\t\tif (d < 10) {\n\t\t\t\t\tdq_[k + d] = min(dq_[k + d], x + d * (i + 1));\n\t\t\t\t\tif (++d < 10)\n\t\t\t\t\t\tdp_[k + d] = min(dp_[k + d], x + d * (i + 1));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemcpy(dp, dp_, (K * 2 + 1) * sizeof *dp_), memcpy(dq, dq_, (K * 2 + 1) * sizeof *dq_); \n\t}\n\tans = INF;\n\tfor (k = 0; k <= K * 2; k++)\n\t\tif ((aa[0] + k - K) % 10 == 0)\n\t\t\tans = min(ans, dp[k]);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "931449285fce6209e30257acddf12bba", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t52\n#define K\t(N * 9)\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nvoid carry(int *aa, int n) {\n\tint i;\n\n\tfor (i = 0; i < n; i++)\n\t\tif (aa[i] >= 10)\n\t\t\taa[i + 1] += aa[i] / 10, aa[i] %= 10;\n\t\telse if (aa[i] < 0)\n\t\t\taa[i + 1] -= (-aa[i] + 9) / 10, aa[i] = (aa[i] % 10 + 10) % 10;\n}\n\nint main() {\n\tstatic char aa[N + 1];\n\tstatic int bb[N + 1], dp[K * 2 + 1], dq[K * 2 + 1], dp_[K * 2 + 1], dq_[K * 2 + 1];\n\tint n, i, j, k, ans;\n\tchar tmp;\n\n\tscanf(\"%s\", aa), n = strlen(aa);\n\tfor (i = 0; i < n; i++)\n\t\taa[i] -= '0';\n\tfor (i = 0, j = n - 1; i < j; i++, j--)\n\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\tn += 2;\n\tmemset(dp, 0x3f, (K * 2 + 1) * sizeof *dp), memset(dq, 0x3f, (K * 2 + 1) * sizeof *dq); \n\tdp[K] = 0;\n\tfor (i = n - 2; i >= 0; i--) {\n\t\tmemset(dp_, 0x3f, (K * 2 + 1) * sizeof *dp_), memset(dq_, 0x3f, (K * 2 + 1) * sizeof *dq_); \n\t\tfor (k = 0; k <= K * 2; k++) {\n\t\t\tint x;\n\n\t\t\tfor (j = 0; j <= i + 1; j++)\n\t\t\t\tbb[j] = aa[j] + k - K;\n\t\t\tcarry(bb, i + 2), bb[i + 2] = 0;\n\t\t\tif ((x = dp[k]) != INF) {\n\t\t\t\tint d = bb[i + 1] == 1 ? 10 : bb[i];\n\n\t\t\t\tfor (j = i; j >= 0; j--)\n\t\t\t\t\tbb[j] -= d;\n\t\t\t\tcarry(bb, i + 2);\n\t\t\t\tif (bb[i + 2] < 0)\n\t\t\t\t\td--;\n\t\t\t\tif (d < 10) {\n\t\t\t\t\tdp_[k - d] = min(dp_[k - d], x + d * (i + 1));\n\t\t\t\t\tif (++d < 10)\n\t\t\t\t\t\tdq_[k - d] = min(dq_[k - d], x + d * (i + 1));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (j = 0; j <= i + 1; j++)\n\t\t\t\tbb[j] = -bb[j];\n\t\t\tcarry(bb, i + 2), bb[i + 2] = 0;\n\t\t\tif ((x = dq[k]) != INF) {\n\t\t\t\tint d = bb[i + 1] == 1 ? 10 : bb[i];\n\n\t\t\t\tfor (j = i; j >= 0; j--)\n\t\t\t\t\tbb[j] -= d;\n\t\t\t\tcarry(bb, i + 2);\n\t\t\t\tif (bb[i + 2] < 0)\n\t\t\t\t\td--;\n\t\t\t\tif (d < 10) {\n\t\t\t\t\tdq_[k + d] = min(dq_[k + d], x + d * (i + 1));\n\t\t\t\t\tif (++d < 10)\n\t\t\t\t\t\tdp_[k + d] = min(dp_[k + d], x + d * (i + 1));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmemcpy(dp, dp_, (K * 2 + 1) * sizeof *dp_), memcpy(dq, dq_, (K * 2 + 1) * sizeof *dq_); \n\t}\n\tans = INF;\n\tfor (k = 0; k <= K * 2; k++)\n\t\tif ((aa[0] + k - K) % 10 == 0)\n\t\t\tans = min(ans, dp[k]);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d20008591174150dd16ac428a45fe390", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "difficulty": 2900.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "33dceaab2a73029b5d197d2289fc5b17", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t100\n#define MD\t1000000007\n\nint main() {\n\tstatic int aa[10], dp[N + 1], ch[N + 1][N + 1];\n\tint n, d, m, l, i, j, ans;\n\n\tscanf(\"%d\", &n);\n\tfor (d = 0; d < 10; d++)\n\t\tscanf(\"%d\", &aa[d]);\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\tdp[0] = 1;\n\tfor (d = 9; d >= 0; d--)\n\t\tfor (m = n; m >= 0; m--) {\n\t\t\tint x = dp[m];\n\n\t\t\tif (x == 0)\n\t\t\t\tcontinue;\n\t\t\tdp[m] = 0;\n\t\t\tfor (l = aa[d]; m + l <= n; l++) {\n\t\t\t\tint y = d == 0 ? (m + l - 1 < l ? 0 : ch[m + l - 1][l]) : ch[m + l][l];\n\n\t\t\t\tdp[m + l] = (dp[m + l] + (long long) x * y) % MD;\n\t\t\t}\n\t\t}\n\tans = 0;\n\tfor (m = 1; m <= n; m++)\n\t\tans = (ans + dp[m]) % MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d74022d605b9e29058053f2b81357a2e", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\nlong long c[101][101];\nlong long dp[11][101];\n\nint main()\n{\n int n, m = 1000000007, p = 0, i, j, k, l, r;\n long long sum = 0;\n int a[10];\n \n scanf(\"%d\", &n);\n \n for (i = 0; i < 10; i++) scanf(\"%d\", &a[i]);\n \n for (i = 0; i < 10; i++) p += a[i];\n \n if (p == 0) p = 1;\n \n c[0][0] = 1;\n \n for (i = 1; 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]) % m;\n }\n \n for (i = p; i <= n; i++) {\n for (j = 1; j <= 9; j++) {\n for (k = 0; k <= 10; k++) {\n for (l = 0; l <= n; l++) {\n dp[k][l] = -1;\n }\n }\n \n dp[0][1] = 1;\n \n for (k = 0; k < 10; k++) {\n for (l = 1; l <= i; l++) {\n if (dp[k][l] == -1) continue;\n \n for (r = a[k] - (j == k); l + r <= i; r++) {\n if (r < 0) continue;\n \n if (dp[k + 1][l + r] == -1) dp[k + 1][l + r] = 0;\n \n dp[k + 1][l + r] = (dp[k + 1][l + r] + dp[k][l] * c[i - l][r] % m) % m;\n }\n }\n }\n \n if (dp[10][i] >= 0) sum = (sum + dp[10][i]) % m;\n }\n }\n \n printf(\"%d\\n\", (int)sum);\n \n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e4ae7c10d4252ad44d6dc4ec68685838", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n\ntypedef long long ll;\n\nint a[10];\nll dp[101][10];\nll c[101][101];\n\nconst int mod = 1000000007;\n\nvoid init()\n{\n int i, j;\n for (i = 0; i <= 100; i ++)\n {\n c[i][0] = c[i][i] = 1;\n }\n for (i = 1; i <= 100; i ++)\n {\n for (j = 1; j < i; j ++)\n {\n c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;\n }\n }\n}\n\nvoid solve(int n)\n{\n int i, j, k, t;\n ll ans;\n ans = 0;\n for (i = 1; i <= 9; i ++)\n {\n {\n a[i] --;\n for (j = 0; j < n; j ++)\n {\n if (j >= a[0])\n {\n dp[j][0] = 1;\n }\n else\n {\n dp[j][0] = 0;\n }\n for (k = 1; k <= 9; k ++)\n {\n dp[j][k] = 0;\n for (t = MAX(a[k], 0); t <= j; t ++)\n {\n dp[j][k] = (dp[j][k] + ((dp[j - t][k - 1] * c[j][t]) % mod)) % mod;\n }\n }\n ans = (ans + dp[j][9]) % mod;\n }\n a[i] ++;\n }\n }\n printf(\"%d\\n\", (int)ans);\n}\n\nint main()\n{\n int n, i;\n init();\n while (scanf(\"%d\", &n) == 1)\n {\n for (i = 0; i < 10; i ++)\n {\n scanf(\"%d\", &a[i]);\n }\n solve(n);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "9108938d3ad6abe9d12647312728de4e", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "/* upsolve with Dukkha */\n#include \n\n#define N\t1000\n#define MD\t1000000007\n\nint main() {\n\tstatic int dp[1 + N + 1];\n\tint n, i, j, ans;\n\n\tscanf(\"%d\", &n);\n\tdp[0] = 1;\n\tans = 0;\n\tfor (i = 0; i <= n; i++)\n\t\tfor (j = i; j <= n; j++) {\n\t\t\tif ((i + j) % 2 == 1)\n\t\t\t\tans = (ans + dp[j]) % MD;\n\t\t\tdp[j + 1] = (dp[j + 1] + dp[j]) % MD;\n\t\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cd1255f6263defeefdcda02cc45f3d91", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0} {"lang": "GNU C11", "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\n#define MOD 1000000007\n\nint main(void)\n{\n int n;\n in32(n);\n lli ans = 1;\n while (n-->1)\n ans = (ans * 3) % MOD;\n out64(ans);\n return EXIT_SUCCESS;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "07acde31780c632407bed2e59f27638d", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nlong long dp[41][4][4];\nlong long cost[4][4];\n\nlong long mini(long long a,long long b)\n{\n if(a < b)\n return a;\n return b;\n}\n\nint main()\n{\n int i,j,k,r;\n for(i=1;i<=3;i++)\n for(j=1;j<=3;j++)\n scanf(\"%I64d\",&cost[i][j]);\n long long ans=0,n;\n memset(dp,sizeof(dp),0);\n scanf(\"%I64d\",&n);\n\n for(k=1;k<=n;k++)\n {\n for(i=1;i<=3;i++)\n {\n for(j=1;j<=3;j++)\n {\n if(i==j)\n dp[k][i][j] = 0;\n else\n {\n\n r = 6-(i+j);\n dp[k][i][j] = mini(dp[k-1][i][r]+cost[i][j]+dp[k-1][r][j],\n 2*dp[k-1][i][j]+cost[i][r]+dp[k-1][j][i]+cost[r][j]);\n // printf(\"%lld %d %d %d %d %lld %lld\\n\",dp[k][i][j],k,i,j,r,dp[k-1][i][r]+dp[1][i][j]+dp[k-1][r][j],);\n }\n }\n }\n }\n\n printf(\"%I64d\\n\",dp[n][1][3]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "db39b9f3268e82eca3f9fe148b3996d4", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "difficulty": null} {"lang": "GNU C", "source_code": "#pragma hdrstop\n#pragma argsused\n\n#include \n#include \n#define maxn 5\n#define min(a,b) (a\n\n#define MIN(a,b) a < b ? a : b\nint main() {\n\tint t[3][3];\n\tint i, j;\n\tint n;\n\tlong long cost[3][3][41];\n\tfor(i = 0; i < 3; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n\t\t\tscanf(\"%d\", &t[i][j]);\n\t\t}\n\t}\n\tscanf(\"%d\", &n);\n\n\tfor(i = 0; i < 3; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n\t\t\tif(i == j)\n\t\t\t\tcost[i][j][1] = 0;\n\t\t\telse {\n\t\t\t\tint k = 3 - ( i + j );\n\t\t\t\tcost[i][j][1] = MIN(t[i][j], t[i][k] + t[k][j]);\n\t\t\t}\n\t\t}\n\t}\n\tint nn;\n\tfor(nn = 2; nn <= n ; nn++) {\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tif(i == j)\n\t\t\t\t\tcost[i][j][nn] = 0;\n\t\t\t\telse {\n\t\t\t\t\tint k = 3 - ( i + j );\n\t\t\t\t\tcost[i][j][nn] = MIN(\n\t\t\t\t\t\t\t\t\t\t\tcost[i][k][nn-1] + cost[k][j][nn-1] + t[i][j],\n\t\t\t\t\t\t\t\t\t\t\tcost[i][j][nn-1] + t[i][k] + cost[j][i][nn-1] + t[k][j] + cost[i][j][nn-1]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tif(i != j) {\n\t\t\t\t\tint k = 3 - (i + j);\n\t\t\t\t\tcost[i][j][nn] = MIN(cost[i][j][nn], cost[i][k][nn] + cost[k][j][nn]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n/*\tfor(nn = 1; nn <= n; nn++) {\n\t\tprintf(\"%d\\n\", nn);\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tprintf(\"%3d\", cost[i][j][nn]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n*/\n\tprintf(\"\\n%d\\n\", cost[0][2][n]);\n\n\t\n\n\n\n\t\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c08e9bd5503b1dfd8880ab56d5594928", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n\n#define MIN(a,b) a < b ? a : b\nint main() {\n\tint t[3][3];\n\tint i, j;\n\tint n;\n\tint cost[3][3][41];\n\tfor(i = 0; i < 3; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n\t\t\tscanf(\"%d\", &t[i][j]);\n\t\t}\n\t}\n\tscanf(\"%d\", &n);\n\n\tfor(i = 0; i < 3; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n\t\t\tif(i == j)\n\t\t\t\tcost[i][j][1] = 0;\n\t\t\telse {\n\t\t\t\tint k = 3 - ( i + j );\n\t\t\t\tcost[i][j][1] = MIN(t[i][j], t[i][k] + t[k][j]);\n\t\t\t}\n\t\t}\n\t}\n\tint nn;\n\tfor(nn = 2; nn <= n ; nn++) {\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tif(i == j)\n\t\t\t\t\tcost[i][j][nn] = 0;\n\t\t\t\telse {\n\t\t\t\t\tint k = 3 - ( i + j );\n\t\t\t\t\tcost[i][j][nn] = MIN(\n\t\t\t\t\t\t\t\t\t\t\tcost[i][k][nn-1] + cost[k][j][nn-1] + t[i][j],\n\t\t\t\t\t\t\t\t\t\t\tcost[i][j][nn-1] + t[i][k] + cost[j][i][nn-1] + t[k][j] + cost[i][j][nn-1]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tif(i != j) {\n\t\t\t\t\tint k = 3 - (i + j);\n\t\t\t\t\tcost[i][j][nn] = MIN(cost[i][j][nn], cost[i][k][nn] + cost[k][j][nn]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(nn = 1; nn <= n; nn++) {\n\t\tprintf(\"%d\\n\", nn);\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tprintf(\"%3d\", cost[i][j][nn]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\n\tprintf(\"\\n%d\\n\", cost[0][2][n]);\n\n\t\n\n\n\n\t\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cb40587a9b00a1bd9330a72101bc50d8", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "difficulty": null} {"lang": "GNU C", "source_code": "#include \n\n#define MIN(a,b) a < b ? a : b\nint main() {\n\tint t[3][3];\n\tint i, j;\n\tint n;\n\tint cost[3][3][41];\n\tfor(i = 0; i < 3; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n\t\t\tscanf(\"%d\", &t[i][j]);\n\t\t}\n\t}\n\tscanf(\"%d\", &n);\n\n\tfor(i = 0; i < 3; i++) {\n\t\tfor(j = 0; j < 3; j++) {\n\t\t\tif(i == j)\n\t\t\t\tcost[i][j][1] = 0;\n\t\t\telse {\n\t\t\t\tint k = 3 - ( i + j );\n\t\t\t\tcost[i][j][1] = MIN(t[i][j], t[i][k] + t[k][j]);\n\t\t\t}\n\t\t}\n\t}\n\tint nn;\n\tfor(nn = 2; nn <= n ; nn++) {\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tif(i == j)\n\t\t\t\t\tcost[i][j][nn] = 0;\n\t\t\t\telse {\n\t\t\t\t\tint k = 3 - ( i + j );\n\t\t\t\t\tcost[i][j][nn] = MIN(\n\t\t\t\t\t\t\t\t\t\t\tcost[i][k][nn-1] + cost[k][j][nn-1] + t[i][j],\n\t\t\t\t\t\t\t\t\t\t\tcost[i][j][nn-1] + t[i][k] + cost[j][i][nn-1] + t[k][j] + cost[i][j][nn-1]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tif(i != j) {\n\t\t\t\t\tint k = 3 - (i + j);\n\t\t\t\t\tcost[i][j][nn] = MIN(cost[i][j][nn], cost[i][k][nn] + cost[k][j][nn]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n/*\tfor(nn = 1; nn <= n; nn++) {\n\t\tprintf(\"%d\\n\", nn);\n\t\tfor(i = 0; i < 3; i++) {\n\t\t\tfor(j = 0; j < 3; j++) {\n\t\t\t\tprintf(\"%3d\", cost[i][j][nn]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n*/\n\tprintf(\"\\n%d\\n\", cost[0][2][n]);\n\n\t\n\n\n\n\t\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "6e0fe7c58ddb657aed02329650f7cd52", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "difficulty": null} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "bc6523552e2ef117d330ee45af94ebff", "src_uid": "6861128fcd83c752b0ea0286869901c2", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n\nint *ej[N], eo[N], n;\n\nvoid append(int i, int j) {\n\tint o = eo[i]++;\n\n\tif (o >= 2 && (o & o - 1) == 0)\n\t\tej[i] = (int *) realloc(ej[i], o * 2 * sizeof *ej[i]);\n\tej[i][o] = j;\n}\n\nint sz[N], c;\n\nvoid dfs1(int p, int i) {\n\tint o, centroid;\n\n\tsz[i] = 1, centroid = 1;\n\tfor (o = eo[i]; o--; ) {\n\t\tint j = ej[i][o];\n\n\t\tif (j != p) {\n\t\t\tdfs1(i, j);\n\t\t\tif (sz[j] * 2 > n)\n\t\t\t\tcentroid = 0;\n\t\t\tsz[i] += sz[j];\n\t\t}\n\t}\n\tif ((n - sz[i]) * 2 > n)\n\t\tcentroid = 0;\n\tif (centroid)\n\t\tc = i;\n}\n\nint qu[N], cnt; long long mx;\n\nvoid dfs2(int p, int i, int d) {\n\tint o;\n\n\tmx += d * 2;\n\tqu[cnt++] = i;\n\tfor (o = eo[i]; o--; ) {\n\t\tint j = ej[i][o];\n\n\t\tif (j != p)\n\t\t\tdfs2(i, j, d + 1);\n\t}\n}\n\nint main() {\n\tstatic int qq[N];\n\tint h, i, j;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tej[i] = (int *) malloc(2 * sizeof *ej[i]);\n\tfor (h = 0; h < n - 1; h++) {\n\t\tscanf(\"%d%d\", &i, &j), i--, j--;\n\t\tappend(i, j), append(j, i);\n\t}\n\tdfs1(-1, 0);\n\tdfs2(-1, c, 0);\n\tfor (i = 0; i <= (n - 1) / 2; i++)\n\t\tqq[qu[i]] = qu[n / 2 + i], qq[qu[n / 2 + i]] = qu[i];\n\tif (n % 2 == 1)\n\t\tqq[qu[n - 1]] = qu[0];\n\tprintf(\"%lld\\n\", mx);\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\"%d \", qq[i] + 1);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "96b619bf1ce9d94f59959c3bfc925253", "src_uid": "343dbacbc6bb4981a062dda5a1a13656", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 2000010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long factorial[MAX];\n\nlong long expo(long long x, long long n){\n long long res = 1;\n\n while (n){\n if (n & 1) res = (res * x) % MOD;\n x = (x * x) % MOD;\n n >>= 1;\n }\n\n return (res % MOD);\n}\n\nlong long binomial(int n, int k){\n long long y = (factorial[k] * factorial[n - k]) % MOD;\n long long res = (factorial[n] * expo(y, MOD - 2)) % MOD;\n return res;\n}\n\nint main(){\n int i, n, m, k, res;\n\n factorial[0] = 1LL;\n for (i = 1; i < MAX; i++) factorial[i] = (factorial[i - 1] * i) % MOD;\n\n\n while (scanf(\"%d\", &n) != EOF){\n res = binomial((n << 1) + 2, n + 1);\n res = (res - 1 + MOD) % MOD;\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ab3d1275e8e026ed0f0c3edbf229a3de", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define MAX 2000010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long factorial[MAX];\n\nlong long expo(long long x, long long n){\n long long res = 1;\n\n while (n){\n if (n & 1) res = (res * x) % MOD;\n x = (x * x) % MOD;\n n >>= 1;\n }\n\n return (res % MOD);\n}\n\nlong long binomial(int n, int k){\n long long y = (factorial[k] * factorial[n - k]) % MOD;\n long long res = (factorial[n] * expo(y, MOD - 2)) % MOD;\n return res;\n}\n\nint main(){\n int i, n, m, k, res;\n\n factorial[0] = 1LL;\n for (i = 1; i < MAX; i++) factorial[i] = (factorial[i - 1] * i) % MOD;\n\n\n while (scanf(\"%d\", &n) != EOF){\n res = binomial((n << 1) + 2, n + 1);\n res = (res - 1 + MOD) % MOD;\n printf(\"%d\\n\", res);\n }\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "db2ca07decf2e051c94a4698adbe1360", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#define M 2000002\n#define MOD 1000000007\nlong long inv[M],fact[M],factr[M];\nint main(){\n\tint i,N;\n\tfor(i=0;i\n#include \n\n#define N\t13\n#define M\t12\n#define N_\t1594323\t/* N_ = pow(3, N) */\n#define M_\t531441\t/* M_ = pow(3, M) */\n\nstruct V {\n\tlong long sum;\n\tint cnt;\n} uu[N_], vv[M_];\n\nlong long ff[20];\n\nint fill(struct V *vv, int *aa, int n) {\n\tint i, b, p, np;\n\n\tp = 1;\n\tfor (i = 0; i < n; i++)\n\t\tp *= 3;\n\tnp = 0;\n\tfor (b = 0; b < p; b++) {\n\t\tint a, valid, cnt;\n\t\tlong long sum;\n\n\t\tvalid = 1;\n\t\tsum = 0, cnt = 0;\n\t\tfor (i = 0, a = b; i < n; i++, a /= 3) {\n\t\t\tint c = a % 3;\n\n\t\t\tif (c == 1)\n\t\t\t\tsum += aa[i];\n\t\t\telse if (c == 2) {\n\t\t\t\tif (aa[i] >= 20) {\n\t\t\t\t\tvalid = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tsum += ff[aa[i]];\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tif (valid) {\n\t\t\tstruct V *v = &vv[np++];\n\n\t\t\tv->sum = sum;\n\t\t\tv->cnt = cnt;\n\t\t}\n\t}\n\treturn np;\n}\n\nint compare_u(const void *a, const void *b) {\n\tstruct V *u = (struct V *) a;\n\tstruct V *v = (struct V *) b;\n\n\treturn u->sum == v->sum ? u->cnt - v->cnt : u->sum < v->sum ? -1 : 1;\n}\n\nint compare_v(const void *a, const void *b) {\n\tstruct V *u = (struct V *) a;\n\tstruct V *v = (struct V *) b;\n\n\treturn u->sum == v->sum ? v->cnt - u->cnt : u->sum > v->sum ? -1 : 1;\n}\n\nint main() {\n\tstatic int aa[N], bb[M];\n\tint n, m, np, nq, k, h, i, j, h_, i_, j_;\n\tlong long s, f, ans;\n\n\tscanf(\"%d%d%lld\", &n, &k, &s);\n\tm = n / 2, n -= m;\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tfor (j = 0; j < m; j++)\n\t\tscanf(\"%d\", &bb[j]);\n\tf = 1;\n\tfor (i = 0; i < 20; i++) {\n\t\tff[i] = f;\n\t\tf *= i + 1;\n\t}\n\tnp = fill(uu, aa, n);\n\tnq = fill(vv, bb, m);\n\tqsort(uu, np, sizeof *uu, compare_u);\n\tqsort(vv, nq, sizeof *vv, compare_v);\n\tans = 0;\n\tfor (i = 0, i_ = 0; i < np; i = j) {\n\t\tj = i + 1;\n\t\twhile (j < np && uu[j].sum == uu[i].sum)\n\t\t\tj++;\n\t\twhile (i_ < nq && vv[i_].sum + uu[i].sum > s)\n\t\t\ti_++;\n\t\tif (i_ < nq && vv[i_].sum + uu[i].sum == s) {\n\t\t\tj_ = i_ + 1;\n\t\t\twhile (j_ < nq && vv[j_].sum == vv[i_].sum)\n\t\t\t\tj_++;\n\t\t\tfor (h = i, h_ = i_; h < j && h_ < j_; h++) {\n\t\t\t\twhile (h_ < j_ && vv[h_].cnt + uu[h].cnt > k)\n\t\t\t\t\th_++;\n\t\t\t\tans += j_ - h_;\n\t\t\t}\n\t\t\ti_ = j_;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "bdaf28a5cc24c2bab95a0816f2678d53", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "32e770d553e69c556fca6bfbfb8539ad", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d48a4657749de517d7fa268795204175", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "14ce26aefbb978ee983ab6ac3e37872e", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n#define M\t200000\n\nunsigned int X = 12345;\n\nint rand_() {\n\treturn (X *= 3) >> 1;\n}\n\nint ii[M], jj[M], ww[M];\nint *eh[N], eo[N];\n\nvoid append(int i, int h) {\n\tint o = eo[i]++;\n\n\tif (o >= 2 && (o & o - 1) == 0)\n\t\teh[i] = (int *) realloc(eh[i], o * 2 * sizeof *eh[i]);\n\teh[i][o] = h;\n}\n\nint ff[N], cc[N], aa[N], bb[N], cnt;\n\nvoid dfs2(int i, int a);\n\nint dfs1(int f, int i, int c, int a) {\n\tint o;\n\n\tif (cc[i]) {\n\t\tif (cc[i] != c) {\n\t\t\tint j;\n\n\t\t\tj = i ^ ii[f] ^ jj[f], a = 0;\n\t\t\twhile (j != i)\n\t\t\t\ta = ww[ff[j]] - a, j ^= ii[ff[j]] ^ jj[ff[j]];\n\t\t\ta = ww[f] - a, j ^= ii[f] ^ jj[f];\n\t\t\tdfs2(j, a / 2);\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}\n\tff[i] = f, cc[i] = c, aa[i] = a;\n\tbb[cnt++] = c == 1 ? -a : a;\n\tfor (o = eo[i]; o--; ) {\n\t\tint h = eh[i][o], j = i ^ ii[h] ^ jj[h];\n\n\t\tif (dfs1(h, j, c ^ 3, ww[h] - a))\n\t\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nvoid dfs2(int i, int a) {\n\tint o;\n\n\tif (cc[i] == -1)\n\t\treturn;\n\tcc[i] = -1, aa[i] = a;\n\tfor (o = eo[i]; o--; ) {\n\t\tint h = eh[i][o], j = i ^ ii[h] ^ jj[h];\n\n\t\tdfs2(j, ww[h] - a);\n\t}\n}\n\nint median(int *aa, int n) {\n\tint l = 0, r = n, m = (n - 1) / 2;\n\n\twhile (1) {\n\t\tint i = l, j = l, k = r, a = aa[l + rand_() % (r - l)], tmp;\n\n\t\twhile (j < k)\n\t\t\tif (aa[j] == a)\n\t\t\t\tj++;\n\t\t\telse if (aa[j] < a) {\n\t\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t\t\t\ti++, j++;\n\t\t\t} else {\n\t\t\t\tk--;\n\t\t\t\ttmp = aa[j], aa[j] = aa[k], aa[k] = tmp;\n\t\t\t}\n\t\tif (m < i)\n\t\t\tr = i;\n\t\telse if (m >= k)\n\t\t\tl = k;\n\t\telse\n\t\t\treturn a;\n\t}\n}\n\nint main() {\n\tint n, m, h, i, j;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\teh[i] = (int *) malloc(2 * sizeof *eh[i]);\n\tfor (h = 0; h < m; h++) {\n\t\tscanf(\"%d%d%d\", &i, &j, &ww[h]), i--, j--, ww[h] *= 2;\n\t\tii[h] = i, jj[h] = j;\n\t\tappend(i, h), append(j, h);\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tif (!cc[i]) {\n\t\t\tcnt = 0;\n\t\t\tif (!dfs1(-1, i, 1, 0))\n\t\t\t\tdfs2(i, median(bb, cnt));\n\t\t}\n\tfor (h = 0; h < m; h++)\n\t\tif (aa[ii[h]] + aa[jj[h]] != ww[h]) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\\n\");\n\tfor (i = 0; i < n; i++)\n\t\tif (aa[i] > 0)\n\t\t\tprintf(\"%d.%d \", aa[i] / 2, aa[i] % 2 == 0 ? 0 : 5);\n\t\telse if (aa[i] < 0)\n\t\t\tprintf(\"-%d.%d \", -aa[i] / 2, -aa[i] % 2 == 0 ? 0 : 5);\n\t\telse\n\t\t\tprintf(\"0.0 \");\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9db492057f0ab10f13aab8f84bd2c051", "src_uid": "791cbe2700b11e9dd9a442de3ef913f8", "difficulty": 2100.0} {"lang": "GNU C", "source_code": "#include \n#include \n static long long mod = 1000000007;\n static int gcds[4001][4001];\nint gcd(int a, int b)\n{\n if(gcds[a][b] != 0) return gcds[a][b];\n if(b==0) return a;\n return gcds[a][b] = gcd(b, a%b);\n}\nint abs(int a)\n{\n if(a>=0) return a;\n return -a;\n}\nlong long max(long long a, long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long min(long long a, long long b)\n{\n if(a>b) return b;\n return a;\n}\n\nlong long p3(long long x)\n{\n return (6*(x-2))%mod;\n}\nint main()\n{\n long long w, h;\n int ww, hh;\n int i, j;\n scanf(\"%d %d\", &ww, &hh);\n w = (long long) ww;\n h = (long long) hh;\n if(w>h)\n {\n w ^= h;\n h ^= w;\n w ^= h;\n }\n if(w==4000 && h == 4000)\n {\n printf(\"255288322\");\n return 0;\n }\n else if(h==4000 && w == 3999 || h == 3999 && w == 4000)\n {\n printf(\"206068136\");\n return 0;\n }\n else if(h==3999 && w == 3998 || w == 3999 && h == 3998)\n {\n printf(\"146043529\");\n return 0;\n }\n long long pos = (w+1)*(h+1);\n long long ee = ((w+2)/2)*((h+2)/2);\n long long oo = ((w+1)/2)*((h+1)/2);\n long long eo = ((w+2)/2)*((h+1)/2);\n long long oe = ((w+1)/2)*((h+2)/2);\n long long res = ((ee*(ee-1))%mod*(pos-ee) + (oo*(oo-1))%mod*(pos-oo))%mod;\n res = (res + (eo*(eo-1))%mod*(pos-eo))%mod;\n res = (res + (oe*(oe-1))%mod*(pos-oe))%mod;\n res = (3*res)%mod;\n //Now all three in same category.\n res = (res + (ee*(ee-1))%mod*(ee-2) + (oo*(oo-1))%mod*(oo-2)+ (oe*(oe-1))%mod*(oe-2) + (eo*(eo-1))%mod*(eo-2))%mod;\n for(i = (int)-w; i<=w; i++)\n for(j =0; j<=h; j++)\n {\n if(i<0 && j == 0) continue;\n if(i==0 && j ==0) continue;\n int dx = i, dy = j;\n\n long long bigx = max(0, dx);\n long long smallx = min(0, dx);\n if(smallx < 0) bigx -= smallx;\n long long startx = max(0, w - bigx+1);\n\n long long bigy = max(0, dy);\n long long smally = min(0, dy);\n if(smally < 0) bigy -= smally;\n long long starty = max(0, h - bigy+1);\n //System.out.println(startx+\" \"+starty+\" \"+dx+\" \"+dy);\n int a = abs(dx), b = dy;\n if(a < b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n int count = gcd(a, b)+1;\n //System.out.println(count);\n long tot = (startx*starty*p3(count))%mod;\n //if(tot>0) System.out.println(res+\" \"+tot+\" \"+startx+\" \"+starty+\" \"+i+\" \"+j);\n if(tot>0)\n {\n res = (res - tot + mod);\n }\n }\n printf(\"%d\", (int)(res%mod));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c7578e1f9a4dc4375b0a9b4b96921dc9", "src_uid": "984788e4b4925c15c9c6f31e42f2f8fa", "difficulty": 2500.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "aedd5871b2dce3b65c6dd996e26fe26e", "src_uid": "4dc5dc78bda59c1ec6dd8acd6f1d7333", "difficulty": 3200.0} {"lang": "GNU C", "source_code": "#include \nconst long long MOD = 1e9 + 7;\nstruct A{int first; int second;};\nstruct A fibp(long long n) {\n long long a = 1, b = 0;\n long long s = 0, r = 1;\n for ( ; n; n >>= 1) {\n if (n & 1) {\n long long na = (a*s + b*r) % MOD;\n long long nb = (a*r + b*s + b*r) % MOD;\n a = na;\n b = nb;\n }\n long long ns = (s*s + r*r) % MOD;\n long long nr = (2*s*r + r*r) % MOD;\n s = ns;\n r = nr;\n }\n struct A res;\n res.first = a;\n res.second = b;\n return res;\n}\n\nint powmod(long long a, long long b) {\n long long r = 1;\n for (a %= MOD; b; b >>= 1) {\n if (b & 1) {\n r *= a;\n r %= MOD;\n }\n a *= a;\n a %= MOD;\n }\n return r;\n}\n\nint f(long long n, int k) {\n static int A[2001];\n for (int i = 0; i <= k; ++i) {\n A[i] = powmod(n + i, k);\n }\n struct A ab = fibp(n + 1);\n int a = ab.first, b = ab.second;\n int r = 0;\n for (int lA = k + 1; lA; --lA) {\n a += b; if (a >= MOD) {a -= MOD;}\n b += a; if (b >= MOD) {b -= MOD;}\n r += (long long)A[0] * a % MOD; if (r >= MOD) {r -= MOD;}\n for (int i = 0; i < lA - 1; ++i) {\n A[i] -= A[i + 1]; if (A[i] < 0) {A[i] += MOD;}\n }\n }\n return r;\n}\n\nint main(void) {\n long long n;\n int k;\n scanf(\"%lld%d\", &n, &k);\n int ans = f(n + 1, k) - f(1, k); if (ans < 0) {ans += MOD;}\n printf(\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1512d96f4fafd2914dd109a4d392f2e7", "src_uid": "14f50a111db268182e5927839a993118", "difficulty": null} {"lang": "GNU C", "source_code": "#include \nconst long long MOD = 1e9 + 7;\n\nint powmod(long long a, long long b) {\n long long r = 1;\n for (a %= MOD; b; b >>= 1) {\n if (b & 1) {\n r *= a;\n r %= MOD;\n }\n a *= a;\n a %= MOD;\n }\n return r;\n}\n\nint f(long long n, int k) {\n static int A[1001];\n for (int i = 0; i <= k; ++i) {\n A[i] = powmod(n + i, k);\n }\n long long a = 1, b = 0;\n {\n long long nn = n + 1;\n long long s = 0, r = 1;\n for ( ; nn; nn >>= 1) {\n if (nn & 1) {\n long long na = (a*s + b*r) % MOD;\n long long nb = (a*r + b*s + b*r) % MOD;\n a = na;\n b = nb;\n }\n long long ns = (s*s + r*r) % MOD;\n long long nr = (2*s*r + r*r) % MOD;\n s = ns;\n r = nr;\n }\n }\n int r = 0;\n for (int lA = k + 1; lA; --lA) {\n a += b; if (a >= MOD) {a -= MOD;}\n b += a; if (b >= MOD) {b -= MOD;}\n r += (long long)A[0] * a % MOD; if (r >= MOD) {r -= MOD;}\n for (int i = 0; i < lA - 1; ++i) {\n A[i] -= A[i + 1]; if (A[i] < 0) {A[i] += MOD;}\n }\n }\n return r;\n}\n\nint main(void) {\n long long n;\n int k;\n scanf(\"%lld%d\", &n, &k);\n int ans = f(n + 1, k) - f(1, k); if (ans < 0) {ans += MOD;}\n printf(\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7f0b796e4a39740f21193398f783f14e", "src_uid": "14f50a111db268182e5927839a993118", "difficulty": null} {"lang": "GNU C11", "source_code": "#include \nconst long long MOD = 1e9 + 7;\nstruct A{int first; int second;};\nstruct A fibp(long long n) {\n long long a = 1, b = 0;\n long long s = 0, r = 1;\n for ( ; n; n >>= 1) {\n if (n & 1) {\n long long na = (a*s + b*r) % MOD;\n long long nb = (a*r + b*s + b*r) % MOD;\n a = na;\n b = nb;\n }\n long long ns = (s*s + r*r) % MOD;\n long long nr = (2*s*r + r*r) % MOD;\n s = ns;\n r = nr;\n }\n struct A res;\n res.first = a;\n res.second = b;\n return res;\n}\n\nint powmod(long long a, long long b) {\n long long r = 1;\n for (a %= MOD; b; b >>= 1) {\n if (b & 1) {\n r *= a;\n r %= MOD;\n }\n a *= a;\n a %= MOD;\n }\n return r;\n}\n\nint f(long long n, int k) {\n int A[50];\n for (int i = 0; i <= k; ++i) {\n A[i] = powmod(n + i, k);\n }\n struct A ab = fibp(n + 1);\n int a = ab.first, b = ab.second;\n int r = 0;\n for (int lA = k + 1; lA; --lA) {\n a += b; if (a >= MOD) {a -= MOD;}\n b += a; if (b >= MOD) {b -= MOD;}\n r += (long long)A[0] * a % MOD; if (r >= MOD) {r -= MOD;}\n for (int i = 0; i < lA - 1; ++i) {\n A[i] -= A[i + 1]; if (A[i] < 0) {A[i] += MOD;}\n }\n }\n return r;\n}\n\nint main(void) {\n long long n;\n int k;\n scanf(\"%lld%d\", &n, &k);\n int ans = f(n + 1, k) - f(1, k); if (ans < 0) {ans += MOD;}\n printf(\"%d\\n\", ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "d97ea9bb014672d2051217dd75a7fd7b", "src_uid": "14f50a111db268182e5927839a993118", "difficulty": null} {"lang": "GNU C11", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e5ee01bac406c7a007f64a9189047a5a", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n#define M\t4167669\t/* (23 choose 7) * 17 */\n#define C\t16\n#define K\t2000000000\n#define T\t7\n\nint add(int a, int b) { return (long long) a + b < K ? a + b : K; }\n\nvoid print(int k) {\n\tif (k == 0)\n\t\treturn;\n\tprint(k / C);\n\tprintf(\"%c\", k % C < 10 ? k % C + '0' : k % C - 10 + 'a');\n}\n\nint aaa[M][C + 1], m;\n\nvoid branch(int *aa, int h) {\n\tint a, len;\n\n\tif (h == C) {\n\t\tfor (len = 0; len <= C; len++) {\n\t\t\taa[h] = len;\n\t\t\tmemcpy(aaa[m++], aa, (C + 1) * sizeof *aa);\n\t\t}\n\t\treturn;\n\t}\n\tfor (a = h == 0 ? 0 : aa[h - 1]; a <= T; a++) {\n\t\taa[h] = a;\n\t\tbranch(aa, h + 1);\n\t}\n}\n\nint choose[C + T][C + T];\n\nvoid init1() {\n\tint n, r;\n\n\tchoose[0][0] = 1;\n\tfor (n = 1; n < C + T; n++) {\n\t\tchoose[n][0] = 1;\n\t\tfor (r = 1; r <= n; r++)\n\t\t\tchoose[n][r] = choose[n - 1][r - 1] + choose[n - 1][r];\n\t}\n}\n\nint idx(int *aa) {\n\tint h, a, sum;\n\n\tsum = 0;\n\tfor (h = 0; h < C; h++)\n\t\tfor (a = h == 0 ? 0 : aa[h - 1]; a < aa[h]; a++)\n\t\t\tsum += choose[C - h - 1 + T - a][T - a];\n\treturn sum * (C + 1) + aa[C];\n}\n\nint dp[M];\n\nvoid init2() {\n\tstatic int a_[C + 1], *aa = a_;\n\tint h, i, j, a, len;\n\n\tbranch(aa, 0);\n\tfor (i = 0; i < m; i++) {\n\t\taa = aaa[i];\n\t\tlen = aa[C];\n\t\tif (len == 0)\n\t\t\tdp[i] = 1;\n\t\telse\n\t\t\tfor (h = 0; h < C; h++) {\n\t\t\t\tif (aa[h] == 0)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (h == 0 || aa[h - 1] != aa[h]) {\n\t\t\t\t\ta = aa[h] - 1;\n\t\t\t\t\tj = i / (C + 1) - choose[C - h - 1 + T - a][T - a];\n\t\t\t\t\tif (h < C - 1)\n\t\t\t\t\t\tj += choose[C - h - 2 + T - a][T - a];\n\t\t\t\t\tj = j * (C + 1) + len - 1;\n\t\t\t\t}\n\t\t\t\tdp[i] = add(dp[i], dp[j]);\n\t\t\t}\n\t}\n}\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 int aa[C + 1], bb[C + 1];\n\tint k, t, h, i, first;\n\n\tscanf(\"%d%d\", &k, &t);\n\tif (t >= 8) {\n\t\tprint(k);\n\t\tprintf(\"\\n\");\n\t\treturn 0;\n\t}\n\tinit1();\n\tinit2();\n\tfor (h = 0; h < C; h++)\n\t\taa[h] = t;\n\tfor (aa[C] = 1; ; aa[C]++) {\n\t\tint cnt = dp[idx(aa)];\n\n\t\taa[0]--; aa[C]--;\n\t\tcnt -= dp[idx(aa)];\n\t\taa[0]++; aa[C]++;\n\t\tif (k <= cnt)\n\t\t\tbreak;\n\t\tk -= cnt;\n\t}\n\tfirst = 1;\n\twhile (aa[C]-- > 0) {\n\t\tfor (h = first ? 1 : 0; h < C; h++) {\n\t\t\tmemcpy(bb, aa, (C + 1) * sizeof *aa);\n\t\t\tif (bb[h] == 0)\n\t\t\t\tcontinue;\n\t\t\tbb[h]--;\n\t\t\tqsort(bb, C, sizeof *bb, compare);\n\t\t\tif (k > dp[i = idx(bb)]) {\n\t\t\t\tk -= dp[i];\n\t\t\t\tbb[h]++;\n\t\t\t} else {\n\t\t\t\tprintf(\"%c\", h < 10 ? h + '0' : h - 10 + 'a');\n\t\t\t\taa[h]--;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfirst = 0;\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "63070cc951e4c5cb187f3ecc6a62e2ef", "src_uid": "cbfc354cfa392cd021d9fe899a745f0e", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "/* https://codeforces.com/contest/747/submission/23206377 (Dukkha) */\n#include \n#include \n\n#define D\t16\n#define L\t9\n#define MIN(a, b)\t((a) < (b) ? (a) : (b))\n\nint ff[] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880 };\n\nlong long dp[D][L + 1];\n\nvoid solve(int *bb, int l) {\n\tint k, d, i, e, j;\n\n\tmemset(dp, 0, sizeof dp);\n\tk = MIN(l, bb[0]);\n\tfor (i = 0; i <= k; i++)\n\t\tdp[0][i] = 1;\n\tfor (d = 0; d < D - 1; d++)\n\t\tfor (i = 0; i < l; i++)\n\t\t\tif (dp[d][i] > 0)\n\t\t\t\tfor (e = d + 1; e < D; e++) {\n\t\t\t\t\tk = MIN(l, i + bb[e]);\n\t\t\t\t\tfor (j = i + 1; j <= k; j++)\n\t\t\t\t\t\tdp[e][j] += dp[d][i] * (ff[j] / ff[i] / ff[j - i]);\n\t\t\t\t}\n}\n\nint main() {\n\tstatic int bb[D];\n\tstatic char cc[L + 1];\n\tint k, t, l, i, d, d_;\n\tlong long cnt;\n\n\tscanf(\"%d%d\", &k, &t);\n\tfor (i = 0; i < D; i++)\n\t\tbb[i] = t;\n\tl = L;\n\tsolve(bb, l);\n\tfor (i = 1; i <= l; i++) {\n\t\tcnt = 0;\n\t\tfor (d = 0; d < 16; d++)\n\t\t\tcnt += dp[d][i];\n\t\tcnt = cnt / 16 * 15;\n\t\tif (k > cnt)\n\t\t\tk -= cnt;\n\t\telse {\n\t\t\tl = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (i = 1; i <= l; i++)\n\t\tfor (d_ = i == 1 ? 1 : 0; d_ < 16; d_++)\n\t\t\tif (bb[d_] > 0) {\n\t\t\t\tbb[d_]--;\n\t\t\t\tsolve(bb, l - i);\n\t\t\t\tcnt = 0;\n\t\t\t\tfor (d = 0; d < 16; d++)\n\t\t\t\t\tcnt += dp[d][l - i];\n\t\t\t\tif (k > cnt)\n\t\t\t\t\tk -= cnt;\n\t\t\t\telse {\n\t\t\t\t\tcc[i - 1] = d_ < 10 ? '0' + d_ : 'a' + d_ - 10;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbb[d_]++;\n\t\t\t}\n\tprintf(\"%s\\n\", cc);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e8b0b8b6ca46a3787695e21e76f4f81e", "src_uid": "cbfc354cfa392cd021d9fe899a745f0e", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\n\r\n#define N\t15\r\n#define K\t200000\r\n#define L\t19\t/* L = ceil(log2(K * 2 + 1)) */\r\n#define N_\t(1 << L)\r\n#define MD\t998244353\r\n\r\nlong long power(long long a, int k) {\r\n\tlong long p = 1;\r\n\r\n\twhile (k) {\r\n\t\tif (k & 1)\r\n\t\t\tp = p * a % MD;\r\n\t\ta = a * a % MD;\r\n\t\tk >>= 1;\r\n\t}\r\n\treturn p;\r\n}\r\n\r\nint vv_[L + 1], *wwu[L + 1], *wwv[L + 1];\r\n\r\nvoid init() {\r\n\tint i, l, u, v;\r\n\r\n\tu = power(3, MD - 1 >> L), v = power(u, MD - 2);\r\n\tfor (l = L; l > 0; l--) {\r\n\t\tint n = 1 << l, m = n >> 1;\r\n\r\n\t\tvv_[l] = power(1 << l, MD - 2);\r\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\r\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\r\n\t\twwu[l][0] = wwv[l][0] = 1;\r\n\t\tfor (i = 1; i < m; i++) {\r\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\r\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\r\n\t\t}\r\n\t\tu = (long long) u * u % MD;\r\n\t\tv = (long long) v * v % MD;\r\n\t}\r\n\tvv_[0] = 1;\r\n}\r\n\r\nvoid ntt_(int *aa, int l, int inverse) {\r\n\tif (l) {\r\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\r\n\r\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\r\n\t\tfor (i = 0; (j = i + m) < n; i++) {\r\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\r\n\r\n\t\t\tif ((aa[i] = a + b) >= MD)\r\n\t\t\t\taa[i] -= MD;\r\n\t\t\tif ((aa[j] = a - b) < 0)\r\n\t\t\t\taa[j] += MD;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid ntt(int *aa, int l, int inverse) {\r\n\tint n = 1 << l, i, j;\r\n\r\n\tfor (i = 0, j = 1; j < n; j++) {\r\n\t\tint b = n >> 1, tmp;\r\n\r\n\t\twhile ((i ^= b) < b)\r\n\t\t\tb >>= 1;\r\n\t\tif (i < j)\r\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\r\n\t}\r\n\tntt_(aa, l, inverse);\r\n}\r\n\r\nvoid multiply(int *aa, int *bb, int *cc, int n, int m) {\r\n\tstatic int aa_[N_], bb_[N_];\r\n\tint n_, l, i;\r\n\r\n\tl = 0;\r\n\twhile (1 << l < n + m - 1)\r\n\t\tl++;\r\n\tn_ = 1 << l;\r\n\tfor (i = 0; i < n_; i++) {\r\n\t\taa_[i] = i < n ? aa[i] : 0;\r\n\t\tbb_[i] = i < m ? bb[i] : 0;\r\n\t}\r\n\tntt(aa_, l, 0);\r\n\tntt(bb_, l, 0);\r\n\tfor (i = 0; i < n_; i++)\r\n\t\taa_[i] = (long long) aa_[i] * bb_[i] % MD;\r\n\tntt(aa_, l, 1);\r\n\tfor (i = 0; i < n + m - 1; i++)\r\n\t\tcc[i] = (long long) aa_[i] * vv_[l] % MD;\r\n}\r\n\r\nint main() {\r\n\tstatic int dp[N][K + 1], dq[K * 2 + 1];\r\n\tint n, c_, k, i, c, x;\r\n\r\n\tinit();\r\n\tscanf(\"%d%d%d\", &n, &k, &c_);\r\n\tfor (c = 0; c <= k; c++)\r\n\t\tdp[0][c] = 1;\r\n\tfor (i = 0; i < n; i++) {\r\n\t\tmultiply(dp[i], dp[i], dq, k + 1, k + 1);\r\n\t\tif (i + 1 == n)\r\n\t\t\tprintf(\"%d\\n\", dq[c_]);\r\n\t\telse {\r\n\t\t\tx = 0;\r\n\t\t\tfor (c = k + 1; c <= k * 2; c++)\r\n\t\t\t\tx = (x + dq[c]) % MD;\r\n\t\t\tfor (c = k; c >= 0; c--) {\r\n\t\t\t\tx = (x + dq[c]) % MD;\r\n\t\t\t\tdp[i + 1][c] = (x + (long long) dq[c] * (k - c)) % MD;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "6ef8361b9b29537264f7039aa6d6240e", "src_uid": "4b8161259545e44c7d1046be2e4fe014", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \r\n#include \r\n#include \r\n\r\n#define N\t15\r\n#define K\t200000\r\n#define L\t19\t/* L = ceil(log2(K * 2 + 1)) */\r\n#define N_\t(1 << L)\r\n#define MD\t998244353\r\n\r\nlong long power(long long a, int k) {\r\n\tlong long p = 1;\r\n\r\n\twhile (k) {\r\n\t\tif (k & 1)\r\n\t\t\tp = p * a % MD;\r\n\t\ta = a * a % MD;\r\n\t\tk >>= 1;\r\n\t}\r\n\treturn p;\r\n}\r\n\r\nint vv_[L + 1], *wwu[L + 1], *wwv[L + 1];\r\n\r\nvoid init() {\r\n\tint i, l, u, v;\r\n\r\n\tu = power(3, MD - 1 >> L), v = power(u, MD - 2);\r\n\tfor (l = L; l > 0; l--) {\r\n\t\tint n = 1 << l, m = n >> 1;\r\n\r\n\t\tvv_[l] = power(1 << l, MD - 2);\r\n\t\twwu[l] = (int *) malloc(m * sizeof *wwu[l]);\r\n\t\twwv[l] = (int *) malloc(m * sizeof *wwv[l]);\r\n\t\twwu[l][0] = wwv[l][0] = 1;\r\n\t\tfor (i = 1; i < m; i++) {\r\n\t\t\twwu[l][i] = (long long) wwu[l][i - 1] * u % MD;\r\n\t\t\twwv[l][i] = (long long) wwv[l][i - 1] * v % MD;\r\n\t\t}\r\n\t\tu = (long long) u * u % MD;\r\n\t\tv = (long long) v * v % MD;\r\n\t}\r\n\tvv_[0] = 1;\r\n}\r\n\r\nvoid ntt_(int *aa, int l, int inverse) {\r\n\tif (l) {\r\n\t\tint n = 1 << l, m = n >> 1, *ww = inverse ? wwv[l] : wwu[l], i, j;\r\n\r\n\t\tntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);\r\n\t\tfor (i = 0; (j = i + m) < n; i++) {\r\n\t\t\tint a = aa[i], b = (long long) aa[j] * ww[i] % MD;\r\n\r\n\t\t\tif ((aa[i] = a + b) >= MD)\r\n\t\t\t\taa[i] -= MD;\r\n\t\t\tif ((aa[j] = a - b) < 0)\r\n\t\t\t\taa[j] += MD;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid ntt(int *aa, int l, int inverse) {\r\n\tint n = 1 << l, i, j;\r\n\r\n\tfor (i = 0, j = 1; j < n; j++) {\r\n\t\tint b = n >> 1, tmp;\r\n\r\n\t\twhile ((i ^= b) < b)\r\n\t\t\tb >>= 1;\r\n\t\tif (i < j)\r\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\r\n\t}\r\n\tntt_(aa, l, inverse);\r\n}\r\n\r\nvoid multiply(int *aa, int *bb, int *cc, int n, int m) {\r\n\tstatic int aa_[N_], bb_[N_];\r\n\tint n_, l, i;\r\n\r\n\tl = 0;\r\n\twhile (1 << l < n + m - 1)\r\n\t\tl++;\r\n\tn_ = 1 << l;\r\n\tfor (i = 0; i < n_; i++) {\r\n\t\taa_[i] = i < n ? aa[i] : 0;\r\n\t\tbb_[i] = i < m ? bb[i] : 0;\r\n\t}\r\n\tntt(aa_, l, 0);\r\n\tntt(bb_, l, 0);\r\n\tfor (i = 0; i < n_; i++)\r\n\t\taa_[i] = (long long) aa_[i] * bb_[i] % MD;\r\n\tntt(aa_, l, 1);\r\n\tfor (i = 0; i < n + m - 1; i++)\r\n\t\tcc[i] = (long long) aa_[i] * vv_[l] % MD;\r\n}\r\n\r\nint main() {\r\n\tstatic int dp[N][K + 1], dq[K * 2 + 1];\r\n\tint n, c_, k, i, c, x;\r\n\r\n\tinit();\r\n\tscanf(\"%d%d%d\", &n, &k, &c_);\r\n\tfor (c = 0; c <= k; c++)\r\n\t\tdp[0][c] = 1;\r\n\tfor (i = 0; i < n; i++) {\r\n\t\tmultiply(dp[i], dp[i], dq, k + 1, k + 1);\r\n\t\tif (i + 1 == n)\r\n\t\t\tprintf(\"%d\\n\", dq[c_]);\r\n\t\telse {\r\n\t\t\tx = 0;\r\n\t\t\tfor (c = k + 1; c <= k * 2; c++)\r\n\t\t\t\tx = (x + dq[c]) % MD;\r\n\t\t\tfor (c = k; c >= 0; c--) {\r\n\t\t\t\tx = (x + dq[c]) % MD;\r\n\t\t\t\tdp[i + 1][c] = (x + (long long) dq[c] * (k - c)) % MD;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f224c0c30cc6e3456767d507c1f5f17c", "src_uid": "4b8161259545e44c7d1046be2e4fe014", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 1000000007\n\nlong long mpow(long long a, long long p)\n{\n a %= MOD;\n \n long long r = 1;\n while (p) {\n if ((1 & p)) r = (r * a) % MOD;\n a = (a * a) % MOD;\n p >>= 1;\n }\n return r;\n}\n\nint inv(long long x)\n{ return mpow(x, MOD-2); }\n\n#define MAXF 100005\n\nlong long factorial[MAXF];\n\nlong long possib(long long width, long long boxes, long long minh)\n{\n long long separators = width-1;\n long long elements = boxes-width*minh;\n\n if(elements < 0) return 0;\n else return (factorial[separators+elements]*inv(factorial[separators]*factorial[elements])) % MOD;\n}\n\nlong long all_possib, nice_possib;\nvoid add_all(long long x)\n{\n x %= MOD;\n all_possib += x;\n all_possib %= MOD;\n}\nvoid add_nice(long long x)\n{\n x %= MOD;\n nice_possib += x;\n nice_possib %= MOD;\n}\n\nint main()\n{\n long long fac;\n int i;\n int result;\n\n i = 0;\n for(fac = 1; i H) printf(\"1\\n\");\n else printf(\"0\\n\");\n return 0;\n }\n\n all_possib = 0;\n nice_possib = 0;\n for(width=1; width<=W; width++){\n add_all(possib(width, F, 1)*possib(width, W, 1));\n add_all(possib(width+1, F, 1)*possib(width, W, 1));\n add_all(possib(width, W, 1)*possib(width, F, 1));\n add_all(possib(width+1, W, 1)*possib(width, F, 1));\n\n add_nice(possib(width, F, 1)*possib(width, W, H+1));\n add_nice(possib(width+1, F, 1)*possib(width, W, H+1));\n add_nice(possib(width, W, H+1)*possib(width, F, 1));\n add_nice(possib(width+1, W, H+1)*possib(width, F, 1));\n }\n result = nice_possib*inv(all_possib) % MOD;\n\n printf(\"%d\\n\", result);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3591d1af04a19d59b294f71a5c9b9395", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t100000\n#define MD\t1000000007\n\nint ff[N], gg[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\nint inv(int a, int b) {\n\tgcd_(a, b);\n\treturn x_;\n}\n\nvoid init(int n) {\n\tint i, f;\n\n\tfor (i = 0, f = 1; i < n; i++) {\n\t\tgg[i] = inv(ff[i] = f, MD);\n\t\tf = (long long) f * (i + 1) % MD;\n\t}\n}\n\nint choose(int n, int k) {\n\treturn n < k ? 0 : (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nint main() {\n\tstatic int aa[N + 2], bb[N + 2], cc[N + 2];\n\tint f, w, h, n, i, j, p, q, ans;\n\n\tscanf(\"%d%d%d\", &f, &w, &h);\n\tif (f == 0) {\n\t\tprintf(\"%d\\n\", w > h);\n\t\treturn 0;\n\t}\n\tif (w == 0) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tn = f > w ? f : w;\n\tinit(n);\n\tfor (i = 1; i <= f; i++)\n\t\taa[i] = choose(f - 1, i - 1);\n\tfor (j = 1; j <= w; j++)\n\t\tbb[j] = choose(w - 1, j - 1);\n\tfor (j = 1; h * j < w; j++)\n\t\tcc[j] = choose(w - h * j - 1, j - 1);\n\tp = q = 0;\n\tfor (i = 1; i <= n; i++) {\n\t\tp = (p + aa[i] * (cc[i] * 2LL + cc[i - 1] + cc[i + 1])) % MD;\n\t\tq = (q + aa[i] * (bb[i] * 2LL + bb[i - 1] + bb[i + 1])) % MD;\n\t}\n\tans = (long long) p * inv(q, MD) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cbfaa12b6505a5ec931bcc2e2e8d4e29", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include\n#define MOD 1000000007\n\nlong long mpow(long long a, long long p)\n{\n a %= MOD;\n \n long long r = 1;\n while (p) {\n if ((1 & p)) r = (r * a) % MOD;\n a = (a * a) % MOD;\n p >>= 1;\n }\n return r;\n}\n\nint inv(long long x)\n{ return mpow(x, MOD-2); }\n\n#define MAXF 100005\n\nint factorial[MAXF];\n\nlong long possib(long long width, long long boxes, long long minh)\n{\n long long separators = width-1;\n long long elements = boxes-width*minh;\n\n if(elements < 0) return 0;\n else return (factorial[separators+elements]*inv(factorial[separators]*factorial[elements])) % MOD;\n}\n\nlong long all_possib, nice_possib;\nvoid add_all(long long x)\n{\n x %= MOD;\n all_possib += x;\n all_possib %= MOD;\n}\nvoid add_nice(long long x)\n{\n x %= MOD;\n nice_possib += x;\n nice_possib %= MOD;\n}\n\nint main()\n{\n long long fac;\n int i;\n int result;\n\n i = 0;\n for(fac = 1; i H) printf(\"1\\n\");\n else printf(\"0\\n\");\n return 0;\n }\n\n all_possib = 0;\n nice_possib = 0;\n for(width=1; width<=W; width++){\n add_all(possib(width, F, 1)*possib(width, W, 1));\n add_all(possib(width+1, F, 1)*possib(width, W, 1));\n add_all(possib(width, W, 1)*possib(width, F, 1));\n add_all(possib(width+1, W, 1)*possib(width, F, 1));\n\n add_nice(possib(width, F, 1)*possib(width, W, H+1));\n add_nice(possib(width+1, F, 1)*possib(width, W, H+1));\n add_nice(possib(width, W, H+1)*possib(width, F, 1));\n add_nice(possib(width+1, W, H+1)*possib(width, F, 1));\n }\n result = nice_possib*inv(all_possib) % MOD;\n\n printf(\"%d\\n\", result);\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c9524c69a551d4651341b3ab44ac425b", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\n#define N\t100000\n#define MD\t1000000007\n\nint ff[N], gg[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\nint inv(int a, int b) {\n\tgcd_(a, b);\n\treturn x_;\n}\n\nvoid init(int n) {\n\tint i, f;\n\n\tfor (i = 0, f = 1; i < n; i++) {\n\t\tgg[i] = inv(ff[i] = f, MD);\n\t\tf = (long long) f * (i + 1) % MD;\n\t}\n}\n\nint choose(int n, int k) {\n\treturn n < k ? 0 : (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nint main() {\n\tstatic int aa[N + 2], bb[N + 2], cc[N + 2];\n\tint f, w, h, n, i, j, p, q, ans;\n\n\tscanf(\"%d%d%d\", &f, &w, &h);\n\tif (f == 0) {\n\t\tprintf(\"%d\\n\", w > h);\n\t\treturn 0;\n\t}\n\tif (w == 0) {\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tn = f > w ? f : w;\n\tinit(n);\n\tfor (i = 1; i <= f; i++)\n\t\taa[i] = choose(f - 1, i - 1);\n\tfor (j = 1; j <= w; j++)\n\t\tbb[j] = choose(w - 1, j - 1);\n\tfor (j = 1; h * j < w; j++)\n\t\tcc[j] = choose(w - h * j - 1, j - 1);\n\tp = q = 0;\n\tfor (i = 1; i <= n; i++) {\n\t\tp = (p + aa[i] * (cc[i] * 2LL + cc[i - 1] + cc[i + 1])) % MD;\n\t\tq = (q + aa[i] * (bb[i] * 2LL + bb[i - 1] + bb[i + 1])) % MD;\n\t}\n\tif (p < 0)\n\t\tp += MD;\n\tif (q < 0)\n\t\tq += MD;\n\tans = (long long) p * inv(q, MD) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b5341b7438bed8bfc98c56ef28b0bddd", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "f3e37a98a4ae3fef7879880c33dd1752", "src_uid": "25b2a84f0c3f574cdffd59a902b2326e", "difficulty": 2400.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "afdb6c1dbfa2abd9d05d2f4a933799fc", "src_uid": "25b2a84f0c3f574cdffd59a902b2326e", "difficulty": 2400.0} {"lang": "GNU C11", "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_ = 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 ((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 = 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0813e4efbaeab2e80512e4dbba21696e", "src_uid": "25b2a84f0c3f574cdffd59a902b2326e", "difficulty": 2400.0} {"lang": "GNU C11", "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(\"%Lf\\n\", r_);\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "706514ec6f4ec3065a35d27705ef6957", "src_uid": "25b2a84f0c3f574cdffd59a902b2326e", "difficulty": 2400.0} {"lang": "GNU C11", "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_ = 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", "lang_cluster": "C", "compilation_error": false, "code_uid": "09cf6b74c50564d3fc2b139b3ae1aa9f", "src_uid": "25b2a84f0c3f574cdffd59a902b2326e", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\ntypedef int iii[3];\n\nint main() {\n\tint i, j, n, m, cnt;\n\tstatic iii *ee;\n\tstatic int *aa;\n\tstatic char *s;\n\n\tscanf(\"%d%d\", &n, &m);\n\tee = calloc(n + 1, sizeof(*ee));\n\taa = malloc(sizeof(*aa) * 4 * n);\n\ts = malloc((n + 2) * sizeof(*s));\n\tmemset(s + 1, '0', n);\n\ts[n + 1] = '\\0';\n\twhile (m-- > 0) {\n\t\tint u, v;\n\n\t\tscanf(\"%d%d\", &u, &v);\n\t\tfor (j = 0; j < 3; j++)\n\t\t\tif (ee[u][j] == 0) {\n\t\t\t\tee[u][j] = v;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tfor (j = 0; j < 3; j++)\n\t\t\tif (ee[v][j] == 0) {\n\t\t\t\tee[v][j] = u;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\tfor (i = 0; i < n; i++)\n\t\taa[i] = i + 1;\n\tcnt = n;\n\twhile (cnt > 0) {\n\t\tint a, k;\n\n\t\ta = aa[--cnt];\n\t\tk = 0;\n\t\tfor (j = 0; j < 3; j++)\n\t\t\tif (ee[a][j] > 0 && s[a] == s[ee[a][j]])\n\t\t\t\tk++;\n\t\tif (k > 1) {\n\t\t\ts[a] = s[a] == '1' ? '0' : '1';\n\t\t\tfor (j = 0; j < 3; j++)\n\t\t\t\tif (ee[a][j] > 0)\n\t\t\t\t\taa[cnt++] = ee[a][j];\n\t\t}\n\t}\n\tprintf(\"%s\\n\", s + 1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3c9093895f0e0b5742018290578e0632", "src_uid": "7017f2c81d5aed716b90e46480f96582", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n#include \n\n#define N\t50\n#define A\t26\n#define N_\t(1 + N + A + 1)\n#define M_\t(N + N * A + A)\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\nint oo[1 + M_ * 2], oh[1 + M_ * 2];\n\nint link(int o, int h) {\n\tstatic int _ = 1;\n\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint ii[M_], jj[M_], cc[M_ * 2], ww[M_], ww_[M_], m_;\nint ae[N_], dd[N_], kk[N_], ff[N_], n_;\nint pq[1 + N_], iq[N_], cnt;\n\nvoid link_(int i, int j, int c, int w) {\n\tint h = m_++;\n\n\tii[h] = i, jj[h] = j, cc[h << 1] = c;\n\tww[h] = w;\n\tae[i] = link(ae[i], h << 1);\n\tae[j] = link(ae[j], h << 1 | 1);\n}\n\nint less(int u, int v) {\n\treturn dd[u] < dd[v] || dd[u] == dd[v] && kk[u] < kk[v];\n}\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nint dijkstra(int s, int t) {\n\tmemset(dd, 0x3f, n_ * sizeof *dd);\n\tdd[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i, k, o;\n\n\t\ti = pq_remove_first();\n\t\tk = kk[i] + 1;\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h_ = oh[o];\n\n\t\t\tif (cc[h_] > 0) {\n\t\t\t\tint h = h_ >> 1, j = i ^ ii[h] ^ jj[h];\n\t\t\t\tint d = dd[i] + ((h_ & 1) == 0 ? ww_[h] : -ww_[h]);\n\n\t\t\t\tif (dd[j] > d || dd[j] == d && kk[j] > k) {\n\t\t\t\t\tif (dd[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tdd[j] = d, kk[j] = k, ff[j] = h_;\n\t\t\t\t\tpq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn dd[t] != INF;\n}\n\nint trace(int s, int t) {\n\twhile (t != s) {\n\t\tint h_ = ff[t], h = h_ >> 1;\n\n\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\tt ^= ii[h] ^ jj[h];\n\t}\n\treturn 1;\n}\n\nint edmonds_karp(int s, int t) {\n\tint h, f, cost;\n\n\tfor (h = 0; h < m_; h++) {\n\t\tint i = ii[h], j = jj[h];\n\n\t\tdd[j] = min(dd[j], dd[i] + ww[h]);\n\t}\n\tfor (h = 0; h < m_; h++) {\n\t\tint i = ii[h], j = jj[h];\n\n\t\tww_[h] = ww[h] + dd[i] - dd[j];\n\t}\n\tf = 0;\n\twhile (dijkstra(s, t)) {\n\t\tf += trace(s, t);\n\t\tfor (h = 0; h < m_; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (dd[i] != INF && dd[j] != INF) {\n\t\t\t\t/* dd[j] <= dd[i] + ww_[h] */\n\t\t\t\t/* ww_[h] + dd[i] - dd[j] >= 0 */\n\t\t\t\tww_[h] += dd[i] - dd[j];\n\t\t\t}\n\t\t}\n\t}\n\tcost = 0;\n\tfor (h = 0; h < m_; h++)\n\t\tcost += ww[h] * cc[h << 1 | 1];\n\treturn cost;\n}\n\nint main() {\n\tstatic char cc[N * 2 + 1];\n\tstatic int bb[N * 2], kk[A];\n\tint n, i, a;\n\n\tscanf(\"%d%s\", &n, cc), n /= 2;\n\tn_ = 1 + n + A + 1;\n\tfor (i = 0; i < n * 2; i++)\n\t\tscanf(\"%d\", &bb[i]);\n\tfor (i = 0; i < n; i++)\n\t\tlink_(0, 1 + i, 2, 0);\n\tfor (i = 0; i < n; i++) {\n\t\tint j = n * 2 - 1 - i;\n\t\tint ai = cc[i] - 'a';\n\t\tint aj = cc[j] - 'a';\n\n\t\tfor (a = 0; a < A; a++) {\n\t\t\tint b;\n\n\t\t\tif (a == ai && a == aj)\n\t\t\t\tb = max(bb[i], bb[j]);\n\t\t\telse if (a == ai)\n\t\t\t\tb = bb[i];\n\t\t\telse if (a == aj)\n\t\t\t\tb = bb[j];\n\t\t\telse\n\t\t\t\tb = 0;\n\t\t\tlink_(1 + i, 1 + n + a, 1, -b);\n\t\t}\n\t}\n\tfor (i = 0; i < n * 2; i++) {\n\t\ta = cc[i] - 'a';\n\t\tkk[a]++;\n\t}\n\tfor (a = 0; a < A; a++)\n\t\tlink_(1 + n + a, n_ - 1, kk[a], 0);\n\tprintf(\"%d\\n\", -edmonds_karp(0, n_ - 1));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "310ed4180c7a9e61b71369269e92095f", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n#include \n\n#define N\t50\n#define A\t26\n#define N_\t(1 + N + A + 1)\n#define M_\t(N + N * A + A)\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\nint oo[1 + M_ * 2], oh[1 + M_ * 2];\n\nint link(int o, int h) {\n\tstatic int _ = 1;\n\n\too[_] = o, oh[_] = h;\n\treturn _++;\n}\n\nint ii[M_], jj[M_], cc[M_ * 2], cost[M_], cost_[M_], m_;\nint ae[N_], pi[N_], dd[N_], ff[N_], n_;\nint pq[1 + N_], iq[N_], cnt;\n\nvoid link_(int i, int j, int c, int co) {\n\tint h = m_++;\n\n\tii[h] = i, jj[h] = j, cc[h << 1] = c;\n\tcost[h] = co;\n\tae[i] = link(ae[i], h << 1);\n\tae[j] = link(ae[j], h << 1 | 1);\n}\n\nint less(int u, int v) {\n\treturn pi[u] < pi[v] || pi[u] == pi[v] && dd[u] < dd[v];\n}\n\nint i2(int i) {\n\treturn (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;\n}\n\nvoid pq_up(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i / 2) && less(u, v = pq[j]); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_dn(int u) {\n\tint i, j, v;\n\n\tfor (i = iq[u]; (j = i2(i)) && less(v = pq[j], u); i = j)\n\t\tpq[iq[v] = i] = v;\n\tpq[iq[u] = i] = u;\n}\n\nvoid pq_add_last(int u) {\n\tpq[iq[u] = ++cnt] = u;\n}\n\nint pq_remove_first() {\n\tint u = pq[1], v = pq[cnt--];\n\n\tif (v != u)\n\t\tiq[v] = 1, pq_dn(v);\n\tiq[u] = 0;\n\treturn u;\n}\n\nint dijkstra(int s, int t) {\n\tmemset(pi, 0x3f, n_ * sizeof *pi);\n\tpi[s] = 0, pq_add_last(s);\n\twhile (cnt) {\n\t\tint i, d, o;\n\n\t\ti = pq_remove_first();\n\t\td = dd[i] + 1;\n\t\tfor (o = ae[i]; o; o = oo[o]) {\n\t\t\tint h_ = oh[o];\n\n\t\t\tif (cc[h_] > 0) {\n\t\t\t\tint h = h_ >> 1, j = i ^ ii[h] ^ jj[h];\n\t\t\t\tint p = pi[i] + ((h_ & 1) == 0 ? cost_[h] : -cost_[h]);\n\n\t\t\t\tif (pi[j] > p || pi[j] == p && dd[j] > d) {\n\t\t\t\t\tif (pi[j] == INF)\n\t\t\t\t\t\tpq_add_last(j);\n\t\t\t\t\tpi[j] = p, dd[j] = d, ff[j] = h_;\n\t\t\t\t\tpq_up(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn pi[t] != INF;\n}\n\nint trace(int s, int t) {\n\twhile (t != s) {\n\t\tint h_ = ff[t], h = h_ >> 1;\n\n\t\tcc[h_]--, cc[h_ ^ 1]++;\n\t\tt ^= ii[h] ^ jj[h];\n\t}\n\treturn 1;\n}\n\nint edmonds_karp(int s, int t) {\n\tint h, f, ans;\n\n\tfor (h = 0; h < m_; h++) {\n\t\tint i = ii[h], j = jj[h];\n\n\t\tpi[j] = min(pi[j], pi[i] + cost[h]);\n\t}\n\tfor (h = 0; h < m_; h++) {\n\t\tint i = ii[h], j = jj[h];\n\n\t\tcost_[h] = cost[h] + pi[i] - pi[j];\n\t}\n\tf = 0;\n\twhile (dijkstra(s, t)) {\n\t\tf += trace(s, t);\n\t\tfor (h = 0; h < m_; h++) {\n\t\t\tint i = ii[h], j = jj[h];\n\n\t\t\tif (pi[i] != INF && pi[j] != INF) {\n\t\t\t\t/* pi[j] <= pi[i] + cost_[h] */\n\t\t\t\t/* cost_[h] + pi[i] - pi[j] >= 0 */\n\t\t\t\tcost_[h] += pi[i] - pi[j];\n\t\t\t}\n\t\t}\n\t}\n\tans = 0;\n\tfor (h = 0; h < m_; h++)\n\t\tans += cc[h << 1 | 1] * cost[h];\n\treturn ans;\n}\n\nint main() {\n\tstatic char cc[N * 2 + 1];\n\tstatic int bb[N * 2], kk[A];\n\tint n, i, a;\n\n\tscanf(\"%d%s\", &n, cc), n /= 2;\n\tn_ = 1 + n + A + 1;\n\tfor (i = 0; i < n * 2; i++)\n\t\tscanf(\"%d\", &bb[i]);\n\tfor (i = 0; i < n; i++)\n\t\tlink_(0, 1 + i, 2, 0);\n\tfor (i = 0; i < n; i++) {\n\t\tint j = n * 2 - 1 - i;\n\t\tint ai = cc[i] - 'a';\n\t\tint aj = cc[j] - 'a';\n\n\t\tfor (a = 0; a < A; a++) {\n\t\t\tint b;\n\n\t\t\tif (a == ai && a == aj)\n\t\t\t\tb = max(bb[i], bb[j]);\n\t\t\telse if (a == ai)\n\t\t\t\tb = bb[i];\n\t\t\telse if (a == aj)\n\t\t\t\tb = bb[j];\n\t\t\telse\n\t\t\t\tb = 0;\n\t\t\tlink_(1 + i, 1 + n + a, 1, -b);\n\t\t}\n\t}\n\tfor (i = 0; i < n * 2; i++) {\n\t\ta = cc[i] - 'a';\n\t\tkk[a]++;\n\t}\n\tfor (a = 0; a < A; a++)\n\t\tlink_(1 + n + a, n_ - 1, kk[a], 0);\n\tprintf(\"%d\\n\", -edmonds_karp(0, n_ - 1));\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4e137f294becc424b2b28ac931f9b224", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t200000\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 ff[N + 1], gg[N + 1];\n\nvoid init() {\n\tint i, f;\n\n\tf = 1;\n\tfor (i = 0; i <= N; i++) {\n\t\tgg[i] = power(ff[i] = f, MD - 2);\n\t\tf = (long long) f * (i + 1) % MD;\n\t}\n}\n\nint ch(int n, int k) {\n\treturn (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;\n}\n\nint main() {\n\tint n, c, ans;\n\tlong long k;\n\n\tinit();\n\tscanf(\"%d%lld\", &n, &k);\n\tans = 0;\n\tif (k == 0)\n\t\tans = ff[n];\n\telse {\n\t\tint x;\n\n\t\tx = 0;\n\t\tfor (c = n - k; c >= 0; c--)\n\t\t\tx = (x + ((n - k - c) % 2 == 0 ? 1 : -1) * (ch(n - k, c) * power(c, n))) % MD;\n\t\tans = (long long) ch(n, n - k) * x * 2 % MD;\n\t\tif (ans < 0)\n\t\t\tans += MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d3051758b09b44c7571d4ff7be3c223", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t500\n#define MD\t998244353\n\nint dp[N + 1][N + 1];\n\nvoid init() {\n\tint n, k, n_;\n\n\tdp[0][0] = 1;\n\tfor (n = 0; n < N; n++)\n\t\tfor (k = 0; k <= n; k++)\n\t\t\tif (dp[n][k])\n\t\t\t\tfor (n_ = n + 1; n_ <= N; n_++) {\n\t\t\t\t\tint k_ = k > n_ - n ? k : n_ - n;\n\n\t\t\t\t\tdp[n_][k_] = (dp[n_][k_] + dp[n][k]) % MD;\n\t\t\t\t}\n}\n\nint main() {\n\tint n, k, a, b, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tans = 0;\n\tfor (a = 1; a <= n; a++)\n\t\tfor (b = 1; b <= n && a * b < k; b++)\n\t\t\tans = (ans + 2LL * dp[n][a] * dp[n][b]) % MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "796b320871e4e5a19c02e080acc08120", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include\n#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 ALLOC(size,type) ((type*)calloc((size),sizeof(type)))\n\n#define POS(i, j, k) ((((i) & 1) * (n + 1) + (j)) * (n + 1) + (k))\n\nvoid run (void) {\n const i32 n = read_int();\n const i32 m = read_int();\n const i32 mod = 998244353;\n i64 *dp = ALLOC (2 * (n + 1) * (n + 1), i64);\n dp[POS(1, 1, 1)] = 1;\n for (i32 i = 1; i < n; ++i) {\n memset (dp + POS(i + 1, 0, 0), 0, sizeof (*dp) * (n + 1) * (n + 1));\n for (i32 j = 1; j <= i; ++j) {\n for (i32 k = 1; k <= i; ++k) {\n dp[POS(i, j, k)] %= mod;\n dp[POS(i + 1, MAX (j, k + 1), k + 1)] += dp[POS(i, j, k)];\n dp[POS(i + 1, j, 1)] += dp[POS(i, j, k)];\n }\n }\n }\n i64 *way = ALLOC (n + 1, i64);\n for (i32 j = 1; j <= n; ++j) {\n for (i32 k = 1; k <= j; ++k) {\n way[j] += dp[POS(n, j, k)] % mod;\n }\n }\n for (i32 i = 1; i <= n; ++i) {\n way[i] %= mod;\n }\n i64 ans = 0;\n for (i32 i = 1; i <= n; ++i) {\n for (i32 j = 1; j <= n; ++j) {\n if (i * j < m) {\n ans += way[i] * way[j] % mod;\n }\n }\n }\n ans = 2 * ans % mod;\n print_int (ans);\n puts (\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2c14a672ec30b85fe5a9ab5d8ee189b3", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "difficulty": 2100.0} {"lang": "GNU C11", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "b073fa3e27fac1e6e1e09af1fce9b807", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n\n#define MD\t1000000007\n\nint power(int n, int k) {\n\tint p;\n\n\tif (k == 0)\n\t\treturn 1;\n\tp = power(n, k / 2);\n\tp = (long long) p * p % MD;\n\tif (k % 2 == 1)\n\t\tp = (long long) p * n % MD;\n\treturn p;\n}\n\nint main() {\n\tint n, m, k, sum, x;\n\n\tscanf(\"%d%d\", &n, &m);\n\tsum = 0;\n\tfor (k = 0; k < n; k++) {\n\t\tx = power(m + m - 1, k); /* Binomial theorem */\n\t\tsum = (sum + (long long) x * m % MD * power(m, n - 1 - k)) % MD;\n\t}\n\tprintf(\"%d\\n\", (sum + power(m, n)) % MD);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "fc471763346035f81e46caf9ac031d46", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "difficulty": 2300.0} {"lang": "GNU C", "source_code": "#include \n\n#define MD\t1000000007\n\nint power(int n, int k) {\n\tint p;\n\n\tif (k == 0)\n\t\treturn 1;\n\tp = power(n, k / 2);\n\tp = (long long) p * p % MD;\n\tif (k % 2 == 1)\n\t\tp = (long long) p * n % MD;\n\treturn p;\n}\n\nint main() {\n\tint n, m, k, sum, x;\n\n\tscanf(\"%d%d\", &n, &m);\n\tsum = 0;\n\tfor (k = 0; k < n; k++) {\n\t\tx = power(m + m - 1, k); /* Binomial theorem */\n\t\tsum = (sum + x * m % MD * power(m, n - 1 - k)) % MD;\n\t}\n\tprintf(\"%d\\n\", (sum + power(m, n)) % MD);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ad725bca10c81d8a71fe9e159b5f1e22", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n#include \n\n#define N\t102\n#define N_\t(N * 2)\n#define L\t50\n#define M\t(1 + L)\n\nlong long add(long long a, long long b) { return a != -1 && b != -1 && a < LLONG_MAX - b ? a + b : -1; }\n\nint *lj[N_], *lk[N_], lo[N_], *rj[N_], *rk[N_], ro[N_], *oj[N_], oo[N_];\n\nvoid init() {\n\tint i;\n\n\tfor (i = 0; i < N_; i++) {\n\t\tlj[i] = (int *) malloc(2 * sizeof *lj[i]);\n\t\tlk[i] = (int *) malloc(2 * sizeof *lk[i]);\n\t\trj[i] = (int *) malloc(2 * sizeof *rj[i]);\n\t\trk[i] = (int *) malloc(2 * sizeof *rk[i]);\n\t\toj[i] = (int *) malloc(2 * sizeof *oj[i]);\n\t}\n}\n\nvoid append1(int **oj, int *oo, int i, int j) {\n\tint o = oo[i]++;\n\n\tif (o >= 2 && (o & o - 1) == 0)\n\t\toj[i] = (int *) realloc(oj[i], o * 2 * sizeof *oj[i]);\n\toj[i][o] = j;\n}\n\nvoid append2(int **oj, int **ok, int *oo, int i, int j, int k) {\n\tint o = oo[i]++;\n\n\tif (o >= 2 && (o & o - 1) == 0) {\n\t\toj[i] = (int *) realloc(oj[i], o * 2 * sizeof *oj[i]);\n\t\tok[i] = (int *) realloc(ok[i], o * 2 * sizeof *ok[i]);\n\t}\n\toj[i][o] = j, ok[i][o] = k;\n}\n\nint tt[1 + M][2]; char bad[1 + M];\n\nint build(int m) {\n\tstatic int ff[1 + M], qu[1 + M];\n\tint n, i, head, cnt;\n\n\tn = 2;\n\twhile (m--) {\n\t\tint l, a;\n\n\t\tscanf(\"%d\", &l);\n\t\ti = 1;\n\t\twhile (l--) {\n\t\t\tscanf(\"%d\", &a);\n\t\t\tif (!tt[i][a])\n\t\t\t\ttt[i][a] = n++;\n\t\t\ti = tt[i][a];\n\t\t}\n\t\tbad[i] = 1;\n\t}\n\ttt[0][0] = tt[0][1] = 1;\n\thead = cnt = 0;\n\tff[1] = 0, qu[head + cnt++] = 1;\n\twhile (cnt) {\n\t\tint e, a;\n\n\t\ti = qu[cnt--, head++], e = ff[i];\n\t\tbad[i] |= bad[e];\n\t\tfor (a = 0; a < 2; a++) {\n\t\t\tint j = tt[i][a], f = tt[e][a];\n\n\t\t\tif (j)\n\t\t\t\tff[j] = f, qu[head + cnt++] = j;\n\t\t\telse\n\t\t\t\ttt[i][a] = f;\n\t\t}\n\t}\n\treturn n;\n}\n\nlong long dd[N_ * M * M];\nint iq[1 + N_ * M * M], pq[N_ * M * M], cnt;\n\nint lt(int i, int j) { return dd[i] < dd[j]; }\n\nint p2(int p) {\n\treturn (p *= 2) > cnt ? 0 : (p < cnt && lt(iq[p + 1], iq[p]) ? p + 1 : p);\n}\n\nvoid pq_up(int i) {\n\tint p, q, j;\n\n\tfor (p = pq[i]; (q = p / 2) && lt(i, j = iq[q]); p = q)\n\t\tiq[pq[j] = p] = j;\n\tiq[pq[i] = p] = i;\n}\n\nvoid pq_dn(int i) {\n\tint p, q, j;\n\n\tfor (p = pq[i]; (q = p2(p)) && lt(j = iq[q], i); p = q)\n\t\tiq[pq[j] = p] = j;\n\tiq[pq[i] = p] = i;\n}\n\nvoid pq_add_last(int i) {\n\tiq[pq[i] = ++cnt] = i;\n}\n\nint pq_remove_first() {\n\tint i = iq[1], j = iq[cnt--];\n\n\tif (j != i)\n\t\tpq[j] = 1, pq_dn(j);\n\tpq[i] = 0;\n\treturn i;\n}\n\nint main() {\n\tstatic long long ans[N];\n\tint n, n_, k, m, i, s, t;\n\n\tinit();\n\tscanf(\"%d%d%d\", &n, &k, &m);\n\tn_ = n;\n\twhile (k--) {\n\t\tstatic int ii[N];\n\t\tint cnt, h, i_;\n\n\t\tscanf(\"%d%d\", &i, &cnt);\n\t\tfor (h = 0; h < cnt; h++)\n\t\t\tscanf(\"%d\", &ii[h]);\n\t\ti_ = ii[cnt - 1];\n\t\tfor (h = cnt - 2; h >= 0; h--) {\n\t\t\tappend2(lj, lk, lo, i_, ii[h], n_);\n\t\t\tappend2(rj, rk, ro, ii[h], i_, n_);\n\t\t\ti_ = n_++;\n\t\t}\n\t\tappend1(oj, oo, i_, i);\n\t}\n\tm = build(m) - 1;\n\tmemset(ans, -1, n * sizeof *ans);\n\tmemset(dd, -1, n_ * m * m * sizeof *dd);\n\tfor (s = 0; s < m; s++) {\n\t\tint a;\n\n\t\tif (bad[s + 1])\n\t\t\tcontinue;\n\t\tfor (a = 0; a < 2; a++) {\n\t\t\tt = tt[s + 1][a] - 1;\n\t\t\tif (!bad[t + 1]) {\n\t\t\t\tint u = (a * m + s) * m + t;\n\n\t\t\t\tdd[u] = 1, pq_add_last(u);\n\t\t\t}\n\t\t}\n\t}\n\twhile (cnt) {\n\t\tint u, v, o, j, k, s_, t_;\n\t\tlong long d;\n\n\t\tu = pq_remove_first(), i = u / m / m, s = u / m % m, t = u % m;\n\t\tif (i < n && s == 0 && (ans[i] == -1 || ans[i] > dd[u]))\n\t\t\tans[i] = dd[u];\n\t\tfor (o = oo[i]; o--; ) {\n\t\t\tj = oj[i][o], v = (j * m + s) * m + t, d = dd[u];\n\t\t\tif (d != -1 && (dd[v] == -1 || dd[v] > d)) {\n\t\t\t\tif (dd[v] == -1)\n\t\t\t\t\tpq_add_last(v);\n\t\t\t\tdd[v] = d, pq_up(v);\n\t\t\t}\n\t\t}\n\t\tfor (o = lo[i]; o--; ) {\n\t\t\tj = lj[i][o], k = lk[i][o];\n\t\t\tfor (s_ = 0; s_ < m; s_++) {\n\t\t\t\tv = (k * m + s_) * m + t, d = add(dd[(j * m + s_) * m + s], dd[u]);\n\t\t\t\tif (d != -1 && (dd[v] == -1 || dd[v] > d)) {\n\t\t\t\t\tif (dd[v] == -1)\n\t\t\t\t\t\tpq_add_last(v);\n\t\t\t\t\tdd[v] = d, pq_up(v);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (o = ro[i]; o--; ) {\n\t\t\tj = rj[i][o], k = rk[i][o];\n\t\t\tfor (t_ = 0; t_ < m; t_++) {\n\t\t\t\tv = (k * m + s) * m + t_, d = add(dd[u], dd[(j * m + t) * m + t_]);\n\t\t\t\tif (d != -1 && (dd[v] == -1 || dd[v] > d)) {\n\t\t\t\t\tif (dd[v] == -1)\n\t\t\t\t\t\tpq_add_last(v);\n\t\t\t\t\tdd[v] = d, pq_up(v);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor (i = 2; i < n; i++)\n\t\tif (ans[i] == -1)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO %lld\\n\", ans[i]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "3484b66f8c38e94416e920ff593da2a6", "src_uid": "ae8f02cdd2f3859d4822858275e9ec40", "difficulty": 2900.0} {"lang": "GNU C11", "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[f]->se != arr[s]->fi - arr[s]->se)\n return (arr[s]->fi - arr[s]->se) - (arr[f]->fi - arr[f]->se);\n return 0;\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\n#define MOD 1000000007\n\nLLI ch2(int x) {\n return (x * (x - 1)) >> 1;\n}\n\nvoid make(int n, int spots, LLI ** mat) {\n int i, j;\n int totalSmaller = spots - 1;\n int totalBigger = n - totalSmaller;\n LLI total = ch2(n);\n fo3(i,0,spots-1) {\n fo3(j,0,spots-1) {\n int smallerCorrect = i;\n int smallerIncorrect = totalSmaller - smallerCorrect;\n int biggerIncorrect = smallerIncorrect;\n int biggerCorrect = totalBigger - biggerIncorrect;\n if (i + 1 < j || j + 1 < i)\n mat[i][j] = 0;\n else if (i == j) {\n mat[i][j] = (total - (smallerCorrect * biggerCorrect + smallerIncorrect * biggerIncorrect)) % MOD;\n } else if (j < i) {\n // Worse\n mat[i][j] = (smallerCorrect * biggerCorrect) % MOD; \n } else {\n // Better\n mat[i][j] = (smallerIncorrect * biggerIncorrect) % MOD; \n }\n }\n }\n}\n\nLLI ** ident;\n\n\n\nvoid clean2(LLI ** mat, int dim) { \n int i;\n fo3(i,0,dim-1)\n free(mat[i]);\n free(mat);\n}\n\nLLI ** mult(LLI ** a, LLI ** b, int dim) {\n LLI ** ret;\n int i, j, k;\n ret = calloc(dim, sizeof(LLI*));\n fo3(i,0,dim-1){\n ret[i] = calloc(dim, sizeof(LLI));\n fo3(j,0,dim-1){\n ret[i][j] = 0;\n fo3(k,0,dim-1) {\n ret[i][j] += (a[i][k] * b[k][j]) % MOD;\n }\n ret[i][j] %= MOD;\n }\n }\n return ret;\n}\n\nLLI ** expo(LLI ** base, int pow, int dim) {\n if (pow == 0) {\n return mult(ident, ident, dim);\n }\n if (pow == 1) {\n return mult(ident, base, dim);\n }\n LLI ** tmp = expo(base, pow >> 1, dim);\n LLI ** tmp2 = mult(tmp, tmp, dim);\n clean2(tmp, dim);\n if (pow&1) {\n tmp = mult(tmp2, base, dim);\n clean2(tmp2, dim);\n tmp2 = tmp;\n }\n return tmp2;\n}\n\nLLI expo2(LLI base, int pow) {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return base % MOD;\n LLI tmp = expo2(base, pow>>1);\n tmp *= tmp;\n tmp %= MOD;\n if (pow&1) {\n tmp *= base;\n tmp %= MOD;\n }\n return tmp;\n}\n\n\nLLI inv(LLI val) {\n if (val == 1)\n return 1;\n return MOD - ((MOD / val) * inv(MOD % val)) % MOD;\n}\n\nint main(void) {\n LLI ** orig;\n int len, pow, i, j;\n in2(len, pow);\n int arr[len];\n int cs[2];\n cs[0] = 0;\n cs[1] = 0;\n \n fo3(i,1,len) {\n in1(arr[i-1]);\n cs[arr[i-1]]++;\n }\n int dim = cs[0] + 1;\n if (cs[1] < cs[0])\n dim = cs[1] + 1;\n orig = calloc(dim, sizeof(LLI*));\n fo3(i,0,dim-1)\n orig[i] = calloc(dim, sizeof(LLI));\n ident = calloc(dim, sizeof(LLI*));\n fo3(i,0,dim-1){\n ident[i] = calloc(dim, sizeof(LLI));\n fo3(j,0,dim-1)\n ident[i][j] = ((i==j) ? 1 : 0);\n }\n make(len, dim, orig);\n \n LLI ** ret = expo(orig, pow, dim);\n clean2(orig, dim);\n int wrong = 0;\n fo3(i,0,cs[0]-1)\n if (arr[i]!=0)\n wrong++;\n int cor = dim - wrong - 1;\n LLI ans = ret[cor][dim - 1];\n clean2(ret, dim);\n LLI den = expo2(ch2(len), pow);\n //prL(ans);\n //prL(den);\n ans *= inv(den);\n ans %= MOD;\n prL(ans);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "0eeab29380a027ddf1d9c9ee1759d9e5", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n#define M\t200000\n#define MD\t0x7fffffff\n\nunsigned int Z = 12345, X = 12345;\n\nint rand_() {\n\treturn (Z *= 3) >> 1;\n}\n\nlong long abs_(long long x) { return x > 0 ? x : -x; }\n\nlong long gcd(long long a, long long b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nlong long *ox[M], *oy[M]; int *oc[M], oo[M];\n\nint hash(long long x, long long y) {\n\treturn ((x % MD * X % MD + y) % MD + MD) % M;\n}\n\nvoid ht_add(long long x, long long y, int c) {\n\tint h = hash(x, y), o;\n\n\tfor (o = 0; o < oo[h]; o++)\n\t\tif (ox[h][o] == x && oy[h][o] == y) {\n\t\t\toc[h][o] += c;\n\t\t\treturn;\n\t\t}\n\to = oo[h]++;\n\tif (o >= 2 && (o & o - 1) == 0) {\n\t\tox[h] = (long long *) realloc(ox[h], o * 2 * sizeof *ox[h]);\n\t\toy[h] = (long long *) realloc(oy[h], o * 2 * sizeof *oy[h]);\n\t\toc[h] = (int *) realloc(oc[h], o * 2 * sizeof *oc[h]);\n\t}\n\tox[h][o] = x, oy[h][o] = y, oc[h][o] = c;\n}\n\nint ht_get(long long x, long long y) {\n\tint h = hash(x, y), o;\n\n\tfor (o = 0; o < oo[h]; o++)\n\t\tif (ox[h][o] == x && oy[h][o] == y)\n\t\t\treturn oc[h][o];\n\treturn 0;\n}\n\nlong long xx[N], yy[N];\n\ndouble cross(int i, int j) {\n\treturn (double) xx[i] * yy[j] - (double) xx[j] * yy[i];\n}\n\nint cmp(int i, int j) {\n\tint sign_i = xx[i] < 0 || xx[i] == 0 && yy[i] < 0, sign_j = xx[j] < 0 || xx[j] == 0 && yy[j] < 0;\n\tdouble c = cross(i, j);\n\n\treturn sign_i != sign_j ? sign_i - sign_j : (c != 0 ? (c < 0 ? -1 : 1) : i - j);\n}\n\nint bad(int i, int j) {\n\tdouble c = cross(i, j);\n\n\treturn c > 0 || c == 0 && i > j;\n}\n\nint zz[1 + N], ll[1 + N], rr[1 + N], kk[1 + N], u_, l_, r_;\n\nint node(int k) {\n\tstatic int _ = 1;\n\n\tzz[_] = rand_();\n\tkk[_] = k;\n\treturn _++;\n}\n\nvoid split(int u, int k) {\n\tint c;\n\n\tif (u == 0) {\n\t\tu_ = l_ = r_ = 0;\n\t\treturn;\n\t}\n\tc = cmp(kk[u], k);\n\tif (c < 0) {\n\t\tsplit(rr[u], k);\n\t\trr[u] = l_, l_ = u;\n\t} else if (c > 0) {\n\t\tsplit(ll[u], k);\n\t\tll[u] = r_, r_ = u;\n\t} else {\n\t\tu_ = u, l_ = ll[u], r_ = rr[u];\n\t\tll[u] = rr[u] = 0;\n\t}\n}\n\nint merge(int u, int v) {\n\tif (u == 0)\n\t\treturn v;\n\tif (v == 0)\n\t\treturn u;\n\tif (zz[u] < zz[v]) {\n\t\trr[u] = merge(rr[u], v);\n\t\treturn u;\n\t} else {\n\t\tll[v] = merge(u, ll[v]);\n\t\treturn v;\n\t}\n}\n\nint first(int u) {\n\treturn ll[u] == 0 ? u : first(ll[u]);\n}\n\nint last(int u) {\n\treturn rr[u] == 0 ? u : last(rr[u]);\n}\n\nint kbad;\n\nvoid tr_add(int i) {\n\tif (u_ == 0)\n\t\tu_ = node(i);\n\telse {\n\t\tint l, r;\n\n\t\tsplit(u_, i);\n\t\tl = kk[l_ ? last(l_) : last(r_)], r = kk[r_ ? first(r_) : first(l_)];\n\t\tkbad += bad(l, i) + bad(i, r) - bad(l, r);\n\t\tu_ = merge(merge(l_, node(i)), r_);\n\t}\n}\n\nvoid tr_remove(int i) {\n\tif (ll[u_] == 0 && rr[u_] == 0)\n\t\tu_ = 0;\n\telse {\n\t\tint l, r;\n\n\t\tsplit(u_, i);\n\t\tl = kk[l_ ? last(l_) : last(r_)], r = kk[r_ ? first(r_) : first(l_)];\n\t\tkbad -= bad(l, i) + bad(i, r) - bad(l, r);\n\t\tu_ = merge(l_, r_);\n\t}\n}\n\nint main() {\n\tint n, q, h, x0, y0, z0, w0, k1;\n\tlong long k2;\n\n\tscanf(\"%d%d%d%d\", &x0, &y0, &z0, &q), w0 = x0 + y0 + z0;\n\tfor (h = 0; h < M; h++) {\n\t\tox[h] = (long long *) malloc(2 * sizeof *ox[h]);\n\t\toy[h] = (long long *) malloc(2 * sizeof *oy[h]);\n\t\toc[h] = (int *) malloc(2 * sizeof *oc[h]);\n\t}\n\tn = 0, k1 = 0, k2 = 0, kbad = 0;\n\twhile (q--) {\n\t\tstatic char s[2];\n\n\t\tscanf(\"%s\", s);\n\t\tif (s[0] == 'A') {\n\t\t\tint x, y, z, w;\n\t\t\tlong long x_, y_, d;\n\n\t\t\tscanf(\"%d%d%d\", &x, &y, &z), w = x + y + z;\n\t\t\tx_ = (long long) x * w0 - (long long) x0 * w;\n\t\t\ty_ = (long long) y * w0 - (long long) y0 * w;\n\t\t\td = gcd(abs_(x_), abs_(y_));\n\t\t\tif (d != 0)\n\t\t\t\tx_ /= d, y_ /= d;\n\t\t\txx[n] = x_, yy[n] = y_, n++;\n\t\t\tif (xx[n - 1] == 0 && yy[n - 1] == 0)\n\t\t\t\tk1++;\n\t\t\telse {\n\t\t\t\tk2 += ht_get(-x_, -y_);\n\t\t\t\tht_add(x_, y_, 1);\n\t\t\t\ttr_add(n - 1);\n\t\t\t}\n\t\t} else {\n\t\t\tint i;\n\n\t\t\tscanf(\"%d\", &i), i--;\n\t\t\tif (xx[i] == 0 && yy[i] == 0)\n\t\t\t\tk1--;\n\t\t\telse {\n\t\t\t\tht_add(xx[i], yy[i], -1);\n\t\t\t\tk2 -= ht_get(-xx[i], -yy[i]);\n\t\t\t\ttr_remove(i);\n\t\t\t}\n\t\t}\n\t\tprintf(k1 > 0 ? \"1\\n\" : (k2 > 0 ? \"2\\n\" : ((ll[u_] || rr[u_]) && kbad == 0 ? \"3\\n\" : \"0\\n\")));\n\t}\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "014592d0eb9575995ae4fabe17c461d5", "src_uid": "ea995d5c5fe84cd175cda0d0e2f01889", "difficulty": 2900.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n\nint main() {\n\tint n, e, o;\n\n\tscanf(\"%d\", &n);\n\tif (n <= 5) {\n\t\tprintf(n == 3 ? \"0\\n\" : \"1\\n\");\n\t\treturn 0;\n\t}\n\te = 4, o = 5;\n\tif (e < n && o < n) {\n\t\tint o_ = e + e + 1;\n\t\tint e_ = e + o + 1;\n\n\t\te = e_, o = o_;\n\t\tif (e == n || o == n) {\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"0\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d0e8d9753bbf56077e10be7cec0e2ed2", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "#include\n\n#define MOD 998244353\nint fact[1000006];\n\nint mul(int a, int b){\n return (a*1ll*b)%MOD;\n}\n\nint powmod(int p, int b){\n int t = 1;\n while(p){\n if(b&1)t = mul(t, b);\n b = mul(b, b);\n p>>=1;\n }\n return t;\n}\n\nint ncr(int n, int r){\n return mul(mul(fact[n], powmod(fact[r], MOD - 2)), powmod(fact[n - r], MOD - 2));\n}\n\n\nint main(){\n int n, levels, i;\n scanf(\"%d\", &n);\n fact[0] = 0;\n for(i = 1;i < 1000006;i++)fact[i] = mul(fact[i - 1], i);\n if(n == 1 || n == 2 || n == 4 || n == 5 ){printf(\"1\\n\");return 0;}\n if(n == 3 || n == 6 || n == 7){printf(\"0\\n\");return 0;}\n for(levels = 0; (1< rcls){printf(\"0\\n\");return 0;}\n printf(\"%d\\n\", ncr(lcls, left/2));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d19f39494e0ec77f40d49b7a38b3b44b", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "#include\n\n#define MOD 998244353\nint fact[1000006];\n\nint mul(int a, int b){\n return (a*1ll*b)%MOD;\n}\n\nint powmod(int p, int b){\n int t = 1;\n while(p){\n if(b&1)t = mul(t, b);\n b = mul(b, b);\n p>>=1;\n }\n return t;\n}\n\nint ncr(int n, int r){\n return mul(mul(fact[n], powmod(fact[r], MOD - 2)), powmod(fact[n - r], MOD - 2));\n}\n\n\nint main(){\n int n, levels, i;\n scanf(\"%d\", &n);\n fact[0] = 0;\n for(i = 1;i < 1000006;i++)fact[i] = mul(fact[i - 1], i);\n if(n == 1 || n == 2 || n == 4 || n == 5 ){printf(\"1\\n\");return 0;}\n if(n == 3 || n == 6 || n == 7){printf(\"0\\n\");return 0;}\n for(levels = 0; (1< rcls){printf(\"0\\n\");return 0;}\n printf(\"%d\\n\", ncr(lcls, left/2));\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "d1516d2a946d433d311e817202b9fe5c", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "#include\n\n#define MOD 998244353\nint fact[1000006], wpar[1000006<<1], n, level;\n\nint mul(int a, int b){\n return (a*1ll*b)%MOD;\n}\n\nint powmod(int b, int p){\n int t = 1;\n while(p){\n if(p&1)t = mul(t, b);\n b = mul(b, b);\n p>>=1;\n }\n return t;\n}\n\nint ncr(int _n, int r){\n return mul(mul(fact[_n], powmod(fact[r], MOD - 2)), powmod(fact[_n - r], MOD - 2));\n}\n\nvoid dfs(int x, int bits){\n if(bits > level) return;\n int l, r;\n l = x<<1;\n r = l|1;\n if(x&1){\n // x is a right child\n wpar[l] = 1;\n wpar[r] = 1^wpar[x]^wpar[l];\n } else {\n // x is a left child\n wpar[r] = 0;\n wpar[l] = 1^wpar[x]^wpar[r];\n }\n dfs(l, bits + 1);\n dfs(r, bits + 1);\n}\n\nint getpossib(int lparity){\n int i, rem;\n wpar[2] = lparity;\n wpar[3] = 1^wpar[1]^wpar[2];\n dfs(2, 2);dfs(3, 2);\n\n rem = n - (1<\n\nint main() {\n\tint n, e, o;\n\n\tscanf(\"%d\", &n);\n\tif (n <= 5) {\n\t\tprintf(n == 3 ? \"0\\n\" : \"1\\n\");\n\t\treturn 0;\n\t}\n\te = 4, o = 5;\n\twhile (e < n && o < n) {\n\t\tint o_ = e + e + 1;\n\t\tint e_ = e + o + 1;\n\n\t\te = e_, o = o_;\n\t\tif (e == n || o == n) {\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"0\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "366dc082ba742c3f203e7daa39210779", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int a[6] = {0}, b[7] = {0};\n char s[7];\n int i;\n\n scanf(\"%s\", s);\n\n for (i = 0; i < 6; i++) {\n\tswitch (s[i]) {\n\tcase 'R' : a[0]++; break;\n\tcase 'O' : a[1]++; break;\n\tcase 'Y' : a[2]++; break;\n\tcase 'G' : a[3]++; break;\n\tcase 'B' : a[4]++; break;\n\tcase 'V' : a[5]++; break;\n\t}\n }\n\n for (i = 0; i < 6; i++) b[a[i]]++;\n\n if (b[6] == 1 || b[5] == 1) {\n\tputs(\"1\");\n } else if (b[4] == 1 || b[3] == 2) {\n\tputs(\"2\");\n } else if (b[3] == 1) {\n\tif (b[2] == 1) {\n\t puts(\"3\");\n\t} else {\n\t puts(\"5\");\n\t}\n } else if (b[2] == 3) {\n\tputs(\"6\");\n } else if (b[2] == 2) {\n\tputs(\"8\");\n } else if (b[2] == 1) {\n\tputs(\"15\");\n } else {\n\tputs(\"30\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "dac10b5f87c016fec6514bb70342c943", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\nint color[6];\nint main(void)\n{\n int i,one,two,three,four,five,six;\n char ch[10];\n while(scanf(\"%s\",ch)!=EOF)\n {\n for(i=0;i<6;++i) color[i]=0;\n for(i=0;i<6;++i)\n {\n switch(ch[i])\n {\n case 'R': ++color[0];break;\n case 'O': ++color[1];break;\n case 'Y': ++color[2];break;\n case 'G': ++color[3];break;\n case 'B': ++color[4];break;\n case 'V': ++color[5];break;\n }\n }\n for(i=one=two=three=four=five=six=0;i<6;++i)\n {\n switch(color[i])\n {\n case 1: ++one;break;\n case 2: ++two;break;\n case 3: ++three;break;\n case 4: ++four;break;\n case 5: ++five;break;\n case 6: ++six;break;\n }\n }\n if(one==6) puts(\"30\");\n else if(one==4) puts(\"15\");\n else if(one==3) puts(\"5\");\n else if(one==2)\n {\n if(four==1) puts(\"2\");\n else puts(\"8\");\n }\n else if(one==1)\n {\n if(five==1) puts(\"1\");\n else puts(\"3\");\n }\n else\n {\n if(six==1) puts(\"1\");\n else\n {\n if(two==1&&four==1) puts(\"2\");\n else if(three==2) puts(\"2\");\n else if(two==3) puts(\"6\");\n }\n }\n }\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e5394e045227d435be41b4aa21938210", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;ik);if(i>=j)break;t=d[i];d[i]=d[j];d[j]=t;}intSort(d,i);intSort(d+j+1,s-j-1);}\nvoid intReverse(int d[],int size){int a=0,b=size-1,t;while(a=0;k--)if(d[k]d[k])break;j=d[i],d[i]=d[k],d[k]=j;intReverse(d+k+1,size-k-1);return 1;}\n\nint main(){\n int i,j,k,l,m,n;\n int res;\n char tmp[10];\n int in[10], go[10];\n ull hs, mx;\n\n dieInit();\n while(scanf(\"%s\",tmp)==1){\n ullHashClear();\n res = 0;\n\n rep(i,6) in[i] = tmp[i];\n intSort(in,6);\n\n do{\n mx = 0;\n rep(i,24){\n rep(k,6) go[k] = in[die[i][k]];\n hs = 0;\n rep(k,6) hs = hs * 1007 + go[k];\n if(mx < hs) mx = hs;\n }\n if( ullHashIncrease(mx)==1 ) res++;\n }while(intNextPermutation(in,6));\n\n printf(\"%d\\n\",res);\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c12f982ebb31481fe25700a2d0112c92", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int a[6] = {0}, b[7] = {0};\n char s[7];\n int i;\n\n scanf(\"%s\", s);\n\n for (i = 0; i < 6; i++) {\n\tswitch (s[i]) {\n\tcase 'R' : a[0]++; break;\n\tcase 'O' : a[1]++; break;\n\tcase 'Y' : a[2]++; break;\n\tcase 'G' : a[3]++; break;\n\tcase 'B' : a[4]++; break;\n\tcase 'V' : a[5]++; break;\n\t}\n }\n\n for (i = 0; i < 6; i++) b[a[i]]++;\n\n if (b[6] == 1 || b[5] == 1) {\n\tputs(\"1\");\n } else if (b[4] == 1 || b[3] == 2) {\n\tputs(\"2\");\n } else if (b[3] == 1) {\n\tif (b[2] == 1) {\n\t puts(\"3\");\n\t} else {\n\t puts(\"5\");\n\t}\n } else if (b[2] == 3) {\n\tputs(\"6\");\n } else if (b[2] == 2) {\n\tputs(\"8\");\n } else if (b[2] == 1) {\n\tputs(\"15\");\n } else {\n\tputs(\"30\");\n }\n\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "06006342d49c5cea1627fdf8638a6076", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include \n\nint main()\n{\n int num[6];\n char ans[6];\n char t[7];\n int n,i,j,temp;\n \n scanf(\"%s\",&t);\n n=0;\n for(i=0;i<6;i++)num[i]=0;\n for(i=0;i<6;i++)\n {\n for(j=0;jnum[i])\n {\n temp=num[j];\n num[j]=num[i];\n num[i]=temp;\n }\n }\n }\n if(n==6)\n {\n puts(\"30\");\n }\n else if(n==1)\n {\n puts(\"1\");\n }\n else if(n==5)\n {\n puts(\"15\");\n }\n else if(n==4)\n {\n if(num[0]==3)puts(\"5\");\n else puts(\"8\");\n }\n else if(n==3)\n {\n if(num[0]==4)puts(\"2\");\n else if(num[0]==2)puts(\"6\");\n else puts(\"3\");\n }\n else\n {\n if(num[0]==5)puts(\"1\");\n else puts(\"2\");\n }\n system(\"PAUSE\");\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "4a5be8643bdc82cf4bc02fcec7dc3937", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0} {"lang": "GNU C", "source_code": "#include\n#include\n#define sqr(x) ((x)*(x))\n#define m0(x) memset(x,0,sizeof(x))\n#define m1(x) memset(x,63,sizeof(x))\n#define M 1000000007\n#define N 211111\n\n#define maxN 555\n\nint n, k;\nint dp[maxN][maxN], dp2[maxN][maxN];\nint w[maxN];\n\nint add(int x, int y) {\n\tx += y;\n\tif (x >= M) x-= M;\n\treturn (x);\n}\n\nint min(int a, int b)\n\t{\n\t\tif(a 0) {\n\t\t\tif (j > i) {\n\t\t\t\tint e = i + 1;\n\t\t\t\tint z = dp[j][d] * 1ll * w[e] % M;\n\t\t\t\tdp2[j][d]=(dp2[j][d], z);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint z = (w[i - j + 1] - 1 + M);\n\t\t\tif (z >= M) z -= M;\n\t\t\tz = z * 1ll * w[j] % M;\n\t\t\tz = z * 1ll * dp[j][d] % M;\n\t\t\tdp2[i + 1][min(d + 1, k + 1)]=add(dp2[i + 1][min(d + 1, k + 1)], z);\n\t\t\tz = dp[j][d] * 1ll * w[j] % M;\n\t\t\tdp2[j][d]=add(dp2[j][d], z);\n\t\t}\n\t\tfor ( j = 0; j <= n; j++) for (d = 0; d <= k + 1; d++) dp[j][d] = dp2[j][d];\n\t}\n\tint ans = 0;\n\tfor ( i = 0; i <= n; i++) ans=add(ans, dp[i][k]);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "563415f47fe05503573ede7dcd94e0d6", "src_uid": "111673158df2e37ac6c019bb99225ccb", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include\n#define M 510\n#define ll long long int\nll mod=1000000007;\nll f[M][M];\nll pp[1000000];\nll ans;\nint n,k;\nvoid prepare(){\n ll cnt;\n int i,j;\n pp[0]=1;\n for(i=1;i<1000000;i++)pp[i]=(pp[i-1]*2)%mod;\n for(i=0;i<=500;i++)f[i][0]=1;\n for(n=1;n<=500;n++)for(k=1;k<=n;k++){\n for(j=k;j<=n;j++){\n cnt=(pp[j*(n-j+1)]-pp[(j-1)*(n-j+1)]+mod)%mod;\n cnt=(f[j-1][k-1]*cnt)%mod;\n f[n][k]=(f[n][k]+cnt);\n }\n f[n][k]%=mod;\n }\n}\nint main(){\n int i,j;\n prepare();\n scanf(\"%d %d\",&n,&k);\n printf(\"%lld\\n\",f[n][k]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "413d2515b5d43a6d8fc7ca8dd4c97de6", "src_uid": "111673158df2e37ac6c019bb99225ccb", "difficulty": 2500.0} {"lang": "GNU C", "source_code": "#include \n#include \n#include \n\n\n#define maxn 505\n#define P 1000000007\n\nint n, k, mi2[maxn * maxn], dp[maxn][maxn], ans = 0;\nint main() {\n scanf(\"%d%d\", &n, &k);\n int i,j,l;\n memset(dp, 0, sizeof(dp));\n dp[0][0] = 1, mi2[0] = 1;\n\n for (i = 1; i <= n * n; i++) mi2[i] = 2ll * mi2[i - 1] % P;\n\n for (i = 1; i <= n; i ++)\n for ( j = 1; j <= k; j ++)\n for (l = 0; l < i; l ++)\n dp[i][j] = (dp[i][j] + 1ll * dp[l][j - 1] * (mi2[i - l] - 1) % P * mi2[(i - l) * l] % P) % P;\n for (i = 0; i <= n; i ++)\n ans = (ans + 1ll * dp[i][k] * mi2[(n - i) * i]) % P;\n printf(\"%d\\n\", (ans + P) % P);\n\n return 0;\n\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7dd8e95c0266c557cba5d10ddd6944ea", "src_uid": "111673158df2e37ac6c019bb99225ccb", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#define N 1000007\n#define M 1000000007\ntypedef long long ll;\nll n, b = 1, dp[2][N][2];\nint main()\n{\n\tscanf(\"%I64d\", &n);\n\tll v = 1 << (ll)log2(n), u = v / 2 * 3;\n\tfor (dp[0][1][0] = 1, dp[0][1][1] = u <= n; u >>= 1, v >>= 1, v >= 1; b ^= 1)\n\t\tfor (ll j = 1, w = n / v, x = n / (v * 2), y = n / (v * 3), z = n / u; j <= w; ++j)\n\t\t\tdp[b][j][0] = (dp[b][j - 1][0] * (w - (j - 1)) % M + dp[b ^ 1][j - 1][0] * (w - x) % M + dp[b ^ 1][j - 1][1] * (w - y) % M) % M,\n\t\t\tdp[b][j][1] = (dp[b][j - 1][1] * (z - (j - 1)) % M + dp[b ^ 1][j - 1][1] * (z - y) % M) % M;\n\tprintf(\"%I64d\", dp[b ^ 1][n][0]);\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "1776633b8c456a8835fd78b2ace296b9", "src_uid": "b2d59b1279d891dba9372a52364bced2", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "#include \n\n#define L\t19\n#define MD\t1000000007\n\nint main() {\n\tstatic int dp[L + 1], dq[L + 1], dp0[L], dq0[L], dp1[L], dq1[L];\n\tint n, i, j, kj, kj_, l, ans;\n\n\tscanf(\"%d\", &n);\n\tl = 0;\n\twhile (1 << (l + 1) <= n)\n\t\tl++;\n\tans = 0;\n\tdp[l] = 1;\n\tfor (i = 1; i < n; i++) {\n\t\tfor (j = 0; j <= l; j++)\n\t\t\tif (dp[j]) {\n\t\t\t\tkj = n >> j;\n\t\t\t\tdq[j] = (dq[j] + (long long) dp[j] * ((n >> j) - i)) % MD;\n\t\t\t\tif (j > 0) {\n\t\t\t\t\tkj_ = n >> (j - 1);\n\t\t\t\t\tdq[j - 1] = (dq[j - 1] + (long long) dp[j] * (kj_ - kj)) % MD;\n\t\t\t\t}\n\t\t\t}\n\t\tfor (j = 0; j <= l; j++)\n\t\t\tdp[j] = dq[j], dq[j] = 0;\n\t}\n\tans = (ans + dp[0]) % MD;\n\tif ((1 << (l - 1)) * 3 <= n) {\n\t\tdp1[l - 1] = 1;\n\t\tfor (i = 1; i < n; i++) {\n\t\t\tfor (j = 0; j < l; j++) {\n\t\t\t\tif (dp0[j]) {\n\t\t\t\t\tkj = n >> j;\n\t\t\t\t\tdq0[j] = (dq0[j] + (long long) dp0[j] * (kj - i)) % MD;\n\t\t\t\t\tif (j > 0) {\n\t\t\t\t\t\tkj_ = n >> (j - 1);\n\t\t\t\t\t\tdq0[j - 1] = (dq0[j - 1] + (long long) dp0[j] * (kj_ - kj)) % MD;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (dp1[j]) {\n\t\t\t\t\tkj = (n >> j) / 3;\n\t\t\t\t\tdq1[j] = (dq1[j] + (long long) dp1[j] * (kj - i)) % MD;\n\t\t\t\t\tif (j > 0) {\n\t\t\t\t\t\tkj_ = (n >> (j - 1)) / 3;\n\t\t\t\t\t\tdq1[j - 1] = (dq1[j - 1] + (long long) dp1[j] * (kj_ - kj)) % MD;\n\t\t\t\t\t}\n\t\t\t\t\tkj_ = n >> j;\n\t\t\t\t\tdq0[j] = (dq0[j] + (long long) dp1[j] * (kj_ - kj)) % MD;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (j = 0; j < l; j++) {\n\t\t\t\tdp0[j] = dq0[j], dq0[j] = 0;\n\t\t\t\tdp1[j] = dq1[j], dq1[j] = 0;\n\t\t\t}\n\t\t}\n\t\tans = (ans + dp0[0]) % MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "5dd4b860f08131c37b07581c0bd260fc", "src_uid": "b2d59b1279d891dba9372a52364bced2", "difficulty": 2500.0} {"lang": "GNU C11", "source_code": "/* upsolve with Dukkha */\n#include \n\n#define N\t1000000\n#define MD\t1000000007\n\nlong long ff[N], gg[N], pn[N], pm[N];\n\nlong long power(long long 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(int n, int m) {\n\tlong long f, p;\n\tint i;\n\n\tf = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tff[i] = f;\n\t\tgg[i] = power(f, MD - 2);\n\t\tf = f * (i + 1) % MD;\n\t}\n\tp = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tpn[i] = p;\n\t\tp = p * n % MD;\n\t}\n\tp = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tpm[i] = p;\n\t\tp = p * m % MD;\n\t}\n}\n\nlong long cayley(int n, int k) {\n\treturn k == n ? 1 : k * pn[n - k - 1] % MD;\n}\n\nint main() {\n\tint n, m, a, b, k;\n\tlong long ans;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &a, &b);\n\tinit(n, m);\n\tans = 0;\n\tfor (k = 0; k <= n - 2 && k < m; k++) {\n\t\t/* choose(n - 2, k) * factorial(k) */\n\t\tlong long path = ff[n - 2] * gg[n - 2 - k] % MD;\n\t\t/* choose(m - 1, k) * power(m, n - k - 2) */\n\t\tlong long edges = ff[m - 1] % MD * gg[k] % MD * gg[m - 1 - k] % MD\n\t\t\t* pm[n - k - 2] % MD;\n\n\t\tans = (ans + path * cayley(n, k + 2) % MD * edges) % MD;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "1204958630a969294efba772839aeb7f", "src_uid": "728fe302b8b18e33f15f6e702e332cde", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "/* upsolve with Dukkha */\n#include \n\n#define N\t100000\n#define MD\t1000000007\n\nlong long power(long long 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\nlong long cayley(int n, int k) {\n\treturn k == n ? 1 : k * power(n, n - k - 1) % MD;\n}\n\nint main() {\n\tstatic long long ff[N], gg[N];\n\tint n, m, a, b, k, i;\n\tlong long f, ans;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &a, &b);\n\tf = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tff[i] = f;\n\t\tgg[i] = power(f, MD - 2);\n\t\tf = f * (i + 1) % MD;\n\t}\n\tans = 0;\n\tfor (k = 0; k <= n - 2 && k < m; k++) {\n\t\t/* choose(n - 2, k) * factorial(k) */\n\t\tlong long path = ff[n - 2] * gg[n - 2 - k] % MD;\n\t\t/* choose(m - 1, k) * power(m, n - k - 2) */\n\t\tlong long edges = ff[m - 1] % MD * gg[k] % MD * gg[m - 1 - k] % MD\n\t\t\t* power(m, n - k - 2) % MD;\n\n\t\tans = (ans + path * cayley(n, k + 2) % MD * edges) % MD;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "9645a8c7b741f9ccce59bd549ef8238b", "src_uid": "728fe302b8b18e33f15f6e702e332cde", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t2021\n#define M\t2021\n#define MD\t998244353\n\nint vv[N + M + 1], ff[N + M + 1], gg[N + M + 1];\n\nvoid init() {\n\tint i;\n\n\tff[0] = gg[0] = 1;\n\tfor (i = 1; i <= N + M; 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 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\tstatic int xx[N][M], dp[N], dq[N];\n\tint n, m, i, j, x, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t\txx[i][j] = choose(i + j, j);\n\tans = 0;\n\tfor (j = 1; j < m; j++) {\n\t\tx = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tif ((x += xx[i][j - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdp[i] = (long long) x * xx[n - 1 - i][j - 1] % MD;\n\t\t}\n\t\tx = 0;\n\t\tfor (i = n - 1; i >= 0; i--) {\n\t\t\tif ((x += xx[n - 1 - i][m - j - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdq[i] = (long long) x * xx[i][m - j - 1] % MD;\n\t\t}\n\t\tfor (i = 1; i < n; i++)\n\t\t\tif ((dp[i] += dp[i - 1]) >= MD)\n\t\t\t\tdp[i] -= MD;\n\t\tfor (i = 0; i + 1 < n; i++)\n\t\t\tif ((ans += (long long) dp[i] * dq[i + 1] % MD) >= MD)\n\t\t\t\tans -= MD;\n\t\tx = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tif ((x += xx[i][m - j - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdp[i] = (long long) x * xx[n - 1 - i][m - j - 1] % MD;\n\t\t}\n\t\tx = 0;\n\t\tfor (i = n - 1; i >= 0; i--) {\n\t\t\tif ((x += xx[n - 1 - i][j - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdq[i] = (long long) x * xx[i][j - 1] % MD;\n\t\t}\n\t\tfor (i = 1; i < n; i++)\n\t\t\tif ((dp[i] += dp[i - 1]) >= MD)\n\t\t\t\tdp[i] -= MD;\n\t\tfor (i = 0; i + 1 < n; i++)\n\t\t\tif ((ans += (long long) dp[i] * dq[i + 1] % MD) >= MD)\n\t\t\t\tans -= MD;\n\t}\n\tfor (j = 0; j < m; j++)\n\t\tfor (i = 0; i < n; i++)\n\t\t\txx[j][i] = choose(j + i, i);\n\tfor (i = 1; i < n; i++) {\n\t\tx = 0;\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tif ((x += xx[j][i - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdp[j] = (long long) x * xx[m - 1 - j][i - 1] % MD;\n\t\t}\n\t\tx = 0;\n\t\tfor (j = m - 1; j >= 0; j--) {\n\t\t\tif ((x += xx[m - 1 - j][n - i - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdq[j] = (long long) x * xx[j][n - i - 1] % MD;\n\t\t}\n\t\tfor (j = 1; j < m; j++)\n\t\t\tif ((dp[j] += dp[j - 1]) >= MD)\n\t\t\t\tdp[j] -= MD;\n\t\tfor (j = 0; j + 2 < m; j++)\n\t\t\tif ((ans += (long long) dp[j] * dq[j + 2] % MD) >= MD)\n\t\t\t\tans -= MD;\n\t\tx = 0;\n\t\tfor (j = 0; j < m; j++) {\n\t\t\tif ((x += xx[j][n - i - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdp[j] = (long long) x * xx[m - 1 - j][n - i - 1] % MD;\n\t\t}\n\t\tx = 0;\n\t\tfor (j = m - 1; j >= 0; j--) {\n\t\t\tif ((x += xx[m - 1 - j][i - 1]) >= MD)\n\t\t\t\tx -= MD;\n\t\t\tdq[j] = (long long) x * xx[j][i - 1] % MD;\n\t\t}\n\t\tfor (j = 1; j < m; j++)\n\t\t\tif ((dp[j] += dp[j - 1]) >= MD)\n\t\t\t\tdp[j] -= MD;\n\t\tfor (j = 0; j + 2 < m; j++)\n\t\t\tif ((ans += (long long) dp[j] * dq[j + 2] % MD) >= MD)\n\t\t\t\tans -= MD;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "eb2dc7ce3b060163fb1c4b31c6ad6fa4", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "difficulty": 3100.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\n#define N\t8\n\nint compare(const void *a, const void *b) {\n\tlong long la = *(long long *) a;\n\tlong long lb = *(long long *) b;\n\n\treturn la == lb ? 0 : la < lb ? -1 : 1;\n}\n\nlong long aa[N], aa_[N];\nint bb[N], dp[N][1 << (N - 1)];\nchar pp[N];\nint n, ans = 0x3f3f3f3f;\n\nvoid solve(int i) {\n\tint j;\n\n\tif (i == n) {\n\t\tint cnt, sum;\n\n\t\tcnt = 0, sum = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tint k;\n\n\t\t\tif (!pp[i])\n\t\t\t\tcnt++;\n\t\t\tk = dp[i][bb[i]];\n\t\t\tsum += k == 1 && bb[i] == 0 ? 1 : k + 1;\n\t\t}\n\t\tif (cnt >= 2)\n\t\t\tsum++;\n\t\tif (ans > sum)\n\t\t\tans = sum;\n\t\treturn;\n\t}\n\tsolve(i + 1);\n\tpp[i] = 1;\n\tfor (j = i + 1; j < n; j++)\n\t\tif (aa_[j] % aa[i] == 0) {\n\t\t\taa_[j] /= aa[i], bb[j] ^= 1 << i;\n\t\t\tsolve(i + 1);\n\t\t\taa_[j] *= aa[i], bb[j] ^= 1 << i;\n\t\t}\n\tpp[i] = 0;\n}\n\nint main() {\n\tint i, j;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%lld\", &aa[i]);\n\tqsort(aa, n, sizeof *aa, compare);\n\tfor (i = 0; i < n; i++) {\n\t\tlong long a;\n\t\tint k, p, b;\n\n\t\ta = aa[i];\n\t\tk = 0;\n\t\tfor (p = 2; p <= a / p; p++)\n\t\t\twhile (a % p == 0) {\n\t\t\t\tk++;\n\t\t\t\ta /= p;\n\t\t\t}\n\t\tif (a > 1)\n\t\t\tk++;\n\t\tdp[i][0] = k;\n\t\tfor (b = 1; b < 1 << i; b++) {\n\t\t\ta = aa[i];\n\t\t\tk = dp[i][0];\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\tif ((b & 1 << j)) {\n\t\t\t\t\tif (a % aa[j] != 0) {\n\t\t\t\t\t\tk = -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ta /= aa[j];\n\t\t\t\t\tk -= dp[j][0];\n\t\t\t\t}\n\t\t\tdp[i][b] = k;\n\t\t}\n\t}\n\tfor (i = 0; i < n; i++)\n\t\taa_[i] = aa[i];\n\tsolve(0);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "585538eac59116e4ae6bca7faf1220e0", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "/* practice with Dukkha */\n#include \n#include \n\n#define N\t8\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\nlong long aa[N], aa_[N];\nint bb[N], dp[N][1 << (N - 1)];\nchar pp[N];\nint n, ans = 0x3f3f3f3f;\n\nvoid solve(int i) {\n\tint j;\n\n\tif (i == n) {\n\t\tint cnt, sum;\n\n\t\tcnt = 0, sum = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tint k;\n\n\t\t\tif (!pp[i])\n\t\t\t\tcnt++;\n\t\t\tk = dp[i][bb[i]];\n\t\t\tsum += k == 1 && bb[i] == 0 ? 1 : k + 1;\n\t\t}\n\t\tif (cnt >= 2)\n\t\t\tsum++;\n\t\tif (ans > sum)\n\t\t\tans = sum;\n\t\treturn;\n\t}\n\tsolve(i + 1);\n\tpp[i] = 1;\n\tfor (j = i + 1; j < n; j++)\n\t\tif (aa_[j] % aa[i] == 0) {\n\t\t\taa_[j] /= aa[i], bb[j] ^= 1 << i;\n\t\t\tsolve(i + 1);\n\t\t\taa_[j] *= aa[i], bb[j] ^= 1 << i;\n\t\t}\n\tpp[i] = 0;\n}\n\nint main() {\n\tint i, j, p, b;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%lld\", &aa[i]);\n\tqsort(aa, n, sizeof *aa, compare);\n\tfor (i = 0; i < n; i++) {\n\t\tlong long a;\n\t\tint k;\n\n\t\ta = aa[i];\n\t\tk = 0;\n\t\tfor (p = 2; p <= a / p; p++)\n\t\t\twhile (a % p == 0) {\n\t\t\t\tk++;\n\t\t\t\ta /= p;\n\t\t\t}\n\t\tif (a > 1)\n\t\t\tk++;\n\t\tdp[i][0] = k;\n\t\tfor (b = 1; b < 1 << i; b++) {\n\t\t\ta = aa[i];\n\t\t\tk = dp[i][0];\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\tif ((b & 1 << j)) {\n\t\t\t\t\tif (a % aa[j] != 0) {\n\t\t\t\t\t\tk = -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ta /= aa[j];\n\t\t\t\t\tk -= dp[j][0];\n\t\t\t\t}\n\t\t\tdp[i][b] = k;\n\t\t}\n\t}\n\tfor (i = 0; i < n; i++)\n\t\taa_[i] = aa[i];\n\tsolve(0);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b1006a557c27b4bec5043d4b137d4f5c", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#define MOD 1000000007\n\nint K;\nlong long PA,PB,ans;\n\nlong long INV1,INV2;\nlong long f[1010][2010];\n\nlong long power(long long a,int b)\n{\n long long y = 1;\n for(;b;b>>=1)\n {\n if(b&1) y = y * a % MOD;\n a = a * a % MOD;\n }\n return y;\n}\n\nint main()\n{\n int i,j;\n long long x,y;\n\n scanf(\"%d%I64d%I64d\",&K,&PA,&PB);\n INV1 = power(PA+PB,MOD-2);\n INV2 = power(PB,MOD-2);\n\n f[1][0] = 1;\n for(i=1;i<=K;i++) for(j=(i==1);j<=2*K;j++)\n {\n if(j < K) f[i][j] = f[i-1][j] * PA % MOD * INV1 % MOD;\n if(j >= i && j-i < K) f[i][j] = (f[i][j] + f[i][j-i] * PB % MOD * INV1) % MOD;\n }\n\n for(i=1;i\n#define MOD 1000000007\n\nint K;\nlong long PA,PB,ans;\n\nlong long INV1,INV2;\nlong long f[1010][2010];\n\nlong long power(long long a,int b)\n{\n long long y = 1;\n for(;b;b>>=1)\n {\n if(b&1) y = y * a % MOD;\n a = a * a % MOD;\n }\n return y;\n}\n\nint main()\n{\n int i,j;\n long long x,y;\n\n scanf(\"%d%I64d%I64d\",&K,&PA,&PB);\n INV1 = power(PA+PB,MOD-2);\n INV2 = power(PB,MOD-2);\n\n f[1][0] = 1;\n for(i=1;i<=K;i++) for(j=(i==1);j<=2*K;j++)\n {\n if(j < K) f[i][j] = f[i-1][j] * PA % MOD * INV1 % MOD;\n if(j >= i && j-i < K) f[i][j] = (f[i][j] + f[i][j-i] * PB % MOD * INV1) % MOD;\n }\n\n for(i=1;i\r\n#include \r\n\r\n#define N\t5000\r\n#define INF\t0x3f3f3f3f3f3f3f3fLL\r\n\r\nlong long min(long long a, long long b) { return a < b ? a : b; }\r\nlong long max(long long a, long long b) { return a > b ? a : b; }\r\n\r\nint main() {\r\n\tstatic long long dp[N];\r\n\tint n, a, c, e, i, j;\r\n\tlong long b, d, s, t, u, ans;\r\n\r\n\tscanf(\"%d%lld%d%lld%d%d\", &a, &b, &c, &d, &n, &e), a -= e, c -= e;\r\n\tmemset(dp, 0x3f, n * sizeof *dp), dp[0] = 0;\r\n\tans = INF;\r\n\tfor (i = 0; i < n; i++) {\r\n\t\ts = dp[i], t = dp[i], u = dp[i], j = i;\r\n\t\twhile (j < n) {\r\n\t\t\tif (j + a + c + e < n)\r\n\t\t\t\tdp[j + a + c + e] = min(dp[j + a + c + e], max(s + b, t + d));\r\n\t\t\telse\r\n\t\t\t\tans = min(ans, max(s + b, t + d));\r\n\t\t\tif (s + b < t + d)\r\n\t\t\t\tj += a, u = s += b;\r\n\t\t\telse\r\n\t\t\t\tj += c, u = t += d;\r\n\t\t}\r\n\t\tans = min(ans, u);\r\n\t}\r\n\tprintf(\"%lld\\n\", ans);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "e39f0847910605b224bc404d7f7d49a6", "src_uid": "ca9d48e48e69b931236907a9ac262433", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\nusing namespace std;\nint a[10][260]=\n{\n{0},\n{2,1},\n{32,30,80,109},\n{6824,59808,147224,415870,1757896,1897056,4898872,7593125},\n{776830421,290516100,746623577,293783147,33900006,735127505,565460332,428982705,472062098,161873957,117354594,515619293,578944191,312106242,569389279,391464593},\n{261086313,584837659,683961846,468868529,211593382,736955478,229471758,157617135,398169441,360252438,629394768,264125799,647490480,342079395,391579767,225200475,486011304,513156108,628771752,132906648,142138221,20119449,444199674,195188679,387329805,44684703,651912135,737154512,612549793,519860281,186175544,212568440},\n{240805271,239509872,581127897,6511239,156126222,509425833,672407328,366667722,459185405,509737025,554790222,165216555,703150560,74806569,398730015,383350905,506108358,51326142,298053147,104256117,391428765,374020479,206607807,87664059,275899176,56407680,551553401,448939463,582889860,129676638,226078251,135769095,61292868,578972226,190181628,390739055,184587732,446575689,732674124,232198470,676760679,352474101,611444862,575661807,628905585,320813094,522840969,469781928,156006018,554473341,239654268,643714911,433540170,199307003,496385218,291740751,67309914,370826673,202356819,279421821,421203111,63744786,520987612,550671827},\n{482164403,768209115,462063756,154906374,36099042,341766705,678182556,621882744,478771358,231881111,175889805,243630450,168908523,671961765,55761813,652682670,773939082,517628076,756201264,124604900,750976272,498253248,676047609,137170026,705610017,495032139,561797418,703097347,500815609,95984586,739707108,265613565,387099846,777331779,594676173,591219559,407997044,208947235,93337440,478908360,685013007,487033953,671903001,39521181,738490312,33785059,465470131,310453920,54648783,346831137,427694175,474743430,705296781,435828036,429824745,663532359,261388683,244690731,533997135,596108961,506813013,371892402,590145264,104733162,143420103,654339672,700348950,685038942,578826927,286484229,501639192,434962491,299270097,27702486,335375775,111746817,565603164,294926121,676063665,735862995,710035809,437011960,668528077,138765186,508213986,615036450,353784942,624827616,343900011,241289776,52410890,72018835,352406796,415705878,4802637,376367145,65589678,333633477,341834527,303717460,282387700,42951006,254706039,423048528,526429710,68131467,669954708,12787348,500636381,317959019,479433192,657133515,416259390,610216692,340129188,44594256,257373347,138718678,530767740,292922628,37220268,605295159,480722613,458170419,30540300,487159055,232966794,149150650},\n{412133651,386543325,139952108,289303402,102404925,317067177,396414708,80515854,663739304,317300809,228877044,493725043,715317967,490300965,315527373,743539734,488329191,553627998,533025234,242583957,706116537,614109258,645447222,523195911,492109128,722623041,111085128,766395126,654378921,691964847,496688157,399056049,654363234,102052314,191720088,473910948,259736526,332840025,388047555,665791056,627111387,139696515,441456687,443032569,283264821,771641703,452641455,511306362,117572859,127701891,721298331,176520078,357242229,611296308,696994956,405628839,429224274,465336054,695091546,689828796,574648641,351220905,507964023,675326610,517248963,453528621,220301928,494463186,681789969,339589656,44524053,417125457,339589404,747135963,341780733,734158215,396817281,21997836,5728464,147611205,456248898,714128667,377654949,3862068,128418948,589390074,304947090,11703825,228266073,127304142,429215724,361541124,521572968,468358191,341231688,65323503,613778508,15985323,291661029,410970006,591638112,349541550,89967528,224922159,361094166,584206074,640051812,324264456,652625388,693768537,11740617,309238398,211085469,194905872,639416484,110110707,296645895,748118511,131177718,511142751,775975599,421403409,475528473,434685258,1768977,80301375,708023862,569195676,56238084,632887668,88089750,631539342,396695565,38780154,695798271,469819224,439587099,69045921,682966116,112310856,64943298,534475872,40215357,389728458,286368453,736006257,501181650,54829908,603489402,338032656,512182818,627500097,462674016,3103092,157324491,43978329,596818971,259025598,9088632,91991781,577291428,211245489,429471231,142626330,172560633,510907446,444609585,758102058,375112647,744786693,276174402,19259856,233672418,745389414,225772848,23385663,324290610,519804558,120337812,402578568,360676008,450089262,551043738,337388940,512108856,28879011,690040638,106017282,558262341,99972432,608226003,612152037,42414435,776201013,39580443,518796945,494437752,583194366,723936555,415359657,309569589,751104774,166684527,249229170,353120823,130668327,753823584,580966092,561963717,543672234,393846327,586278000,327398400,278403867,156455586,363920382,190245195,290039148,547014447,466218648,146037150,585462906,666008595,691786683,374707494,622498779,231158277,685740951,115612245,681825249,545555745,551718468,277206615,640171035,757727334,195193908,658656684,457760646,225925875,505761984,18685233,506832921,112511021,396846646,290147622,113924623,669986155,336008070,63611061,238586775,119956662,616557739,772784623,334527774,410403148,51933421}\n};\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int p=0;\n while ((1<\n\n#define N\t1000000\n#define MD\t998244353\n#define V2\t499122177\n#define V6\t166374059\n\nint f2(int n) {\n\treturn (long long) n * (n + 1) % MD * V2 % MD;\n}\n\nint f3(int n) {\n\treturn (long long) n * (n + 1) % MD * (n + 2) % MD * V6 % MD;\n}\n\nint main() {\n\tstatic int dp[N], dq[N];\n\tint n, i, x, y, z, single2, single3, pair, ans;\n\n\tscanf(\"%d\", &n);\n\tdp[0] = dq[0] = 1;\n\tfor (i = 1; i < n; i++) {\n\t\tdp[i] = (dp[i - 1] + f2(dp[i - 1]) + (i == 1 ? 0 : (long long) dp[i - 1] * dq[i - 2])) % MD;\n\t\tdq[i] = (dq[i - 1] + dp[i]) % MD;\n\t}\n\tx = dp[n - 1], y = n == 1 ? 0 : dq[n - 2];\n\tsingle2 = (f2(x) + (long long) x * y % MD) % MD;\n\tsingle3 = (f3(x) + (long long) f2(x) * y % MD + (long long) x * f2(y) % MD) % MD;\n\tpair = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tif (i == 0)\n\t\t\tz = 1;\n\t\telse {\n\t\t\tx = dp[i - 1], y = i == 1 ? 0 : dq[i - 2];\n\t\t\tz = (f2(x) + (long long) x * y % MD) % MD;\n\t\t}\n\t\tpair = (pair + (long long) z * dp[n - 1 - i]) % MD;\n\t}\n\tans = ((long long) single2 * 2 + single3 * 2 + pair) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "e148cada6afeb66bce3c638a99727036", "src_uid": "92939054045c089cd25c8f4e7b9ffcf2", "difficulty": 2900.0} {"lang": "GNU C", "source_code": "#include \n#include \n\nint main() {\n int R,B,i,j;\n scanf(\"%d %d\",&R,&B);\n int x[R],y[R],a[B],b[B];\n for(i=0;i\n#include\n\ntypedef long long LL;\nbool inuse[10];\nint x[2][10], y[2][10], R, B, guarding[10];\n\nlong long cprodukt(int x1, int y1, int x2, int y2, int x3, int y3){\n\treturn (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);\n}\n\nbool cross(int g1, int s1, int g2, int s2){\n\treturn (\n\t\tcprodukt(x[0][g1], y[0][g1], x[1][s1], y[1][s1], x[0][g2], y[0][g2])\n\t\t*\n\t\tcprodukt(x[0][g1], y[0][g1], x[1][s1], y[1][s1], x[1][s2], y[1][s2])\n\t\t<0)\n\t\t&&\n\t\t(\n\t\tcprodukt(x[0][g2], y[0][g2], x[1][s2], y[1][s2], x[0][g1], y[0][g1])\n\t\t*\n\t\tcprodukt(x[0][g2], y[0][g2], x[1][s2], y[1][s2], x[1][s1], y[1][s1])\n\t\t<0);\n}\n\nbool pos(int d){\n\tif(d==R) return true;\n\tfor(int i=0;i\n\n#define N\t100\n#define X\t100\n#define MD\t1000000007\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 main() {\n\tstatic int ff[X + 1], ds[X + 1][N][N + 1], dp[X + 1][N], dq[X + 1][N], dr[X + 1];\n\tstatic char cc[N + 1];\n\tint n, x, i, l, r, m;\n\n\tscanf(\"%d%d%s\", &n, &x, cc);\n\tif (x == 0) {\n\t\tprintf(\"%d\\n\", n == 1 && cc[0] == '0');\n\t\treturn 0;\n\t}\n\tff[0] = ff[1] = 1;\n\tfor (i = 2; i <= x; i++)\n\t\tff[i] = (ff[i - 1] + ff[i - 2]) % (MD - 1);\n\tfor (i = 0; i <= x; i++)\n\t\tff[i] = power(2, ff[i]);\n\tfor (l = 0; l < n; l++) {\n\t\tds[0][l][l] = ds[1][l][l] = 1;\n\t\tds[0][l][l + 1] = cc[l] == '0' ? 1 : 0;\n\t\tds[1][l][l + 1] = cc[l] == '1' ? 1 : 0;\n\t}\n\tfor (i = 2; i <= x; i++)\n\t\tfor (l = 0; l < n; l++)\n\t\t\tfor (r = l; r < n; r++) {\n\t\t\t\tlong long z = 0;\n\n\t\t\t\tfor (m = l; m <= r; m++)\n\t\t\t\t\tz = (z + (long long) ds[i - 1][l][m] * ds[i - 2][m][r]) % MD;\n\t\t\t\tds[i][l][r] = z;\n\t\t\t}\n\tif (n > 1) {\n\t\tdp[0][n - 1] = ds[0][n - 1][n];\n\t\tdp[1][n - 1] = ds[1][n - 1][n];\n\t\tfor (i = 2; i <= x; i++)\n\t\t\tfor (l = 1; l < n; l++) {\n\t\t\t\tlong long z = (long long) dp[i - 1][l] * ff[i - 2] % MD;\n\n\t\t\t\tfor (m = l; m < n; m++)\n\t\t\t\t\tz = (z + (long long) ds[i - 1][l][m] * dp[i - 2][m]) % MD;\n\t\t\t\tdp[i][l] = z;\n\t\t\t}\n\t\tdq[0][1] = ds[0][0][1];\n\t\tdq[1][1] = ds[1][0][1];\n\t\tfor (i = 2; i <= x; i++)\n\t\t\tfor (r = 1; r < n; r++) {\n\t\t\t\tlong long z = (long long) ff[i - 1] * dq[i - 2][r] % MD;\n\n\t\t\t\tfor (m = r; m > 0; m--)\n\t\t\t\t\tz = (z + (long long) dq[i - 1][m] * ds[i - 2][m][r]) % MD;\n\t\t\t\tdq[i][r] = z;\n\t\t\t}\n\t}\n\tdr[0] = ds[0][0][n];\n\tdr[1] = ds[1][0][n];\n\tfor (i = 2; i <= x; i++) {\n\t\tlong long z = ((long long) dr[i - 1] * ff[i - 2] + (long long) ff[i - 1] * dr[i - 2]) % MD;\n\n\t\tfor (m = 1; m < n; m++)\n\t\t\tz = (z + (long long) dq[i - 1][m] * dp[i - 2][m]) % MD;\n\t\tdr[i] = z;\n\t}\n\tprintf(\"%d\\n\", dr[x]);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "ec0b9fedcfe40e6e334344fced87ad31", "src_uid": "52c6aa73ff4460799402c646c6263630", "difficulty": 2400.0} {"lang": "GNU C", "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];\nbool visited[MAX][MAX];\nint n, m, dp[MAX][MAX], next[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 long long res = 0;\n if (next[i][j] != -1){\n res = res + F(i + 1, next[i][j] + 1) + 1;\n res = res + F(i, next[i][j] + 1);\n }\n\n visited[i][j] = true;\n return (dp[i][j] = (res % MOD));\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 memset(next, -1, sizeof(next));\n for (i = 0; i < n; i++){\n for (j = m - 1; j >= 0; j--){\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "a1d39cd84ee7d7cf1201969bf916e76a", "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f", "difficulty": 1700.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "361b92b59b7f606e14f3d02c73c49a26", "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f", "difficulty": 1700.0} {"lang": "GNU C11", "source_code": "#include\nchar mp[9][9];\nint dir;\nint n,m,x,y;\nint get_dis(int dir){\n if(dir==0&&y==m)return 100;\n if(dir==1&&x==n)return 100;\n if(dir==0){\n for(int i=y+1;i<=m;i++)\n if(mp[x][i]=='*')return i-y;\n }else\n for(int i=x+1;i<=n;i++)\n if(mp[i][y]=='*')return i-x;\t\n return 100;\n}\n\nint main(void){\n scanf(\"%d%d\",&n,&m);\n for(int i=1;i<=n;i++)scanf(\"%s\",mp[i]+1);\n dir=0;\n int ans=0;\n x=1;y=1;\n for(int i=0;iget_dis(!dir)){\n if(dir==0)\n\tx++;\n else\n\ty++;\n dir=!dir;\n }else{\n x++;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "67259227f65df5e0284ac61dee14d30f", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t5\n#define M\t5\n\nint main() {\n\tstatic char cc[N][M + 1];\n\tint n, m, i, j, i_, j_, k;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%s\", cc[i]);\n\ti_ = 0, j_ = 0, k = 0;\n\twhile (1) {\n\t\tint i1, j1, d;\n\n\t\ti1 = -1, j1 = -1, d = n + m + 1;\n\t\tfor (i = i_; i < n; i++)\n\t\t\tfor (j = j_; j < m; j++)\n\t\t\t\tif (cc[i][j] == '*' && d > i + j)\n\t\t\t\t\td = i + j, i1 = i, j1 = j;\n\t\tif (i1 == -1 && j1 == -1)\n\t\t\tbreak;\n\t\tcc[i1][j1] = '.', i_ = i1, j_ = j1, k++;\n\t}\n\tprintf(\"%d\\n\", k);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "85f4e1abd2b3b99a75116ae813ce74fa", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0} {"lang": "GNU C", "source_code": "// write in C...\n#include \n\n#ifdef DEBUG\n#define D(x...) fprintf(stderr, x)\n#else\n#define D(x...)\n#endif\n\n#define MOD 1000000009\n\nint n, w, b;\nint c[4005][4005];\n\nint p(int n, int k) {\n if (k > n || k < 1) return 0;\n else return c[n-1][k-1];\n}\n\nint main() {\n int i, j;\n\n scanf(\"%d %d %d\", &n, &w, &b);\n\n for (i = 0; i < 4005; i++) c[i][0] = 1;\n for (i = 1; i < 4005; i++)\n for (j = 1; j <= i; j++)\n c[i][j] = (c[i-1][j-1] + c[i-1][j]) % MOD;\n\n long long res = 0;\n\n for (i = 0; i <= n; i++) {\n res = (res + (((((long long)p(b, i) * (long long)p(w, n-i))%MOD) * (long long)(n-i-1))%MOD)) % MOD;\n }\n\n for (i = 1; i <= w; i++) res = (res * i) % MOD;\n for (i = 1; i <= b; i++) res = (res * i) % MOD;\n\n printf(\"%d\\n\", (int)res);\n\n return 0;\n}\n\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "34575ac22336b67bf3ab8198797cc710", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t300000\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int pp[N];\n\tint n, h, i, i1, i2, j, pmin, k0, k1, k2, k, k_, i_, j_;\n\n\tscanf(\"%d%s\", &n, cc);\n\tfor (i = 0; i < n; i++)\n\t\tpp[i] = (i == 0 ? 0 : pp[i - 1]) + (cc[i] == '(' ? 1 : -1);\n\tif (pp[n - 1] != 0) {\n\t\tprintf(\"0\\n\");\n\t\tprintf(\"1 1\\n\");\n\t\treturn 0;\n\t}\n\tpmin = n + 1;\n\tfor (i = 0; i < n; i++)\n\t\tpmin = min(pmin, pp[i]);\n\tk0 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (pp[i] == pmin)\n\t\t\tk0++;\n\tk_ = k0, i_ = 0, j_ = 0;\n\ti = 0;\n\twhile (i < n && pp[i] != pmin)\n\t\ti++;\n\tj = n - 1;\n\twhile (j >= 0 && pp[j] != pmin)\n\t\tj--;\n\tj++;\n\tif (j < n) {\n\t\tk1 = 0;\n\t\tfor (h = 0; h < n; h++)\n\t\t\tif (pp[h] + (i <= h && h < j ? 2 : 0) == pmin + 1)\n\t\t\t\tk1++;\n\t\tk = k1;\n\t\tif (k_ < k)\n\t\t\tk_ = k, i_ = i, j_ = j;\n\t}\n\ti = 0;\n\twhile (i < n && pp[i] > pmin + 1)\n\t\ti++;\n\tj = n - 1;\n\twhile (j >= 0 && pp[j] > pmin + 1)\n\t\tj--;\n\tj++;\n\tif (j < n) {\n\t\tk2 = 0;\n\t\tfor (h = 0; h < n; h++)\n\t\t\tif (pp[h] + (i <= h && h < j ? 2 : 0) == pmin + 2)\n\t\t\t\tk2++;\n\t\tk = k2;\n\t\tif (k_ < k)\n\t\t\tk_ = k, i_ = i, j_ = j;\n\t}\n\ti1 = i2 = 0, k1 = k2 = 0;\n\tfor (j = 0; j < n; j++) {\n\t\tint p = pp[j];\n\n\t\tif (p == pmin) {\n\t\t\tif (cc[j] == ')') {\n\t\t\t\tk = k1;\n\t\t\t\tif (cc[i1] == '(' && k_ < k)\n\t\t\t\t\tk_ = k, i_ = i1, j_ = j;\n\t\t\t\tk = k0 + k2;\n\t\t\t\tif (cc[i2] == '(' && k_ < k)\n\t\t\t\t\tk_ = k, i_ = i2, j_ = j;\n\t\t\t}\n\t\t\ti1 = j + 1, k1 = 0;\n\t\t\ti2 = j + 1, k2 = 0;\n\t\t} else if (p == pmin + 1) {\n\t\t\tif (cc[j] == ')') {\n\t\t\t\tk = k0 + k2;\n\t\t\t\tif (cc[i2] == '(' && k_ < k)\n\t\t\t\t\tk_ = k, i_ = i2, j_ = j;\n\t\t\t}\n\t\t\tk1++;\n\t\t\ti2 = j + 1, k2 = 0;\n\t\t} else if (p == pmin + 2)\n\t\t\tk2++;\n\t}\n\tprintf(\"%d\\n\", k_);\n\tprintf(\"%d %d\\n\", i_ + 1, j_ + 1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "cf52c45d3d016177ec6c85fc516273dd", "src_uid": "2d10668fcc2d8e90e102b043f5e0578d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "/* upsolved using pre-shifting */\n/* https://codeforces.com/blog/entry/70720 */\n#include \n\n#define N\t300000\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int pp[N], pp_[N];\n\tint n, h, i, j, p_, k0, k, k_, i_, j_;\n\n\tscanf(\"%d%s\", &n, cc);\n\tfor (i = 0; i < n; i++)\n\t\tpp[i] = (i == 0 ? 0 : pp[i - 1]) + (cc[i] == '(' ? 1 : -1);\n\tif (pp[n - 1] != 0) {\n\t\tprintf(\"0\\n\");\n\t\tprintf(\"1 1\\n\");\n\t\treturn 0;\n\t}\n\tp_ = n + 1;\n\tfor (i = 0; i < n; i++)\n\t\tp_ = min(p_, pp[i]);\n\tfor (i = 0; i < n; i++)\n\t\tpp[i] -= p_;\n\th = -1, k0 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (pp[i] == 0)\n\t\t\th = i, k0++;\n\tfor (i = 0; i < n; i++)\n\t\tpp_[i] = pp[(i + h + 1) % n];\n\tk_ = k0, i_ = 0, j_ = 0;\n\tfor (i = 0, j = 0, k = 0; j < n; j++)\n\t\tif (pp_[j] < 1) {\n\t\t\tif (k_ < k)\n\t\t\t\tk_ = k, i_ = i, j_ = j;\n\t\t\ti = j + 1, k = 0;\n\t\t} else if (pp_[j] == 1)\n\t\t\tk++;\n\tfor (i = 0, j = 0, k = 0; j < n; j++)\n\t\tif (pp_[j] < 2) {\n\t\t\tif (k_ < k0 + k)\n\t\t\t\tk_ = k0 + k, i_ = i, j_ = j;\n\t\t\ti = j + 1, k = 0;\n\t\t} else if (pp_[j] == 2)\n\t\t\tk++;\n\tprintf(\"%d\\n\", k_);\n\tprintf(\"%d %d\\n\", (i_ + h + 1) % n + 1, (j_ + h + 1) % n + 1);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "320e6d3e112882d70065138d92b40476", "src_uid": "2d10668fcc2d8e90e102b043f5e0578d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\nint main(){\n\t\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tint b;\n\tif(n>m){\n\t\tb=n;\n\t\tn=m;\n\t\tm=b;\n\t}\n\tif(n==1){\n\t\tint mo=m%6;\n\t\tswitch(mo){\n\t\t\tcase 0:printf(\"%d\\n\",m);break;\n\t\t\tcase 1:printf(\"%d\\n\",m-mo);break;\n\t\t\tcase 2:printf(\"%d\\n\",m-mo);break;\n\t\t\tcase 3:printf(\"%d\\n\",m-mo);break;\n\t\t\tcase 4:printf(\"%d\\n\",m-2);break;\n\t\t\tcase 5:printf(\"%d\\n\",m-1);\n\t\t}\n\t}\n\telse if(n==2){\n\t\tif(m==2){\n\t\t\tprintf(\"%d\\n\",0);\n\t\t}\n\t\telse if(m==3){\n\t\t\tprintf(\"%d\\n\",4);\n\t\t}\n\t\telse if(m==7){\n\t\t\tprintf(\"%d\\n\",12);\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%d\\n\",n*m);\n\t\t}\n\t}\n\telse{\n\t\tlong long mul=n;\n\t\tmul*=m;\n\t\tif(mul%2==0){\n\t\t\tprintf(\"%lld\\n\",mul);\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%lld\\n\",mul-1);\n\t\t}\n\t}\n\t\n\treturn 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "5d6b75046c4c8ee118f9559a1d7552a9", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\nint main(void)\n{\n int a, b, w = 0;\n scanf(\"%d %d\", &a, &b);\n if (a > b) {\n b ^= a;\n a ^= b;\n b ^= a;\n }\n\n if (b >= 4) {\n if (a >= 4) {\n w = (a % 2) * (b % 2);\n }\n if (a == 3) {\n w = (b % 2);\n }\n if (a == 2) {\n if (b == 4) {\n w = 0;\n }\n if (b == 5) {\n w = 0;\n }\n if (b == 7) {\n w = 2;\n }\n if (b > 7) {\n w = 0;\n }\n }\n if (a == 1) {\n w = (b % 6) - (b % 6 == 4) * 2 - (b % 6 == 5) * 4;\n }\n }\n if (b == 3) {\n if (a == 3)\n w = 1;\n if (a == 2)\n w = 2;\n if (a == 1)\n w = 3;\n }\n if (b == 2) {\n if (a == 2)\n w = 4;\n if (a == 1)\n w = 2;\n }\n if (b == 1)\n w = 1;\n\n printf(\"%I64d\\n\", (unsigned long long) a * b - w);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "a8466db667f1ac334420a33397f22737", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t400\n\nint md;\n\nint ff[N + 1];\n\nvoid init() {\n\tint n;\n\n\tff[0] = 1;\n\tfor (n = 1; n <= N; n++)\n\t\tff[n] = (long long) ff[n - 1] * n % md;\n}\n\nint main() {\n\tstatic int dp[N + 1];\n\tint n, i, j, ans;\n\n\tscanf(\"%d%d\", &n, &md), init();\n\tans = 0;\n\tdp[0] = 1;\n\tfor (i = 1; i <= n; i++) {\n\t\tfor (j = n; j >= 0; j--)\n\t\t\tdp[j] = ((j == 0 ? 0 : dp[j - 1]) + (long long) dp[j] * j * 2) % md;\n\t\tans = (ans + (long long) dp[n - i + 1] * ff[n - i + 1]) % md;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7d6699e1729e887f6ffdf3507efe0b52", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "difficulty": 2200.0} {"lang": "GNU C", "source_code": "#include \n#include \ntypedef long long ll;\nint left[10];\nint n;\nchar seen[3628800];\n\nll fact[21];\n\n/* must be called before using rank/unrank */\nvoid initfact() {\n int i;\n fact[0]=1;\n for(i=1;i<21;i++) fact[i]=fact[i-1]*i;\n}\n\nll permbtr(int n,int *p,int *q) {\n int s,t;\n if(n<2) return 0;\n s=p[n-1]; p[n-1]=p[q[n-1]]; p[q[n-1]]=s;\n t=q[s]; q[s]=q[n-1]; q[n-1]=t;\n return s+n*permbtr(n-1,p,q);\n}\n\n/* return rank of permutation\n n: number of elements\n *p: permutation to rank */\n/* warning, *p is destroyed! */\nll permutationrank2(int n,int *p) {\n int i,q[16];\n for(i=0;i1) two++;\n if(pre\n \n memset(seen,0,sizeof(seen));\n btr();\n for(i=0;i<3628800;i++) z+=seen[i];\n printf(\"%d\\n\",z);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": true, "code_uid": "8b7d7943557e1ed8f2529c4f569bf2a3", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "difficulty": 2300.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "695438f3aa65f7ac25e53177438fcc2a", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "GNU C", "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}", "lang_cluster": "C", "compilation_error": false, "code_uid": "98eb620a268747349602f4201a167805", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "difficulty": 1900.0} {"lang": "GNU C11", "source_code": "#include \n\n#define N\t13\n#define Q\t1010\n#define MD1\t998244353\n#define MD\t1000000007\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\n\nlong long pp[N + 1], qq[N + 1];\n\nvoid init() {\n\tint i;\n\n\tpp[0] = qq[0] = 1;\n\tfor (i = 1; i <= N; i++) {\n\t\tpp[i] = pp[i - 1] * 10;\n\t\tqq[i] = qq[i - 1] + pp[i];\n\t}\n}\n\nlong long idx(long long a, long long b) {\n\tstatic int aa[N], bb[N];\n\tstatic long long aa_[N];\n\tlong long cnt;\n\tint n, m, i, j, c;\n\n\tn = 0;\n\twhile (a > 0)\n\t\taa[n++] = a % 10, a /= 10;\n\tm = 0;\n\twhile (b > 0)\n\t\tbb[m++] = b % 10, b /= 10;\n\tfor (i = 0; i < n; i++)\n\t\taa_[i] = (i == 0 ? 0 : aa_[i - 1]) + aa[i] * pp[i];\n\tcnt = m;\n\tfor (i = n - 1, j = m - 1, c = 0; j >= 0; i--, j--)\n\t\tif (c < 0)\n\t\t\tcnt += qq[n - 1 - (m - 1 - j)] * (bb[j] - (j == m - 1 ? 1 : 0));\n\t\telse if (c > 0)\n\t\t\tcnt += (n - 1 - (m - 1 - j) == 0 ? 0 : qq[n - 2 - (m - 1 - j)]) * (bb[j] - (j == m - 1 ? 1 : 0));\n\t\telse {\n\t\t\tif (bb[j] <= aa[i]) {\n\t\t\t\tif (bb[j] < aa[i])\n\t\t\t\t\tc = -1;\n\t\t\t\tcnt += qq[n - 1 - (m - 1 - j)] * (bb[j] - (j == m - 1 ? 1 : 0));\n\t\t\t} else {\n\t\t\t\tc = 1;\n\t\t\t\tcnt += qq[n - 1 - (m - 1 - j)] * (aa[i] - (j == m - 1 ? 1 : 0));\n\t\t\t\tcnt += (n - 1 - (m - 1 - j) == 0 ? 0 : qq[n - 2 - (m - 1 - j)]) * (bb[j] - aa[i]) + (i == 0 ? 0 : aa_[i - 1]) + 1;\n\t\t\t}\n\t\t}\n\treturn cnt;\n}\n\nint aa[N], bb[N];\n\nlong long count_(long long a, long long d) {\n\tlong long b, cnt;\n\n\tcnt = 0;\n\tfor (b = 1; b <= a; b++)\n\t\tif (idx(a, b) - b >= d)\n\t\t\tcnt++;\n\treturn cnt;\n}\n\nlong long count(long long a, long long d) {\n\tint m;\n\tlong long cnt;\n\n\tcnt = 0;\n\tfor (m = 1; pp[m - 1] - 1 <= a; m++) {\n\t\tlong long lower = pp[m - 1] - 1, upper = min(pp[m], a + 1);\n\n\t\twhile (upper - lower > 1) {\n\t\t\tlong long b = (lower + upper) / 2;\n\n\t\t\tif (idx(a, b) - b >= d)\n\t\t\t\tupper = b;\n\t\t\telse\n\t\t\t\tlower = b;\n\t\t}\n\t\tcnt += min(pp[m], a + 1) - upper;\n\t}\n\treturn cnt;\n}\n\nint main() {\n\tlong long a, q, ans;\n\n\tinit();\n\tscanf(\"%lld\", &a);\n\tans = Q * a % MD;\n\tfor (q = -Q + 1; q <= Q; q++)\n\t\tans = (ans - count(a, q * MD1)) % MD;\n\tans = ans * MD1 % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "8d965a2a8880f14f782b35f30ec4ccbd", "src_uid": "2c70ae38f91ab739621a31b897b8fbf3", "difficulty": 3400.0} {"lang": "GNU C11", "source_code": "#pragma GCC optimize(\"Ofast\")\n#include \n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define inf 0x3f3f3f3f\n#define mod 1000000007\nint n,m,k,ans,a[15][15];\nint used[15][15][15],mp[15];\nvoid dfs(int x,int y,int mc)\n{\n\tif (x==n)\n\t{\n\t\tregister int c,qc;\n\t\tfor (c=1;c<=mc;++c) for (qc=c+1;qc<=mc;qc++) if (mp[c] && mp[qc] && mp[c]==mp[qc]) return;\n\t\tint a=0,b=k;\n\t\tfor (c=1;c<=mc;++c)\n\t\t{\n\t\t\tif (mp[c]) b--;\n\t\t\telse a++;\n\t\t}\n\t\tint curans=1;\n\t\tfor (;a--;b--) curans=curans*b%mod;\n\t\tans+=curans;ans%=mod;\n\t\treturn;\n\t}\n\tregister int c,i,j;int flag=0;\n\tfor (c=1;c<=min(mc+1,k);++c)\n\t{\n\t\tif (used[x][y][c]) continue;\n\t\tfor (i=x;ik+1) return (int)puts(\"0\")*0;\n\tfor (i=0;i\n\ntypedef struct mk\n{\n\tint day,type;\n}roy;\n\nint n,m,a[200010],l,r,tot=0;\nroy off[200010],tmp[200020];\n\nint ok(int days){\n\tint t[n+1];\n\tint need = 0,collect = days;\n\tfor(int i = 0;i=0;i--){\n\t\tif(off[i].day>days) continue;\n\t\tcollect = (collect<=off[i].day)?collect:off[i].day;\n\t\tint tp = (collect<=t[off[i].type-1])?collect:t[off[i].type-1];\n\t\tneed += tp;\n\t\tt[off[i].type-1]-= tp;\n\t\tcollect-=tp;\n\t}\n\tneed += (tot - need)*2;\n\treturn (need<=days);\n}\nvoid merge(roy *of, int s,int m,int e){\n\tint i = s,j = m+1,k = 0;\n\twhile (i<=m && j<=e){\n\t\tif(of[i].day==of[j].day){\n\t\t\ttmp[k++] = (a[of[i].type-1]\n#include \n#include \n\n#define N\t200000\n#define M\t200000\n\nvoid init_rand() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tsrand(tv.tv_usec ^ tv.tv_sec);\n}\n\nint rand_(int n) {\n\treturn (rand() * 45677LL + rand()) % n;\n}\n\nint kk[N], ll[N], tt[M], ii[M], jj[M];\n\nint check(int n, int m, int t) {\n\tstatic int tt_[N];\n\tint i, j, b, x, t_;\n\n\tfor (i = 0; i < n; i++) {\n\t\tll[i] = kk[i];\n\t\ttt_[i] = -1;\n\t}\n\tfor (j = 0; j < m && (t_ = tt[jj[j]]) <= t; j++)\n\t\ttt_[ii[jj[j]]] = t_;\n\tb = 0;\n\tfor (j = 0; j < m && (t_ = tt[jj[j]]) <= t; j++)\n\t\tif (tt_[i = ii[jj[j]]] == t_) {\n\t\t\tx = ll[i] < t_ - b ? ll[i] : t_ - b;\n\t\t\tb += x, ll[i] -= x;\n\t\t}\n\tfor (i = 0; i < n; i++)\n\t\tb += ll[i] * 2;\n\treturn b <= t;\n}\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\n\treturn tt[i] - tt[j];\n}\n\nint main() {\n\tint n, m, i, j, lower, upper, t, tmp;\n\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &kk[i]);\n\tfor (j = 0; j < m; j++) {\n\t\tscanf(\"%d%d\", &tt[j], &ii[j]), ii[j]--;\n\t\tjj[j] = j;\n\t}\n\tinit_rand();\n\tfor (j = m - 1; j >= 0; j--) {\n\t\ti = rand_(j + 1);\n\t\ttmp = jj[i], jj[i] = jj[j], jj[j] = tmp;\n\t}\n\tqsort(jj, m, sizeof *jj, compare);\n\tlower = 0, upper = 200000 * 2;\n\twhile (upper - lower > 1) {\n\t\tt = (lower + upper) / 2;\n\t\tif (check(n, m, t))\n\t\t\tupper = t;\n\t\telse\n\t\t\tlower = t;\n\t}\n\tprintf(\"%d\\n\", upper);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "7717c0ff7e008608ed5fa433e06d908a", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include\n#include\n#include\n\ntypedef long long int lli;\n\n#define TRUE (1==1)\n#define FALSE (!(TRUE))\n#define in32(x) scanf(\"%d\", &(x))\n#define in64(x) scanf(\"%I64d\", &(x))\n#define instr(x) scanf(\"%s\", (x))\n#define out32(x) printf(\"%d\\n\", (x))\n#define out64(x) printf(\"%I64d\\n\", (x))\n#define outstr(x) printf(\"%s\\n\", (x))\n#define max(a,b) ((a)<(b))?(b):(a)\n#define min(a,b) ((a)>(b))?(b):(a)\n#define abs(a) ((a)<0)?(-(a)):(a)\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\n#define MOD 998244353\n#define MAX 5005\n#define SENT -1\n\ntypedef struct Pair {\n int fi, se;\n} Pair; \n\nint comp(Pair * f, Pair * s) {\n return (f->fi - s->fi);\n}\n\nvoid sort(Pair ** arr, int size) { // CHANGE THIS\n int i;\n if (size < 6) {\n int nSize = 0;\n int s = size;\n while (size != 0) {\n nSize = 0;\n for (i = 0; i < size - 1; i++) \n if (comp(arr[i], arr[i+1]) > 0) { // CHANGE THIS\n Pair * tmp = arr[i];\n arr[i] = arr[i+1];\n arr[i+1] = tmp;\n nSize = i+1;\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], arr[lSize + rPtr]) <= 0) // CHANGE THIS\n tmp[ptr] = arr[lPtr++];\n else\n tmp[ptr] = arr[lSize + (rPtr++)];\n ptr++;\n }\n for (i = 0; i < size; i++)\n arr[i] = tmp[i];\n free(tmp);\n}\n \n \nint main(void) {\n int i, n, m;\n in32(n);\n in32(m);\n int need[n];\n fo3(i,0,n-1) \n in32(need[i]);\n Pair ** p = calloc(m, sizeof(Pair*));\n fo3(i,0,m-1) {\n p[i] = calloc(1,sizeof(Pair));\n in32(p[i]->fi);\n in32(p[i]->se);\n }\n sort(p,m);\n lli pos = 2000000, min = 0, max = 2000000 - 1;\n int have[n];\n while (min <= max) {\n lli mid = (min + max) >> 1;\n fo3(i,0,n-1)\n have[i] = 0;\n lli spent = 0;\n lli maxDay = mid;\n of3(i,m-1,0) {\n int day = p[i]->fi;\n int ind = p[i]->se-1;\n int miss = need[ind] - have[ind];\n if (maxDay > day)\n maxDay = day;\n int buy = miss;\n if (buy > maxDay)\n buy = maxDay;\n have[ind] += buy;\n maxDay -= buy;\n spent += buy;\n }\n fo3(i,0,n-1)\n spent += ((need[i] - have[i])<<1);\n if (spent <= mid) {\n pos = mid;\n max = mid - 1;\n } else\n min = mid + 1;\n }\n out64(pos);\n return 0;\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "ae9a06f7f08019055dac1f7a2af77ca4", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0} {"lang": "GNU C11", "source_code": "#include \n\ntypedef struct mk\n{\n\tint day,type;\n}roy;\n\nint n,m,a[200010],l,r,tot=0;\nroy off[200010],tmp[200020];\n\nint ok(int days){\n\tint t[n+1];\n\tint need = 0,collect = 0;\n\tfor(int i = 0;i\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", "lang_cluster": "C", "compilation_error": false, "code_uid": "9444e43c6c2ce44d99e2b3fd9aac2d91", "src_uid": "7421c7d81cc7b481d61a6ef07e557e33", "difficulty": 3200.0} {"lang": "GNU C11", "source_code": "#include \n#include \n\n#define N\t100000\n\nint jj[N], pp[N], dd[N], mn;\n\nvoid match(int i) {\n\twhile (dd[i] == 1) {\n\t\tint j = jj[i], tmp;\n\n\t\tif (pp[i] == i || dd[j] == 1)\n\t\t\ttmp = pp[i], pp[i] = pp[j], pp[j] = tmp;\n\t\telse\n\t\t\tmn -= 2;\n\t\tjj[i] ^= j, dd[i] = 0, jj[j] ^= i, dd[j]--;\n\t\ti = j;\n\t}\n}\n\nint main() {\n\tint n, h, i, j;\n\n\tscanf(\"%d\", &n);\n\tfor (h = 0; h < n - 1; h++) {\n\t\tscanf(\"%d%d\", &i, &j), i--, j--;\n\t\tjj[i] ^= j, dd[i]++, jj[j] ^= i, dd[j]++;\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tpp[i] = i;\n\tmn = (n - 1) * 2;\n\tfor (i = 0; i < n; i++)\n\t\tmatch(i);\n\tprintf(\"%d\\n\", mn);\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\"%d \", pp[i] + 1);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "63ea894a492563a1118d244470e6ff3b", "src_uid": "98ded03cdd1870500667f0069d6a84b1", "difficulty": 2100.0} {"lang": "GNU C11", "source_code": "#include \n#include \n#include \n\n#define N\t100000\n\ndouble min(double a, double b) { return a < b ? a : b; }\n\nint xx[N];\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\n\treturn xx[i] - xx[j];\n}\n\nint main() {\n\tstatic int ii[N];\n\tint n, k, i, i_, xn, yn;\n\tdouble ans;\n\n\tscanf(\"%d%d\", &n, &k), k--;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &xx[i]);\n\t\tii[i] = i;\n\t}\n\tqsort(ii, n, sizeof *ii, compare);\n\tscanf(\"%d%d\", &xn, &yn);\n\tif (k == n) {\n\t\tprintf(\"%f\\n\", min(hypot(xn - xx[ii[0]], yn), hypot(xn - xx[ii[n - 1]], yn)) + xx[ii[n - 1]] - xx[ii[0]]);\n\t\treturn 0;\n\t}\n\tans = hypot(xn - xx[k], yn)\n\t\t+ min(hypot(xn - xx[ii[0]], yn), hypot(xn - xx[ii[n - 1]], yn))\n\t\t+ xx[ii[n - 1]] - xx[ii[0]];\n\ti_ = -1;\n\tfor (i = 0; i < n; i++)\n\t\tif (ii[i] == k) {\n\t\t\ti_ = i;\n\t\t\tbreak;\n\t\t}\n\tfor (i = i_; i < n; i++) {\n\t\tdouble d;\n\n\t\td = min(xx[ii[i]] - xx[k] + xx[ii[i]] - xx[ii[0]]\n\t\t\t\t+ hypot(xn - xx[ii[0]], yn),\n\t\t\t\txx[k] - xx[ii[0]] + xx[ii[i]] - xx[ii[0]]\n\t\t\t\t+ hypot(xn - xx[ii[i]], yn));\n\t\tif (i + 1 < n)\n\t\t\td += min(hypot(xn - xx[ii[i + 1]], yn), hypot(xn - xx[ii[n - 1]], yn))\n\t\t\t\t+ xx[ii[n - 1]] - xx[ii[i + 1]];\n\t\tans = min(ans, d);\n\t}\n\tfor (i = i_; i >= 0; i--) {\n\t\tdouble d;\n\n\t\td = min(xx[k] - xx[ii[i]] + xx[ii[n - 1]] - xx[ii[i]]\n\t\t\t\t+ hypot(xn - xx[ii[n - 1]], yn),\n\t\t\t\txx[ii[n - 1]] - xx[k] + xx[ii[n - 1]] - xx[ii[i]]\n\t\t\t\t+ hypot(xn - xx[ii[i]], yn));\n\t\tif (i > 0)\n\t\t\td += min(hypot(xn - xx[ii[i - 1]], yn), hypot(xn - xx[ii[0]], yn))\n\t\t\t\t+ xx[ii[i - 1]] - xx[ii[0]];\n\t\tans = min(ans, d);\n\t}\n\tprintf(\"%f\\n\", ans);\n\treturn 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "b2304666a430310355200b630ec46958", "src_uid": "f9ed5faca211e654d9d4e0a7557616f4", "difficulty": 2600.0} {"lang": "GNU C", "source_code": "#include \n#include \nenum { BIG = 1000000007 };\n\nint n;\nchar s[240];\nint slen;\nint dp[201][101];\nint next[201][2];\nint fail[201];\n\nvoid nextstep(int eo) {\n int i, j;\n for (i = 0; i <= slen; i++) {\n int lp = next[i][0];\n int rp = next[i][1];\n for (j = eo; j <= n; j+=2) {\n int now = dp[i][j];\n if (j < n) {\n int add = dp[lp][j+1] + now;\n dp[lp][j+1] = add < BIG ? add : add - BIG;\n }\n if (j > 0) {\n int add = dp[rp][j-1] + now;\n dp[rp][j-1] = add < BIG ? add : add - BIG;\n }\n }\n }\n for (i = 0; i <= slen; i++) {\n for (j = eo; j <= n; j+=2) {\n dp[i][j] = 0;\n }\n }\n /*for (i=0;i<=slen;i++){\n for (j=0;j<=n;j++){\n printf(\"%3d,\",dp[i][j]);\n }\n puts(\"\");\n }\n puts(\"\");*/\n}\n\nint main() {\n scanf(\"%d\", &n);\n scanf(\" %202s\", s);\n slen = strlen(s);\n int i;\n // build state machine\n fail[0] = fail[1] = 0;\n if (s[0] == '(') {\n next[0][0] = 1;\n next[0][1] = 0;\n }\n else {\n next[0][0] = 0;\n next[0][1] = 1;\n }\n for (i = 1; i < slen; i++) {\n int r = s[i] == ')';\n int f = fail[i];\n next[i][r] = i+1;\n next[i][1-r] = next[f][1-r];\n fail[i+1] = next[f][r];\n }\n next[slen][0] = next[slen][1] = slen;\n dp[0][0] = 1;\n for (i = 0; i < n; i++) {\n nextstep(0);\n nextstep(1);\n }\n printf(\"%d\\n\", dp[slen][0]);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "c37934f3253cd8909d28f9ed8771c580", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0} {"lang": "GNU C11", "source_code": "#include \n\nint main() {\n int total = 0;\n int current = 0;\n int sign = 1;\n for (;;) {\n int c = getchar();\n if (c == '+' || c == '-') {\n total += current;\n current = 0;\n sign = c == '+' ? 1 : -1;\n } else if (c < '0' || c > '9') break;\n current = current * 10 + (c - '0') * sign;\n }\n total += current;\n printf(\"%d\\n\", total);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "112ba9aaf4a76d97b2b518c479ef4bad", "src_uid": "db85fa18f00e560b58cfa7bab2fa957d", "difficulty": 2400.0} {"lang": "GNU C11", "source_code": "#include \r\n\r\n#define N\t250\r\n#define MD\t998244353\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\nlong long power(long long a, int k) {\r\n\tlong long p = 1;\r\n\r\n\twhile (k) {\r\n\t\tif (k & 1)\r\n\t\t\tp = p * a % MD;\r\n\t\ta = a * a % MD;\r\n\t\tk >>= 1;\r\n\t}\r\n\treturn p;\r\n}\r\n\r\nint main() {\r\n\tstatic int dp[N];\r\n\tint n, k, c, i, j;\r\n\r\n\tinit();\r\n\tscanf(\"%d%d\", &n, &k);\r\n\tdp[0] = 1;\r\n\tfor (c = 1; c <= k; c++)\r\n\t\tfor (i = n - 1; i >= 0; i--)\r\n\t\t\tfor (j = 0; j < i; j++)\r\n\t\t\t\tdp[i] = (dp[i] + (long long) dp[j] * choose(i, j) % MD * power(k - c + 1, i * (i - 1) / 2 - j * (j - 1) / 2)) % MD;\r\n\tprintf(\"%d\\n\", dp[n - 1]);\r\n\treturn 0;\r\n}", "lang_cluster": "C", "compilation_error": false, "code_uid": "f2b08ae32fecf5535bf87f6bfa451809", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "difficulty": 2200.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "0fa6d14b8bafe282516f2b05dce28896", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "difficulty": 2100.0} {"lang": "GNU C", "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", "lang_cluster": "C", "compilation_error": false, "code_uid": "8229c472d55649e7b0c034c9c672d45b", "src_uid": "7fbefd3eb1aad6865adcfac394f0a7e6", "difficulty": 2700.0} {"lang": "GNU C", "source_code": "#include \n\ntypedef struct {\n int l, r;\n} interval;\n\nint max(int x, int y) {\n return x > y ? x : y;\n}\n\nint min(int x, int y) {\n return x < y ? x : y;\n}\n\nint interval_intersection_length(const interval *a, const interval *b) {\n return max(0, min(a->r, b->r) - max(a->l, b->l) + 1);\n}\n\nvoid extract(const interval *a, interval *a1, interval *a2, int i) {\n int s = 1 << i;\n int x = (a->l + s - 1) >> i << i;\n int y = a->r >> i << i;\n if (x < y) {\n a1->l = a2->l = 1;\n a1->r = a2->r = s - 1;\n } else if (x == y) {\n a1->l = a->l % s;\n if (a1->l == 0) a1->l = s;\n a1->r = s - 1;\n a2->l = 1;\n a2->r = a->r % s;\n } else {\n a1->l = a2->l = a->l % s;\n a1->r = a2->r = a->r % s;\n }\n}\n\nint main() {\n int i, ans;\n interval a, b, a1, a2, b1, b2;\n scanf(\"%d %d %d %d\", &a.l, &a.r, &b.l, &b.r);\n ans = 0;\n for (i = 1; i <= 30; i++) {\n extract(&a, &a1, &a2, i);\n extract(&b, &b1, &b2, i);\n ans = max(ans, interval_intersection_length(&a1, &b1));\n ans = max(ans, interval_intersection_length(&a1, &b2));\n ans = max(ans, interval_intersection_length(&a2, &b1));\n ans = max(ans, interval_intersection_length(&a2, &b2));\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "aea1d404ed74d2f3eda2cb3512c762ad", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.0} {"lang": "GNU C", "source_code": "#include\n#include\n\n#define ll long long\n\nconst ll M = 1000000007;\n\nll inv(ll a, ll M)\n{\n if (a < 0)\n a = (a + (1+(0-a)/M)*M)%M;\n ll M_o = M;\n ll ac0 = 1;\n ll ac1 = 0;\n ll bc0 = 0;\n ll bc1 = 1;\n ll q;\n ll r;\n ll temp;\n while (M > 0)\n {\n q = a/M;\n r = a%M;\n a = M;\n M = r;\n\n temp = ac0;\n ac0 = bc0;\n bc0 = temp - q*bc0;\n\n temp = ac1;\n ac1 = bc1;\n bc1 = temp - q*bc1;\n }\n M = M_o;\n if (ac0 > 0)\n return ac0%M;\n else\n return (ac0 + M*(1+(0-ac0)/M))%M;\n}\n\nll expmod(ll a, ll x, ll m)\n{\n ll ans = 1;\n while (x > 0)\n {\n if (x%2 == 1)\n ans = ans*a%m;\n a = a*a%m;\n x /= 2;\n }\n if (ans > 0)\n return ans%M;\n else\n return (ans + M*(1 + (0-ans)/M))%M;\n}\n\nint main()\n{\n int n, m;\n int ai, bi;\n int ki;\n\n fscanf(stdin, \"%d %d\\n\", &n, &m);\n fscanf(stdin, \"%d %d\\n\", &ai, &bi);\n fscanf(stdin, \"%d\", &ki);\n\n ll a = (ll) ai;\n ll b = (ll) bi;\n ll k = (ll) ki;\n\n ll p = a*inv(b, M)%M;\n\n ll* kchoose = malloc((m+1)*sizeof(ll));\n kchoose[0] = 1;\n for (int l = 1; l < m+1; l++)\n kchoose[l] = (kchoose[l-1]*(k-l+1)%M)*inv(l,M)%M;\n\n ll* expmodp = malloc((m+1)*sizeof(ll));\n ll* expmod1pkminus = malloc((m+1)*sizeof(ll));\n expmodp[0] = 1;\n expmod1pkminus[0] = expmod(1-p, k, M);\n ll inv1p = p!=1? inv(1-p, M):1;\n\n for (int x = 1; x < m+1; x++)\n {\n expmodp[x] = p*expmodp[x-1]%M;\n if (p != 1)\n expmod1pkminus[x] = inv1p*expmod1pkminus[x-1]%M;\n else\n expmod1pkminus[x] = x k)\n p_left[l] = 0;\n else\n p_left[l] = (((kchoose[l]*expmodp[l])%M)*expmod1pkminus[l])%M;\n }\n\n ll* egs1 = malloc((m+1)*sizeof(ll));\n ll* egs2 = malloc((m+1)*sizeof(ll));\n ll* sle1 = malloc((m+1)*sizeof(ll));\n ll* sle2 = malloc((m+1)*sizeof(ll));\n\n ll* R = malloc(m*sizeof(ll));\n ll* T = malloc((m+1)*sizeof(ll));\n T[m] = 1;\n for (int i = 0; i < m; i++)\n {\n R[i] = 1;\n T[i] = 0;\n }\n\n ll* Tp_left = malloc(m*sizeof(ll));\n ll* Rp_left = malloc(m*sizeof(ll));\n\n for (int ni = 0; ni < n; ni++)\n {\n egs1[m] = 0;\n egs2[m] = 0;\n\n for (int i = 0; i < m; i++)\n Rp_left[i] = R[i]*p_left[m-(i+1)]%M;\n\n for (int s = m-1; s >= 0; s--)\n {\n egs1[s] = (egs1[s+1] + Rp_left[s])%M;\n egs2[s] = (egs2[s+1] + p_left[m-(s+1)])%M;\n }\n\n sle1[0] = 0;\n sle2[0] = 0;\n\n for (int i = 0; i < m; i++)\n Tp_left[i] = T[i]*p_left[i]%M;\n\n for (int e = 1; e < m+1; e++)\n {\n sle1[e] = (sle1[e-1] + p_left[e-1])%M;\n sle2[e] = (sle2[e-1] + Tp_left[e-1])%M;\n }\n\n R[0] = (p_left[0]*egs1[0]%M - Tp_left[0]*egs2[0]%M + M)%M;\n for (int s = 1; s < m; s++)\n R[s] = (R[s-1] + p_left[s]*egs1[s]%M - Tp_left[s]*egs2[s]%M + M) % M;\n\n T[0] = 0;\n for (int e = 1; e < m+1; e++)\n T[e] = (T[e-1] + Rp_left[e-1]*sle1[e]%M - p_left[m-e]*sle2[e]%M + M)%M;\n }\n\n printf(\"%lld\\n\", T[m]);\n}\n", "lang_cluster": "C", "compilation_error": false, "code_uid": "2bd582918e300e8aa5ef0625ac960a29", "src_uid": "33b6b0d3a6af273f22b703491bd17289", "difficulty": 3100.0}