CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program
{
	float a,b;
	cin>>a>>b;//accepting two numbers a and b

	float num=((a*a*a*a*a)-(3*a*a*a*a*b)+(4*a*a*b*b*b)-(5*a*b*b*b*b)+(b*b*b*b*b));//computing the numerator, can also use pow(x,y) function
	float den=a-b;//computing the denominator

	float res=num/den;//finding the final result

	cout<<res;//printing out the result
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
float a,b;
cin>>a>>b;
double c=((pow(a,5))-(3*pow(a,4)*b)+(4*pow(a,2)*pow(b,3))-(5*a*pow(b,4))+(pow(b,5)));
float d=a-b;
double f=c/d;
cout<<f;



}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
int main(){
long double  w,e,a,b,c,x,y,m,n,o,t,z;
cin>>a>>b;
x=pow(a,5);
y=pow(a,4);
z=pow(a,2);
m=pow(b,3);
n=pow(b,4);
o=pow(b,5);

t=x-(3*y*b)+(4*z*m)-(5*a*n)+o;
w=a-b;
e=t/w;
cout<<e;
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program
{
	float a,b;
	cin>>a>>b;
	float sum ;
	sum = pow(a,5)-3*pow(a,4)*b+4*a*a*pow(b,3)-5*a*b*b*b*b+pow(b,5);
	float dif = a-b;
	float res = sum/dif;
	cout<<res;
    

}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a,b;
	cin >> a >> b;
	if ( a >= -10 && a <= 10 && b >= -10 && b <= 10 && a!=b){
		cout << (a*a*a*a*a -3*a*a*a*a*b +4*a*a*b*b*b - 5*a*b*b*b*b + b*b*b*b*b )/(a-b);
	}
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include <simplecpp>

main_program{
	float a,b;
	cin >> a;cin >> b;
	cout << (a*a*a*a*a - 3*a*a*a*a*b + 4*a*a*b*b*b - 5*a*b*b*b*b + b*b*b*b*b)/(a-b);
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a,b;
	cin>>a>>b;
	float x;
	x=(pow(a,5)-3*pow(a,4)*b+4*a*a*b*b*b-5*a*b*b*b*b+pow(b,5))/(a-b);
	cout<<x;
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
	main_program{
		float a,b;
		cin>>a>>b;
		float c;
  c= (pow(a,4)-2*pow(a,3)*b-2*pow(a,2)*pow(b,2)+2*a*pow(b,3)-3*pow(b,4)-2*pow(b,5)/(a-b));			  
 
 cout<<c<<endl;
		  }

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include <simplecpp>
main_program{
	float a,b;
	cin>>a>>b;
	cout<<( a*a*a*a*a-3*a*a*a*a*b + 4*a*a*b*b*b-5*a*b*b*b*b + b*b*b*b*b)/(a-b);
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
float a,b;
cin>>a>>b;
cout<<(a*a*a*a*a-3*a*a*a*a*b+4*a*a*b*b*b-5*a*b*b*b*b+b*b*b*b*b)/(a-b);



}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a, b;
	cin >> a >> b;
        float c;
	c=(a*a*a*a*a-3*a*a*a*a*b+4*a*a*b*b*b-5*a*b*b*b*b+b*b*b*b*b)/(a-b);
	cout << c << endl;
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	int a,b;
	cin >> a >> b;
	float p,q;
	p=pow(a,5)-(3*pow(a,4)*b)+(4*pow(a,2)*pow(b,4))-(5*a*pow(b,4))+pow(b,5);
	q=(a-b);
	if(q!=0  && a!=b)
	cout<< p/q << endl;
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a,b,num;
	cin<<a<<b;
	num (a*a*a*a*a-3*a*a*a*a*b+4*a*a*b*b*b-5*a*b*b*b*b*b)/(a-b);
	cout<<num/(a-b);
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a,b;
	cin>>a>>b;
	cout<< ((pow(a,5))-(3*pow(a,4)*b)+(4*pow(a,2)*pow(b,3))-(5*a*pow(b,4))+(pow(b,5)))/(a-b);
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include <simplecpp>

main_program {
	float a, b;
	cin >> a >> b;

	float a5 = a * a * a * a * a;
	float a4 = a * a * a * a;
	float a2 = a * a;

	float b5 = b * b * b * b * b;
	float b4 = b * b * b * b;
	float b3 = b * b * b;

	cout << (a5 - (3 * a4 * b) + (4 * a2 * b3) - (5 * a * b4) + b5) / (a - b);
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a,b;
	cin>>a;
	cin>>b;
	cout<<(pow(a,5)-3*pow(a,4)*b+4*pow(a,2)*pow(b,3)-5*a*pow(b,4)+pow(b,5))/(a-b);
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float  a,b;
	cin>>a>>b;
	if( a!=b &&-10<=a && b<=10){
	       cout<<((a*a*a*a*a) -(3*a*a*a*a) + (4*a*a*b*b*b) - (5*a*b*b*b*b)+ (b*b*b*b*b))/(a-b)
		       	       
;}
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<iostream>
using namespace std;
int main()
	{
		float  a,b;
		cin>>a>>b;
		if(a>=-10 && b>=-10 && a<=10 && b<=10 && (a-b)!=0)
		{cout<<(a*a*a*a*a-3*a*a*a*a*b+4*a*a*b*b*b-5*a*b*b*b*b+b*b*b*b*b)/(a-b);
		}
	
	
	}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
float a,b,n;
cin>>a>>b;
n=((a*a*a*a*a)-(3*a*a*a*a*b)+(4*a*a*b*b*b)-(5*a*b*b*b*b)+(b*b*b*b*b))/(a-b);
cout<<n;
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to accept two floating point numbers from the user, a and b, and evaluate the expression and print the result:  (a5 - 3a4b + 4a2b3 - 5ab4 + b5) / (a -b). Print the computed value of the expression

Constraints (Assume)-10 <= a, b <=10a is not equal to b(a-b) is never 0

Student submission:
#include<simplecpp>
main_program{
	float a,b;
	cin>>a>>b;
	float exp1;
	float exp2;
	if((-10<=a && a<=10) && (-10<=b && b<=10) && (a!=b)){
		exp1=(pow(a,5) - 3*pow(a,4)*b + 4*pow(a,2)*pow(b,3) - 5*a*pow(b,4) + pow(b,5));
		exp2=(a-b);
		cout<<exp1/exp2;
	}
	else cout<<" " ;
}

Grading criterion: Correctness of Answer
Rating A: Final answer completely correct
Rating B: Individual Terms Calculated correctly but error in final answer, or some other mistake
Rating C: Code completely wrong
Rating D: 0
Assigned grade: A
Problem: At college X, students and professors often use abbreviations for long titles of academic papers and projects. In this problem, you are asked to verify whether a given abbreviation matches the first letters of the words in a string, ignoring case. The abbreviation is valid only if it follows the exact order of the first letters of each word.

Examples:

For the words:
United Nations
united nations
United nations
united Nations

Valid abbreviations are:
UN, un, Un, uN

For the words:
Machine Learning college X

Valid abbreviations are:
MLIB (or any combination of upper and lowercase letters in the same order, such as mLiB).

Your Task

Main Program:

Write a C++ program that accepts four characters from the user and stores them in four character variables. Pass these characters to a function named isValidAbbreviation, which returns true if the abbreviation is valid, otherwise returns false. In the main function, print "yes" or "no" (lowercase letters) based on the returned value.

isValidAbbreviation Function:

1. Accept the words character by character as input.
2. Check whether the first letter of each word matches the corresponding abbreviation character (case insensitive).
3. Return false if there is any mismatch.
4. Return true if the entire abbreviation is correct.

To read character sequences with spaces:
First write:
cin >> noskipws;

Then a loop like the following may be used:
for (cin >> c; c != '\n'; cin >> c)

Output Format:

Print:
yes
or
no

accordingly.

Note:

- Do not print any extra messages such as:
  cout << "Enter a number";
  cout << "The computed answer is";
- Use cout only to print the final output.
- Do not print unnecessary spaces.
- Do not hard-code the solution.
- If any test case passes by simply printing with cout and without logic, marks will not be awarded.

Student submission:
#include<simplecpp>

int main(){
    char a,b;
    cin>> a;
    cin>> b;
    cout<< a<< b;;
}

Grading criterion: Accepting words character by character
Rating A: Correctly implemented a loop which accepts the sequence as input, character by character till a '\n' is encountered

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: C
Problem: At college X, students and professors often use abbreviations for long titles of academic papers and projects. In this problem, you are asked to verify whether a given abbreviation matches the first letters of the words in a string, ignoring case. The abbreviation is valid only if it follows the exact order of the first letters of each word.

Examples:

For the words:
United Nations
united nations
United nations
united Nations

Valid abbreviations are:
UN, un, Un, uN

For the words:
Machine Learning college X

Valid abbreviations are:
MLIB (or any combination of upper and lowercase letters in the same order, such as mLiB).

Your Task

Main Program:

Write a C++ program that accepts four characters from the user and stores them in four character variables. Pass these characters to a function named isValidAbbreviation, which returns true if the abbreviation is valid, otherwise returns false. In the main function, print "yes" or "no" (lowercase letters) based on the returned value.

isValidAbbreviation Function:

1. Accept the words character by character as input.
2. Check whether the first letter of each word matches the corresponding abbreviation character (case insensitive).
3. Return false if there is any mismatch.
4. Return true if the entire abbreviation is correct.

To read character sequences with spaces:
First write:
cin >> noskipws;

Then a loop like the following may be used:
for (cin >> c; c != '\n'; cin >> c)

Output Format:

Print:
yes
or
no

accordingly.

Note:

- Do not print any extra messages such as:
  cout << "Enter a number";
  cout << "The computed answer is";
- Use cout only to print the final output.
- Do not print unnecessary spaces.
- Do not hard-code the solution.
- If any test case passes by simply printing with cout and without logic, marks will not be awarded.

Student submission:
#include<iostream>
using namespace std;

int main(){
     
    return 0;
}

Grading criterion: Accepting words character by character
Rating A: Correctly implemented a loop which accepts the sequence as input, character by character till a '\n' is encountered

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: C
Problem: At college X, students and professors often use abbreviations for long titles of academic papers and projects. In this problem, you are asked to verify whether a given abbreviation matches the first letters of the words in a string, ignoring case. The abbreviation is valid only if it follows the exact order of the first letters of each word.

Examples:

For the words:
United Nations
united nations
United nations
united Nations

Valid abbreviations are:
UN, un, Un, uN

For the words:
Machine Learning college X

Valid abbreviations are:
MLIB (or any combination of upper and lowercase letters in the same order, such as mLiB).

Your Task

Main Program:

Write a C++ program that accepts four characters from the user and stores them in four character variables. Pass these characters to a function named isValidAbbreviation, which returns true if the abbreviation is valid, otherwise returns false. In the main function, print "yes" or "no" (lowercase letters) based on the returned value.

isValidAbbreviation Function:

1. Accept the words character by character as input.
2. Check whether the first letter of each word matches the corresponding abbreviation character (case insensitive).
3. Return false if there is any mismatch.
4. Return true if the entire abbreviation is correct.

To read character sequences with spaces:
First write:
cin >> noskipws;

Then a loop like the following may be used:
for (cin >> c; c != '\n'; cin >> c)

Output Format:

Print:
yes
or
no

accordingly.

Note:

- Do not print any extra messages such as:
  cout << "Enter a number";
  cout << "The computed answer is";
- Use cout only to print the final output.
- Do not print unnecessary spaces.
- Do not hard-code the solution.
- If any test case passes by simply printing with cout and without logic, marks will not be awarded.

Student submission:
#include <simplecpp>

bool isValidAbbreviation(char c1, char c2, char c3, char c4)
{
    cin>>noskipws;
    int word=4;
    int space=0;
    char c='f';
    char abb;
    bool b1,b2,b3,b4;
    
    repeat(100)
    {
        cin>>c;
        if(c==c1 && space==0)
        b1=1;
        if(c==' ')
        {
            space++;
            cin>>abb;
            if(((abb==c2)||(abb==(c2-32))||(abb==(c2+32))) && space==1)
            {
                b2=1;
            }
            if(((abb==c3)||(abb==(c3-32))||(abb==(c3+32))) && space==2)
            {
                b3=1;
            }
            if(((abb==c4)||(abb==(c4-32))||(abb==(c4+32))) && space==3)
            {
                b4=1;
            }
            
        }
    }
    if(space>3)
    return(0);
    if(b1&b2&b3&b4==1)
    return(1);
    else
    return(0);
}

main_program
{
    char c1,c2,c3,c4;
    cin>>c1>>c2>>c3>>c4;
    bool res=isValidAbbreviation(c1,c2,c3,c4);
    if(res==1)
    cout<<"yes";
    else
    cout<<"no";
    
}

Grading criterion: Accepting words character by character
Rating A: Correctly implemented a loop which accepts the sequence as input, character by character till a '\n' is encountered

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: B