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,k;
cin>>n;
for( k=2;n%k==0; k++) {
  for(int i=2;k%i!=0;i++)
  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 <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
cin >> n;
int i=2;

while (i<=n)
{
int t=2;
int p=2;
int c=1;
int u=2;
int k=0;
while (t<i)
{
if (i%t==0) {c=0;break;}
else {t++;p=i;}
}
if (c==1)
{
while (n%p==0) {u=p;n=n/p;k=1;}
if (k==1) {cout<<u<<"\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: 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;
if (n%3=0) cout<<3;
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;
cin>> n;
for (int i=2;i<=(n/2)+1; i++)
{
if (n%i==0) cout <<i<<endl;
if (n%i==0) 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<simplecpp>
main_program
{
	int n,k=3;
	cin>>n;
	if(n>=2)
	      {

	       while(n%2==0){
	       	
	       	
             cout<<2<<endl;
             

	       n=n/2;
	      
	       
           }
	       

                  while(n%k==0)
	            {
	             cout<<k<<endl;
	             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 <simplecpp>
main_program{
int n, rem, num;
cin >> n;
num = n;
if (n%2 == 0){
while (n%2 == 0){
if (n%2 == 0) {n = n/2;}
}
cout << 2 << endl;
}
for (int k = 3; k <= num; k = k + 2){
	rem = n%k;
	if (rem == 0) {n = n/k; cout << k <<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: 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>
#include<cmath>
using namespace std;
int main(){
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;
}

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 i,n,p=1,c=0;
cin>>n;
while(p<=n)
{
for(i=1;i<=p;i++)
{
if(p%i==0)
{
c++;
}
}
if(c==2)
{
if(n%p==0)
{
cout<<p<<"\n";
n=n/p;
}
}
c=0;
p++;
}
}

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; cin>>n;
k=2;
if (n%2==0) cout<<"2"<<endl;
while(n%k==0) n=n/k;
k=3; 
if(n%3==0) cout<<"3"<<endl;
while(n%k==0) n=n/k;
int b=5;
while(n!=1){
if(n%b==0) {cout<<b<<endl; n=n/b;}
b+=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;
	cout<<"Enter the no.";
	cin>>n;
	for(int i=1;i<=n;i++)
	{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;
cin>>n;
if (n%2==0)
cout<<"2";
for(int i=3; i<n){
if (n%i==0)
cout<<i;
n/=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: 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;
int c=n;
for(int i=2;i<=n;i=i+1)
{
bool f=false;
while(c%i==0)
{
c=c/i;
f=true;
}
if(f){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: 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 ;
	for (int i=2 ; i<=n ; i++)
	{
	if (n%i==0)
	cout << i << endl ;
		while (n%i==0)
		{
			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: 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 k, n,i=3;

cin>>n;

k=n;

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

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

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 main()
{	int n,i,j;
	cin>>n;
	for(i=2;i<=n;i++)
	{for(j=2;j<i;j++)
	 {	if(i%j==0){break;}
	 }
	 if(j==i)
		{if(n%j==0){cout<<j<<endl;}
		}
	}
	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: 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 main()
{
	long long int n, j = 0;
	cin >> n;

	for (long long int i = 2; i <= n; i++) {
		while (!(n%i)) {
			n /= i;
			j++;
		}
		if (j) {
			cout << i << endl;
			j = 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