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;
int i=0;

if(i<1 &&n%2==0)
{cout<<"2 "<<endl;
i++;}
int j=0;
if(j< 1 && n%3==0)
{ cout<<"3 "<<endl;
j++;}
for(int k; k>=5; k=k+2)
if (n%k==0) cout<<"k "<<endl;
else {continue;}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;

if ( n%2 == 0 ) {cout << "2\n"; 
	  n = n/2 ; }

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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<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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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;
 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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<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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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;
     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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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 <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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No Qualities
Rating C: 0
Rating D: 0
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 <iostream>

using namespace std;

bool isprime(int n){
int k = 0;
if(n == 2) return true;
if(n == 3) return true;
for(int j = 2; j < n;j++){
if(n % j == 0){
k++;
break;
}
}
if(k == 0) return true;
else return false;
}

int main(){
int n,i;
cin >> n;
if(n > 5){
for(i = 2; i < n;i++){
if(isprime(i) == true && n % i == 0) cout << i << endl;
}
}
if(n == 2) cout << "2";
if(n == 3) cout << "3";
if(n == 4) cout << "2";
if(n == 5) cout << "5";
if(isprime(n)) cout << n;
}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
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<iostream>
#include<cmath>

using namespace std;
int nthPrimeNumber(int n)

{
	int i,j,k,p;
	k=2;
	j=0;
	p=1;
	while(p<=n)
	{
		j=0;
		for (i=2;i<=sqrt(k);i++)
		{
			if (k%i==0)
			{
				j++;
			}

		}
	k++;
	if (j==0)
	{
		p++;
	
	}
	}
	return k-1;

}

int main()
{
	int n,i,j;
	cin>>n;
	i=1;
	while (nthPrimeNumber(i)<=sqrt(n))
	{
	i++;
	}
	for (j=1;j=(i-1);j++)
	{
		if (n%nthPrimeNumber(j)==0)
		{
			cout<<nthPrimeNumber(j)<<endl;
		}
	}
		
}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
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<iostream>
using namespace std;
bool isPrime(int N)
{
int i = 2;
bool flag = true;
for(i = 2;i<N;i++)
{
if(N%i == 0)
{
flag = 0;
break;
}
}
return flag;
}
int nextPrime(int N)// to return the prime number immediately  after N
{
int i = N+1;
while(true)
{
if(isPrime(i))
return i;
i++;
}
}
int main()
{
int n,temp , flag = 0, prime = 2;// temp variable as a copy of n to retain its value
cin >> n;
temp = n;
while(temp !=1)
{
while(true)
{
if(temp % prime == 0)
{
flag = 1;
temp /= prime;
}
else
break;
}
if(flag == 1)
cout << prime << endl;
flag = 0;
prime = nextPrime(prime);
}
return 0;
}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
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 namespacestd;
int main(){

	int n,k;
	cin>>n;
	if (n%2==0){
	while(n%2==0)}
	cout<<"2";

	for(k>=3;k<=n;k=k+2){
		if(n%k==0)
		{
		cout<<k;
		}
	}
}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
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;int k=3;
cin>>n;
if (n%2==0){
cout<<"2"<<endl;}
while(n%2==0)
{n=n/2;}
while(k<=n)
{if (n%k==0){
cout<<k<<endl;}
while(n%k==0)
{n=n/k;}
k=k+2;
}}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
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(){
	int n;
	cin>>n;
	if (n%2==0){
		cout<<2<<endl;
		while (n%2==0) n=n/2;
	}
	{
		for (int i=3;i<=n;i=i+2){
			if (n%i==0){
				cout<<i<<endl;
				while (n%i==0) n=n/i;
			}
		}
	}
	return(0);
}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
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(){
int n,k=3;
cin>>n;
if(n%2==0)cout<<2;
while(n%k==0){
cout<<k;
k=k+2;
}
}

Grading criterion: Divisibility by k=2 checked and number reduced.
Rating A: Fully Correct
Rating B: Just divisibility checked but number not reduced
Rating C: Totally wrong
Rating D: 0
Assigned grade: B