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 n1,n2;
        cout << "Enter 1st number:";
	cin >> n1;
        cout << "Enter 2nd number:";
	cin >> n2;
	cout << n1+n2;
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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 of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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 of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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 of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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 of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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,l1,l2;
	char L;
	cin>>r1>>l1>>r2>>l2>>L;

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

	if(L=='A'){
		cout<<r1+r2<<" "<<l1+l2;
	}
	if(L=='S'){
		cout<<r1-r2<<" "<<l1-l2;
	}
	if(L=='M'){
		cout<<(r1*r2-l1*l2)<<" "<<(r1*l2+r2*l1);
	}
	if(L=='D'){
		cout<<(r1*r2+l1*l2)/(r2*r2+l2*l2)<<" "<<(r2*l1-r1*l2)/(r2*r2+l2*l2);
	}


}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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 x1,y1,x2,y2;char n ; cin >> x1 >> y1 >> x2 >> y2 ;
char S,M,D,A;
cin >> n;
	cout << fixed;
	cout.precision(3);
	if(n == A){
		cout << x1+x2 << " " << y1+y2 << endl;}
	else if(n == S){
		cout << x1-x2 << " " << y1-y2 << endl;}
	else if(n == M){
		cout << (x1*x2)-(y1*y2) << " " << (x1*y2)+(x2*y1) << endl ; }
	else if(n == D){
		cout << ((x1*x2)-(y1*y2))/(x2*x2+y2*y2) << " " << ((x1*y2)+(x2*y1))/(x2*x2+y2*y2) << endl ;}
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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,a,b;
		char c;
	cin>> r1>>i1>>r2>>i2>>c;
	if(c=='A'){
		a=r1+r2;
		b=i1+i2;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b;
		
	}
if(c=='S'){
	a=r1-r2;
	b=i1-i2;
	cout<<fixed;
	cout.precision(3);
	cout<<a<<" "<<b;
}
if(c=='M'){
	a=r1*r2-i1*i2;
	b=r1*i2+r2*i1;
	cout<<fixed;
	cout.precision(3);
	cout<<a<<" "<<b;
}
if(c=='D'){
	a=(r1*r2+i1*i2)/(r2*r2+i2*i2);
	b=(r2*i1-r1*i2)/(r2*r2+i2*i2);
	cout<<a<<" "<<b;
}
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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,real2,imag1,imag2;	
cin>>real1;
cin>>imag1;
cin>>real2;
cin>>imag2;
char i;
double sum,sub,mul,di;
char A,S,M,D;
if(cin>>A){
sum=((real1+real2)+((imag1+imag2)*i));
cout<<(real1+real2)<<" ";
cout<<(imag1+imag2);
}
if(cin>>S){
sub=((real1-real2)+((imag1-imag2)*i));
cout<<(real1-real2)<<" ";
cout<<(imag1-imag2);}
if (cin>>M){
mul=(((real1*real2)-(imag1*imag2))+(((real1*imag2)+(real2*imag1))*i));
cout<<((real1*real2)-(imag1*imag2))<<" ";
cout<<((real1*imag2)+(real2*imag1));}
if(cin>>D){
di=(((real1*real2)-(imag1*imag2)))/((real2*real2)+(imag2*imag2)) +(((((real2*imag1)-(real1*imag2))))/((real2*real2)+(imag2*imag2))*i);
cout<<(((real1*real2)-(imag1*imag2)))/((real2*real2)+(imag2*imag2))<<" ";
cout<<((((real2*imag1)-(real1*imag2))))/((real2*real2)+(imag2*imag2));}}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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{
        char i;
        float a,b,c,d;
        cin >> a >> b >> c >> d >>i;
        if (i == 'A') cout << a+c << " "<< b+d;
        if(i== 'S') cout << a-c << " " << b-d;
        if ( i =='M') cout << a*c - b*d << " "<< b*c + a*d;
        if ( i=='D') cout << (a*c + b*d)/(c*c+d*d) <<" "<<(b*c-a*d)/(c*c+d*d);
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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 ch;
	cin>>real1>>imag1>>real2>>imag2;
	cin>>ch;
	if(ch=='A'){
		cout<<fixed;
		cout.precision(3);
		cout<<real1+real2<<" "<<imag1+imag2;
	}
	else if(ch=='S'){
		cout<<fixed;
		cout.precision(3);
		cout<<real1-real2<<" "<<imag1-imag2;
	}
	else if(ch=='M'){
		cout<<fixed;
		cout.precision(3);
		cout<<((real1*real2)-(imag1*imag2))<<" "<<imag1*real2+imag2*real1;
	}
	else if(ch=='D'){
		cout<<fixed;
		cout.precision(3);
		cout<<((real1*real2)+(imag1*imag2))/(real2*real2+imag2*imag2)<<" " <<((imag1*real2)-(real1*imag2))/(real2*real2+imag2*imag2);
	}
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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;
	float s1=a+c;
	float s2=b+d;
	float A;
	float su1=a-c;
	float su2=b-d;
	float S;

	if(A==s1+s2){
		cout<<s1<<s2<<endl;}
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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, imag1, real2, imag2;
	char o;
	cin>>real1>>imag1>>real2>>imag2;
	cin>>o;
	float a,b,c,d,e,f,g,h;
	if(o=='A'){a=real1+real2;
		b=imag1+imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b;
	}
	else if(o=='S'){c=real1-real2;
                d=imag1-imag2;
		cout<<fixed;
                cout.precision(3);
		cout<<c<<" "<<d;
	}
	else if(o=='M'){e=((real1*real2)-(imag1*imag2));
                f=((real1*imag2)+(real2*imag1));
		cout<<fixed;
                cout.precision(3);
		cout<<e<<" "<<f;
        }
	else if(o=='D'){g=(((real1*real2)+(imag1*imag2))/((real2)*(real2)+(imag2)*(imag2)));
                h=(((real2*imag1)-(real1*imag2))/((real2)*(real2)+(imag2)*(imag2)));
		cout<<fixed;
                cout.precision(3);
                cout<<g<<" "<<h;
        }
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
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;
	cin >> real1 >> imag1 >> real2 >> imag2;

	float a, b;

	char O;
	cin >> O;

	switch(O){

		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)+(real1*imag2);
			   break;

			 }
		case 'D' : { 
			   a = ((real1*real2)+(imag1*imag2))/(pow(real2,2)+pow(imag2,2));
			   b = ((imag1*real2)-(real1*imag2))/(pow(real2,2)+pow(imag2,2));
			   break;
			 }

		}

	cout<<fixed;
	cout.precision(3);
       cout << a <<" "<< b;	
}

Grading criterion: is subtraction of complex numbers is correct implemented?
Rating A: if subtraction function of complex numbers is correctly written
Rating B: if the subtraction function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A