CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int n;
	cin>>n;

	int arr[n];

	for (int i=0; i<n-1; i++){
		arr[i]=i+2;
	}

	bool check[n];

	for (int i=0; i<n; i++){
		check[i]=1;
	}

	

	for(int p=2;p<n;p++){
		for(int j=p-1; j<n; j++) {
			if(arr[j]%p==0) {check[j]=0;}
			}
	}

	
	int k=0;
	for (int i=0;i<n-1;i++) {
		if (check[i]==1) {cout<<arr[i]; k++;
			if(k%5!=0) {cout<<" ";}	
			if(k%5==0) {cout<<endl;}
	}

		

	}

}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;
int main(){
long long int n,b[n],i,j,a[9999],p=2;
 a[0]=2;
cin>>n;
//float z;
//z=n/2;
for(int j=1;j<n-1;j++)
  a[j]=a[j-1]+1;
for(int k=2;k<=n;k++){
 for(int i=0;i<=n;i++)
  { b[0]=k*p;
    b[i+1]=b[i]+p;
 //for(int i=1;i<n/2;i++)
while (b[i]>=a[j]){
      if(a[j]!=b[i])
               cout<<a[j];}}}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;
bool m(int n){
	if(n%5==0){return 1;}
	else{return 0;}
}
bool prime(int n){
	for(int i=2; i<n; i++){
		if(n%i==0){return 0;}
	}
	return 1;
}


int main(){
	int n,c=0;
	cin>>n;
	for(int i=2; i<=n; i++){
		if(prime(i)){cout<<i<<" "; c++;
			if(m(c)){cout<<endl;}
	}
	}
	return 0;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<simplecpp>

main_program{
int n;
cin>>n;
int A[n-1];
for(int i=2;i<n+1;i++)A[i-2]=i;
int p=2;
while(p<n){
for(int i=0;i<=n-2;i++){
	for(int j=0;j<=n-2;j++){
	if (A[j]==p*(i+2))	{A[j]=0;break;}
	}
	}
for(int i=p+1;i<=n;i++){
if (A[i]!=0){
p=i;
break;
}
}
}
int b=0;
for(int i=0;i<n-1;i++){
if (A[i]!=0){
cout<<A[i]<<" ";
b+=1;
if (b%5==0) cout<<endl;
}
}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;
int main(){
int N; cin>>N; int A[N-1];
for(int i=1;i<N-1;i++) {A[0]=2; A[i]=A[i-1]+1;}
for(int i=0;i<N-1;i++){ int mul=A[i];
    for(int j=2;mul<N;j++){ mul*=j;
       for(int k=i;k<N-1;k++){
         if(A[k]==mul) A[k]=0;
         }
     }
  }
  for(int i=0;i<N-1;i++){
     if(A[i]!=0) cout<<A[i]<<" ";
     }
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;

int main(){
	int n;
	cin>>n;
	int arr[n-1];
	int p=2;
	for(int i=0; i<n-1; i++){
		arr[i]=p;
		p++;
	}
	p=2;
	while(p<=n){
		for(int i=0; i<n-1; i++){
			if((arr[i])%p==0 && arr[i]!=0 && arr[i]!=p){
				arr[i]=0;
			}
		}
		int j=p-1;
		if(arr[j]!=0){
			p++;
		}
		else{
			while(arr[j]==0 && j<n-1){
				p++;
				j++;
			}
		}
	}
	
	int c=0;
	for(int i=0; i<n-1; i++){
		if(arr[i]!=0){
			cout<<arr[i]<<" ";
			c++;
		}
		if(c%5==0 && c!=0){
			cout<<"\n";
			c=0;
		}
	}
	
	return 0;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;
int n;
cin>>n;
int arr[n-1];
for (int i=0; i<n-1; i++)
{
arr[i]=i+2;}
int c=0;
for (i=0; i<n-1; i++)
{
if (arr[i]%arr[0]==0)
{c++;
int t=c;}
}
int p=2;
int j=0;
double q=t-(t/p)+(t%p);
int prr[q];
for (int i=1; i<t-1; i++)
{
if (trr[i]%p != 0)
prr[j]=trr[i];
j++;	
}
p=prr[0];
int i;
for(int i=0; i<t; i++)
{cout<<prr[i]<<" ";}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include <iostream>
using namespace std;

int main(){
int n, remainder, reverse;
cin>>n;
int m=n;
reverse=0;

while(n/10>0){
remainder=n%10;
reverse=reverse*10+remainder;
n=n/10;
}

remainder=n%10;
reverse=reverse*10+remainder;

if(reverse==m) cout<<1<<endl;
else cout<<0<<endl;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<simplecpp>
main_program{
	int n;
	cin>>n;
	int a[n-1];
	for(i=0;i<n-1;i++){
	a[i]=i+2;
	}
	int p=2,k=2;
	while(k*p<n+1){
	for(i=0;i<n-1;i++){
	if (a[i]==k*p) {a[i]=0}
	}
	k++;
	}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>

using namespace std;

int main(){
	int n;
	cin>>n;
	int arr[n-1];


	for(int i=0; i<n-1; i++){
		arr[i]=i+2;
	}

	for (int i = 0; i < n-1; i++)
	{	
		int t = arr[i];
		for(int j=i+1; j<n-1; j++){
			int k=arr[j];

			if(arr[i]!=0){
				if(k%t==0) arr[j]=0;
			}
		}
	}

	int count = 0;
	for(int i=0; i<n-1; i++){
		if(arr[i]!=0){
			count++;
		}
	}

	int arr1[count];
	int k=0;
	for(int i=0; i<n-1; i++){
		if(arr[i]!=0){
			arr1[k]=arr[i];
			k++;
		}
	}

	for(int i=0; i<count; i++){
		cout<<arr1[i]<<" ";
		if(i%5==4){
			cout<<endl;
		}
	}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;
bool isitprime(int n){
	int count=0;
	for(int i=2; i<n; i++){
		
		if(n%i==0){count++;}
	}
	if(count>0) return 0;
	else return 1;
}
int main(){
	int n; 
	cin>>n;
	int all[n-1];
	for(int i=0; i<n-1; i++){all[i]=i+2;}
	int p=2;
	int prime[n];
	for(int i=0; i<n; i++){prime[i]=0;}
	int j=0;
	for(int i=2; i<=n; i++){
		if(isitprime(i)){prime[j]=i; j++;}
		else{continue;}
	}
	
	for(int i=0; i<n; i++){
		if(prime[i]!=0){
			if((i+1)%5!=0)cout<<prime[i]<<" ";
			else cout<<prime[i]<<endl;
		}
		else break;
	}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include<iostream>
using namespace std;

void arrin(int a[] , int n)
{
	for(int i = 0; i < n ; i++)
	{
		a[i] = 2 + i;
	}
}

void arrout(int a[] , int n)
{ 	int count =0;
        for(int i = 0; i < n ; i++)
        {
     	  		if (a[i] != 0)
        		{	
      	        		 count = count + 1;
      	        		 cout << a[i] << " ";
      	        		 if( count%5 == 0)
      	        		 {
      	        		 	cout << endl;
      	        		 }
      			}
        }
}

int pnew(int a[] , int n , int p)
{
	for(int i = 0; i < (n-1) ; i++)
	{
		if(a[i] > p)
		{
			p = a[i];
			break;
		}
		else if(a[i] == p)
		{
			p = 0;	
		}
	}
	return p;
}

void mark(int a[] , int n , int p)
{
	int num,m;
	num = n/p;
	for(int i = 2 ;  i < (num+1) ; i++)
	{
		m = i*p;
		for(int j = 0; j < (n-1) ; j++)
		{
			if (a[j] == m)
			{
				a[j] = 0;
			}
		}
	}
}

void prime(int a[] , int n)
{
	int p = 2;
	while(p != 0)
	{
		mark(a,n,p);
		p = pnew(a,n,p);
	}
}

int main()
{
	int n;
	cin >> n;
	int a[n-1];
	arrin(a,n-1);
	prime(a,n);
	arrout(a,n-1);
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to find all prime numbers from 2 to n (n taken as input from the user) following the procedure given below:Create an array of consecutive integers from 2 through n: (2, 3, 4, ..., n).Initially, let p equal 2, the smallest prime number. Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the array as non-prime (these will be 2p, 3p, 4p, ...; the p itself should not be marked). Find the smallest number in the array greater than p that is not marked. If there was no such number, stop. Otherwise, let p now be equal to this new number (which will be the next prime number), and repeat from step 3.When the algorithm terminates, the numbers remaining not marked in the array are all the primes below n. Your program should print out all prime numbers from 2 to n. You do not need to use functions in this task (you may if you wish to). 

Input Format - Integer n.
Output Format - Print out the prime numbers with a space in between. After every five prime numbers print a newline character for ease of reading. 

Constraints
n >= 2 and n <= 500

Student submission:
#include <iostream>
using namespace std;
int main()   {
	int array_A[2]={2,3,5,7,....n}
	for(int i=0;i<2,i++)
	{
		cout<<"prime number"<<array;
		cout<<\n;
	}
	return 0;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing extra.
Rating C: 0
Rating D: 0
Assigned grade: B