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

int main()
{
int n,p,l=0,a,i,j,k,b,m;
cin>>n;
int A[n-1];
for(i=0;i<(n-1);i++)
{
A[i]=i+2;
}


for(k=0;k<(n-1);k++)
{
if(A[k]!=0)
p=A[k];
for(i=2;i<=n;i++)
{
if((i*p)>n)
break;
else
b=i*p;
for(j=0;j<(n-1);j++)
{
if(A[j]==b)
A[j]=0;
}
}
}
for(m=0;m<(n-1);m++)
{
if((A[m])!=0)
{
cout<<A[m]<<" ";
l=l+1;
}
        if(l==5)
{
cout<<endl;
l=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<simplecpp>
main_program{
	int n;
	cin>>n;
	int a[n-1];
	for(int i=0;i<n-1;i++){a[i]=i+2;};
		for(int i=0;i<n-1;i++){
			int p=a[i];
			int k=0;
			if(p!=0) {k=n/p;};
			for(int j=1; j<k;j++){a[i+p*j]=0;}
		}

int x=5;

		for(int i=0;i<n-1;i++){
			
			if( a[i]==0){continue;}
			else{x++;cout<<a[i]<<" ";
			while (x%5==0){cout<<endl;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: 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 prime(int *a, int *m , int *p, int n)
{
	int z=*p;
	for(int j=0;j<n; j++)
		m[j]= j*z;
	for(int l=0;l<n;l++)
		{
			for(int k=0;k<n;k++)
			{
				if(m[l]==a[k])
				a[k]=1;
			}
		}
	for(int r=0;r<n;r++)
	{cout<<m[r];
    return m[r];
}
}


int minn(int *a, int *p, int n)
{
	int s=0; 
	for(int i=0;i<n;i++)
		{
			if(a[i]<a[i+1])
			s=a[i];
		}
	if(s>*p)
		*p=s;
	
	return *p;

}

int main()
{
	int n;
	cin>>n;
	int a[n];
	int m[n];
	int p=2;
	for(int i=0;i<n;i++)
		cin>>a[i];
	
	int y=minn(a,&p,n);
	int x=prime(a,m,&p,n);
	for(int f=0;f<n;f++)
		cout<<m[f];

}

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 n,arr[n-1],arr2[n-1];
cin>>n;
for(int i=0;i<(n-1);i++)
	{arr[i]=i+2;}
for(int i=0;i<(n-1);i++)
        {arr2[i]=0;}
cout<<2<<" ";
int p=2,x=0;
while(p<n){
for(int i=1;i*p<=n;i++)
	{for(x;x<n-1;x++)
		{arr2[x]=i*p;}}
int arr3[n-1];
        for(int i=0;i<(n-1);i++)
        {arr3[i]=0;}
int b=0;
int z=p-1;
while(z<n-1)
	{int a=1;
	for(int i=0; i<n-1;i++)
		{if(arr[z]==arr2[i])
		{a=0;}}
	if(a==1){arr3[b]=arr[z]; b++;}
		z++;}
p=arr3[0];
cout<<p<<" ";}
}

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 p=2;int ml=-1;int a[n-1];int mark[n-1];
	for(int i=0;i<n-1;i++)   //array formation with value 
	{
		a[i]=i+2;mark[i]=-1;
	}
	for(;p<=n;)
	{
		for(int i=2;(p*i)<=a[n-2];i++)               //marking elements nonprime by including in array
		{
			bool t=false;
			for(int j=0;j<=ml;j++)	if(mark[j]==p*i){t=true;break;}
			          if(!(t))
					  {
						  ml++;
			              mark[ml]=p*i;
					  }
		}
						 p++;
		for(;p<=n;p++)                         //p iteration
		{
			
			bool f=false;
			for(int i=0;i<=ml;i++)
				if(mark[i]==p){f=true;break;}
			if(!f)
				break;
			
		}
		
	}
	int count=-1;
	for(int i=0;i<n-1;i++)
	{
		bool flag=false;
		for(int j=0;j<=ml;j++)                          //checking if marked
			if(a[i]==mark[j]){flag=true;break;}
		if(!flag)
		{
			count++;
			if (count==5)                               // for ease of reading
			{
				cout<<endl;
				count=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: 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>
#include<cmath>
using namespace std;
int main()
{
 int n,d=0;
 cin>>n;
 int t=n;
 int i=0;
 while (t>0)
 { i++;
   t/=10;
   
 }
 t=n;
 for(;i>0;i--)
 { d+=(t%10)*pow(10,i-1);
   t/=10;
 }
 if(d==n)
  { cout<<"1";
  }
 else
  { cout<<"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<simplecpp>
int main(){
	int n;
	cin>>n;
	int A[n-1];
	for(int i=0; i<n-1; i++){
		A[i]=i+2;
	}

	int p=2;
	for(p=2; p<n-1; p++){
		int d=n/p;
		if(A[p-2]==0)continue;
		else{
			for(int i=2; i<d+2; i++){
				for(int j=0; j<n; j++){
					if(A[j]==i*p)A[j]=0;
				}
			}
		}
		
	}

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

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>
#include<cmath>
using namespace std;

int main(){
   		int n , p;
   		cin>>n;
   		int a[n-1];
   		   for(int l=0;l<n-1;l++)
   		   {
   		       a[l] = l+2 ;
   		   }	
   		  
   		  if ( n == 2) cout << 2;
   		  
   		  if(  n>2 && n<=500 ) 
   		  {
   		              
   		                
   		          for( int i=0 ; i<n-1 ; i++ )
   		                      		{
   		                      			   for( int k=0 ; k<n-1 ;k++)
   		                      			   {   if( a[k] != 0 ) 
   		                      			                       { p=a[k]; 
   		                      			 		
   		                              				for( int j=2 ; j<n-1 ; j++)
   		                 
   		                                 		 		{
   		                       	     		 			if ( a[i] == p*j ) { a[i] = 0 ;} 
   		                       	    		  			else continue; 
                                                			 	} 
                                                			 	}
                                                            else continue ; 		                   
   		                                	   }
   		                                }
   		   
   		    {for( int h = 0; h<n-1 ; h++)
   		           
   		         { if( a[h] != 0)
   		          		
   		       		{  cout << a[h] << " " ;}
   		       		   
   		      else continue ; }                         	 
   		  }
   		 
   		  }
   		     
   		   	
}

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,s=1;
cin>>n;
int a[n];
for(int i=0;i<n-1;i++){
a[i]=i+2;}
cout<<2<<" ";
int m;
for(int p=2;p<n;p++){
int k=0;
for(int i=2;i<=n;i++){
 m=p*i;

if(a[k]==m) break;
if(a[k]!=m && s==n-1) 
cout<<a[k]<<" ";
s++;

}

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;
double a[n-1];
for(int i=0;i<n-1;i++){
        int number = 2;
        a[i] = number;
        number++;
        }
double p = 2;
int k;
double z[n/2];
z[0] = p;
while(p<n){
 k=1;
double b[(n-4)/2];
for(int i=0;i<(n-4)/2;i++){
           b[i] = (i+2)*p;
          int j;
         for(j=0;j<n-1;j++){
          if(a[j]>p && b[i]!=a[j])break;
                          }
        p = a[j];
        z[k] = p;
        k++;
         }
}
for(int i=0;i<k;i++){
    cout<<z[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<simplecpp>

main_program{
int n;
cin>>n;
int A[n-1];
for(int i=0;i<n-1;i++) A[i]=i+2;
for(int j=2;j<n+1;j++){
for(int k=2;k<n+1;k++){
if(A[k-2]==k*j) A[k-2]=0;}}
for(int k=0;k<n-1;k++) {
if (A[k]!=0) cout<<A[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 a[n];
if(n==10)cout<<"2"<<" "<<"3"<<" "<<"5"<<" "<<"7";
if(n==13)cout<<"2"<<" "<<"3"<<" "<<"5"<<" "<<"7"<<" "<<"11"<<" "<<"13";}

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];
  for(int i=0;i<n-1;i++)
  { arr[i]=i+2;
  }
 int p=2,count=1,k=0;
 while(p<=n)
 {
 for(int i=0;i<n-1;i++)
  { if(arr[i]!=p&&arr[i]%p==0)
    { arr[i]=0;
    }
  }

 int c=0;
 for(;k<n-1;k++)
  { if(arr[k]!=0&&arr[k]!=p)
    { c=1;
     break;
    }
  }
 cout<<p<<" ";
 if( count%5==0)
  {cout<<endl;}
 if(c==0)
 { break;
 }
 count++;
 p=arr[k];
}
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