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 O;
        cin>>r1>>i1>>r2>>i2>>O;
	if(O=='A'){
		float R= r1+r2;
		float I= i1+i2;
		cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else if(0=='S'){
		float R=r1-r2;
		float I= i1-i2;
                cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else if(O=='M'){
		float R= r1*r2-i1*i2;
		float I= i1*r2 + i2*r1;
		cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else if(O=='D'){
		float R= (r1*r2+ i1*i2)/(pow(r2, 2)+ pow(i2, 2));
		float I= (r2*i1- r1*i2)/(pow(r2, 2)+ pow(i2, 2));
		cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else{
		cout<<"";
	}
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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;
	char A,S,M;
        cout<<fixed;
        cout.precision(3);	

 if (cin>>S){cout<<real2-real1<<" "<<imag2-imag1;}
	else if (cin>>M){cout<<real1*real2<<" "<<imag1*imag2;}
	

}

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

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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;
	char command;
	cout<<"choose a command "<<endl<<"A:Addition"<<endl<<"S:subtraction"<<endl<<"M:multiplication"<<endl<<"D:division"<<endl;
	cin>>command;
	if(command='A' ){
		float sumreal=real1+real2;//adds the real part//
		float sumimag=imag1+imag2;//adds the imaginary part//
                cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<sumreal<<" "<<sumimag<<endl;
	}
	else if(command ='S')
		float subreal=real1-real2;//subtracts the real part//
	        float subimag=imag1-imag2;//subtracts the imaginary part//
                cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<subreal<<" "<<subimag<<endl;
	}
	else if(command='M')
		float mulreal=real1*real2;//multiplies the real part //
		float mulimag=imag1*imag2;//multiplies the imaginary part//
		cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<mulreal<<" "<<mulimag<<endl;
	}
	else if (command='D')
		float divreal=real1/real2;//divides the real part //
		float divimag=imag1/imag2;//divides the imaginary part //
	        cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<divreal<<" "<<divimag<<endl;
	}
	else{
		cout<<"enter valid command";
	}

}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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 r1,i1,r2,i2;
	 char operation;
	 cin >> r1 >> i1 >> r2 >> i2 >> operation;
	 if(operation =='A'){
		 float r = r1 +r2;
		 float i = i1+i2;
		 cout<<fixed;
                 cout.precision(3);
		 cout << r << " " << i;
	 }
	 else if(operation == 'S'){
		 float r = r1-r2;
		 float i = i1-i2;
		 cout<<fixed;
                 cout.precision(3);
		 cout << r << " " << i;
	 }
	 else if(operation == 'M'){
                 float r = r2*r1 - i1*i2;
                 float i = r1*i2+r2*i1 ;
		 cout<<fixed;
                 cout.precision(3);
		 cout << r << " " << i;
         }
	 else if(operation == 'D'){
		 float k = pow(r2,2)+pow(i2,2);
                 float r = (r2*r1 + i1*i2)/k;
                 float i = (r2*i1-r1*i2)/k;
		 cout<<fixed;
		 cout.precision(3);
                 cout << r << " " << i;
         }
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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,i1,i2;
	cin>>r1>>i1>>r2>>i2;
         float sr,si;
       	char 0 ;
       switch(0){
	       case "A":{sr=r1+r2;
		     si=i1+i2; 
                      break;}
	       case "B":{sr=r1-r2;
		       si=i1-i2;
		       break;
		      }
	      cout<<sr" "<<"i"<<si<<endl;
       }
}

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

	switch(oper){
	case 'A':
		cout<<fixed;
		cout.precision(3);
		cout<<real1+real2<<" "<<imag1+imag2<<endl;
	          break;
	case 'S':
		  cout<<fixed;
		  cout.precision(3);
	       	cout<<real1-real2<<" "<<imag1-imag2<<endl;
               	break;
	case 'M':
         	cout<<fixed;
	        cout.precision(3);
        	cout<<real1*real2-imag1*imag2<<" "<<real1*imag2+real2*imag1<<endl;
         	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)<<endl;
	break;
	default:cout<<"invalid";
}
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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, x, y;	
	char op;
	cin >> a >> b >> x >> y >> op;
		cout << fixed;
		cout.precision(3);
		if (op== 'A'){cout <<float(a+x) << " " << float(b+y);}
		else if (op== 'S'){ cout << float(a-x) << " " << float(b-y);}
		else if (op=='M'){ cout << float(a*x-b*y) << " " << float(b*x+a*y);}
		else if (op== 'D'){ cout << float((a*x+b*y)/(x*x + y*y)) << " " << float((b*x-a*y)/(x*x+y*y));}
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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 operation;
	cin >> real1>>imag1>>real2>>imag2>>operation;
	if (operation == 'A') {
		cout << fixed;
		cout.precision(3); 
		cout << real1 + real2 << " " << imag1 + imag2;
	}

 	if (operation == 'S') {
	         cout << fixed;
       		 cout.precision(3);
                 cout << real1 - real2 << " " << imag1 - imag2;
        }
	
	if (operation == 'M') {
		cout << fixed;
		cout.precision(3);
		cout << (real1*real2)-(imag1*imag2) << " " << (imag1*real2)+(real1*imag2);
        }

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

}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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 a,b,c,d;
	char x;
	cin>>a>>b>>c>>d>>x;
	switch(x){
		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)/(pow(c,2)+pow(d,2))<<" "<<(b*c-a*d)/(pow(c,2)+pow(d,2));
			break;
		}
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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 o;
	float r1,r2,i1,i2;
	cin>>r1>>i1>>r2>>i2>>o;

        if(o=='A')
	cout<<r1+r2<<" "<<i1+i2;

	else if(0=='S')
		cout<<r1-r2<<" "<<i1-i2;
	else if(o=='M')
		cout<<(r1*r2-i1*i2)<<" "<<(r1*i2+r2*i1);
	else if(o=='D')
	{
		float s=pow(r2,2)+pow(i2,2);
		cout<<(r1*r2+i1*i2)/s<<" "<<(-r1*i2+r2*i1)/s;
	}

}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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 w=0,x,y,z,a,b;
	cin >>w >>x >>y >>z;
	cout <<w<<" "<<x<<" "<<y<<" "<<z<<" ";
	cout<<fixed;
	cout.precision(3);
	a=w+y;
	b=x+z;
	cout  <<a <<" "<<b;
wait(1);
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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{
	double  a,b,c,d,f,g;

	char e;
	cin >> a >> b >> c >> d >> e;
	
		if (e == 'A'){
		 f = a+c;
	         g = b+d;}
		else if(e == 'S'){
	         f = a-c;
                 g = b-d;}
		else if(e == 'M'){
                 f = a*c-b*d;
                 g = a*d + b*c;}
		else if(e == 'D'){
                 f = (a*c + b*d)/(c*c+d*d);
                 g = (b*c-d*a)/(c*c + d*d);
		}
		else{
		f=0;g=0;}	
cout <<fixed;
cout.precision(3);
cout << f << " " << g;
 }

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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>
using namespace std;


int main(){
	float real1,real2,imag1,imag2;
	
	char ch;
       cin>>real1>>imag1>>real2>>imag2>>ch;
       if(ch=='A'){
	       cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
	       cout<<real1+real2<<" "<<imag1+imag2;
	       }
       if(ch=='S'){
	       cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
	       cout<<real1-real2<<" "<<imag1-imag2;
	      }
       if(ch=='M'){

	   cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
	     cout<<((real1*real2)-(imag1*imag2))<<" "<<((imag1*real2)+(real1*imag2));
	      }
       if(ch=='D'){
	       cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
	       cout<<(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(imag1*real2-imag2*real1)/(real2*real2+imag2*imag2);
              
       }
   
}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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, real2, img1, img2;
	char oper;

	cin >> real1 >> img1 >> real2 >> img2 >> oper;
	cout << fixed;
	cout.precision(3);

	if (oper=='A'){
		cout << real1 + real2 << " " << img1 + img2 << endl;
	}
	else if (oper == 'S'){
		cout << real1 - real2 << " " << img1 - img2 << endl;
	}
	else if (oper == 'M'){
		cout << (real1*real2 - img1*img2) << " " << (real1*img2 + img1*real2) << endl;
	}
	else if (oper == 'D'){
		cout << (real1*real2 + img1*img2)/(real2*real2 + img2*img2) << " " << (img1*real2 - real1*img2)/(real2*real2 + img2*img2) << endl;
	}

}

Grading criterion: is division of complex numbers is correct implemented?
Rating A: if division of complex numbers is correctly written
Rating B: if the division of complex numbers 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 response;
	cin>>real1>>imag1>>real2>>imag2>>response;
	if(response=='A'){
		float x1=real1+real2;
		float y1=imag1+imag2;;
		cout<<fixed;
		cout.precision(3);
		cout<<x1<<" "<<y1<<endl;}
	if(response=='S'){
		float x2=real1-real2;
		float y2=imag1-imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<x2<<" "<<y2<<endl;}
	if(response=='M'){
		float x3=((real1*real2)-(imag1*imag2));
		float y3=((real1*imag2)+(real2*imag1));
		cout<<fixed;
		cout.precision(3);
		cout<<x3<<" "<<y3<<endl;}
	if(response=='D'){
		float x4=((real1*real2)+(imag1*imag2))/((real2*real2)+(imag2*imag2));
		float y4=((imag1*real2)-(real1*imag2))/((real2*real2)+(imag2*imag2));
		cout<<fixed;
		cout.precision(3);
		cout<<x4<<" "<<y4<<endl;}
}

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