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
{
	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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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  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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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 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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;
       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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;
	float realans,imagans;
	{
	cin>>real1>>" ">>imag1>>" ">>real2>>" ">>imag2>>endl;
	}

	realans = real1 + real2;
	imagans + imag1 + imag2;
	{
	cout>>realans>>" ">>imagans>>endl;
	}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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 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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;
	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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A