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<simplecpp>
main_program{
	int n,i,j,c;
	cin >> n;
	for(i=2;i<=n;i++){
		c=1;
		for(j=2;j<i;j++){
			if(i%j==0) c=0; break;
		}
		if(c==0) continue;
		if(n%i==0){
			cout << i << endl;
			while(n%i==0){
				n=n/i;
			}
		}
		if(n==1) break;
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;

int main(){
	int n,k=3;
	cin>>n;
	if(n%2==0){
		cout<<2<<endl;
		while(n%2==0){
				n/=2;
		}
	}
	while(k<=n){
		if(n%k==0){
			cout<<k<<endl;
			while(n%k==0){
				n/=k;
			}
		}
		else{
			k+=2;
		}
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;
int main(){
int n;
cin>>n;

if (n%2==0){
cout<<"2"<<endl;
while(n%2!=0);}
 if (n%3==0){
while(n%3!=0);
cout<<"3"<<endl;}

	for(int i=5;i<n;i+2)
{		if (n%i==0){
		
		cout<<i<<endl;
while(n%i!=0);
}
else(n%i!=0);
 continue;
              
	}



return 0;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int k=2;
for(int i=2;i<=n;i++)
{
 if(n%i==0)
 {
 while(n%i==0)
 n/=i;
 cout<<i<<endl;
 }
 }
 }

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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,k;
cin>>n;
for(k=2;k<=n;k++){
if(n%k==0){
cout<<k<<endl;
}
else
cout<<"1"<<endl;
}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i;
int h;
if (i>=h &&  i%h != 0){
while (  i>=2 && i<=n )
if ( n%i == 0 )
{  n= n/i ;  cout<<i<<endl;}
}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;
int main() {

int n, i, q,a=0 ;
cin >> n;
while(n>=2){
for(i=2;i<=n;i++){
while (n%i==0){
q=n/i;
n=q;
cout<<i<<endl;
}
}
}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;
int main()
{
int b,n,a,c;
cin>>n;
if(n%2==0){cout<<"2";
cout<<endl;}
for(int k=3; k<=n; k=k+2)
{ if (n%k==0)cout<<k;
cout<<endl;
}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
#include<cmath>
using namespace std;
int main()
{
int p,n,r;
cin>>n;
p=n;
	for(int i=2;i<=n;i++)
	{
	if(p%i==0) 
		{cout<<i<<endl;
		while(2)
			{
			p=p/i;
			if(p%i!=0)break;
			}
		}
	if(i==2) continue;
	i++;
	}

}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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";
 n=n/2;}
 cout<<endl;
for(int k=3;k<=n;k=k+2)
 if(n%k==0){
cout<<k;
 n=n/k;
 cout<<endl;}

 
  }

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
#include<cmath>
using namespace std;
int main() {
int n;
cout<<"sorry didnt have enough time this time will try harer next time";
return 0;
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std;
int main(){
int n,k=1,i=3;
cin>>n; if(n>=2) {
while(k==1) {
if(n%2==0) { if (n%4==0) {n=n/2;} else {cout<<2<<endl;k=3;}}
else {n=n/2;} }

while(k==i) {
if(n!=1) {
if(n%k==0) {if (n%(k*k)==0) {n=n/2;} else {cout<<k<<endl; k=k+2;i=i+2;}}
else {n=n/k;}}
else {k=0;}}}
return 0;



}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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,k=3;
    cin>>n;
    if(n%2==0){cout<<"2"<<"\n";}
    while(n%2==0){
        n=n/2;
    }
    while(n%k==0){
        n=n/k;
        cout<<k<<"\n";k++;k++;
    }

}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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 <iostream>
using namespace std;
int main(){
int n,k,i,a,r;
bool flag;
cin>>n;
if(2<=n){

if (n%2==0){	cout<<2<<endl;
		for(a=0;n%2==0;a++)
				{r=n/2;
				n=r;
				if(r%2!=0) break;
				 }
	}
k=3;
while(k<=n){
if (n%k==0 && k!=n){	cout<<k<<endl;flag=1;
		for(a=0;flag==1;a++)
				{r=n/k;
				n=r;
				if(r%k!=0) flag=0;
				 }
		}
else if (k==n) cout<<k<<endl;
k=k+2;
}


}


}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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<iostream>
using namespace std ;
int main()
{
	int n ;
	cin >> n ;
	int prime = 2 ;
	while(n!=1)
	{
		int count = 0 ;
		while(n%prime==0)
		{
			n = n / prime ;
			count++ ;
		}
		if(count >=1 )
		{
			cout << prime ;
			cout << endl ;
		}
		prime ++ ;
	}
}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
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 <iostream>
using namespace std;
int main() {
int k=2, n;
cin>> n;

if (n>=2) {
while (k<=n) {
   if (k==2) {
      if (n%k==0) {
      while (n%k==0) {
      	n = n/k;
      }
      cout<< k << "\n";
      }
      k+=1;
   }
   else {
     if (n%k==0) {
        while (n%k==0) {
          n = n/k;
        }
        cout<<k << "\n";
        k +=2;
     }   
     else {
        k +=2;
     }
     }
      
   
   
   
}	

}


}

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Okay Commented
Rating C: Poor or No Comment
Rating D: 0
Assigned grade: C