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;



int main(){
int n; cin>>n;
int p=2;
int a[n]; int b[n];
for(int i=0;i<n;i++){
a[i]=i+2;
}

int z=0;
for(int i=0;i<=n/p-2;i++){
b[i]=(i+2)*p;
for(int z=p+1;z<=n/p-2;z++){
if(z==b[i]){
p=z;
}
else p=p;
}
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<simplecpp>
main_program{
	int l;
	cin>>l;
	int n=l-1;
	int a[n];
	int x=2;
	for (int i=0;i<n;i++)
	{
	a[i]=x;
	x++;
	}
	int np[n];
	int k=0;
	int p=2;
	while (p<n){
		for (int i=1;i<n;i++)
		{
			if (a[i]%p==0)
			{
				if (a[i]!=p){
				np[k]=a[i];
				k++;
			}}
		}
		p++;
		for (int j=0;j<k;j++)
		{
			if (np[j]==p)
			{
				p++;
				continue;
			}
		}
	}
	int y=0;
	while (y<n){
		for (int i=0;i<k;i++){
			if (a[y]==np[i]){
				y++;
				continue;
			}
		}
		cout<<a[y]<<" ";
		y++;
	}
}

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 rec_multiplesOf(int *array,int n,int p)
{
bool flag;
for(int i=0;i<n-1;i++)
	{ 
	if(array[i]==p*(i+2)) flag=1;
	}

for(int i=0;i<n;i++)
	{
	  while(flag!=1)
	  {
            if(array[i]>p)
		{
		 p+=1;
		rec_multiplesOf(array,n,p);
		}
	    else break;
	  }

	}
}

int main()
{
int n,p=2;
bool flag;
cin>>n;
int array[n];
for(int i=0;i<n-1;i++)
	{
	 array[i]=i+2;
 	 rec_multiplesOf(array,n,p);
while(flag!=1)
cout<<array[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>
usingnamespace std;
let a=natural number

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

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

string str;
for(int i=0;i<n-1;i++){
str[i]=i+2;
}
int p=2;
while(p<sqrt(n)){
for(int i=p*p-2;i<n;i+=p){
str.erase(i,1);
}
p++;
}

for(int i=0;i<n;i+=5){
cout<<str[i]<<" "<<str[i+1]<<" "<<str[i+2]<<" "<<str[i+3]<<" "<<str[i+4]<<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: 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=0;i<n-1;i++)
a[i]=i+2;



int t=2;
int p=t+t;
while(t<n)
{for(;p<n+1;p=p+t) {a[p-2]=0;}
t=t+1;
p=t+t;}



float r=0;
for (int i=0;i<n-1;i++) {
if (a[i]!=0)
{cout<<a[i]<<" ";r=r+1;int b=r/5;
if (b==r/5) 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>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
int A[n];
A[0]=0;
A[1]=0;
for (int i=2; i<=n; i++){
A[i]=i;
}
int y=2;
for (int i=2; i<=n; i++){
	
	for (;y<=n; y++) {
		if (A[y]!=0) {i=y; break;}}
	for (int j=2; j<=n; j++){
		for(int k=2; k<=n; k++){
			if (A[j]==i*k) {A[j]=0; break;}
				}
				 }
y=i;
y++;			 
}
int b=0;
for (int i=2; i<=n; i++) {if (A[i]!=0) {b++; cout<<A[i]; if (b<=4 && 1<=b) {cout<<" ";}}
if (b==5) {b=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=0;i<n-1;i++) {
int j=2;
a[i]=j;
j=j+1;
}
int *b;
for (int i=2;i<n+1;i++) {
 for (int j=2;j<n;j++) {
 int k=i*j;
 while(k<n){
 for (int y=0;y>-1;y++) {
 b[y]=k;}
 }
 }
 }

for (int i=0;i<n-1;i++){
 for (int y=0;y>-1;y++){
 if (a[i] != b[y]) 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;
int count=0;
cin>>n;
for(int j=2;j<=n;j++){
int a=0;
for(int i=2;i<j;i++){
if(j%i==0){
a=1;
break;

}
}
if(a==0){
cout<<j<<" ";
count++;

}
if(count==5){
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: 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;
#include <cmath>

int main(){
	int n;
	cin>>n;
	int a[n-1];
	for(int i=0;i<n-1;i++){a[i]=2+i;}
	int b[n-1];
	for(int i=0;i<n-1;i++){b[i]=2;}
	for(int i=0;i<n-1;i++){
		if(b[i]!=0){b[i]=1;}
		else if(b[i]==0){continue;}
		for(int j=i+1;j<n-1;j++){if(a[j]%a[i]==0){b[j]=0;}}
	}
	int ne=1,j=0;
	for(int i=0;i<n-1;i++){
		if(b[i]==1){j++; if(j%5!=0){cout<<a[i]<<" ";} else {cout<<a[i];}}
		if(j==5*(ne)){cout<<endl;ne++;}
	}
}

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;
void markoff(int p,int* a,int n){
	for(int i=p-1;i<n;i++){
		if(a[i]%p==0){a[i]=0;}}
}
int main(){
int n,k=0;
cin>>n;
int a[n-1];
for(int i=0;i<n-1;i++){
	a[i]=2+i;}
for(int i=0;i<n-1;i++){
	if(a[i]!=0){markoff(a[i],a,n-1);}}
for(int i=0;i<n-1;i++){
	if(k==5){cout<<endl;k=0;}
	if(a[i]!=0){cout<<a[i]<<" ";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: 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;
cin>>n;

int ar[n-1];

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

for(int i=0 ; i<n-1 ; i++)
 {
   if(ar[i] != 0)
   {
     int p= ar[i];
     for(int j=1 ; j<=n ; j++)
       {
 	for(int k=i+1 ; k<n-1 ; k++)
	 {
	    if(ar[k]==p*j)
		ar[k]=0;
	}
       }
   }

 }
int j=0;
for(int i=0 ; i<n-1 ; i++)
{
 if(ar[i] != 0)
{
  cout<<ar[i]<<" ";
 j++;

if(j%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=0;i<n-1;i++){
a[i]=i+2;}
int x=1;
int p=2;
while(p*x<n){
x++;
for(int i=0;i<n-1;i++){
while(a[i]>p){
if( a[i]!=p*x)
p=a[i];

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 d(int N)
{
int n=0;
for(int i=1; i<=N; i++)
{
if(N%i==0)n++;
}
return n;
}
int main()
{
int N, n;
cin>>N;
for(int i=1; i<=N; i++)
{
if(d(i)==2)cout<<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