diff --git "a/data/cpp/data/humanevalbugs.json" "b/data/cpp/data/humanevalbugs.json" --- "a/data/cpp/data/humanevalbugs.json" +++ "b/data/cpp/data/humanevalbugs.json" @@ -1 +1,494 @@ -[{"buggy_solution": " int i,j;\n \n for (i=0;i all_parens;\n string current_paren;\n int level=0;\n char chr;\n int i;\n for (i=0;i out={};\n if (numbers.size()>0) out.push_back(numbers[0]);\n for (int i=1;i all_levels;\n string current_paren;\n int level=0,max_level=0;\n char chr;\n int i;\n for (i=0;imax_level) max_level=level;\n current_paren+=chr;\n }\n if (chr==')')\n {\n level-=1;\n current_paren+=chr;\n if (level==0){\n all_levels.push_back(max_level);\n current_paren=\"\";\n max_level=0;\n }\n }\n }\n return all_levels;\n}\n"}, {"buggy_solution": " vector out;\n for (int i=0;i out;\n int max=0;\n for (int i=0;imax) max=numbers[i];\n out.push_back(max);\n }\n return out;\n}\n"}, {"buggy_solution": " int i;\n for (i=0;i=a.length()) \n {\n output+=b[i];\n }\n else output+=a[i];\n }\n }\n return output;\n}\n"}, {"buggy_solution": " string out;\n for (int i=0;iout.length()) out=strings[i];\n }\n return out;\n}\n"}, {"buggy_solution": " int out,m;\n while (true){\n if (a out;\n string current=\"\";\n for (int i=0;i distinct={};\n transform(str.begin(),str.end(),str.begin(),::tolower);\n for (int i=0;i out={};\n if (music_string.length()>0)\n music_string=music_string+' ';\n for (int i=0;i tonum={{\"zero\",0},{\"one\",1},{\"two\",2},{\"three\",3},{\"four\",4},{\"five\",5},{\"six\",6},{\"seven\",7},{\"eight\",8},{\"nine\",9}};\n map numto={{0,\"zero\"},{1,\"one\"},{2,\"two\"},{3,\"three\"},{4,\"four\"},{5,\"five\"},{6,\"six\"},{7,\"seven\"},{8,\"eight\"},{9,\"nine\"}};\n int count[10];\n for (int i=0;i<10;i++)\n count[i]=0;\n string out=\"\",current=\"\";\n if (numbers.length()>0) numbers=numbers+' ';\n for (int i=0;i0) out.pop_back();\n return out;\n}\n"}, {"buggy_solution": " vector out={};\n for (int i=0;iout[1])\n out={out[1],out[0]};\n return out;\n}\n"}, {"buggy_solution": " float min=100000,max=-100000;\n for (int i=0;imax) max=numbers[i];\n }\n for (int i=0;i out;\n for (it=values.begin();it!=values.end();it++)\n {\n anyone=*it;\n if( anyone.type() == typeid(int) )\n out.push_back(boost::any_cast(*it));\n }\n return out;\n}\n"}, {"buggy_solution": " return str.length();\n}\n"}, {"buggy_solution": " for (int i=2;i*i<=n;i++)\n if (n%i==0) return n/i;\n return 1;\n\n}\n"}, {"buggy_solution": " vector out={};\n for (int i=2;i*i<=n;i++)\n if (n%i==0)\n {\n n=n/i;\n out.push_back(i);\n i-=1;\n }\n out.push_back(n);\n return out;\n}\n"}, {"buggy_solution": " vector out={};\n vector has1={};\n vector has2={};\n for (int i=0;i=97 and w<=122) {w-=32;}\n else\n if (w>=65 and w<=90){ w+=32;}\n out=out+w;\n }\n return out;\n}\n"}, {"buggy_solution": " string out=\"\";\n for (int i=0;i out={};\n for (int i=0;i out={};\n for (int i=0;i0) out.push_back(l[i]);\n return out;\n}\n"}, {"buggy_solution": " if (n<2) return false;\n for (long long i=2;i*i<=n;i++)\n if (n%i==0) return false;\n return true;\n}\n"}, {"buggy_solution": " double ans=0;\n double value;\n value=poly(xs,ans);\n while (abs(value)>1e-6)\n {\n double driv=0;\n for (int i=1;i third={};\n int i;\n for (i=0;i*3 out={};\n for (i=0;i out={};\n for (int i=0;i0)\n {\n if (q%10==7) count+=1;\n q=q/10;\n }\n } \n return count;\n}\n"}, {"buggy_solution": " vector out={};\n vector even={};\n for (int i=0;i*20)\n {\n out=to_string(x%base)+out;\n x=x/base;\n }\n return out;\n}\n"}, {"buggy_solution": "return (a*h)*0.5;\n\n}\n"}, {"buggy_solution": " int f[100];\n f[0]=0;\n f[1]=0;\n f[2]=2;\n f[3]=0;\n for (int i=4;i<=n;i++)\n {\n f[i]=f[i-1]+f[i-2]+f[i-3]+f[i-4];\n }\n return f[n];\n}\n"}, {"buggy_solution": " sort(l.begin(),l.end());\n if (l.size()%2==1) return l[l.size()/2];\n return 0.5*(l[l.size()/2]+l[l.size()/2-1]);\n}\n"}, {"buggy_solution": " string pr(text.rbegin(),text.rend());\n return pr==text;\n}\n"}, {"buggy_solution": " int out=1;\n for (int i=0;i=t) return false;\n return true;\n}\n"}, {"buggy_solution": " return x+y;\n}\n"}, {"buggy_solution": " for (int i=0;i') level-=1;\n if (level<0) return false;\n }\n if (level!=0) return false;\n return true;\n}\n"}, {"buggy_solution": " int incr,decr;\n incr=0;decr=0;\n for (int i=1;il[i-1]) incr=1;\n if (l[i] out={};\n for (int i=0;ii) n=n/i;\n return n;\n}\n"}, {"buggy_solution": " return n*(n+1)/2;\n}\n"}, {"buggy_solution": " int level=0;\n for (int i=0;i out={};\n for (int i=1;i=65 and s[i]<=90)\n sum+=s[i];\n return sum;\n}\n"}, {"buggy_solution": " string num1=\"\",num2=\"\";\n int is12;\n is12=0;\n for (int i=0;i=48 and s[i]<=57)\n {\n if (is12==0) num1=num1+s[i];\n if (is12==1) num2=num2+s[i];\n }\n else\n if (is12==0 and num1.length()>0) is12=1;\n return n-atoi(num1.c_str())-atoi(num2.c_str());\n\n}\n"}, {"buggy_solution": " vector out={};\n for (int i=0;i> freq={};\n int max=-1;\n for (int i=0;i=freq[j][0] and freq[j][0]>max) max=freq[j][0];\n }\n if (not(has)) \n {\n freq.push_back({lst[i],1});\n if (max==-1 and lst[i]==1) max=1;\n }\n }\n return max;\n}\n"}, {"buggy_solution": " vector out={};\n sort(lst.begin(),lst.end());\n int l=0,r=lst.size()-1;\n while (lw) return false;\n return true;\n}\n"}, {"buggy_solution": " int out=0;\n for (int i=0;inum2) return lst2;\n return lst1;\n}\n"}, {"buggy_solution": " int num=0;\n for (int i=2;i*i<=a;i++)\n while (a%i==0 and a>i)\n {\n a=a/i;\n num+=1;\n }\n if (num==2) return true;\n return false; \n}\n"}, {"buggy_solution": " int p=1,count=0;\n while (p<=x and count<100)\n {\n if (p==x) return true;\n p=p*n;count+=1;\n }\n return false;\n}\n"}, {"buggy_solution": " for (int i=0;i*i*i<=abs(a);i++)\n if (i*i*i==abs(a)) return true;\n return false;\n}\n"}, {"buggy_solution": " string key=\"2357BD\";\n int out=0;\n for (int i=0;i0)\n {\n out=to_string(decimal%2)+out;\n decimal=decimal/2;\n }\n out=\"db\"+out+\"db\";\n return out;\n}\n"}, {"buggy_solution": " if (s.length()<3) return false;\n for (int i=2;i out={};\n for (int i=0;i=3.9999) out.push_back(\"A+\");\n if (grades[i]>3.7001 and grades[i]<3.9999) out.push_back(\"A\");\n if (grades[i]>3.3001 and grades[i]<=3.7001) out.push_back(\"A-\");\n if (grades[i]>3.0001 and grades[i]<=3.3001) out.push_back(\"B+\");\n if (grades[i]>2.7001 and grades[i]<=3.0001) out.push_back(\"B\");\n if (grades[i]>2.3001 and grades[i]<=2.7001) out.push_back(\"B-\");\n if (grades[i]>2.0001 and grades[i]<=2.3001) out.push_back(\"C+\");\n if (grades[i]>1.7001 and grades[i]<=2.0001) out.push_back(\"C\");\n if (grades[i]>1.3001 and grades[i]<=1.7001) out.push_back(\"C-\");\n if (grades[i]>1.0001 and grades[i]<=1.3001) out.push_back(\"D+\");\n if (grades[i]>0.7001 and grades[i]<=1.0001) out.push_back(\"D\");\n if (grades[i]>0.0001 and grades[i]<=0.7001) out.push_back(\"D-\");\n if (grades[i]<=0.0001) out.push_back(\"E\");\n }\n return out;\n}\n"}, {"buggy_solution": " int l,i;\n l=str.length();\n if (l<2) return false;\n for (i=2;i*i<=l;i++)\n if (l%i==0) return false;\n return true;\n}\n"}, {"buggy_solution": " if (n<1) return 0;\n if (n==1) return 1;\n int out=18;\n for (int i=2;i0)\n {\n bi=to_string(sum%2)+bi;\n sum=sum/2;\n }\n return bi;\n}\n"}, {"buggy_solution": " int sum=0;\n for (int i=0;i*2+10) out=out+' ';\n out=out+current;\n current=\"\";\n }\n else current=current+s[i];\n return out;\n}\n"}, {"buggy_solution": " vector> out={};\n for (int i=0;i=0;j-=1)\n if (lst[i][j]==x) out.push_back({i,j});\n return out;\n}\n"}, {"buggy_solution": " if (array.size()==0) return {};\n if ((array[0]+array[array.size()-1]) %2==1)\n {\n sort(array.begin(),array.end());\n return array;\n }\n else\n {\n sort(array.begin(),array.end());\n vector out={};\n for (int i=array.size()-1;i>=0;i-=1)\n out.push_back(array[i]);\n return out;\n }\n\n}\n"}, {"buggy_solution": " string out;\n int i;\n for (i=0;i=97 and w<=122){w=w-32;}\n else if (w>=65 and w<=90) w=w+32;\n if (find(vowels.begin(),vowels.end(),w)!=vowels.end()) w=w+2;\n out=out+w;\n }\n return out;\n}\n"}, {"buggy_solution": " int largest=0;\n for (int i=0;ilargest)\n {\n bool prime=true;\n for (int j=2;j*j<=lst[i];j++)\n if (lst[i]%j==0) prime=false;\n if (prime) largest=lst[i];\n }\n int sum=0;\n string s;\n s=to_string(largest);\n for (int i=0;i\n"}, {"buggy_solution": " map::iterator it;\n int islower=0,isupper=0;\n if (dict.size()==0) return false;\n for (it=dict.begin();it!=dict.end();it++)\n {\n string key=it->first;\n \n for (int i=0;i90 and key[i]<97) or key[i]>122) return false;\n if (key[i]>=65 and key[i]<=90) isupper=1;\n if (key[i]>=97 and key[i]<=122) islower=1;\n if (isupper+islower==2) return false;\n }\n\n }\n return true;\n}\n"}, {"buggy_solution": " vector out={};\n int i,j;\n for (i=2;i out={n};\n for (int i=1;i out={};\n s=s+' ';\n for (int i=0;i0)\n {\n out.push_back(current);\n current=\"\";\n }\n }\n else current=current+s[i];\n return out;\n}\n"}, {"buggy_solution": " if (ym) return \"-1\";\n int num=(m+n)/2;\n string out=\"\";\n while (num>0)\n {\n out=to_string(num%2)+out;\n num=num/2;\n }\n return out;\n}\n"}, {"buggy_solution": " vector out={};\n for (int i=0;i0 and u)\n {\n if (num%2==0) u=false;\n num=num/10;\n }\n if (u) out.push_back(x[i]);\n }\n sort(out.begin(),out.end());\n return out;\n}\n"}, {"buggy_solution": " map numto={{0,\"Zero\"},{1,\"One\"},{2,\"Two\"},{3,\"Three\"},{4,\"Four\"},{5,\"Five\"},{6,\"Six\"},{7,\"Seven\"},{8,\"Eight\"},{9,\"Nine\"}};\n sort(arr.begin(),arr.end());\n vector out={};\n for (int i=arr.size()-1;i>=0;i-=1)\n if (arr[i]>=1 and arr[i]<=9)\n out.push_back(numto[arr[i]]);\n return out;\n}\n"}, {"buggy_solution": " int sum=0,prod=1;\n vector out={};\n for (int i=1;i<=n;i++)\n {\n sum+=i;\n prod*=i;\n if (i%2==0) out.push_back(prod);\n else out.push_back(sum);\n } \n return out;\n}\n"}, {"buggy_solution": " int num1=0,num2=0;\n for (int i=1;i<=n;i++)\n {\n string w=to_string(i);\n string p(w.rbegin(),w.rend());\n if (w==p and i%2==1) num1+=1;\n if (w==p and i%2==0) num2+=1;\n \n }\n return {num2,num1};\n}\n"}, {"buggy_solution": " int num=0;\n for (int i=0;i0) num+=1;\n else\n {\n int sum=0;\n int w;\n w=abs(n[i]);\n while (w>=10)\n {\n sum+=w%10;\n w=w/10;\n }\n sum-=w;\n if (sum>0) num+=1;\n }\n return num;\n}\n"}, {"buggy_solution": " int num=0;\n if (arr.size()==0) return true;\n for (int i=1;iarr[0]) num+=1;\n if (num<2) return true;\n return false;\n}\n"}, {"buggy_solution": " int num=0;\n for (int i=0;i=lst1.size()) return \"YES\";\n return \"NO\";\n}\n"}, {"buggy_solution": " map count={},out={};\n map ::iterator it;\n int max=0;\n for (int i=0;imax) max=count[test[i]];\n }\n for (it=count.begin();it!=count.end();it++)\n {\n char w1=it->first;\n int w2=it->second;\n if (w2==max) out[w1]=w2;\n }\n return out;\n}\n"}, {"buggy_solution": " string n=\"\";\n for (int i=0;i out={};\n for (int i=0;i=48 and lst[i][j]<=57 and lst[i][j]%2==1)\n sum+=1;\n string s=\"the number of odd elements in the string i of the input.\";\n string s2=\"\";\n for (int j=0;j0) out+=(sum-1)/capacity+1;\n }\n return out;\n}\n"}, {"buggy_solution": " vector bin={};\n int m;\n\n for (int i=0;i0)\n {\n b+=n%2;n=n/2;\n }\n bin.push_back(b);\n }\n for (int i=0;i out={};\n int numc=0;\n s=s+' ';\n for (int i=0;i=65 and s[i]<=90) or (s[i]>=97 and s[i]<=122))\n if (find(vowels.begin(),vowels.end(),s[i])==vowels.end())\n numc+=1;\n }\n return out;\n}\n"}, {"buggy_solution": " string out=\"\";\n string vowels=\"AEIOUaeiou\";\n for (int i=word.length()-2;i>=1;i-=1)\n if (find(vowels.begin(),vowels.end(),word[i])!=vowels.end())\n if (find(vowels.begin(),vowels.end(),word[i+1])==vowels.end())\n if (find(vowels.begin(),vowels.end(),word[i-1])==vowels.end())\n return out+word[i];\n return out;\n}\n"}, {"buggy_solution": " string l1=lst[0]+lst[1];\n int i,count=0;\n bool can=true;\n for (i=0;i out(arr.end()-k,arr.end());\n return out;\n}\n"}, {"buggy_solution": " int sum=0;\n for (int i=0;i*2=-99 and arr[i]<=99)\n sum+=arr[i];\n return sum;\n}\n"}, {"buggy_solution": " vector out={1};\n while (n!=1)\n {\n if (n%2==1) {out.push_back(n); n=n*3+1;}\n else n=n/2;\n }\n sort(out.begin(),out.end());\n return out;\n}\n"}, {"buggy_solution": " int mm,dd,yy,i;\n if (date.length()!=10) return false;\n for (int i=0;i<10;i++)\n if (i==2 or i==5)\n {\n if (date[i]!='-') return false;\n }\n else\n if (date[i]<48 or date[i]>57) return false;\n\n mm=atoi(date.substr(0,2).c_str());\n dd=atoi(date.substr(3,2).c_str());\n yy=atoi(date.substr(6,4).c_str());\n if (mm<1 or mm>12) return false;\n if (dd<1 or dd>31) return false;\n if (dd==31 and (mm==4 or mm==6 or mm==9 or mm==11 or mm==2)) return false;\n if (dd==30 and mm==2) return false;\n return true;\n\n}\n"}, {"buggy_solution": " int i;\n string current=\"\";\n vector out={};\n if (find(txt.begin(),txt.end(),' ')!=txt.end())\n {\n txt=txt+' ';\n for (i=0;i0)out.push_back(current); \n current=\"\";\n }\n else current=current+txt[i];\n return out;\n }\n if (find(txt.begin(),txt.end(),',')!=txt.end())\n {\n txt=txt+',';\n for (i=0;i0)out.push_back(current); \n current=\"\";\n }\n else current=current+txt[i];\n return out;\n }\n int num=0;\n for (i=0;i=97 and txt[i]<=122 and txt[i]%2==0)\n num+=1;\n return {to_string(num)};\n}\n"}, {"buggy_solution": " for (int i=1;i=2 and lst[i]==lst[i-1] and lst[i]==lst[i-2]) return false;\n }\n return true;\n}\n"}, {"buggy_solution": " int inter1,inter2,l,i;\n inter1=max(interval1[0],interval2[0]);\n inter2=min(interval1[1],interval2[1]);\n l=inter2-inter1;\n if (l<2) return \"NO\";\n for (i=2;i*i<=l;i++)\n if (l%i==0) return \"NO\";\n return \"YES\";\n}\n"}, {"buggy_solution": " if (arr.size()==0) return -32768;\n int i,sum=0,prods=1;\n for (i=0;i0 and grid[x-1][y]0 and grid[x][y-1] out={};\n for (i=0;i out={1,3};\n if (n==0) return {1};\n for (int i=2;i<=n;i++)\n {\n if (i%2==0) out.push_back(1+i/2);\n else out.push_back(out[i-1]+out[i-2]+1+(i+1)/2);\n }\n return out;\n}\n"}, {"buggy_solution": " int prod=1,has=0;\n string s=to_string(n);\n for (int i=0;imaxcount) maxcount=count;\n if (count<=maxcount-2) return true;\n }\n return false;\n}\n"}, {"buggy_solution": " int sum=0;\n for (int i=0;i90 and chr<97) or chr>122) return false;\n if (txt.length()==1) return true;\n chr=txt[txt.length()-2];\n if ((chr>=65 and chr<=90) or (chr>=97 and chr<=122)) return false;\n return true;\n}\n"}, {"buggy_solution": " int max=-1;\n for (int i=0;imaxneg)) maxneg=lst[i];\n if (lst[i]>0 and (minpos==0 or lst[i](a);\n if (find(s.begin(),s.end(),',')!=s.end())\n for (int i=0;i(a);\n if (a.type()==typeid(double)) numa=boost::any_cast(a);\n }\n if (b.type()==typeid(string))\n {\n string s;\n s=boost::any_cast(b);\n if (find(s.begin(),s.end(),',')!=s.end())\n for (int i=0;i(b);\n if (b.type()==typeid(double)) numb=boost::any_cast(b);\n }\n\n if (numa==numb) return string(\"None\");\n if (numanumb) return a;\n}\n"}, {"buggy_solution": " if (n%2==0 and n>=8) return true;\n return false;\n}\n"}, {"buggy_solution": " long long fact=1,bfact=1;\n for (int i=1;i<=n;i++)\n {\n fact=fact*i;\n bfact=bfact*fact;\n }\n return bfact;\n}\n"}, {"buggy_solution": " string out=\"\";\n int spacelen=0;\n for (int i=0;i2) out=out+'-';\n spacelen=0;\n out=out+text[i];\n }\n if (spacelen==1) out=out+'_';\n if (spacelen==2) out=out+\"__\";\n if (spacelen>2) out=out+'-';\n return out;\n}\n"}, {"buggy_solution": " int numdigit=0,numdot=0;\n if (file_name.length()<5) return \"No\";\n char w=file_name[0];\n if (w<65 or (w>90 and w<97) or w>122) return \"No\";\n string last=file_name.substr(file_name.length()-4,4);\n if (last!=\".txt\" and last!=\".exe\" and last!=\".dll\") return \"No\";\n for (int i=0;i=48 and file_name[i]<=57) numdigit+=1;\n if (file_name[i]=='.') numdot+=1;\n }\n if (numdigit>3 or numdot!=1) return \"No\";\n return \"Yes\"; \n}\n"}, {"buggy_solution": " int sum=0;\n for (int i=0;i0)\n out.pop_back();\n return out;\n}\n"}, {"buggy_solution": " int a,b,c,d,i;\n for (i=0;i sumdigit={};\n for (int i=0;i0) sum+=w[0]-48;\n else sum-=w[0]-48;\n sumdigit.push_back(sum);\n }\n int m;\n for (int i=0;isumdigit[j])\n {\n m=sumdigit[j];sumdigit[j]=sumdigit[j-1];sumdigit[j-1]=m;\n m=nums[j];nums[j]=nums[j-1];nums[j-1]=m;\n }\n \n return nums;\n}\n"}, {"buggy_solution": " int num=0;\n for (int i=0;i10)\n {\n string w=to_string(nums[i]);\n if (w[0]%2==1 and w[w.length()-1]%2==1) num+=1;\n }\n return num;\n}\n"}, {"buggy_solution": " vector a;\n vector> sum={{0,0,0}};\n vector> sum2={{0,0,0}};\n for (int i=1;i<=n;i++)\n {\n a.push_back((i*i-i+1)%3);\n sum.push_back(sum[sum.size()-1]);\n sum[i][a[i-1]]+=1;\n }\n for (int times=1;times<3;times++)\n {\n for (int i=1;i<=n;i++)\n {\n sum2.push_back(sum2[sum2.size()-1]);\n if (i>=1)\n for (int j=0;j<=2;j++)\n sum2[i][(a[i-1]+j)%3]+=sum[i-1][j];\n }\n sum=sum2;\n sum2={{0,0,0}};\n }\n\n return sum[n][0];\n}\n"}, {"buggy_solution": " vector planets={\"Mercury\",\"Venus\",\"Earth\",\"Mars\",\"Jupiter\",\"Saturn\",\"Uranus\",\"Neptune\"};\n int pos1=-1,pos2=-1,m;\n for (m=0;mpos2) {m=pos1;pos1=pos2;pos2=m;}\n vector out={};\n for (m=pos1+1;m out={};\n for (int i=0;i0 and (int)(round(lst[i]))%2==1) sum+=(int)(round(lst[i]))*(int)(round(lst[i]));\n return sum;\n}\n"}, {"buggy_solution": " vector out;\n for (int i=0;i=65 and chr<=90) strength+=1;\n if (chr>=97 and chr<=122) strength-=1;\n }\n if (strength>max) \n {\n max=strength;\n strongest=extensions[i];\n }\n }\n return class_name+'.'+strongest;\n}\n"}, {"buggy_solution": " for (int i=0;i rep={\"m\",\"cm\",\"d\",\"cd\",\"c\",\"xc\",\"l\",\"xl\",\"x\",\"ix\",\"v\",\"iv\",\"i\"};\n vector num={1000,900,500,400,100,90,50,40,10,9,5,4,1};\n int pos=0;\n while(number>0)\n {\n while (number>=num[pos])\n {\n current=current+rep[pos];\n number-=num[pos];\n }\n if (number>0) pos+=1;\n }\n return current;\n}\n"}, {"buggy_solution": " if (abs(a*a+b*b-c*c)<1e-4 or abs(a*a+c*c-b*b)<1e-4 or abs(b*b+c*c-a*a)<1e-4) return true;\n return false;\n}\n"}, {"buggy_solution": " string max=\"\";\n int maxu=0;\n for (int i=0;imaxu or (unique.length()==maxu and words[i]remaining) return {number+remaining, 0};\n return {number+need,remaining-need};\n}\n"}, {"buggy_solution": " vector num={};\n vector posto={};\n for (int i=0;i=65 and w<=90) w=w+32;\n else if (w>=97 and w<=122) w=w-32;\n else nletter+=1;\n out=out+w;\n }\n if (nletter==s.length())\n {\n string p(s.rbegin(),s.rend());\n return p;\n }\n else return out;\n}\n"}, {"buggy_solution": " unsigned char md[16];\n if (text.length()==0) return \"None\";\n MD5_CTX c;\n int i;\n MD5_Init(&c);\n MD5_Update(&c, (unsigned char*)text.c_str(), text.length());\n MD5_Final(md, &c);\n string out_str=\"\";\n for (int i=0;i<16;i++)\n {\n char w;\n if (md[i]<160) w=48+md[i]/16;\n else w=87+md[i]/16;\n out_str=out_str+w;\n if (md[i]%16<10) w=48+md[i]%16;\n else w=87+md[i]%16;\n out_str=out_str+w;\n }\n return out_str;\n}\n"}, {"buggy_solution": " int m;\n if (b out={};\n for (int i=a;i<=b;i++)\n if (i<10 and i%2==0) out.push_back(i);\n return out;\n}\n"}] \ No newline at end of file +[ + { + "buggy_solution": " int i,j;\n \n for (i=0;i all_parens;\n string current_paren;\n int level=0;\n char chr;\n int i;\n for (i=0;i out={};\n if (numbers.size()>0) out.push_back(numbers[0]);\n for (int i=1;i all_levels;\n string current_paren;\n int level=0,max_level=0;\n char chr;\n int i;\n for (i=0;imax_level) max_level=level;\n current_paren+=chr;\n }\n if (chr==')')\n {\n level-=1;\n current_paren+=chr;\n if (level==0){\n all_levels.push_back(max_level);\n current_paren=\"\";\n max_level=0;\n }\n }\n }\n return all_levels;\n}\n" + }, + { + "buggy_solution": " vector out;\n for (int i=0;i out;\n int max=0;\n for (int i=0;imax) max=numbers[i];\n out.push_back(max);\n }\n return out;\n}\n" + }, + { + "buggy_solution": " int i;\n for (i=0;i=a.length()) \n {\n output+=b[i];\n }\n else output+=a[i];\n }\n }\n return output;\n}\n" + }, + { + "buggy_solution": " string out;\n for (int i=0;iout.length()) out=strings[i];\n }\n return out;\n}\n" + }, + { + "buggy_solution": " int out,m;\n while (true){\n if (a out;\n string current=\"\";\n for (int i=0;i distinct={};\n transform(str.begin(),str.end(),str.begin(),::tolower);\n for (int i=0;i out={};\n if (music_string.length()>0)\n music_string=music_string+' ';\n for (int i=0;i tonum={{\"zero\",0},{\"one\",1},{\"two\",2},{\"three\",3},{\"four\",4},{\"five\",5},{\"six\",6},{\"seven\",7},{\"eight\",8},{\"nine\",9}};\n map numto={{0,\"zero\"},{1,\"one\"},{2,\"two\"},{3,\"three\"},{4,\"four\"},{5,\"five\"},{6,\"six\"},{7,\"seven\"},{8,\"eight\"},{9,\"nine\"}};\n int count[10];\n for (int i=0;i<10;i++)\n count[i]=0;\n string out=\"\",current=\"\";\n if (numbers.length()>0) numbers=numbers+' ';\n for (int i=0;i0) out.pop_back();\n return out;\n}\n" + }, + { + "buggy_solution": " vector out={};\n for (int i=0;iout[1])\n out={out[1],out[0]};\n return out;\n}\n" + }, + { + "buggy_solution": " float min=100000,max=-100000;\n for (int i=0;imax) max=numbers[i];\n }\n for (int i=0;i out;\n for (it=values.begin();it!=values.end();it++)\n {\n anyone=*it;\n if( anyone.type() == typeid(int) )\n out.push_back(boost::any_cast(*it));\n }\n return out;\n}\n" + }, + { + "buggy_solution": " return str.length();\n}\n" + }, + { + "buggy_solution": " for (int i=2;i*i<=n;i++)\n if (n%i==0) return n/i;\n return 1;\n\n}\n" + }, + { + "buggy_solution": " vector out={};\n for (int i=2;i*i<=n;i++)\n if (n%i==0)\n {\n n=n/i;\n out.push_back(i);\n i-=1;\n }\n out.push_back(n);\n return out;\n}\n" + }, + { + "buggy_solution": " vector out={};\n vector has1={};\n vector has2={};\n for (int i=0;i=97 and w<=122) {w-=32;}\n else\n if (w>=65 and w<=90){ w+=32;}\n out=out+w;\n }\n return out;\n}\n" + }, + { + "buggy_solution": " string out=\"\";\n for (int i=0;i out={};\n for (int i=0;i out={};\n for (int i=0;i0) out.push_back(l[i]);\n return out;\n}\n" + }, + { + "buggy_solution": " if (n<2) return false;\n for (long long i=2;i*i<=n;i++)\n if (n%i==0) return false;\n return true;\n}\n" + }, + { + "buggy_solution": " double ans=0;\n double value;\n value=poly(xs,ans);\n while (abs(value)>1e-6)\n {\n double driv=0;\n for (int i=1;i third={};\n int i;\n for (i=0;i*3 out={};\n for (i=0;i out={};\n for (int i=0;i0)\n {\n if (q%10==7) count+=1;\n q=q/10;\n }\n } \n return count;\n}\n" + }, + { + "buggy_solution": " vector out={};\n vector even={};\n for (int i=0;i*20)\n {\n out=to_string(x%base)+out;\n x=x/base;\n }\n return out;\n}\n" + }, + { + "buggy_solution": "return (a*h)*0.5;\n\n}\n" + }, + { + "buggy_solution": " int f[100];\n f[0]=0;\n f[1]=0;\n f[2]=2;\n f[3]=0;\n for (int i=4;i<=n;i++)\n {\n f[i]=f[i-1]+f[i-2]+f[i-3]+f[i-4];\n }\n return f[n];\n}\n" + }, + { + "buggy_solution": " sort(l.begin(),l.end());\n if (l.size()%2==1) return l[l.size()/2];\n return 0.5*(l[l.size()/2]+l[l.size()/2-1]);\n}\n" + }, + { + "buggy_solution": " string pr(text.rbegin(),text.rend());\n return pr==text;\n}\n" + }, + { + "buggy_solution": " int out=1;\n for (int i=0;i=t) return false;\n return true;\n}\n" + }, + { + "buggy_solution": " return x+y;\n}\n" + }, + { + "buggy_solution": " for (int i=0;i') level-=1;\n if (level<0) return false;\n }\n if (level!=0) return false;\n return true;\n}\n" + }, + { + "buggy_solution": " int incr,decr;\n incr=0;decr=0;\n for (int i=1;il[i-1]) incr=1;\n if (l[i] out={};\n for (int i=0;ii) n=n/i;\n return n;\n}\n" + }, + { + "buggy_solution": " return n*(n+1)/2;\n}\n" + }, + { + "buggy_solution": " int level=0;\n for (int i=0;i out={};\n for (int i=1;i=65 and s[i]<=90)\n sum+=s[i];\n return sum;\n}\n" + }, + { + "buggy_solution": " string num1=\"\",num2=\"\";\n int is12;\n is12=0;\n for (int i=0;i=48 and s[i]<=57)\n {\n if (is12==0) num1=num1+s[i];\n if (is12==1) num2=num2+s[i];\n }\n else\n if (is12==0 and num1.length()>0) is12=1;\n return n-atoi(num1.c_str())-atoi(num2.c_str());\n\n}\n" + }, + { + "buggy_solution": " vector out={};\n for (int i=0;i> freq={};\n int max=-1;\n for (int i=0;i=freq[j][0] and freq[j][0]>max) max=freq[j][0];\n }\n if (not(has)) \n {\n freq.push_back({lst[i],1});\n if (max==-1 and lst[i]==1) max=1;\n }\n }\n return max;\n}\n" + }, + { + "buggy_solution": " vector out={};\n sort(lst.begin(),lst.end());\n int l=0,r=lst.size()-1;\n while (lw) return false;\n return true;\n}\n" + }, + { + "buggy_solution": " int out=0;\n for (int i=0;inum2) return lst2;\n return lst1;\n}\n" + }, + { + "buggy_solution": " int num=0;\n for (int i=2;i*i<=a;i++)\n while (a%i==0 and a>i)\n {\n a=a/i;\n num+=1;\n }\n if (num==2) return true;\n return false; \n}\n" + }, + { + "buggy_solution": " int p=1,count=0;\n while (p<=x and count<100)\n {\n if (p==x) return true;\n p=p*n;count+=1;\n }\n return false;\n}\n" + }, + { + "buggy_solution": " for (int i=0;i*i*i<=abs(a);i++)\n if (i*i*i==abs(a)) return true;\n return false;\n}\n" + }, + { + "buggy_solution": " string key=\"2357BD\";\n int out=0;\n for (int i=0;i0)\n {\n out=to_string(decimal%2)+out;\n decimal=decimal/2;\n }\n out=\"db\"+out+\"db\";\n return out;\n}\n" + }, + { + "buggy_solution": " if (s.length()<3) return false;\n for (int i=2;i out={};\n for (int i=0;i=3.9999) out.push_back(\"A+\");\n if (grades[i]>3.7001 and grades[i]<3.9999) out.push_back(\"A\");\n if (grades[i]>3.3001 and grades[i]<=3.7001) out.push_back(\"A-\");\n if (grades[i]>3.0001 and grades[i]<=3.3001) out.push_back(\"B+\");\n if (grades[i]>2.7001 and grades[i]<=3.0001) out.push_back(\"B\");\n if (grades[i]>2.3001 and grades[i]<=2.7001) out.push_back(\"B-\");\n if (grades[i]>2.0001 and grades[i]<=2.3001) out.push_back(\"C+\");\n if (grades[i]>1.7001 and grades[i]<=2.0001) out.push_back(\"C\");\n if (grades[i]>1.3001 and grades[i]<=1.7001) out.push_back(\"C-\");\n if (grades[i]>1.0001 and grades[i]<=1.3001) out.push_back(\"D+\");\n if (grades[i]>0.7001 and grades[i]<=1.0001) out.push_back(\"D\");\n if (grades[i]>0.0001 and grades[i]<=0.7001) out.push_back(\"D-\");\n if (grades[i]<=0.0001) out.push_back(\"E\");\n }\n return out;\n}\n" + }, + { + "buggy_solution": " int l,i;\n l=str.length();\n if (l<2) return false;\n for (i=2;i*i<=l;i++)\n if (l%i==0) return false;\n return true;\n}\n" + }, + { + "buggy_solution": " if (n<1) return 0;\n if (n==1) return 1;\n int out=18;\n for (int i=2;i0)\n {\n bi=to_string(sum%2)+bi;\n sum=sum/2;\n }\n return bi;\n}\n" + }, + { + "buggy_solution": " int sum=0;\n for (int i=0;i*2+10) out=out+' ';\n out=out+current;\n current=\"\";\n }\n else current=current+s[i];\n return out;\n}\n" + }, + { + "buggy_solution": " vector> out={};\n for (int i=0;i=0;j-=1)\n if (lst[i][j]==x) out.push_back({i,j});\n return out;\n}\n" + }, + { + "buggy_solution": " if (array.size()==0) return {};\n if ((array[0]+array[array.size()-1]) %2==1)\n {\n sort(array.begin(),array.end());\n return array;\n }\n else\n {\n sort(array.begin(),array.end());\n vector out={};\n for (int i=array.size()-1;i>=0;i-=1)\n out.push_back(array[i]);\n return out;\n }\n\n}\n" + }, + { + "buggy_solution": " string out;\n int i;\n for (i=0;i=97 and w<=122){w=w-32;}\n else if (w>=65 and w<=90) w=w+32;\n if (find(vowels.begin(),vowels.end(),w)!=vowels.end()) w=w+2;\n out=out+w;\n }\n return out;\n}\n" + }, + { + "buggy_solution": " int largest=0;\n for (int i=0;ilargest)\n {\n bool prime=true;\n for (int j=2;j*j<=lst[i];j++)\n if (lst[i]%j==0) prime=false;\n if (prime) largest=lst[i];\n }\n int sum=0;\n string s;\n s=to_string(largest);\n for (int i=0;i\n" + }, + { + "buggy_solution": " map::iterator it;\n int islower=0,isupper=0;\n if (dict.size()==0) return false;\n for (it=dict.begin();it!=dict.end();it++)\n {\n string key=it->first;\n \n for (int i=0;i90 and key[i]<97) or key[i]>122) return false;\n if (key[i]>=65 and key[i]<=90) isupper=1;\n if (key[i]>=97 and key[i]<=122) islower=1;\n if (isupper+islower==2) return false;\n }\n\n }\n return true;\n}\n" + }, + { + "buggy_solution": " vector out={};\n int i,j;\n for (i=2;i out={n};\n for (int i=1;i out={};\n s=s+' ';\n for (int i=0;i0)\n {\n out.push_back(current);\n current=\"\";\n }\n }\n else current=current+s[i];\n return out;\n}\n" + }, + { + "buggy_solution": " if (ym) return \"-1\";\n int num=(m+n)/2;\n string out=\"\";\n while (num>0)\n {\n out=to_string(num%2)+out;\n num=num/2;\n }\n return out;\n}\n" + }, + { + "buggy_solution": " vector out={};\n for (int i=0;i0 and u)\n {\n if (num%2==0) u=false;\n num=num/10;\n }\n if (u) out.push_back(x[i]);\n }\n sort(out.begin(),out.end());\n return out;\n}\n" + }, + { + "buggy_solution": " map numto={{0,\"Zero\"},{1,\"One\"},{2,\"Two\"},{3,\"Three\"},{4,\"Four\"},{5,\"Five\"},{6,\"Six\"},{7,\"Seven\"},{8,\"Eight\"},{9,\"Nine\"}};\n sort(arr.begin(),arr.end());\n vector out={};\n for (int i=arr.size()-1;i>=0;i-=1)\n if (arr[i]>=1 and arr[i]<=9)\n out.push_back(numto[arr[i]]);\n return out;\n}\n" + }, + { + "buggy_solution": " int sum=0,prod=1;\n vector out={};\n for (int i=1;i<=n;i++)\n {\n sum+=i;\n prod*=i;\n if (i%2==0) out.push_back(prod);\n else out.push_back(sum);\n } \n return out;\n}\n" + }, + { + "buggy_solution": " int num1=0,num2=0;\n for (int i=1;i<=n;i++)\n {\n string w=to_string(i);\n string p(w.rbegin(),w.rend());\n if (w==p and i%2==1) num1+=1;\n if (w==p and i%2==0) num2+=1;\n \n }\n return {num2,num1};\n}\n" + }, + { + "buggy_solution": " int num=0;\n for (int i=0;i0) num+=1;\n else\n {\n int sum=0;\n int w;\n w=abs(n[i]);\n while (w>=10)\n {\n sum+=w%10;\n w=w/10;\n }\n sum-=w;\n if (sum>0) num+=1;\n }\n return num;\n}\n" + }, + { + "buggy_solution": " int num=0;\n if (arr.size()==0) return true;\n for (int i=1;iarr[0]) num+=1;\n if (num<2) return true;\n return false;\n}\n" + }, + { + "buggy_solution": " int num=0;\n for (int i=0;i=lst1.size()) return \"YES\";\n return \"NO\";\n}\n" + }, + { + "buggy_solution": " map count={},out={};\n map ::iterator it;\n int max=0;\n for (int i=0;imax) max=count[test[i]];\n }\n for (it=count.begin();it!=count.end();it++)\n {\n char w1=it->first;\n int w2=it->second;\n if (w2==max) out[w1]=w2;\n }\n return out;\n}\n" + }, + { + "buggy_solution": " string n=\"\";\n for (int i=0;i out={};\n for (int i=0;i=48 and lst[i][j]<=57 and lst[i][j]%2==1)\n sum+=1;\n string s=\"the number of odd elements in the string i of the input.\";\n string s2=\"\";\n for (int j=0;j0) out+=(sum-1)/capacity+1;\n }\n return out;\n}\n" + }, + { + "buggy_solution": " vector bin={};\n int m;\n\n for (int i=0;i0)\n {\n b+=n%2;n=n/2;\n }\n bin.push_back(b);\n }\n for (int i=0;i out={};\n int numc=0;\n s=s+' ';\n for (int i=0;i=65 and s[i]<=90) or (s[i]>=97 and s[i]<=122))\n if (find(vowels.begin(),vowels.end(),s[i])==vowels.end())\n numc+=1;\n }\n return out;\n}\n" + }, + { + "buggy_solution": " string out=\"\";\n string vowels=\"AEIOUaeiou\";\n for (int i=word.length()-2;i>=1;i-=1)\n if (find(vowels.begin(),vowels.end(),word[i])!=vowels.end())\n if (find(vowels.begin(),vowels.end(),word[i+1])==vowels.end())\n if (find(vowels.begin(),vowels.end(),word[i-1])==vowels.end())\n return out+word[i];\n return out;\n}\n" + }, + { + "buggy_solution": " string l1=lst[0]+lst[1];\n int i,count=0;\n bool can=true;\n for (i=0;i out(arr.end()-k,arr.end());\n return out;\n}\n" + }, + { + "buggy_solution": " int sum=0;\n for (int i=0;i*2=-99 and arr[i]<=99)\n sum+=arr[i];\n return sum;\n}\n" + }, + { + "buggy_solution": " vector out={1};\n while (n!=1)\n {\n if (n%2==1) {out.push_back(n); n=n*3+1;}\n else n=n/2;\n }\n sort(out.begin(),out.end());\n return out;\n}\n" + }, + { + "buggy_solution": " int mm,dd,yy,i;\n if (date.length()!=10) return false;\n for (int i=0;i<10;i++)\n if (i==2 or i==5)\n {\n if (date[i]!='-') return false;\n }\n else\n if (date[i]<48 or date[i]>57) return false;\n\n mm=atoi(date.substr(0,2).c_str());\n dd=atoi(date.substr(3,2).c_str());\n yy=atoi(date.substr(6,4).c_str());\n if (mm<1 or mm>12) return false;\n if (dd<1 or dd>31) return false;\n if (dd==31 and (mm==4 or mm==6 or mm==9 or mm==11 or mm==2)) return false;\n if (dd==30 and mm==2) return false;\n return true;\n\n}\n" + }, + { + "buggy_solution": " int i;\n string current=\"\";\n vector out={};\n if (find(txt.begin(),txt.end(),' ')!=txt.end())\n {\n txt=txt+' ';\n for (i=0;i0)out.push_back(current); \n current=\"\";\n }\n else current=current+txt[i];\n return out;\n }\n if (find(txt.begin(),txt.end(),',')!=txt.end())\n {\n txt=txt+',';\n for (i=0;i0)out.push_back(current); \n current=\"\";\n }\n else current=current+txt[i];\n return out;\n }\n int num=0;\n for (i=0;i=97 and txt[i]<=122 and txt[i]%2==0)\n num+=1;\n return {to_string(num)};\n}\n" + }, + { + "buggy_solution": " for (int i=1;i=2 and lst[i]==lst[i-1] and lst[i]==lst[i-2]) return false;\n }\n return true;\n}\n" + }, + { + "buggy_solution": " int inter1,inter2,l,i;\n inter1=max(interval1[0],interval2[0]);\n inter2=min(interval1[1],interval2[1]);\n l=inter2-inter1;\n if (l<2) return \"NO\";\n for (i=2;i*i<=l;i++)\n if (l%i==0) return \"NO\";\n return \"YES\";\n}\n" + }, + { + "buggy_solution": " if (arr.size()==0) return -32768;\n int i,sum=0,prods=1;\n for (i=0;i0 and grid[x-1][y]0 and grid[x][y-1] out={};\n for (i=0;i out={1,3};\n if (n==0) return {1};\n for (int i=2;i<=n;i++)\n {\n if (i%2==0) out.push_back(1+i/2);\n else out.push_back(out[i-1]+out[i-2]+1+(i+1)/2);\n }\n return out;\n}\n" + }, + { + "buggy_solution": " int prod=1,has=0;\n string s=to_string(n);\n for (int i=0;imaxcount) maxcount=count;\n if (count<=maxcount-2) return true;\n }\n return false;\n}\n" + }, + { + "buggy_solution": " int sum=0;\n for (int i=0;i90 and chr<97) or chr>122) return false;\n if (txt.length()==1) return true;\n chr=txt[txt.length()-2];\n if ((chr>=65 and chr<=90) or (chr>=97 and chr<=122)) return false;\n return true;\n}\n" + }, + { + "buggy_solution": " int max=-1;\n for (int i=0;imaxneg)) maxneg=lst[i];\n if (lst[i]>0 and (minpos==0 or lst[i](a);\n if (find(s.begin(),s.end(),',')!=s.end())\n for (int i=0;i(a);\n if (a.type()==typeid(double)) numa=boost::any_cast(a);\n }\n if (b.type()==typeid(string))\n {\n string s;\n s=boost::any_cast(b);\n if (find(s.begin(),s.end(),',')!=s.end())\n for (int i=0;i(b);\n if (b.type()==typeid(double)) numb=boost::any_cast(b);\n }\n\n if (numa==numb) return string(\"None\");\n if (numanumb) return a;\n}\n" + }, + { + "buggy_solution": " if (n%2==0 and n>=8) return true;\n return false;\n}\n" + }, + { + "buggy_solution": " long long fact=1,bfact=1;\n for (int i=1;i<=n;i++)\n {\n fact=fact*i;\n bfact=bfact*fact;\n }\n return bfact;\n}\n" + }, + { + "buggy_solution": " string out=\"\";\n int spacelen=0;\n for (int i=0;i2) out=out+'-';\n spacelen=0;\n out=out+text[i];\n }\n if (spacelen==1) out=out+'_';\n if (spacelen==2) out=out+\"__\";\n if (spacelen>2) out=out+'-';\n return out;\n}\n" + }, + { + "buggy_solution": " int numdigit=0,numdot=0;\n if (file_name.length()<5) return \"No\";\n char w=file_name[0];\n if (w<65 or (w>90 and w<97) or w>122) return \"No\";\n string last=file_name.substr(file_name.length()-4,4);\n if (last!=\".txt\" and last!=\".exe\" and last!=\".dll\") return \"No\";\n for (int i=0;i=48 and file_name[i]<=57) numdigit+=1;\n if (file_name[i]=='.') numdot+=1;\n }\n if (numdigit>3 or numdot!=1) return \"No\";\n return \"Yes\"; \n}\n" + }, + { + "buggy_solution": " int sum=0;\n for (int i=0;i0)\n out.pop_back();\n return out;\n}\n" + }, + { + "buggy_solution": " int a,b,c,d,i;\n for (i=0;i sumdigit={};\n for (int i=0;i0) sum+=w[0]-48;\n else sum-=w[0]-48;\n sumdigit.push_back(sum);\n }\n int m;\n for (int i=0;isumdigit[j])\n {\n m=sumdigit[j];sumdigit[j]=sumdigit[j-1];sumdigit[j-1]=m;\n m=nums[j];nums[j]=nums[j-1];nums[j-1]=m;\n }\n \n return nums;\n}\n" + }, + { + "buggy_solution": " int num=0;\n for (int i=0;i10)\n {\n string w=to_string(nums[i]);\n if (w[0]%2==1 and w[w.length()-1]%2==1) num+=1;\n }\n return num;\n}\n" + }, + { + "buggy_solution": " vector a;\n vector> sum={{0,0,0}};\n vector> sum2={{0,0,0}};\n for (int i=1;i<=n;i++)\n {\n a.push_back((i*i-i+1)%3);\n sum.push_back(sum[sum.size()-1]);\n sum[i][a[i-1]]+=1;\n }\n for (int times=1;times<3;times++)\n {\n for (int i=1;i<=n;i++)\n {\n sum2.push_back(sum2[sum2.size()-1]);\n if (i>=1)\n for (int j=0;j<=2;j++)\n sum2[i][(a[i-1]+j)%3]+=sum[i-1][j];\n }\n sum=sum2;\n sum2={{0,0,0}};\n }\n\n return sum[n][0];\n}\n" + }, + { + "buggy_solution": " vector planets={\"Mercury\",\"Venus\",\"Earth\",\"Mars\",\"Jupiter\",\"Saturn\",\"Uranus\",\"Neptune\"};\n int pos1=-1,pos2=-1,m;\n for (m=0;mpos2) {m=pos1;pos1=pos2;pos2=m;}\n vector out={};\n for (m=pos1+1;m out={};\n for (int i=0;i0 and (int)(round(lst[i]))%2==1) sum+=(int)(round(lst[i]))*(int)(round(lst[i]));\n return sum;\n}\n" + }, + { + "buggy_solution": " vector out;\n for (int i=0;i=65 and chr<=90) strength+=1;\n if (chr>=97 and chr<=122) strength-=1;\n }\n if (strength>max) \n {\n max=strength;\n strongest=extensions[i];\n }\n }\n return class_name+'.'+strongest;\n}\n" + }, + { + "buggy_solution": " for (int i=0;i rep={\"m\",\"cm\",\"d\",\"cd\",\"c\",\"xc\",\"l\",\"xl\",\"x\",\"ix\",\"v\",\"iv\",\"i\"};\n vector num={1000,900,500,400,100,90,50,40,10,9,5,4,1};\n int pos=0;\n while(number>0)\n {\n while (number>=num[pos])\n {\n current=current+rep[pos];\n number-=num[pos];\n }\n if (number>0) pos+=1;\n }\n return current;\n}\n" + }, + { + "buggy_solution": " if (abs(a*a+b*b-c*c)<1e-4 or abs(a*a+c*c-b*b)<1e-4 or abs(b*b+c*c-a*a)<1e-4) return true;\n return false;\n}\n" + }, + { + "buggy_solution": " string max=\"\";\n int maxu=0;\n for (int i=0;imaxu or (unique.length()==maxu and words[i]remaining) return {number+remaining, 0};\n return {number+need,remaining-need};\n}\n" + }, + { + "buggy_solution": " vector num={};\n vector posto={};\n for (int i=0;i=65 and w<=90) w=w+32;\n else if (w>=97 and w<=122) w=w-32;\n else nletter+=1;\n out=out+w;\n }\n if (nletter==s.length())\n {\n string p(s.rbegin(),s.rend());\n return p;\n }\n else return out;\n}\n" + }, + { + "buggy_solution": " unsigned char md[16];\n if (text.length()==0) return \"None\";\n MD5_CTX c;\n int i;\n MD5_Init(&c);\n MD5_Update(&c, (unsigned char*)text.c_str(), text.length());\n MD5_Final(md, &c);\n string out_str=\"\";\n for (int i=0;i<16;i++)\n {\n char w;\n if (md[i]<160) w=48+md[i]/16;\n else w=87+md[i]/16;\n out_str=out_str+w;\n if (md[i]%16<10) w=48+md[i]%16;\n else w=87+md[i]%16;\n out_str=out_str+w;\n }\n return out_str;\n}\n" + }, + { + "buggy_solution": " int m;\n if (b out={};\n for (int i=a;i<=b;i++)\n if (i<10 and i%2==0) out.push_back(i);\n return out;\n}\n" + } +] \ No newline at end of file