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,i,j,k;
	cin>>n;
	for(i=2;i<=n;i++)
	{
		if(n%i==0)
		{
			for(j=2;j<i;j++)
			{
			      k=i%j;
			 
			}
			     if(k!=0)
			 {
			 cout<<i<<endl;
			 }
			 
			
			n=n/i;
		}
		
	}
}

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;
int main(){

int n;
cin>>n;
if(n%2==0) cout<<"2"<<endl;
for( ;n%2==0; )
    {n=n/2;}
    
 if(n%3==0) cout<<"3"<<endl;
for( ;n%3==0; )
    {n=n/3;}
 
 if(n%5==0) cout<<"5"<<endl;
for( ;n%5==0; )
    {n=n/5;}
    if(n%7==0) cout<<"7"<<endl;
for( ;n%7==0; )
    {n=n/7;}
    
    if(n%9==0) cout<<"9"<<endl;
for( ;n%9==0; )
    {n=n/9;}
    if(n%11==0) cout<<"11"<<endl;
for( ;n%11==0; )
    {n=n/11;}
    
    if(n%13==0) cout<<"13"<<endl;
for( ;n%13==0; )
    {n=n/13;}
    if(n%17==0) cout<<"17"<<endl;
for( ;n%17==0; )
    {n=n/17;}
    if(n%19==0) cout<<"19"<<endl;
for( ;n%19==0; )
    {n=n/19;}
    if(n%23==0) cout<<"23"<<endl;
for( ;n%23==0; )
    {n=n/23;}
    if(n%29==0) cout<<"29"<<endl;
for( ;n%29==0; )
    {n=n/29;}
 }

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=2;
cin>>n;
for(int i=1;i>0;i++){

if(n%k==0)
{cout<<k<<endl;
n=n/k;
}
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<iostream>
using namespace std;

int main()
{
unsigned int n, k=2; cin >> n;
while (true)
{
	if (n%k==0)
	{
		cout << k << endl;
		while (true)
		{
			n=n/k;
			if (n%k!=0) break;
		}
	}
	k++;
	if (n==1) break;	
}
}

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= 45 ) 
cout<< 3 << endl;
cout<<5<<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: 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;}
if(n%3==0){cout<<"3"<<endl;}
if(n%5==0){cout<<"5"<<endl;}
if(n%7==0){cout<<"7"<<endl;}
if(n%11==0){cout<<"11"<<endl;}
if(n%13==0){cout<<"13"<<endl;}
if(n%17==0){cout<<"17"<<endl;}
if(n%19==0){cout<<"19"<<endl;}
if(n%23==0){cout<<"23"<<endl;}
if(n%29==0){cout<<"29"<<endl;}
if(n%31==0){cout<<"31"<<endl;}
if(n%37==0){cout<<"37"<<endl;}
if(n%41==0){cout<<"41"<<endl;}
if(n%43==0){cout<<"43"<<endl;}
if(n%47==0){cout<<"47"<<endl;}
if(n%53==0){cout<<"53"<<endl;}
if(n%59==0){cout<<"59"<<endl;}
if(n%61==0){cout<<"61"<<endl;}
if(n%67==0){cout<<"67"<<endl;}
if(n%71==0){cout<<"71"<<endl;}
if(n%73==0){cout<<"73"<<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;
int main(){
	int n;
	int i=3;
	cin>>n;
	if(n%2==0){
		while(n%2==0){
			n=n/2;
		}
		cout<<"2"<<endl;
	}

	while(i<=n){
		if(n%i==0){
			while(n%i==0){
				n=n/i;
			}
			cout<<i<<endl;
		}
		i=i+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 prime(int n)
{
int c=0;
for(int i=1;i<=n;i++)
if(n%i==0)
c++;
if(c==2)
return 1;
else
return 0;
}
int main()
{
int n;
cin>>n;
for(int i=2;i<=n;i++)
{
if(prime(i)==1)
if(n%i==0)
cout<<i<<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<simplecpp>
main_program
{
    int n,i,j=3,a=0,b=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
    	while (n%2==0)
    	{
    		n=n/2;
    		a++;
    	}
    	if(a>0)
    	{cout<<"2"<<endl;}
    	while(n%j==0)
    	{
    		n=n/j;
    		b++;
    	}
    	if(b>0)
    	{cout<<j<<endl;}
    	b=0;
    	a=0;
    	j=j+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;
n=n/2;};
if(n%3==0)
{cout<<"3"<<endl;
n=n/3;};
if(n%5==0)
{cout<<"5"<<endl;
n=n/5;};
if(n%7==0)
{cout<<"7"<<endl;
n=n/7;};
if(n%11==0)
{cout<<"11"<<endl;
n=n/11;};
if(n%13==0)
{cout<<"13"<<endl;
n=n/13;};
if(n%17==0)
{cout<<"17"<<endl;
n=n/17;};
if(n%19==0)
{cout<<"19"<<endl;
n=n/19;};

}

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;

int main(){
int n,a,i,t;
cin >> n;
a=2;
while (n>1) {
if (n%a==0) {
while (n%a==0) {
n=n/a;
}
cout << a << endl;
}
else a++;
}
}

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<simplecpp>
main_program
{
	int n,k;
	cin >> n;
	if (n%2==0) cout << "2" << endl;//checking divisiblity by 2
	while(n%2==0){n=n/2;};//taking quotient till remainder is non-zero
	//for loop that checks divisibiity by odd primes by incrementing k by 2
	for(k=3;k<=n;k=k+2)
	{
		if (n%k==0) cout << k <<endl;//checking dividiblity by k
		while(n%k==0){n=n/k;};//taking quotient on dividing by k till remainder is non-zero
	} 
}

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;
int constant=n;
if(n%2==0){cout<<"2";}
while(n%2==0){n=n/2;}
int i=0;
int k=3;
while(i<constant){
if(n%k==0){cout<<endl<<k;}
while(n%k==0){n=n/k;}
k=k+2;
i++;
}
}

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(){
	float<<2;
	cout (n/2%);
	cout (a=1, b=2, c=3, d=4):
	int (a<<1, b<<2, c<<3, d<<4);
	float(n=3%);
	cout (a=1%, b=2%, c=3%, d=4%);
	cout (a<=1, b<=2, c<=3, d<=4);
}

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: 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;
while(n%2==0){cout<<"2"<<endl;
n=n/2;}
while(n%3==0){cout<<"3"<<endl;
n=n/3;}
while(n%5==0){cout<<"5"<<endl;
n=n/5;}
while(n%7==0){cout<<7<<endl;
n=n/7;}
while(n%11==0){cout<<11<<endl;
n=n/11;}
while(n%13==0){cout<<13<<endl;
n=n/13;}
while(n%17==0){cout<<17<<endl;
n=n/17;}
while(n%19==0){cout<<19<<endl;
n=n/19;}
while(n%23==0){cout<<23<<endl;
n=n/23;}
while(n%29==0){cout<<29<<endl;
n=n/29;}


}

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