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 command;
	cin>>real1>>imag1>>real2>>imag2>>command;
	cout<<fixed;
	cout.precision(3);
	if(command=='A') {
	   cout<<(real1+real2)<<" "<<(imag1+imag2)<<endl;
	}
	if(command=='S') {
           cout<<(real1-real2)<<" "<<(imag1-imag2)<<endl;
	}
	if(command=='M') {
	   cout<<((real1*real2)-(imag1*imag2))<<" "<<((real1*imag2)+(real2*imag1))<<endl;
			   }
	if(command=='D') {
	   cout<<((real1*real2)+(imag1*imag2))/((real2*real2)+(imag2*imag2))<<" "<<((real2*imag1)-(real1*imag2))/((real2*real2)+(imag2*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,A,S,M,D;
	char x;
        cout<<fixed;
        cout.precision(3);
	cin>>a>>b>>c>>d>>x;
	if(x == A){
		cout<<a+b<<" "<<c+d<<" "<<endl;
	}
	else if(x == S){
	       cout<<a-c<<" "<<b-d<<" "<<endl;
	}
	else if(x == M){
		cout<<a*c - b*d<<" "<<b*c + a*d<<endl;
	}
	else if(x == D){
		cout<<a*c/(c*c + d*d) +b*d/(c*c + d*d)<<" "<<b*c/(c*c + d*d) - a*d/(c*c + d*d)<<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, real2, imag2;
char var;
cin>>real1>>imag1>>real2>>imag2>>var;
if(var=='A'){
cout<<fixed;
cout.precision(3);
cout<<real1+real2<<" "<<imag1+imag2;}
else if(var=='S')
{
	cout<<fixed;
cout.precision(3);
cout<<real1-real2<<" "<<imag1-imag2;
}
else if(var=='M')
{
	cout<<fixed;
cout.precision(3);
cout<<real1*real2-imag1*imag2<<" "<<real1*imag2+real2*imag1;
}
else if(var=='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=0,b=0,c=0,d=0;
	char  n;
	cin >> a >> b >> c >> d >> n;
	if( n=='A'){
		cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
		cout << (a+c) << " "<< (b+d);}
		
	if(n=='S'){
	cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
		cout << (a-c) << " "<< (b-d);}
		
	if (n=='M'){
	cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
		cout << ((a*c)-(b*d)) << " "<< ((a*d)+(b*c));}
		
	if (n=='D'){
	cout << fixed;
// uses fixed floating point representation
cout.precision(3); // print two digits after the decimal point.
		cout <<( ((a*c)+(b*d))/((c*c)+(d*d))) << " " << ((a*d)+(b*c));}
		

}

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;
	cin>>a;

	float real3,imag3;
   	
	if(a == 'A')
	{
		real3 = real1+real2;
		imag3 = imag1+imag2;
	}

	else if(a == 'S')
	{
		real3 = real1-real2;
		imag3 = imag1-imag2;
	}

	else if(a == 'M')
	{
		real3 = real1*real2 -imag1*imag2;
		imag3 = real2*imag1 + real1*imag2;
	}

	else if(a == 'D')
	{
		real3 = (real1*real2 + imag1*imag2)/(real2*real2 + imag2*imag2);		imag3 = (imag1*real2 - real1*imag2)/(real2*real2 + imag2*imag2);	}

	cout<<real3; cout.precision(3);
	cout<<" ";
	cout<<imag3; cout.precision(3);
	cout<<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{
	int a,b,i,c,d;
	cout <<" a + c" <<" b i + d i";
	cin >>a>>b>>i>>c>>d>>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: 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{
	int a,b,c,d;
	cin >> a >> b >> c >>d;
	char command;
	cin>> command;
	if (command =='A')(
	 cout << a>c <<" "<< b>d<<endl;
	 cout.precison(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: 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 i;
	cin>>a>>b>>c>>d>>i;
	        cout<<fixed;
        cout.precision(3);
	float p,q;
	switch(i)
	{
       		case 'A' : p=a+c;
                           q=b+d;
                           break;
                case 'S' :p=a-c;
                          q=b-d;
                        break;
                case 'M': p=a*c-b*d;
                          q=a*d+b*c;
                        break;
                case 'D' : p=(a*c+b*d)/(sqrt(c*c+d*d));
                           q=(b*c-a*d)/(sqrt(c*c+d*d));
                        break;

        }
	cout<<p<<" "<<q;
}

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,img1,real2,img2;
	char letter;
	cin>>real1 >> img1 >> real2 >> img2;
	cin>>letter;
	switch(letter){
		case 'A': cout<<fixed;
			  cout.precision(3);
			  cout<< real1+real2<< " "<< img1+img2<<endl;break;
	        case 'S': cout<<fixed;
			  cout.precision(3);
			  cout<< real1-real2<< " "<< img1-img2<<endl;break;
	        case 'M': cout<<fixed;
			  cout.precision(3);
			  cout<< real2*real1 - img2*img1<< " "<< real2*img1 + img2*real1<<endl;break;
	        case 'D': cout<<fixed;
			  cout.precision(3);
			  cout<< (real2*real1 + img2*img1)/(real2*real2 + img2*img2) << " "<<  (real2*img1 - img2*real1)/ (real2*real2 + img2*img2)<<endl;break;
}
}

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,p,q;
	char z;
	cin>>real1>>imag1>>real2>>imag2>>z;
	if(z=='A'){
		p= real1 + real2;
		q= imag1+imag2;
	}
	else if ( z=='S'){
		p=real1 - real2;
		q=imag1 -imag2;
	}
	else if( z=='M'){
		p=(real1*real2)-(imag1*imag2);
		q=( real1*imag2)+(real2*imag1);
	}
	else if(z=='D'){
		p=(( real1*real2)+( imag1* imag2))/(pow( real2,2)+pow( imag2,2));
		q=((imag2* real1)-(real1*imag2))/(pow(real2,2)+pow(imag2,2));
	}
	cout<<p;cout.precision(3);
        cout<<" ";
        cout<<q;cout.precision(3);	
}

Grading criterion: if division takes place if D is passed as input
Rating A: if division takes place correctly if D is passed
Rating B: if any other function executed other than division
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>
int main(){
	//taking inputs
	float x1,y1,x2,y2,x3,y3;
	cin >> x1 >> y1 >> x2 >> y2;
	char command;
	cin >> command;

	if(command=='A'){
		x3=x1+x2;
		y3=y1+y2;
	}
	if(command=='S'){
		x3=x1-x2;
		y3=y1-y2;
	}
	if(command=='M'){
		x3=x1*x2-y1*y2;
		y3=x1*y2+x2*y1;
	}
	if(command=='D'){
		x3=(x1*x2+y1*y2)/(x2*x2+y2*y2);
		y3=(x2*y1-x1*y2)/(x2*x2+y2*y2);
	}
	cout << fixed; cout.precision(3);
	cout << x3 << " " << y3;
}

Grading criterion: if division takes place if D is passed as input
Rating A: if division takes place correctly if D is passed
Rating B: if any other function executed other than division
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; // a is r1,b is i1,c is r2,d is i2
	cin>>a>>b>>c>>d;
   char oper;
   cin>>oper;
   
   if(oper == 'A'){
	   	cout<<fixed;
		cout.precision(3);
	   cout<<a+c<<" "<<b+d;
   }
   if(oper == 'S'){
	   cout<<fixed;
	   cout.precision(3);
	   cout<<a-c<<" "<<b-d;
   }
   if(oper == 'M'){
	   cout<<fixed;
	   cout.precision(3);
	   cout<<a*c -b*d <<" "<<a*d + b*c;
   }
   if (oper == 'D'){
	   cout<<fixed;
	   cout.precision(3);
	   cout<<(a*c +b*d) /(c*c +d*d) <<" "<<(b*c -a*d)/(c*c +d*d);
   }
   cout<<endl;
}

Grading criterion: if division takes place if D is passed as input
Rating A: if division takes place correctly if D is passed
Rating B: if any other function executed other than division
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 a1, b1, a2, b2;
char x;
cin>> a1;
cin>> b1;
cin>> a2;
cin>> b2;
cin>>x;
cout<<fixed; cout.precision(3);
if(x=='A')
{cout<<a1+a2<<" "<<b1+b2<<endl;}
else if(x=='S')
{cout<<a1-a2<<" "<<b1-b2<<endl;}
else if(x=='M')
{cout<<(a1*a2)-(b1*b2)<<" "<<(a1*b2)+(a2*b1)<<endl;}
else if(x=='D')
{cout<<((a1*a2)+(b1*b2))/((a2*a2)+(b2*b2))<<" "<<((a2*b1)-(a1*b2))/((a2*a2)+(b2*b2))<<endl;
}
}

Grading criterion: if division takes place if D is passed as input
Rating A: if division takes place correctly if D is passed
Rating B: if any other function executed other than division
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,p,q;

     cin >> a >> p >> b >> q;     //  a and b are Real & p and Img
     cout <<"A"<<endl;

      cout << a+b <<" "<< p+q <<" "<<endl;

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

Grading criterion: if division takes place if D is passed as input
Rating A: if division takes place correctly if D is passed
Rating B: if any other function executed other than division
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 r; // A, S, M, D;
	
	cin>>real1>>imag1>>real2>>imag2>>r;

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

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




}





























/*	switch(r){
		case A : {
			cout<<(real1+real2)<<" " <<(imag1+imag2)<<endl;
			break;
		}

		case S : {
			cout<<(real1-real2)<<" "<<(imag1-imag2)<<endl;
			break;}

		case M : {
			cout<<(real1*real2 - imag1*imag2)<<" "<<(real1*imag2 + real2*imag1)<<endl;
			break;}
		case D : {
			cout<<((real1*real2 + imag1*imag2)/(real2*real2 + imag2*imag2))<< " "<< ((real2*imag1 - imag2*real1)/(real2*real2+imag2*imag2))<<endl;
			break;}
	}}
	
*/

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

       }

}

Grading criterion: if division takes place if D is passed as input
Rating A: if division takes place correctly if D is passed
Rating B: if any other function executed other than division
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,sum1,sum2,sub1,sub2,mul1,mul2,div1,div2;
	char w,A='A',S='S',D='D',M='M';
	
	cin >> a >> b >> x >> y;
	cin >> w;
	sum1=a+x;
	sum2=b+y;
	sub1=a-x;
	sub2=b-y;
	mul1=(a*x)-(b*y);
	mul2=(a*y)+(b*x);
	div1=((a*x)+(b*y))/((x*x)+(y*y));
	div2=((b*x)-(a*y))/((x*x)+(y*y));

	

	if(w==A)
	{	cout<<fixed;
		cout.precision(3);
		cout << sum1 << " " << sum2 << endl;
	}
	if(w==S)
	{	cout<<fixed;
		cout.precision(3);
		cout << sub1 << " " << sub2 << endl;
	}
	if(w==M)
	{	cout<<fixed;
		cout.precision(3);
		cout << mul1 << " " << mul2 << endl;
	}
	if(w==D)
	{	cout<<fixed;
		cout.precision(3);
		cout << div1 << " " << div2 << endl;
	}	
}

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