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,real,imag;
	cin>>real1>>imag1>>real2>>imag2;
	 char condition;
	cin>>condition;
	int x=condition;
	cout<<fixed;
	cout.precision(3);
	
	if (x==65){
		real= real1 + real2;
		imag = imag1 + imag2;
		cout<<real<<" "<<imag;
	}
	else if (x==77){
		real = real1*real2 - imag1*imag2;
		imag = real1*imag2 + real2*imag1;
		cout<<real<<" "<<imag;
	}
	else if (x==83){
		real = real1 - real2;
		imag= imag1 - imag2;
		cout<<real<<" "<<imag;
	}
	else if (x == 68){
		real =( real1*real2 +  imag1*imag2)/(pow(real2,2) +pow(imag2,2));
		imag= ( real2*imag1 - real1*imag2)/(pow(real2,2) + pow(imag2,2));
		cout<<real<<" "<<imag;
	}

}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
float r1, r2, i1, i2;
char c;
cin >> r1 >> i1 >> r2 >> i2 >> c;
if (c == "A") {
    float q = (r1 + r2); float w = (i1 + i2); 
    cout << q << " " << w << endl; }
if (c == "S") {
    cout << (r1 - r2) << " " << (i1 - i2) << endl; }
if (c == "M") {
    cout << (r1*r2 - i1*i2) << " " << (r1*i2 + r2*i1) << endl; }
if (c == "D") {
   cout << (r1*r2 + i1*i2)/(pow((r2*r2 + i2*i2), 0.5)) << " " << (i1*r2 - i2*r1)/(pow(exp(r2*r2 + i2*i2, 0.5))) << endl; }
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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 p,q,r,s;
	char a;
	cin>>p>>q>>r>>s>>a;
	float R,I;         //real and imaginary part outputs
	if (a==char('A')){
		R=p+r;
		I=q+s;
	}
	if (a==char('S')){
		R=p-r;
		I=q-s;
	}
	if (a==char('M')){
		R=(p*r)-(q*s);
		I=(p*s)+(q*r);
	}
	if (a==char('D')){
		R=((p*r)+(q*s))/(r*r+s*s);
		I=((q*r)-(p*s))/(r*r+s*s);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<R<<" "<<I;
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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;
	float b;
	float c;
	float d;
	char x;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	cin>>x;
	char A;char M;char S;char D;
	if (x==A){
		cout << fixed;
		cout.precision(3);
		cout<<a+c<<" "<<b+d;
	}
	if (x==S){
		cout << fixed;
		cout.precision(3);
		cout<<a-c<<" "<<b-d;
	}	
	if (x==M){
		cout << fixed;
		cout.precision(3);
		cout<<((a*c)-(b*d))<<" "<<((b*c)+(a*d));		
	}
	if (x==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 the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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;
       float b;
       float c;
       float d;
       char command;
       cin>>a>>b>>c>>d;

       cin>>command;


      // char k ='i';
      // int m,n;
      // m=a+k*b;
      // n=c+k*d;
      
     //  cin>>m>>n;

      if(command=='S')
      {
     cout<<fixed;
     cout.precision(3);



    // cout<<a*c<<" "<<b*d<<"M"<<endl;
    // cout<<a/c<<" "<<b/d<<"D"<<endl;
     cout<<(a-c)<<" "<<(b-d)<<endl;
   

}

else if (command=='M'){
	 cout<<fixed;
     cout.precision(3);


	 cout<<(a*c)-(b*d)<<" "<<(b*c)+(a*d)<<endl;
}
   else if (command=='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)))<<endl;
				 

}

 else{
           cout<<a+c<<" "<<b+d;
	   }
	   }

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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>
int main(){
	float a,b,c,d;

	char o;
	cin>>a>>b>>c>>d>>o;
	cout<<fixed;
	cout.precision(3);
	if(o=='A') cout<<a+c<<" "<<b+d;
	 if(o=='S') cout<<a-c<<" "<<b-d<<endl;
	 if(o=='D') cout<<(a*c+b*d)/(c*c+d*d)<<" "<<(b*c-a*d)/(c*c+d*d);
	 if(o=='M') cout<<a*c-b*d<<" "<<a*d+b*c;
	
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program
{
	float real1, real2, imag1, imag2;
        cout <<"real1"<<"real2"<<"imag1"<<"imag2";
	cin >> real1 >> real2 >> imag1 >> imag2;

	cout >> real1+real2 >>" ">> imag1+imag2 >>" ";
	cout >> real1-real2 >>" ">> imag1-imag2 >>" ";
	cout >> real1*real2 >>" ">> imag1*imag2 >>" ";
	cout >> real1/real2 >>" ">> imag1/imag2 >>" ";
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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 a1,b1,a2,b2;
	cin >> a1 >>b1 >>a2 >>b2;
	char op;
	cin >>op;
	if (op=='A'){
		cout << fixed;
		cout.precision(3);
		cout <<a1+a2 <<" " <<b1+b2;
		}
	if (op=='S'){
		cout<< fixed;
		cout.precision(3);
		cout <<a1-a2 <<" " <<b1-b2;
	
	}
	if (op=='M'){
		cout<< fixed;
		cout.precision(3);
		cout <<a1*a2-b1*b2 <<" " <<a1*b2+a2*b1;
	
	}
	if (op=='D'){
		cout<< fixed;
		cout.precision(3);
		cout <<(a1*a2+b1*b2)/(a2*a2+b2*b2) <<" " <<(-a1*b2+a2*b1)/(a2*a2+b2*b2);
	}	
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include <simplecpp>
main_program{
float r1,i1,r2,i2;
char o,A,S,M,D;
cin>>r1;
cin>>i1;
cin>>r2;
cin>>i2;
cin>>o;
if(o==A){
cout<<fixed;
cout.precision(3);
cout<<r1+r2<<" "<<i1+i2;
}
else if(o=S){
cout<<fixed;
cout.precision(3);
cout<<r1-r2<<" "<<i1-i2;
}
else if(o==M){
cout<<fixed;
cout.precision(3);
cout<<r1*r2<<" "<<i1*i2;
}
else if(o==D){
cout<<fixed;
cout.precision(3);
cout<<r1/r2<<" "<<i1/i2;
}
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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,a,b;
	char command;
	cout<<fixed;
	cout.precision(3);
	cin>>real1;
	cout<<" ";
	cin>>imag1;
	cout<<" ";
	cin>>real2;
	cout<<" ";
	cin>>imag2;
	cout<<" ";
	cin>>command;
	if(command=='A'){
		
		a=real1+real2;
		b=imag1+imag2;
	        cout<<a;
		cout<<" ";
	        cout<<b;   
		
	}
	else if(command=='S'){
		a=real1-real2;
		b=imag1-imag2;
		cout<<a;
		cout<<" ";
	        cout<<b;
		
		
	}
	else if(command=='M'){
		
		a=real1*real2-imag1*imag2;
		b=imag1*real2+imag2*real1;
		cout<<a;
		cout<<" ";
	        cout<<b;
		
	}
	else if(command=='D'){
		a=(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2);
		b=(imag1*real2-imag2*real1)/(real2*real2+imag2*imag2);
		cout<<a;
		cout<<" ";
		cout<<b;
		
	}
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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 p; cin>>p;
	if(p=='A'){
		float real= a+c;
		float imag= b+d;
		
		cout<<fixed;
		cout.precision(3);
		cout<<real<<" "<<imag;
	}
	if(p=='S') {
		float real=a-c;
		float imag=b-d;
		
		cout<<fixed;
		cout.precision(3);
		cout<<real<<" "<<imag;
	}
	if(p=='M') {
		float real=a*c-b*d;
		float imag=a*d+b*c;
		
		cout<<fixed;
		cout.precision(3);
		cout<<real<<" "<<imag;
	}
	if(p=='D') {
		float real=(a*c+b*d)/(c*c+d*d);
		float imag=(b*c-a*d)/(c*c+d*d);
		
		cout<<fixed;
		cout.precision(3);
		cout<<real<<" "<<imag;
	} 
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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;
	cin>>real1>>imag1>>real2>>imag2;
	char ch;
	cin>>ch;
	cout<<fixed; cout.precision(3);
	switch(ch)
	{
		case 'A': cout<<(real1+real2)<<" "<<(imag1+imag2);
			break;
		case 'S':cout<<(real1-real2)<<" "<<(imag1-imag2);
			break;
		case 'M': cout<<real1*real2-imag1*imag2<<" "<<real1*imag2+real2*imag1;
			break;
		case 'D': cout<<(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(real1*(-1)*imag2+real2*imag1)/(real2*real2+ imag2*imag2);
			break;
	}
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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;
	cin>>real1>>imag1>>real2>>imag2;
	char x;
	cin>>x;
	float real,imag;
	float sum2=pow(real2,2)+pow(imag2,2);

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

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float r1,i1,r2,i2;
	cin >> r1>>i1>>r2>>i2;
	char command;
	cin >> command;
        cout << fixed;
	cout.precision(3);
	switch (command){
		case 'A'  : cout << r1+r2 << ' ' << i1+i2<<endl;
			   break;
	        case 'S' : cout << r1-r2 << ' ' << i1-i2<<endl;
			   break;
		case 'M' : cout << r1*r2 - i1*i2 << ' ' << r1*i2 + r2*i1 <<endl;
			   break;
		case 'D' : cout << (r1*r2 + i1*i2)/(r2*r2 + i2*i2) << ' ' << (r2*i1 - r1*i2)/(r2*r2 + i2*i2)<<endl;
			   break;
	}
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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 operation;
	cin >> real1 >> imag1 >> real2 >> imag2;
	cin >> operation;
	cout << fixed;
	cout.precision(3);
	if (operation == 'A'){
		float m = real1 + real2;
	        float n = imag1 + imag2;
		cout << m << " " << n <<endl;
	}
	else if (operation == 'S'){
		float m = real1 - real2;
		float n = imag1 - imag2;
		cout << m << " " << n <<endl;
	}
	else if (operation == 'M'){
		float m = real1*real2;
		float n = imag1*imag2;
		float p = real1*imag2;
		float q = imag1*real2;
		cout << m-n << " " << p+q <<endl;
	}
	else if (operation == 'D'){
		if(imag2 == 0 && real2 !=0){
			float m = real1/real2;
		        float n = imag1/real2;
			cout << m << " " << n <<endl;
		}
		else if(imag2 != 0){
			float m = real2*real2 + imag2*imag2;
			float p = (real1*real2) - (imag1*(-imag2));
			float n = (real1*(-imag2)) + (imag1*real2);
			cout << p/m << " " << n/m <<endl;
		}
		else if(real2 == 0 && imag2 == 0){
			cout << NAN <<endl;
		}
	}
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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, y; 
	cin>>a>>b>>c>>d; //complex numbers of the form a+ib and c+id
	char x;
	cin >>x;
	y=pow(c,2)+pow(d,2);
	
	cout<<fixed;
	cout.precision(3);
	
	if (x=='A') { cout<<a+c<<" "<<b+d<<'\n';
		}
	if (x=='S') { cout<<a-c<<" "<<b-d<<'\n';
		}
	if (x=='M') { cout<<a*c-b*d<<" "<<a*d+b*c<<'\n';
		}
	if (x=='D') { cout<<(a*c+b*d)/y<<" "<<(b*c-a*d)/y<<'\n';
		}
		
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
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{
	cout<<fixed;
	cout.precision(3);
	float a,b,c,d,e,f;
	char v;
	cin>>a>>b>>c>>d>>v;
	if(v=='A')
	{
		e=a+c;
		f=b+d;
	}
	else
	{
		if(v=='S')
		{
			e=a-c;
			f=b-d;
		}
		else{
			if(v=='M')
			{
				e=(a*c)-(b*d);
				f=(a*d)+(b*c);
			}
			else{
				if(v=='D')
				{
					e=((a*c)+(b*d))/((c*c)+(d*d));
					f=((b*c)-(a*d))/((c*c)+(d*d));
				}
			}
		}
	}
	cout<<e<<" "<<f<<endl;
}

Grading criterion: is the code checking whether the real and imaginary parts are zero or not for division operation?
Rating A: if the code submission is checking the above case
Rating B: if the code submission is not checking
Rating C: 0
Rating D: 0
Assigned grade: B