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 x1,y1,x2,y2;
	char x;
	cin >> x1 >> y1 >> x2 >> y2 >> x;
	if (x=='A'){
		float a,b;
		a = (x1)+(x2);
		b = (y1)+(y2);
		cout <<fixed;
		cout.precision(3);
		cout << (a) <<" " <<(b);
	}
	else if(x=='S'){
		float a,b;
		a=(x1)-(x2);
		b=(y1)-(y2);
		cout<<fixed;
		cout.precision(3);
		cout<<(a)<<" "<<(b);
	}
	else if(x=='M'){
		float a,b;
		a=((x1)*(x2))-((y1)*(y2));
		b=((x1)*(y2))+((x2)*(y1));
		cout <<fixed;
		cout.precision(3);
		cout << (a)<<" "<<(b);
	}
	else if(x=='D'){
		float a,b;
		a=((((x1)*(x2))+(((y1)*(y2))))/((pow(x2,2))+(pow(y2,2))));
		b=((-((x1)*(y2))+((x2)*(y1)))/((pow(x2,2))+(pow(y2,2))));
		cout<<fixed;
		cout.precision(3);
		cout<<(a)<<" "<<(b);
		}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 e,A,S,M,D;
	cin >>a>>b>>c>>d>>e;
	{if(e==A); 
Then; cout << a+c<<" "<<b+d<<endl;
	else
		(e==S);
Then; cout << c-a<<" "<<d-b<<endl;
	else
		(e==M);
		Then; cout <<(a*c-b*d)<<" "<<(a*d+b*c)<<endl;
	else
		(e==D);
		Then; cout <<(a*c+b*d)/(c*c+d*d)<<" "<<endl;
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 w,x,y,z,sum1,sum2;
	cin>>w>>x>>y>>z;//first number is w+xi
				       //second number is y+zi
	sum1=w+y;
	sum2=x+z;
	cout<<sum1<<sum2;
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 command;
	float a,b,c,d;
	cin>>a>>b>>c>>d;
	cin>>command;
	switch(command){
		case 'A':cout<<fixed;
		       cout.precision(3);
		       cout<<a+c<<" "<<b+d;
		       break;
		case 'S':cout<<fixed;
		  cout.precision(3);
			 cout<<a-c<<" "<<b-d;
			 break;
		case 'M':cout<<fixed;
			 cout.precision(3);
			 cout<<a*c-b*d<<" "<<b*c+a*d;
			 break;
		case 'D':cout<<fixed;
			 cout.precision(3);
			 cout<<(a*c+b*d)/(c*c+d*d)<<" "<<(b*c-a*d)/(c*c+d*d);
			 break;


	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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,e,f;
	char ch;
	cin >>a>>b>>c>>d>>ch;
	switch(ch)
	{
	case 'A': 
	{
		e = a+c;
		f = b+d;
		break;
	}
	case 'S':
	{
		e = a-c;
		f = b-d;
		break;
	}
	case 'M':
	{
		e = a*c - b*d;
		f = a*d + b*c;
		break;
	}
	case 'D':
	{
		e = (a*c + b*d)/(c*c+d*d);
		f = (b*c - a*d)/(c*c+d*d);
		break;
	}

	}
	cout<<fixed;
	cout.precision(3);
	cout<<e<<" "<<f;
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 oper;
	float a, b;

	cin >> r1 >> i1 >> r2 >> i2 >> oper;

	if ( oper == 'A' )
	{
		a = r1 + r2;
		b = i1 + i2;
	}

	if ( oper == 'S' )
	{
		a = r1 - r2;
		b = i1 - i2;
	}

	if ( oper == 'M' )
	{
		a = r1*r2 - i1*i2;
		b = i2*r1 + i1*r2;
	}

	if ( oper == 'D' )
	{
		float d = r2*r2 + i2*i2;
		a = ( r1*r2 + i1*i2 ) / d;
		b = ( i1*r2 - i2*r1 ) / d;
	}

        cout << fixed;
	cout.precision(3);
	cout << a << " " << b;
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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,A1,S1,M1,D1,A2,S2,M2,D2;
	cin >> real1 >> imag1 >> real2 >> imag2;
	A1 = real1 + real2;
	A2 = imag1 + imag2;
	S1 = real2 - real1;
	S2 = imag2 - imag1;
	M1 = real1*real2;
	M2 = imag1*imag2;
	D1 = real1/real2;
	D2 = imag1/imag2;
	cout<<fixed;
	cout.precision(3);
	cout << A1 << " " << A2 << " ";
	cout << S1 << " " << S2 <<" ";
	cout << M1 << " " << M2 <<" ";
	cout << D1 << " " << D2 <<" ";
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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;
	cin>>p>>q>>r>>s;
	char t;
	cin>>t;
	int f=t;
	if(f==65){
		float a=p+r;
		float b=q+s;
		cout<<fixed;
		cout.precision(3);
		cout <<a<<" " <<b;
	}
	else if (f==83){
		float u=p-r;
		float y=q-s;
		cout<<fixed;
		cout.precision(3);
		cout <<u<<" " <<y;
	}
	else if (f==77){
		float d=((p*r)-(q*s));
		float e=((p*s)+(q*r));
		cout<<fixed;
		cout.precision(3);
		cout <<d<<" " << e ;
	}
	else{
		float w=((p*r)+(s*q))/(r*r+s*s);
		float c=((r*q)-(p*s))/(r*r+s*s);
		cout<<fixed;
		cout.precision(3);
		cout<<w<<" "<<c;
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 a;
	cin>>real1>>imag1>>real2>>imag2>>a;
	if(a=='A')
        {
		p=real1+real2;
	        q=imag1+imag2;
		}
        else if(a=='S')
	{
		p=real1-real2;
	        q=imag1-imag2;
		}
	else if(a=='M')
	{
		p=(real1*real2)-(imag1*imag2);
		q=(real1*imag2)+(real2*imag1);
		}
	else if(a=='D')
	{
		p=((real1*real2)+(imag1*imag2))/(pow(real2,2)+pow(imag2,2));
		q=((imag1*real2)-(real1*imag2))/(pow(real2,2)+pow(imag2,2));
		}
        cout<<fixed;
        cout.precision(3);
	cout<<p;
	cout<<" ";
	cout<<fixed;
	cout.precision(3);
	cout<<q;
	}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 l;
	cin>>a>>b>>c>>d>>l;
	switch(l){
		case 'A':
			cout<<fixed;
			cout.precision(3);
			cout<<a+c<<" "<<b+d;
			break;
		case 'S':
		        cout<<fixed;
                        cout.precision(3);
                        cout<<a-c<<" "<<b-d;
                        break;	
		case 'D':
			cout<<fixed;
                        cout.precision(3);
                        cout<<(a*c+b*d)/(c*c+d*d)<<" "<<(b*c-a*d)/(c*c+d*d);
                        break;
		case 'M':
			cout<<fixed;
                        cout.precision(3);
                        cout<<a*c-b*d<<" "<<b*c+d*a;
                        break;
	}
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 operate;
	cin>>real1>>imag1>>real2>>imag2>>operate;
	cout<<fixed;
	cout.precision(3);
	switch(operate){
		case(65): cout<<real1+real2<<" "<<imag1+imag2; break;
		case(83): cout<<real1-real2<<" "<<imag1-imag2; break;
		case(77): cout<<real1*real2-imag1*imag2<<" "<<real1*imag2+real2*imag1; break;
		case(68): cout<<(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(real2*imag1-real1*imag2)/(real2*real2+imag2*imag2); break;
	}
	cout<<endl;
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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;
  float Ar,Ai;
  cin>>real1>>imag1>>real2>>imag2;
  cin>>c;
  
   if(c=='A')
   { Ar=real1+real2;
	  Ai=imag1+imag2;
	 }
	  else if(c=='S')
	  { Ar=real1-real2;
	    Ai=imag1-imag2;
	    }
   else if( c=='M')
   { Ar=real1*real2-imag1*imag2;
	   Ai=real1*imag2+real2*imag1;
           
      
   }
   else if(c=='D')
   {  Ar=(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2);
	   Ai=(real2*imag1-imag2*real1)/(real2*real2+imag2*imag2);

  
   }
   cout<<fixed;
    cout.precision(3);
   cout<<Ar<<" "<<Ai;
  
  
}

Grading criterion: is subtraction taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 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 taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 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 taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
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 taking place if S is passed as input
Rating A: if subtraction is taking place correctly if S is passed as input argument
Rating B: if any other function executed other than subtraction
Rating C: 0
Rating D: 0
Assigned grade: A