CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1,imag1,real2,imag2;
	char a;
	imaginary k = sqrt(-1)
	cin>>real1>>imag1>>real2>>imag2>>a;
	if (a=='A'){
		double i = real1 + imag1*k;
		double j = real2 + imag2*k;
		cout<<i<<" "<<j;
		cout.precision(3);

		
	
	}
	if (a=='S'){
		double i = real1-imag1*k;
		double j = real2-imag2*k;
		cout<<i<<" "<<j;
		cout.precision(3);
	}
	if (a=='M'){
		double i = real1*(imag1*k);
		double j = real2*(imag2*k);
		cout<<i<<" "<<j;
		cout.precision(3);
	}
	if (a=='D'){
		double i = real1/imag1*k;
		double j = real2/imag2*k;
		cout<<i<<" "<<j;
		cout.precision(3);

	}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 B;
        float real1, real2,imag1,imag2,a,b,c,d,e,f,i,j;
        cin>>real1;
        cin>>imag1;
        cin>>real2;
        cin>>imag2;
        cin>>B;
        a=real1+real2;
        b=imag1+imag2;
        c=real2-real1;
        d=imag2-imag1;
        e=real1*real2;
        f=imag1*imag2;
        i=real1*imag2;
        j=real2*imag1;
	cout<<fixed;
	cout.precision(3);
        if(B=='A'){
                cout<<a<<" "<<b<<endl;

        }
        if(B=='S'){
                cout<<c<<" "<<d<<endl;

        }
        if(B=='M'){
                cout<<e-f<<" "<<i+j<<endl;

        }
        if(B=='D'){
                cout<<(e+f)/(pow(real2,2)+pow(imag2,2))<<" "<<(j-i)/(pow(real2,2)+pow(imag2,2))<<endl;

        }
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 ch;
	cin>>real1>>imag1>>real2>>imag2>>ch;
cout<< fixed;
cout.precision(3);
	if( ch== 'A')
	{ cout<< real1+real2<<" "<< imag1+imag2;
	}
	else if(ch=='S')
		cout<<(real1-real2)<<" "<<(imag1-imag2);
	else if(ch=='M')
		cout<<( real1*real2-imag1*imag2)<<" "<<(real1*imag2+imag1*real2);
	else if( ch=='D')
		cout<<( real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(imag1*real2- real1*imag2)/(real2*real2+imag2*imag2);

}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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,r2,i1,i2,r0,i0;
	char x;
	cin>>r1>>i1>>r2>>i2>>x;
	if(x=='A') {
		r0 = r1+r2; i0 = i1+i2;
	}
	if(x=='S') {
		r0 = r1-r2; i0 = i1-i2;
	}
	if(x=='M') {
		r0 = r1*r2 - i1*i2;
		i0 = r1*i2 + i1*r2;
	}
	if(x=='D') {
		r0 = (r1*r2 + i1*i2)/(r2*r2 + i2*i2);
		i0 = (i1*r2 - r1*i2)/(r2*r2 + i2*i2);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<r0<<" "<<i0<<endl;
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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;
	char O;
	cin>>a>>b>>c>>d;
	cin>>O;
	cout<<fixed;
	cout.precision(3);
	if (O=='A')
		cout<<(a+c)<<" "<<(b+d);
	else if (O=='S')
		cout<<(a-c)<<" "<<(b-d);
	else if (O=='M')
		cout<<(a*c-b*d)<<" "<<(a*d+b*c);
	else if (O=='D')
		cout<<((a*c+b*d)/(c*c+d*d))<<" "<<((b*c-a*d)/(c*c+d*d));
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
        int x = 3 ;
	int y = 4 ;
	int sum = x + y ;
	cout << sum ;                                                                                                                                                                                                                                                   
	return 0 ;
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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,real1,imag1,real2,imag2;
	char op;

	cin>>real1>>imag1>>real2>>imag2;
	cin>>op;
	if(op==65){
		a=real1+real2;
		b=imag1+imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}
	else if(op==83){
		a=real1-real2;
		b=imag1-imag2;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}

	else if(op==77){
		a=real1*real2-imag1*imag2;
		b=real1*imag2+real2*imag1;
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}
	else if(op==68){
	a=(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2);
		b=(imag1*real2-imag2*real1)/(real2*real2+imag2*imag2);
		cout<<fixed;
		cout.precision(3);
		cout<<a<<" "<<b<<endl;
	}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 real1=1.000,imag1=1.000,real2=1.000,imag2=1.000;
char c;
cin>>real1>>imag1>>real2>>imag2>>c;
if(c=='A'){ cout<<real1+real2<<" "<<imag1+imag2;cout.precision(3);}
else if(c=='S'){cout<<real1-real2<<" "<<imag1-imag2;cout.precision(3);}
else if(c=='M'){cout<<real1*real2-imag1*imag2<<" "<<imag1*real2+real1*imag2;
cout.precision(3);}
else if(c=='D'){cout<<(real1*real2+imag1*imag2)/(real2*real2+imag2*imag2)<<" "<<(imag1*real2-imag2*real1)/(real2*real2+imag2*imag2);
cout.precision(3);}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 ch;
	cin>>ch;

	if(ch=='A'){
		cout<<fixed;
		cout.precision(3);
		cout<<a+c<<" "<<b+d;
	
	}

	else if(ch=='S'){
		cout<<fixed;
		cout.precision(3);
		cout<<a-c<<" "<<b-d;
		
	}

	else if(ch=='M'){
		cout<<fixed;
		cout.precision(3);
		cout<<((a*c)-(b*d))<<" "<<((a*d)+(b*c));
		
	}

	else if(ch=='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));
		
	}

}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 oper;
	cin>>real1>>imag1>>real2>>imag2>>oper;
	float a , b;
	if(oper=='A'){
		a= real1+real2;
		b=imag1+imag2;
	}
	else if(oper=='S'){
		a=(real1)-(real2);
		b=(imag1)-(imag2);
	}
	else if(oper=='M'){
		a=real1*real2 - imag1*imag2;
		b=real1*imag2+real2*imag1;
	}
	else if(oper=='D'){
		a=(real1*real2+imag1*imag2)/((real2*real2)+(imag2*imag2));
		b=(real2*imag1-real1*imag2)/((real2*real2)+(imag2*imag2));	
	
	}

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

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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,x,y;
	cin >> a >> b >> c >> d;
	x = a + b*i;
	y = c + d*i;
	if cin >> 'A'{ 
	cout << (a+c) << " " << (b+d) << 'i' << endl}
	else cin >> 'S' {
		cout << (c-a) << (d-b) << 'i' << endl}
	else cin >> 'M'{
		cout << (a*c - b*d) << (a*d + b*c) << 'i' << endl}
	else cin >> 'D'{
		cout <<  ((a*c + b*d)/(c*c-d*d)) << ((b*c-a*d)/(c*c-d*d)) << 'i' << endl}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: C
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 x;
     cin>>real1>>imag1>>real2>>imag2>>x;
     
      if(x=='A')
      {
	      cout << fixed;       // uses fixed floating point representation

              cout.precision(3); // print two digits after the decimal point.
               
	      cout<<real1+real2<<" "<<imag1+imag2;
      }
      else if(x=='S')
      {
	      cout << fixed;       // uses fixed floating point representation

              cout.precision(3); // print two digits after the decimal point.

              cout<<real1-real2<<" "<<imag1-imag2;
      }

       else if(x=='M')
       {      
	      cout << fixed;       // uses fixed floating point representation

              cout.precision(3); // print two digits after the decimal point.

              cout<<(real1*real2)-(imag1*imag2)<<" "<<(real1*imag2)+(imag1*real2);
       }

       else if(x=='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))<<" "<<-((real1*imag2)-(imag1*real2))/((real2*real2)+(imag2*imag2));
       }
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 O;
        cin>>r1>>i1>>r2>>i2>>O;
	if(O=='A'){
		float R= r1+r2;
		float I= i1+i2;
		cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else if(0=='S'){
		float R=r1-r2;
		float I= i1-i2;
                cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else if(O=='M'){
		float R= r1*r2-i1*i2;
		float I= i1*r2 + i2*r1;
		cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else if(O=='D'){
		float R= (r1*r2+ i1*i2)/(pow(r2, 2)+ pow(i2, 2));
		float I= (r2*i1- r1*i2)/(pow(r2, 2)+ pow(i2, 2));
		cout<<fixed;
		cout.precision(3);
		cout<<R<<" "<<I;
	}else{
		cout<<"";
	}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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,S,M;
        cout<<fixed;
        cout.precision(3);	

 if (cin>>S){cout<<real2-real1<<" "<<imag2-imag1;}
	else if (cin>>M){cout<<real1*real2<<" "<<imag1*imag2;}
	

}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float a,b,c,d;
	char p ,A,S,M,D;
	cin>>a>>b>>c>>d>>p;
	if(p==A) cout<<a+c<<" "<< b+d<<endl;
	else if ( p==S) cout<< a-c<<" "<< b-d<<endl;
	else if (p==M) cout<< a*c-c*d<<" "<< a*d-b*c<<endl;
	else if (p==D) cout<< (a*c-b*d)/(c*c+d*d)<<" "<< (b*c-a*d)/(c*c+d*d);
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 command;
	cout<<"choose a command "<<endl<<"A:Addition"<<endl<<"S:subtraction"<<endl<<"M:multiplication"<<endl<<"D:division"<<endl;
	cin>>command;
	if(command='A' ){
		float sumreal=real1+real2;//adds the real part//
		float sumimag=imag1+imag2;//adds the imaginary part//
                cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<sumreal<<" "<<sumimag<<endl;
	}
	else if(command ='S')
		float subreal=real1-real2;//subtracts the real part//
	        float subimag=imag1-imag2;//subtracts the imaginary part//
                cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<subreal<<" "<<subimag<<endl;
	}
	else if(command='M')
		float mulreal=real1*real2;//multiplies the real part //
		float mulimag=imag1*imag2;//multiplies the imaginary part//
		cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<mulreal<<" "<<mulimag<<endl;
	}
	else if (command='D')
		float divreal=real1/real2;//divides the real part //
		float divimag=imag1/imag2;//divides the imaginary part //
	        cout << fixed;// uses fixed floating point representation
                cout.precision(3); // print two digits after the decimal point.
		cout<<divreal<<" "<<divimag<<endl;
	}
	else{
		cout<<"enter valid command";
	}

}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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;
	 if(operation =='A'){
		 float r = r1 +r2;
		 float i = i1+i2;
		 cout<<fixed;
                 cout.precision(3);
		 cout << r << " " << i;
	 }
	 else if(operation == 'S'){
		 float r = r1-r2;
		 float i = i1-i2;
		 cout<<fixed;
                 cout.precision(3);
		 cout << r << " " << i;
	 }
	 else if(operation == 'M'){
                 float r = r2*r1 - i1*i2;
                 float i = r1*i2+r2*i1 ;
		 cout<<fixed;
                 cout.precision(3);
		 cout << r << " " << i;
         }
	 else if(operation == 'D'){
		 float k = pow(r2,2)+pow(i2,2);
                 float r = (r2*r1 + i1*i2)/k;
                 float i = (r2*i1-r1*i2)/k;
		 cout<<fixed;
		 cout.precision(3);
                 cout << r << " " << i;
         }
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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,r2,i1,i2;
	cin>>r1>>i1>>r2>>i2;
         float sr,si;
       	char 0 ;
       switch(0){
	       case "A":{sr=r1+r2;
		     si=i1+i2; 
                      break;}
	       case "B":{sr=r1-r2;
		       si=i1-i2;
		       break;
		      }
	      cout<<sr" "<<"i"<<si<<endl;
       }
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: B