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{
        int x = 3 ;
	int y = 4 ;
	int sum = x + y ;
	cout << sum ;                                                                                                                                                                                                                                                   
	return 0 ;
}

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 a,b,real1,imag1,real2,imag2;
	char op;

	cin>>real1>>imag1>>real2>>imag2;
	cin>>op;
	if(op==65){
		a=real1+real2;
		b=imag1+imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}
	else if(op==83){
		a=real1-real2;
		b=imag1-imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}

	else if(op==77){
		a=real1*real2-imag1*imag2;
		b=real1*imag2+real2*imag1;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}
	else if(op==68){
	a=(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2);
		b=(imag1*real2-imag2*real1)/(real2*real2+imag2*imag2);
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<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 {
double real1=1.000,imag1=1.000,real2=1.000,imag2=1.000;
char c;
cin>>real1>>imag1>>real2>>imag2>>c;
if(c=='A'){ cout<<real1+real2<<" "<<imag1+imag2;cout.precision(3);}
else if(c=='S'){cout<<real1-real2<<" "<<imag1-imag2;cout.precision(3);}
else if(c=='M'){cout<<real1*real2-imag1*imag2<<" "<<imag1*real2+real1*imag2;
cout.precision(3);}
else if(c=='D'){cout<<(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(imag1*real2-imag2*real1)/(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{
	float a,b,c,d;
	cin>>a>>b>>c>>d;

	char ch;
	cin>>ch;

	if(ch=='A'){
		cout<<fixed;
		cout.precision(3);
		cout<<a+c<<" "<<b+d;
	
	}

	else if(ch=='S'){
		cout<<fixed;
		cout.precision(3);
		cout<<a-c<<" "<<b-d;
		
	}

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

	else if(ch=='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));
		
	}

}

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 oper;
	cin>>real1>>imag1>>real2>>imag2>>oper;
	float a , b;
	if(oper=='A'){
		a= real1+real2;
		b=imag1+imag2;
	}
	else if(oper=='S'){
		a=(real1)-(real2);
		b=(imag1)-(imag2);
	}
	else if(oper=='M'){
		a=real1*real2 - imag1*imag2;
		b=real1*imag2+real2*imag1;
	}
	else if(oper=='D'){
		a=(real1*real2+imag1*imag2)/((real2*real2)+(imag2*imag2));
		b=(real2*imag1-real1*imag2)/((real2*real2)+(imag2*imag2));	
	
	}

	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
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,x,y;
	cin >> a >> b >> c >> d;
	x = a + b*i;
	y = c + d*i;
	if cin >> 'A'{ 
	cout << (a+c) << " " << (b+d) << 'i' << endl}
	else cin >> 'S' {
		cout << (c-a) << (d-b) << 'i' << endl}
	else cin >> 'M'{
		cout << (a*c - b*d) << (a*d + b*c) << 'i' << endl}
	else cin >> 'D'{
		cout <<  ((a*c + b*d)/(c*c-d*d)) << ((b*c-a*d)/(c*c-d*d)) << 'i' << 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 x;
     cin>>real1>>imag1>>real2>>imag2>>x;
     
      if(x=='A')
      {
	      cout << fixed;       // uses fixed floating point representation

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

              cout.precision(3); // print two digits after the decimal point.

              cout<<real1-real2<<" "<<imag1-imag2;
      }

       else if(x=='M')
       {      
	      cout << fixed;       // uses fixed floating point representation

              cout.precision(3); // print two digits after the decimal point.

              cout<<(real1*real2)-(imag1*imag2)<<" "<<(real1*imag2)+(imag1*real2);
       }

       else if(x=='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))<<" "<<-((real1*imag2)-(imag1*real2))/((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 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 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;
	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 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 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 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;
	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 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;
	 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 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,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 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,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 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, 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 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 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 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