CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float r1, i1, r2, i2;
	char operation;
	cin >> r1 >> i1 >> r2 >> i2 >> operation ;
	
	operation=A ? cout<< r1+r2 <<" "<< i1+i2 :
	operation=S ? cout<< r1-r2 <<" "<< i1-i2 :
	operation=M ? cout<< (r1*r2)-(i1*i2) <<" " << (r2*i1)+(r1*i2):
	operation=D ? cout<<( (r1*r2)+(i1*i2))/(r2*r2+i2*i2)<< " " <<((r2*i1)-(r1*i2))/(r2*r2+i2*i2) : cout<< endl;

}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float a, b, c, d;    //complex numbers of the form a+bi annd c+di
	char x;
	cin>>a>>b>>c>>d>>x;
	if (x=='A'){          //addition of complex numbers
		cout<<fixed;   //uses fixed floating point representation
		cout.precision(3);  //print two digits after the decimal point
		cout<<a+c<<" "<<b+d;
	}
	if (x=='S'){            //subtraction fo complex numbers
		cout<<fixed;
		cout.precision(3);
		cout<<a-c<<" "<<b-d;
	}
	if (x=='M'){            //multiplication of complex numbers
		cout<<fixed;
		cout.precision(3);
		cout<<a*c-b*d<<" "<<b*c+a*d;
	}
	if(x=='D'){          //division of complex numbers
	cout<<fixed;
	cout.precision(3);
	cout<<(a*c+b*d)/(c*c+d*d)<<" "<<(b*c-a*d)/(c*c+d*d);
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program
{
	float real1, imag1, real2, imag2;
	char N;
	cin>>real1>>imag1>>real2>>imag2>>N;
	float Y, Z;
        Y=(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2);
	Z=(-real1*imag2+real2*imag1)/(real2*real2+imag2*imag2);
	if(N=='A'){cout<<fixed;
	        cout.precision(3);
		cout<<real1+real2<<' '<<imag1+imag2;}
	else if(N=='S'){cout<<fixed;
	              cout.precision(3);
		      cout<<real1-real2<<' '<<imag1-imag2;}
         else if(N=='M'){cout<<fixed;
	 cout.precision(3);
	 cout<<real1*real2-imag1*imag2<<' '<<real1*imag2+real2*imag1;}
	else if(N=='D'){cout<<fixed;
	cout.precision(3);
	cout<<Y<<' '<<Z;}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program
{
	float real1,imag1,real2,imag2;
	char input;

	cin >> real1 >> imag1 >> real2 >> imag2 >> input;

	if (input == 'A')
		{	
		  	cout << fixed;
		       	cout.precision(3);
			cout<<(real1 + real2) << " " <<( imag1 + imag2);
		}

	if (input == 'S')
		{	
		   cout << fixed;
                   cout.precision(3);
                   cout << real1 - real2 << " " << imag1 - imag2;
                }
	if (input == 'M')
		{
       	           cout << fixed;
                   cout.precision(3);
                   cout << real1 * real2 - imag1*imag2 << " " << real1*imag2 +real2* imag1;
		}       
	if (input == 'D')
		{
		   cout << fixed;
               	   cout.precision(3);
                   cout << (real1 * real2 + imag1*imag2)/(pow(real2,2)+pow(imag2,2)) << " " << (real2*imag1-real1*imag2)/(pow(real2,2)+pow(imag2,2));
                }	   
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include <simplecpp>
main_program{float r1,i1,r2,i2;char o;
	cin >> r1 >> i1 >> r2 >> i2>>o;float s1,s2;
	switch(o)
	{ case 'A':s1=r1+r2;s2=i1+i2;
		cout <<fixed;
		cout.precision(3);
		cout << s1<< " "  <<s2;
		break;
	case 'S':s1=r1-r2;s2=i1-i2;	
		 cout <<fixed;
                cout.precision(3);
                cout << s1<< " "  <<s2;
                break;  
        case 'M': s1=(r1*r2)-(i1*i2);
		  s2=(r1*i2)+(r2*i1);
		  cout <<fixed;
                cout.precision(3);
                cout << s1<< " " <<s2;
                break;
	case 'D': s1=((r1*r2)+(i1*i2))/(r2*r2+i2*i2);
		  s2=((r2*i1)-(r1*i2))/(r2*r2+i2*i2);
		  cout <<fixed; cout.precision(3);
                cout << s1<< " "  <<s2;
                break;
	}}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float r1, i1, r2, i2, m2, r3, i3;
	char c;
	cin>>r1>>i1>>r2>>i2>>c;
	if(c==65){
		r3=r1+r2;
		i3=i1+i2;
		cout << fixed;
		cout.precision(3);
		cout<<r3<<" "<<i3;
	}
	else if(c==83){
		r3=r1-r2;
		i3=i1-i2;
		cout << fixed;
		cout.precision(3);
		cout<<r3<<" "<<i3;
		}
	else if(c==77){
		r3=r1*r2-i1*i2;
		i3=r1*i2+r2*i1;
		cout << fixed;
		cout.precision(3);
		cout<<r3<<" "<<i3;
		}
	else if(c==68){
		m2=(r2*r2+i2*i2);
		r3=(r1*r2+i1*i2)/m2;
		i3=(-r1*i2+r2*i1)/m2;
		cout << fixed;
		cout.precision(3);
		cout<<r3<<" "<<i3;
		}
	else{}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1,ans1,ans2, imag1, real2, imag2;
	char c;
	cin>>real1>>imag1>>real2>>imag2>>c;
	if(c=='A')
	{
		ans1= real1+real2;
                ans2=imag1 + imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<ans1<<" "<<ans2;
	}
        else if(c=='S')
	{
		ans1=real1-real2;
		ans2=imag1-imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<ans1<<" "<<ans2;
	}
        else if(c=='M')
	{
		ans1=(real1*real2)-(imag1*imag2);
		ans2=(real1*imag2)+(imag1*real2);
		cout<<fixed;
		cout.precision(3);
		cout<<ans1<<" "<<ans2;
	}
	else if(c=='D')
	{
          ans1=(real1*real2 + imag1*imag2)/(real2*real2 + imag2*imag2);
	  ans2=(imag1*real2-imag2*real1)/(real2*real2 + imag2*imag2);
	  cout<<fixed;
	  cout.precision(3);
	  cout<<ans1<<" "<<ans2;
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{

float a,b,c,d,l,m,p,q;
char X,A,S,M,D;


	cin>>a>>b>>c>>d>>X;

	if(X=='A'){

		l=a+c;
		m=b+d;
		cout<<fixed;
		cout.precision(3);
		cout<<l<<" "<<m;
	}
	
	else if(X=='S'){

		l=a-c;
		m=b-d;
		cout<<fixed;
		cout.precision(3);
		cout<<l<<" "<<m;
	}

	else if(X=='M'){
		p=(a*c)-(b*d);
		q=(b*c)+(a*d);
		cout<<fixed;
		cout.precision(3);
	cout<<p<<" "<<q;
	}
	
	else if(X=='D'){

		p=((a*c)+(b*d))/((pow(c,2)) + (pow(d,2)));
		q=((b*c)-(a*d))/((pow(c,2)) + (pow(d,2)));
		cout<<fixed;
		cout.precision(3);
		cout<<p<<" "<<q;

	}

}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float a,b,c,d;
	cin>>a>>b>>c>>d;
	char t;
	cin>>t;
	switch(t)
	{
		case 'A':cout<<fixed;
			 cout.precision(3);
			 cout<<a+c<<b+d;
			 break;
		case 'S':cout<<fixed;
			 cout.precision(3);
			 cout<<a-c<<b-d;
			 break;
		case 'M':cout<<fixed;
			 cout.precision(3);
			 cout<<((a*c)-(b*d))<<(a*d+b*c);
			 break;
		case 'D':cout<<fixed;
			 cout.precision(3);
			 cout<<(a*c+b*d)/(c*c+d*d)<<(b*c-a*d)/(c*c+d*d);
			 break;
		default: break;
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program
{
	float r1,r2,i1,i2,r,i;
	char R;
	cin>>r1>>i1>>r2>>i2>>R;

	if(R=='A'){
		r=r1+r2;
	 	i=i1+i2;
		cout<<fixed;
	 	cout.precision(3);
		cout<<r<<" "<<i<<endl;}
	if(R=='S'){
		r=r1-r2;
		i=i1-i2;
		cout<<fixed;
                cout.precision(3);
                cout<<r<<" "<<i<<endl;}
	if(R=='M'){
		r=r1*r2 -i1*i2 ;
		i=r1*i2 + r2*i1;
		cout<<fixed;
                               cout.precision(3);
                               cout<<r<<" "<<i<<endl;
	}
	if(R=='D'){
		r=(r1*r2 + i1*i2)/(r2*r2+i2*i2);
		i=(i1*r2 - r1*i2)/(r2*r2+i2*i2);
		cout<<fixed;
                               cout.precision(3);
                               cout<<r<<" "<<i<<endl;
	}
	
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include <simplecpp>
main_program
{
double real1,imag1,real2,imag2,a,b;

char command;

 cin>>real1>>imag1>>real2>>imag2>>command;


switch(command)
{
case'A': a = ( real1+ real2 ); b = (imag1 + imag2); break;

case'S' :a = ( real1 - real2 ); b = (imag1 - imag2); break;
case'M' : a = ( (real1*real2) - (imag1*imag2) ); b = (( imag1*real2) + (imag2*real1) ); break;
case 'D' : a = (( (real1*real2) + (imag1*imag2) ))/(pow(real2,2) + pow(imag2,2) ); b = ((( imag1*real2) -  (imag2*real1))/(pow(real2,2) + pow(imag2,2) ) ); break;
}
 cout<<fixed;
cout.precision(3);
 cout<<a<<" "<<b;
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float n1,n2;
        cout << "Enter 1st number:";
	cin >> n1;
        cout << "Enter 2nd number:";
	cin >> n2;
	cout << n1+n2;
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1,real2,imag1,imag2;
	char letter;
	
        cin>>real1>>imag1>>real2>>imag2>>letter;
       
       	if (letter=='A'){
		cout<<fixed;
		cout.precision(3);
	     cout<<(real1+real2)<<" "<<(imag1+imag2)<<endl;
	}

	else if (letter=='S'){
		cout<<fixed;
		cout.precision(3);
            cout<<(real1-real2)<<" "<<(imag1-imag2)<<endl;
       }
	else if (letter=='M'){
		cout<<fixed;
		cout.precision(3);
	  cout<<((real1*real2)-(imag1*imag2))<<" "<<((real1*imag2)+(real2*imag1))<<endl;
       }
	else  if (letter=='D'){
	       cout<<fixed;
	       cout.precision(3);
	       cout<<(((real1*real2)+(imag1*imag2))/(pow(real2,2)+pow(imag2,2)))<<" "<<(((real2*imag1)-(real1*imag2))/(pow(real2,2)+pow(imag2,2)))<<endl;
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1, imag1;
	float real2, imag2;
	char op;
	char A ='+';
        char S ='-';
	char M ='*';
	char D ='/';
	cin >> real1 >> imag1 >> real2 >> imag2 >> op;
        if( op =='A'){
		cout<<fixed;
		cout.precision(3);
		cout<< real1 +  real2 <<" "<< imag1 + imag2 <<endl;}
	else if ( op =='S'){
        	cout<<fixed;
		cout.precision(3);
		cout <<( real1 -real2) <<" "<< imag1 - imag2 << endl;}
	else if( op =='M'){
		cout<<fixed;
		cout.precision(3);
		cout << real1*real2 - imag1*imag2 <<" "<< real1*imag2 + imag1*real2 << endl;}

	else if ( op =='D'){
		cout<< fixed;
		cout.precision(3);
		cout <<(real1*real2 + imag1*imag2)/(real2*real2 + imag2*imag2) +  <" "<< imag1/imag2 << endl;}

}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program
{  float a,b,c,d,ansR,ansC;
   cin>>a>>b>>c>>d;

   char oper;
   cin>>oper;
   
switch(oper){
	   case 'A' : {ansR=a+c;ansC=b+d;break;}
	   case 'S' : {ansR=a-c;ansC=b-d;break;}
	   case 'M' : {ansR=a*c-b*d;ansC=a*d+b*c;break;}
	   case 'D' : {ansR=(a*c+b*d)/(c*c+d*d);ansC=(b*c-a*d)/(c*c+d*d);break;}
	      }
         
   
   
   cout<<fixed;
   cout.precision(3);
   cout<<ansR<<" "<<ansC;

}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
float real1,imag1,real2,imag2;
char c;
cin>>real1;
cout<<" ";
cin>>imag1;
cout<<" ";
cin>>real2;
cout<<" ";
cin>>imag2;
cout<<" ";
cin>>c;
cout<<endl;
         if(c=='A'){
	cout << fixed;
        cout.precision(3);	 
	cout<<real1+real2<<" "<<imag1+imag2<<endl;
	 }
	 else{if(c=='M'){
         cout << fixed;
         cout.precision(3);
	 cout<<(real1*real2 -imag1*imag2)<<" "<<(real1*imag2 + real2*imag1);
	 }
	 else{
	 if(c=='S'){
	  cout << fixed;
        cout.precision(3);
        cout<<real1-real2<<" "<<imag1-imag2<<endl;
         }
	 else{
	 if(c=='D'){
          cout << fixed;
        cout.precision(3);
        cout<<(real1*real2 +imag1*imag2)/(real2*real2 +imag2*imag2)<<" "<<(-1*real1*imag2 + real2*imag1)/(real2*real2 +imag2*imag2);

         }

	 }

	 }
	 }
	 }

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A