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 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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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 A,S,M,D,c;
	cin>>real1>>imag1>>real2>>imag2;
	cin>>c;cout<<fixed;cout.precision(3);
	if(c=='A'){
		cout<<real1+real2;
		cout.precision(3);
		cout<<" ";
		cout<<imag1+imag2;
		cout.precision(3);
	}
	else if (c=='S'){
		cout<<real1-real2;
		cout.precision(3);
		cout<<" ";

		cout<<imag1-imag2;
		cout.precision(3);
	}
	else if(c=='M'){
cout<<real1*real2-imag1*imag2;
cout.precision(3);
cout<<" ";

cout<<real1*imag2+real2*imag1;
cout.precision(3);
	}

	else if(c=='D'){
		cout<<(real1*real2-imag1*imag2)/(real2*real2+imag2*imag2);

		cout.precision(3);
		cout<<" ";

cout<<(real1*imag2+real2*imag1)/(real2*real2+imag2*imag2);
cout.precision(3);
	}
}

Grading criterion: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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;
		     char command;

		  
		  cin>>real1>> imag1>> real2>> imag2>> command;
		  switch(command){
		  case 'A':cout<<fixed;
			   cout.precision(3);
			   cout<<(real1+real2)<<" "<<(imag1+imag2);
		              break;
                  case 'S':cout<<fixed;
                           cout.precision(3);
                           cout<<(real1-real2)<<" "<<(imag1-imag2);
                              break;
		  case 'M':cout<<fixed;
		           cout.precision(3);
		           cout<<(real1*real2-imag1*imag2)<<" "<<(real1*imag2+real2*imag1);
                              break;
		  case 'D':cout<<fixed;
		           cout.precision(3);
		           cout<<(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(real2*imag1-real1*imag2)/(real2*real2+imag2*imag2);	   

			         }
	}

Grading criterion: if addition takes place if A is passed as input
Rating A: if addition takes place correctly if A is passed as input argument
Rating B: if any other function executed other than addition
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,real,imag;
	char e;
	cin>> a>>b>>c>>d>>e;
	
        if( e==65){ real=a+c;
		     imag=b+d;
	             }
	if(e== 83){ real=a-c;
	             imag=b-d;
	                 }
	if(e== 77) {real=a*c-b*d;
	             imag=b*c+a*d;
	                 }
	if(e== 68){ real=(a*c+b*d)/(c*c+d*d);
	             imag=(b*c-a*d)/(c*c+d*d);
	                }
	cout<<fixed;
	cout.precision(3);
	cout << real<<" "<< imag;
}

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