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{
	double a,b,c,d;
	cin>>a>>b>>c>>d;
	char O;
	cin>>O;
	double M1 = ((a*c) - (b*d));
	double M2 = ((a*d) + (b*c));
	double D1 = ((a*c)+(b*d))/(pow(c,2) +pow(d,2));
        double D2 = ((c*b)-(a*d))/(pow(c,2) + pow(d,2)); 
	if(O=='A') cout<<fixed, cout.precision(3), cout<<(a+c)<<" "<<(b+d)<<endl;
	else if (O=='S') cout<<fixed, cout.precision(3), cout<<(a-c)<<" "<<(b-d)<<endl;
	else if (O=='M') cout<<fixed, cout.precision(3), cout<<M1<<" "<<M2<<endl;
	else if	(O=='D') cout<<fixed, cout.precision(3), cout<<D1<<" "<<D2<<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 a1 , b1 , a2 , b2  ;
	char x=A,x=S,x=D,x=M;
	cin>>a1;
	cin>>b1;
	cin>>a2;
	cin>>b2;
	cin>>x;
	if(x==A);
       	cout<<a1+a2<<" "<<b1+b2;
	if(x==S);
       	cout<<a2-a1<<" "<<b2-b1;
	if(x==M) ;
       	cout<<a1*a2-b1*b2<<" "<<a1*b2+b1*a2;
	       if(x==D);
	       cout<<(a1*a2+b1*b2)/(a2*a2+b2*b2)<<" "<<(a2*b1-a1*b2)/(a2*a2+b2*b2);
}

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,c,d;
       cin>>a>>b>>c>>d;

       char A,S,M,D;

       
       int i = sqrt(-1);
       int t;
       cin>>t;
       t=A || S || M || D;

       if(t==A){cout<< (a+d)<<"+"<<(c+b)*i;
	      }
       if(t==S){cout<<(a-d)<<"+"<<(c-d);
       }
       if(t==M){cout<<(a*c-b*d)<<"+"<<(a*d+b*c);
       }
       if(t==D){cout<<(a*c-b*d)+(a*d+b*c)/pow((c +i*d),2);
       } 

 
       cout<<endl;
       return 0;
}

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,imag1,real2,imag2;
	float realans,imagans;
	{
	cin>>real1>>" ">>imag1>>" ">>real2>>" ">>imag2>>endl;
	}

	realans = real1 + real2;
	imagans + imag1 + imag2;
	{
	cout>>realans>>" ">>imagans>>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 a,b,c,d,e,f;
	cin>>a>>b>>c>>d;

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

	}
	else if(x=='D'){
		e=(a*c+b*d)/(c*c+d*d);
		f=(c*b-a*d)/(c*c+d*d);
                cout<<fixed;
                cout.precision(3);
                cout<<e<<" "<<f;

	}
}

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 {
	cout << fixed;
	cout.precision(3);
	double r1, i1, r2, i2;
	char o;
	cin >> r1 >> i1 >> r2 >> i2 >> o;
	if(o == 'A') {
		double r, i;
		r = r1 + r2;
		i = i1 + i2;
		cout << r << ' ' << i;
	}

	if(o == 'M') {
		double r, i;
		r = r1*r2 - i1*i2;
		i = r1*i2 + i1*r2;
		cout << r << ' ' << i;
	}	
	if(o == 'S') {
		double r, i;
		r = r1 - r2;
		i = i1 - i2;
		cout << r << ' ' << i;
	}
	if(o == 'D') {
		double mr, mi;
		i2 = -i2;
		mr = r1*r2 - i1*i2;
		mi = r1*i2 + i1*r2;
		mr = mr/((r2*r2) + (i1*i1));
		mi =  mi/((r2*r2) + (i1*i1));
		cout << mr << ' '<< mi;
	}

}

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;
	double real3, imag3,a,b,c,d;
	char com;
	cin>>real1>>imag1>>real2>>imag2>>com;
	a = real1*real2;
	b =imag1*imag2;
	c = real1*imag2;
	d = real2*imag1;

	if(com=='A'){
		real3 = real1 +real2;
		imag3 = imag1 +imag2;
	}
	else if(com = 'S'){
		real3= real1 - real2;
		imag3= imag1-imag2;
	}
	else if(com='M'){
		real3= a- b;
		imag3= c +d;
	}
	else if(com='D'){
		real3= (a + b)/((real2*real2) +(imag2*imag2));
		imag3 = (c - d)/((real2*real2) +(imag2*imag2));
	}
	cout<<fixed;
	cout.precision(3);
	cout<<real3<<" "<<imag3;
}

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{
	char f;
	double r1,i1,r2,i2;
	cin>>r1>>i1>>r2>>i2>>f;
	if(f=='A'){
		double a1=r1+r2;
		double a2=i1+i2;
		cout<<a1<<" "<<a2<<endl;}
	else if(f=='S'){
		double s1=r1-r2;
		double s2=i1-i2;
		cout<<s1<<" "<<s2<<endl;}
	else if(f=='M'){
		double m1=r1*r2-i1*i2;
		double m2=r1*i2+r2*i1;
		cout<<m1<<" "<<m2<<endl;}
	else if(f=='D'){
		double d1=(r1*r2+i1*i2)/(pow(r2,2)+pow(i2,2));
		double d2=(r2*i1-r1*i2)/(pow(r2,2)+pow(i2,2));
		cout<<d1<<" "<<d2<<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;
	float imag1;
	float real2;
	float imag2;
	char command;
	cin>>real1>>imag1>>real2>>imag2>>command;
	switch(command){
		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;

	
	}}

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)<<" "<<(real1*imag2)+(real2*imag1);
	}
	if(operation == '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 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, c, d;
	char op;
	float ansr, ansi;
	cin >> a >> b >> c >> d;
	cin >> op;
	if (op == 'A')
	{
		ansr = a + c;
		ansi = b + d;
	}
	else if (op == 'S')
	{
		ansr = a - c;
		ansi = b - d;
	}
	else if (op == 'M')
	{
		ansr = a*c - b*d;
		ansi = a*d + b*c;
	}
	else if (op == 'D')
	{
		float den = c*c + d*d;
		ansr = (a*c + b*d)/den;
		ansi = (b*c - a*d)/den;
	}
	else
		cout << "invalid input";
	cout << fixed; cout.precision(3); cout << ansr; cout << " ";
	cout << fixed; cout.precision(3); cout << ansi;
}

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 c;
	cin>>real1>>imag1>>real2>>imag2>>c;
	if(c=='A')
	{
		float reala=real1+real2;
		float imaga=imag1+imag2;
		cout<<fixed;cout.precision(3);
		cout<<reala<<" "<<imaga;
	}
	else if(c=='S')
	{
		float reala=real1-real2;
		float imaga=imag1-imag2;
		cout<<fixed;cout.precision(3);
		cout<<reala<<" "<<imaga;
	}
	else if(c=='M')
	{
		float reala=real1*real2-imag1*imag2;
		float imaga=real1*imag2+real2*imag1;
		cout<<fixed;cout.precision(3);
		cout<<reala<<" "<<imaga;
	}
	else if(c=='D')
	{
		float reala=(real1*real2+imag1*imag2)/(real2*real2-imag2*imag2);
		float imaga=(real2*imag1-real1*imag2)/(real2*real2-imag2*imag2);
		cout<<fixed;cout.precision(3);
		cout<<reala<<" "<<imaga;
	}
}

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, imag1, real2, imag2;
	char a;
	cin>>real1>>imag1>>real2>>imag2>>a;
	cout << fixed;
	cout.precision(3);
	switch(a){
		case 'A':{
			 float c,d;
			 c=real1+real2;
			 d=imag1+imag2;
			 cout<<c<<' '<<d;
			 break;
			 }
		case 'S':{
			float c,d;
                         c=real1-real2;
                         d=imag1-imag2;
                         cout<<c<<' '<<d;
			 break;
			 }
		case 'M':{
			float c,d;
			c=(real1*real2-imag1*imag2);
			d=(imag1*real2+imag2*real1);
			cout<<c<<' '<<d;
			break;
			 }
		case 'D':{
			float c,d;
			c=(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2);
			d=(imag1*real2-imag2*real1)/(real2*real2+imag2*imag2);
			cout<<c<<' '<<d;
			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{
	float a,b,c,d ;
	cin >> a >> b >> c >> d ;
	char k ;
	cin >> k ;
	if(k=='A')
	{cout << fixed ;
		cout.precision(3) ;
		cout << a+c << " " << b+d ;
	}
	else if ( k=='S')
	{cout << fixed ;
                cout.precision(3) ;
		cout << a-c << " " << b-d ;
	}
	else if ( k=='M')
	{cout << fixed ;
                cout.precision(3) ;
		cout << (a*c)-(b*d) << " " << (a*d)+(b*c) ;
	}
	else if ( k=='D')
	{ cout << fixed ;
                cout.precision(3) ;
		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{
cout << fixed;
cout.precision(3);
       
	float p=0.000,q=0.000,r=0.000,s=0.000;
 cin>>p>>q>>r>>s; 
 char k;
 cin>>k;
  if(k=='A'){cout<<p+r<<" "<<q+s;}
  else if(k=='S'){cout<<p-r<<" "<<q-s;}
  else if(k=='M'){cout<<(p*r) -(q*s)<<" "<<(p*s)+(r*q);}
  else if(k=='D'){cout<<((p*r)+(q*s))/(pow(r,2)+pow(s,2))<<" "<<((q*r)-(p*s))/(pow(r,2)+pow(s,2));}

}

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, i1, r2, i2;
	char operation;
	cin >> r1 >> i1 >> r2 >> i2 >> operation ;
	
	operation=A ? cout<< r1+r2 <<" "<< i1+i2 :
	operation=S ? cout<< r1-r2 <<" "<< i1-i2 :
	operation=M ? cout<< (r1*r2)-(i1*i2) <<" " << (r2*i1)+(r1*i2):
	operation=D ? cout<<( (r1*r2)+(i1*i2))/(r2*r2+i2*i2)<< " " <<((r2*i1)-(r1*i2))/(r2*r2+i2*i2) : cout<< 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 a, b, c, d;    //complex numbers of the form a+bi annd c+di
	char x;
	cin>>a>>b>>c>>d>>x;
	if (x=='A'){          //addition of complex numbers
		cout<<fixed;   //uses fixed floating point representation
		cout.precision(3);  //print two digits after the decimal point
		cout<<a+c<<" "<<b+d;
	}
	if (x=='S'){            //subtraction fo complex numbers
		cout<<fixed;
		cout.precision(3);
		cout<<a-c<<" "<<b-d;
	}
	if (x=='M'){            //multiplication of complex numbers
		cout<<fixed;
		cout.precision(3);
		cout<<a*c-b*d<<" "<<b*c+a*d;
	}
	if(x=='D'){          //division of complex numbers
	cout<<fixed;
	cout.precision(3);
	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