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>
main program;
int main()
cout<<prime factor of a number>>
 //if it contains repeated no;
 cin<<print only one time>>
 finding prime factor of a number
 cin<<the number is 45>>
 cout<<end p the no is 3 and 5 >>
 cout<<this is resul>>

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=1;
int j,k,l;
while(i<n){

j=n%i;
if(j==0){
k=n/i;
l=k%i;
if(l==0){i++;
	continue;
}else{
	cout<<i<<endl;
}


}

else{
i++;
	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, d=2;
cin>>n;
while(d<=n){
	while(n%d==0){
		n=n/d;
		if(n%d!=0) cout<<d<<endl;
		else continue;}
	d++;
	}
}

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<math.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n%2==0) {        // used an extra if function because i didnt want to type "2" again and again
		while (n%2==0) {n=n/2;}   // when n gets out from dividing by 2, if it enters here, I dont want n to be further divisible by 2, same explanation for further prime numbers as well :)
		cout << "2" << endl;   // used endl because of bodhitree errors
	}
		
	if (n%3==0) {
		while (n%3==0) {n=n/3;}
		cout << "3" << endl;
	}
	
	int k=5;         // Important to set k=5 (next prime number after 3) that too outside while loop as after k=k+2 i dont want while loop to again set k=5
	while (n != 1){
	
		if (n%k==0) {
			while (n%k==0) {n=n/k;}
			cout << k << endl;
	}
	
	k=k+2;
			}
}             // Thank you for reading my code personally :):)

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: 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>
useing namingpace std;
int main()
{
cin >> n;
if (n>5)(
for (i=2;i<n;i++)(
if(piseine (i) == tiru && n % i ==0) cout<<i;
{
	cout<<n;
}
if (n==2) cout <<"2";
if (n==3) cout <<"3";
if (n==4) cout <<"4";
if (n==5) cout <<"5";
ifsprtne (n)) cout<<n;
}

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,f,div;
cin>>n;
for(int i=2;i<=n;i++)
{
f=1;
for(int k=2;k<=i;k++)
{if(i%k==0)
{f++;}
}
if(f==2)
{if(n%i==0)
{cout<<i<<endl;
n=n/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<iostream>
using namespace std ;
int main ()
{
  int n ,k;
  cin >> n ; 
  for ( int i = 2 ; i < n ; i++)
  {
    for ( int d = 2 ; d <= i ; d++)
    {
    	 k = i%d ;
    	if ( k != 0)
     	 {
            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>
#include<cmath>
using namespace std;

int main(){
	int n,flag;
	cin >> n ;
	if (n==2){
		cout << 2<<endl;
		cout << 2/n;
	}
	if (n>2){
		for(int j=2;j<n; j++){
			if(n%j==0) {
				for(int x=1;x<=j;x++){
					int m=0;
					if(j%x!=0){

					}
				flag=1;

				}
			if (flag==1){
				cout << j<<endl;
			}		
			}
		}}}
//		else{
//		for(int k=3;k<n; k=k+2){
//			if(n%k==0){
//				cout << 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>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
while (n%2==0){
cout<<"2"<<endl;
n=n/2;}

for (int i=3; i<=sqrt(n); i=i+2){
while (n%i==0){
cout<<i<<endl;
n=n/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)
	{
	for(int i=2;i<n;i++)
	{int k=0;
	if(n%i==0)
	{
	for(int j=1;j<=i;j++)
	{
	if(i%j==0)
	k=k+1;
	}
	if(k==2)
	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,j,c;
	cin>>n;
	int m=n;
	for(i=2;i<=m;i++)
	{
		c=0;
		while(n%i==0)
		{
			c++;
			if(c==1)     cout<<i<<endl;
			n=n/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<iostream>
using namespace std;
int main(){
int n,i,a,p,b;
cin>>n;
for(b=2;b<n;b++){
	if(n%b==0){break;}	
}
if(b==n){cout<<n;}
else{
for(i=2;i<n;i++){
	if(i==2){
		if(n%2==0){cout<<2<<endl;}
		}
	else if(i!=2){
		for(a=2;a<i;a++){if(i%a==0){break;}}
		if(a==i){p=a;if(n%p==0){cout<<p<<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 ,j,c;
cin>>n;
for(int 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>
#include <math.h>
using namespace std;
int main (){
    int n;
    int i;
    cin >> n;

    for (i=2;i<=n;i++){
        while (n%i==0){
            n= n/i;

        }
        cout << i << endl << n;

        
        
        
        

    }
    
    


}

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>

int main(){
	using namespace std;
	int n;
	cin >> n;
	if (n%2==0){
		cout << 2 << endl;
		n=n/2;
		for (int i=1;;i++){
			if (n%2==0){
				n=n/2;
				continue;}
			else {break;}
			}}
	for (int j=3;j<=n;j+=2){
		if (n%j==0){
			cout << j<<endl;
			n=n/j;
			for (int i=1;;i++){
				if (n%j==0){
					n=n/j;
					continue;}
				else {break;}}}
		else{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,k;
cin>>n;
for( k=2;n%k==0; k++) {
  for(int i=2;k%i!=0;i++)
  cout<<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