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;
	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 multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1,imag1,real2,imag2;
	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 multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float r1,i1,r2,i2;
	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 multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1,imag1,real2,imag2;
	char operation;
	cin >> real1 >> imag1 >> real2 >> imag2;
	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 multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include <simplecpp>
main_program{

	float a, b, c, d, 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 multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	cout<<fixed;
	cout.precision(3);
	float 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 multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
int main(){
	char t;
	float a, b, c, d, x, y;
	cin>>a>>b>>c>>d>>t;
	if(t == 'A'){
		x = a+c;
		y = b+d;
		cout << fixed;
		cout.precision(3);
		cout<<x<<" "<<y<<endl;
	}
	if(t == 'S'){
		x = a-c;
		y = b-d;
		cout << fixed;
		cout.precision(3);
		cout<<x<<" "<<y<<endl;
	}
	if(t == 'M'){
		x = a*c - b*d;
		y = a*d + b*c;
		cout << fixed;
// uses fixed floating point representation
		cout.precision(3); // print two digits after the decimal point.
		cout<<x<<" "<<y<<endl;
	}
	if(t == 'D'){
		x = (a*c + b*d)/(c*c + d*d);
		y = (b*c - a*d)/(c*c + d*d);
		cout << fixed;
// uses fixed floating point representation
		cout.precision(3); // print two digits after the decimal point.
		cout<<x<<" "<<y<<endl;
	}
}

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

Student submission:
#include<simplecpp>
main_program{
	float real1,imag1,real2,imag2;
	char 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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program
{
        char 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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

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


	char 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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float r1,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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

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

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

Student submission:
#include<simplecpp>
main_program{
	
	float a,b,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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program {
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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float a,b,c,d;
	cin>>a>>b>>c>>d;

	char 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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program that takes as input two complex numbers and performs one of the following operations on them: addition, subtraction, multiplication, or division. The output should be the result of the operation, with 3 digits after the decimal point. The input should be two pairs of floating-point numbers indicating the real and imaginary parts of the complex numbers, separated by spaces, followed by a letter indicating the operation to be performed. The output should be two space-separated numbers, with the real part followed by the imaginary part.

Student submission:
#include<simplecpp>
main_program{
	float real1 , imag1 , real2 , imag2 ;
	char 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: is multiplication of complex numbers is correct implemented?
Rating A: if muliplication of complex numbers is correctly written
Rating B: if the multiplication function is not correctly written
Rating C: 0
Rating D: 0
Assigned grade: A