CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to take a positive integer n as input from the user and print out its unique prime factors. For this, do the following: While n is divisible by 2, print the number 2 and divide n by 2. After that, the number is no longer even. While n is divisible by k=3, print the number 3 and divide n by 3. After k no longer divides n, increase k by 2 and repeat. 

Input Format - integer n
Output Format - All prime factors, each one printed on a new line. 

Constraints
n is a positive integer such that n>=2

Sample input and output
Input - 45
Output - 3 5
Explanation:45 can be expressed as 3x3x5 . Hence its prime factors are 3 and 5


Note:Do not write any C++ statements for printing general messages. For example, the following should NOT be present in your program:cout << "Enter a number:",cout << "The computed answer is", etc.cout should be used to print only the computed final output. In addition, do not print unnecessary spaces unless specified in the programThe solution file name should be an C_Q2.cpp

Student submission:
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n%2==0){
	while(n%2==0){
		n=n/2;}
	cout<<"2"<<endl;}	
	else if(n%3==0){
	while(n%3==0){
		n=n/3;}
	cout<<"3"<<endl;}
	else if(n%5==0){
	while(n%5==0){
		n=n/5;}
	cout<<"5"<<endl;}
	else if(n%7==0){
	while(n%7==0){
		n=n/7;}
	cout<<"7"<<endl;}
	else {for(int i=9;n==0;i=i+2){
		while(n%i==0){
		 n=n/i;}
	cout<<i<<endl;
	}}
	}

Grading criterion: K repetitively incremeneted by 2 and divisibility by k is checked and number is reduced.
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried Something in somewhat right direction
Rating D: Code not there or totally wrong.
Assigned grade: C
Problem: Write a C++ program to take a positive integer n as input from the user and print out its unique prime factors. For this, do the following: While n is divisible by 2, print the number 2 and divide n by 2. After that, the number is no longer even. While n is divisible by k=3, print the number 3 and divide n by 3. After k no longer divides n, increase k by 2 and repeat. 

Input Format - integer n
Output Format - All prime factors, each one printed on a new line. 

Constraints
n is a positive integer such that n>=2

Sample input and output
Input - 45
Output - 3 5
Explanation:45 can be expressed as 3x3x5 . Hence its prime factors are 3 and 5


Note:Do not write any C++ statements for printing general messages. For example, the following should NOT be present in your program:cout << "Enter a number:",cout << "The computed answer is", etc.cout should be used to print only the computed final output. In addition, do not print unnecessary spaces unless specified in the programThe solution file name should be an C_Q2.cpp

Student submission:
#include<simplecpp>

main_program{
 int n;
 cin >> n;
if (n%2==0){cout << "2" << endl; n=float(n)/2.0;}
 for (int i=3; i<=n; i=i+2){

 	if (n%i==0){cout << i << endl; n=float(n)/float(i);}

 							}

			}

Grading criterion: K repetitively incremeneted by 2 and divisibility by k is checked and number is reduced.
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried Something in somewhat right direction
Rating D: Code not there or totally wrong.
Assigned grade: B
Problem: Write a C++ program to take a positive integer n as input from the user and print out its unique prime factors. For this, do the following: While n is divisible by 2, print the number 2 and divide n by 2. After that, the number is no longer even. While n is divisible by k=3, print the number 3 and divide n by 3. After k no longer divides n, increase k by 2 and repeat. 

Input Format - integer n
Output Format - All prime factors, each one printed on a new line. 

Constraints
n is a positive integer such that n>=2

Sample input and output
Input - 45
Output - 3 5
Explanation:45 can be expressed as 3x3x5 . Hence its prime factors are 3 and 5


Note:Do not write any C++ statements for printing general messages. For example, the following should NOT be present in your program:cout << "Enter a number:",cout << "The computed answer is", etc.cout should be used to print only the computed final output. In addition, do not print unnecessary spaces unless specified in the programThe solution file name should be an C_Q2.cpp

Student submission:
#include<simplecpp>
main_program{
	int n,k=2;
	cin>>n;

if(n%k==0)cout<<k<<endl;
	while(n%k==0){n=n/k;}
k=k+1;
repeat(n){
if(n%k==0)cout<<k<<endl;
	while(n%k==0){n=n/k;}
k=k+2;}
}

Grading criterion: K repetitively incremeneted by 2 and divisibility by k is checked and number is reduced.
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried Something in somewhat right direction
Rating D: Code not there or totally wrong.
Assigned grade: A
Problem: Write a C++ program to take a positive integer n as input from the user and print out its unique prime factors. For this, do the following: While n is divisible by 2, print the number 2 and divide n by 2. After that, the number is no longer even. While n is divisible by k=3, print the number 3 and divide n by 3. After k no longer divides n, increase k by 2 and repeat. 

Input Format - integer n
Output Format - All prime factors, each one printed on a new line. 

Constraints
n is a positive integer such that n>=2

Sample input and output
Input - 45
Output - 3 5
Explanation:45 can be expressed as 3x3x5 . Hence its prime factors are 3 and 5


Note:Do not write any C++ statements for printing general messages. For example, the following should NOT be present in your program:cout << "Enter a number:",cout << "The computed answer is", etc.cout should be used to print only the computed final output. In addition, do not print unnecessary spaces unless specified in the programThe solution file name should be an C_Q2.cpp

Student submission:
#include<iostream>
using namespace std;
int main()
{
unsigned int n,p,k,t;
p=2;
cin>>n;
while(n>1)
{
if(n%p==0)
{
cout<<p<<endl;
while(k!=0)
{
t=n/p;
k=t%p;
n=t;
}
p=p+1;}
else
{p=p+1;}
}
}

Grading criterion: K repetitively incremeneted by 2 and divisibility by k is checked and number is reduced.
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried Something in somewhat right direction
Rating D: Code not there or totally wrong.
Assigned grade: D
Problem: Write a C++ program to take a positive integer n as input from the user and print out its unique prime factors. For this, do the following: While n is divisible by 2, print the number 2 and divide n by 2. After that, the number is no longer even. While n is divisible by k=3, print the number 3 and divide n by 3. After k no longer divides n, increase k by 2 and repeat. 

Input Format - integer n
Output Format - All prime factors, each one printed on a new line. 

Constraints
n is a positive integer such that n>=2

Sample input and output
Input - 45
Output - 3 5
Explanation:45 can be expressed as 3x3x5 . Hence its prime factors are 3 and 5


Note:Do not write any C++ statements for printing general messages. For example, the following should NOT be present in your program:cout << "Enter a number:",cout << "The computed answer is", etc.cout should be used to print only the computed final output. In addition, do not print unnecessary spaces unless specified in the programThe solution file name should be an C_Q2.cpp

Student submission:
#include<simplecpp>
    main_program
    
    {
      int n;
     cout<<"n"<<endl;
      cin>>n;
   while(n>1){
       if (n/2) cout<<"2"<<endl;
       if ( n/3) cout<<"3"<<endl;
      if (n/5) cout<<"5"<<endl;
      if ( n/7) cout<<"7"<<endl;
      }
}

Grading criterion: K repetitively incremeneted by 2 and divisibility by k is checked and number is reduced.
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried Something in somewhat right direction
Rating D: Code not there or totally wrong.
Assigned grade: D
Problem: Write a C++ program to take a positive integer n as input from the user and print out its unique prime factors. For this, do the following: While n is divisible by 2, print the number 2 and divide n by 2. After that, the number is no longer even. While n is divisible by k=3, print the number 3 and divide n by 3. After k no longer divides n, increase k by 2 and repeat. 

Input Format - integer n
Output Format - All prime factors, each one printed on a new line. 

Constraints
n is a positive integer such that n>=2

Sample input and output
Input - 45
Output - 3 5
Explanation:45 can be expressed as 3x3x5 . Hence its prime factors are 3 and 5


Note:Do not write any C++ statements for printing general messages. For example, the following should NOT be present in your program:cout << "Enter a number:",cout << "The computed answer is", etc.cout should be used to print only the computed final output. In addition, do not print unnecessary spaces unless specified in the programThe solution file name should be an C_Q2.cpp

Student submission:
# include <iostream>
using namespace std;
int main(){

int n;
cin>>n;
if(n%2==0){
cout<<2<<endl;
}
for(int i=2;i<n;i++){

for (int m=2;m<i;m++){
if (i%m !=0)


{
if(0==(n%i)){
if(i%6!=0 && i%4!=0 && i%14!=0 && i%9!=0 && i%21!=0 && i%26!=0 && i%22!=0 ){
cout<<i<<endl;}
}

}
break;



}







}
}

Grading criterion: K repetitively incremeneted by 2 and divisibility by k is checked and number is reduced.
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried Something in somewhat right direction
Rating D: Code not there or totally wrong.
Assigned grade: D
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{

}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int integer(int m){
	int k=0,i=0; 
	while(m!=0){
		k +=(m%10)*pow(2,i);
		m /=10;
		i++;}
	return k;}
double fraction(int n){
	int j=1;
	double l;
	while(n!=0){
		l +=(n%10)*pow(2,j);
		n/=10;
		j++;}
	l/=pow(2,j);
	return l;}

main_program{
	int intpart, fracpart;
	cin>>intpart>>fracpart;
	double finalin = integer(intpart);
	double finalfrac= fraction(fracpart);
	double result = finalin+finalfrac;
	cout<<fixed;
	cout.precision(2);
	cout<<result;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include <simplecpp>
int digit(int x) {
	int n=1;
	while ((x/pow(10,n-1)) >10) {
		n++;
	}
	return n;
}
float integer(int x) {
	int n=0;
	float sum=0,z=0;
	while (x>0) {
		int k= x%10;
		if (k==0) z=0;
		else z= pow(2,n);
		sum += z;
		n++;
		x= x/10;
	}
	return sum;
}
double floating(int x,int y) {
	int n=0;
	double sum=0,z=0;
	while (x>0) {
 int k= x%10;
                if (k==0) z=0;
                else z= pow(2,n);
                sum += z;
                n++;
                x= x/10;
	}
	int d= digit(y);
	while (y>0) {
		int k= y%10;
                if (k==0) z=0;
                else z= pow(2,-d);
		 sum += z;
                d--;
                y= y/10;
	}
	return sum;
}
main_program {
	int x,y;
	cin >>x >>y;
	cout <<fixed;
	cout.precision(2);
	if (y==0) {
		cout << integer(x) <<endl;
	}
	else {
		cout << floating(x,y) <<endl;
	}
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{









}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
float integerpart(int a){
	int n=0, m=0, c;
	for(int i=0;a!=0; i++)(a!=0){
		c=a%10;
		c=c*pow(2,n);
		m=m+c;
		a=a/10;
		n++;
	}
	return m;
}
float fractional(int b){
	int k=0, n=-1, m=0;
	for(int i=0; b!=0; i++){
		int c=b%10;
		k=k+c;
		k*=10;
		n=n/10;
	}
	k=k/10;
	n=k;

	for(int i=0;b!=0;i++){
		int c=b%10;
		c=c*pow(2,n);
		m=m+c;
		b=b/10;
		n--;
	}
return m*pow(10,n);
}
main_program{
	int a, b;
	cin>>a>>b;
	double ans;
	ans= integerpart(a)+fractional(b);
	cout<<fixed;
	cout.precision(2);
	cout<<ans;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{
			double r=0;
			float n;
			int i;

			cin>>n;
		for(i<=n,i++);
		double z;
		z=pow(2,r);
		r++;


		int y= z*i;
		float sum;
		sum+=y;
	}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program
{
	double n,ans=0;
	cin>>n;
	int m=n;
	int t=0;
	for(int i=m;i>0;i/=10)
	{
		ans=ans+(i%10)*pow(2,t);
		t++;

	}
	cout<<ans;

}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include <simplecpp>

int bin_int(int a){
	int sum = 0;
	if (a%10 == 0){
		while (a > 0){
			sum *= 2;
			sum += a%10;
			a = a/10;
		}
		return sum*2;
	}
	else{		
		while (a > 0){
			sum += a%10;
			sum *= 2;
			a = a/10;
		}
		return sum/2;
	}
}

float bin_dec(int b){
	float sum = 0;
	while (b > 0){
		sum += b%10;
		sum /= 2;
		b = b/10;
	}
	return sum;
}

main_program{
	int a, b;
	float c;
	cin >> a >> b;
	c = bin_int(a) + bin_dec(b);
	cout << fixed;
	cout.precision(2);
	cout << c;
	
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include <simplecpp>
main_program {
	int a; int b;
	float value;
	cin >> a >> b;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>

double intBinary(int a1){
    int sum1=0,i=0;
    while(a1!=0){
    int remain=a1%10;
    a1=a1/10;
    sum1=sum1+remain*pow(2,i);
    i++;

    }   
    return sum1;
}

double fracBinary(int a2){
     int count,b=a2;
     while(b!=0){
	     b=b/10;
	     count++;
     }
	
     float sum2=0,j=-count;
     while(a2!=0){
	     int remain2=a2%10;
	     a2=a2/10;
	     sum2=sum2+remain2*pow(2,j);
	     j++;
     }


return sum2;
}

main_program{
   int a1,a2;
   float sum=0;
   cin>>a1>>a2;

   sum=sum+intBinary(a1)+fracBinary(a2);
   cout<<sum;
   cout<<fixed;
   cout.precision(2);



}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int func1(int a){
	int i=10;
	int b=0;
	int c=0;
	int d=0;
      while(a%i!=a){
              c=(a%i
	      b=(a%i)*pow(2,c);
	      c++;
	      i=i*10;

      }

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B