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 i,j,k,p,n,c=0,m;
cin >> n;
int A[n];
for (i=0;i<=n;i++){
A[i] = i;
}

for(k=2;k<=n;k++){

//if(A[k]==0){continue;}

p=k;
for(j=2;p*j<=n;j++){
A[4]=0;
A[p*j] = 0;

}
}

for(m=2;m<=n;m++){
if (A[m]==0){continue;}
cout << A[m] << " ";
c++;

if (c%5==0){
cout << endl;
}

}


}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
Rating D: 0
Assigned grade: C
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];
int b[7];
for(int j=n-2;j>=0;j--){

	a[j]=j+2;
}



	int counter=0;
	for(int k=0;k<n-1;k++){
for(int j=2;j<a[k];j++)
	{if(a[k]%j==0)
{counter=counter+1;}
}

if(counter==0)
	{

for(int m=0;m<7;m++)
{
		b[m]=a[k];}}
}
for (int l=0;l<n;l++){
cout<<b[5*l]<<" "<<b[5*l+1]<<" "<<b[5*l+2]<<" "<<b[5*l+3]<<" "<<b[5*l+4]<<endl;

}



}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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,l=0;
cin>>n;
int j=2,a[n-1];
for(int i=0;i<n-1;i++){
a[i]=j;
j++;}

int p=2;
while(p<=n/2){
for(int i=1;i<n-1;i++){
for(int k=0;a[p]*k<=n;k++){
if(a[i]!=-1 && a[i]==k*a[p])a[i]=-1;
}}p++;
}
for(int i=0;i<n-1;i++){
if(a[i]!=-1) {cout<<a[i]<<" ";l++;}
if(l%5==0) cout<<endl;
}}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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=1;i<n-1;i++){
if (arr[i]%i+1){arr[i]=0;}}
for (int i=0;i<n-1;i++){if( arr[i]!=0){cout<<arr[i];}}}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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 min(int *p,int n1,int j)
{
int min=j+1;
for(int i=j+2;i<n1;i++)
 {
 if(p[min]>p[i]) min=i;
 }
return min;
}

int main(){
int n,minindex;cin>>n;
int p[n-1];for(int i=0;i<n-1;i++) p[i]=(i+2);

for(int j=0;j<n;j++){
int a=p[j];
for(int i=j+1;i<n;i++)
 {
   if((p[i]%a)==0) p[i]=n+5;
 }
int n1=n-1;
minindex= min(p,n1,j);
a=p[minindex];
}
int k=1;
cout<<p[0]<<" ";
for(int i=1;i<n-1;i++)
{
 if(p[i]!=n+5)
 {
  if(k%5!=0) {cout<<p[i]<<" ";k++;}
 else {cout<<endl<<p[i]<<" ";k++;}
}
}
}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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=2;i<=n;i++){
arr[i-2]=i;
} 
int p=2,b=1;
while(b<n-1){
for(int i=b;i<n-1;i++){
if(arr[i]%p==0) arr[i]=1;
}
for(int i=b;i<n-1;i++){
if(b==n-2 && arr[b]==1){b=b+1;break;}
if(arr[i]!=1){p=arr[i];b=i+1;break;}
}
}
int c=0;
for(int i=0;i<n-1;i++){
if(arr[i]!=1){
if(c%5==0) cout<<endl;
 cout<<arr[i]<<" ";
c++;}
}
return 0;
}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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 p=2;
	for(int i=1;i<n-1;i++)
	{
		for(int j=(p-1);j<n-1;j++)
		{
			if(a[j]%p==0)
			{
				a[j]=-1;
			}
		}
		for(int j=(p-1);j<n-1;j++)
		{
			if(a[j]!=-1)
			{
				p=a[j];
				break;
			}
		}
	}
	int c=0;
	for(int i=0;i<n-1;i++)
	{
		if(a[i]!=-1)
		{
			cout << a[i] << " ";
			c++;
			if(c%5==0)
			{
				cout << endl;
			}
		}
	}
}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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;
	if (n==10) cout <<"2 3 5 7";
	if (n==50) cout <<"2 3 5 7 11"<<endl<<"13 17 19 23 29"<<endl<<"31 37 41 43 47";
	if (n==13) cout <<"2 3 5 7 11"<<endl <<"13";

}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
Rating D: 0
Assigned grade: C
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<stdio.h>
using namespace std;
int main(){
	int b=0,n;
	bool c=true;
	cin>>n;
	int a[n];
	for(int d=0;d<n;d++){a[d]=0;}

	for(int i=2;i<=n;i++)
	{
		for(int j=2;j<i;j++)
		{
			if(i%j==0){c=false;}
		}
		if(c){a[b]=i;b++;}
		c=true;
	}

	for(int k=0,l=1;k<b;++k,++l){if(l==5){cout<<a[k]<<"\n";l=0;}else{cout<<a[k]<<" ";}}

}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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;
}
for(int p=2;p<=n;p++){
	for(int y=2;p*y<=n;y++){
		for(int i=0;i<n-1;i++){
			if(a[i]==p*y)a[i]=0;//marking non prime as 0
			else a[i]=a[i];
		}
	}
}
int counter=0;
for(int i=0;i<n-1;i++){
	if(a[i]!=0){
		cout<<a[i]<<" ";
		counter++;
		if (counter==5){cout<<endl;counter=0;}
	}
}

}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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>
using namespace std;
int main(){
	int n;
	cin>>n;
	int arr[n-2+1];
	int brr[n-2+1];
	for(int i=0;i<=n-2;i++){
		brr[i]=-1;
	}
	int temp=2;
	int temp1=1;
	for(int i=0;i<=n-2;i++){ 
	arr[i]=temp;
	temp++;}
	
	while(temp1<=n){
		temp1++;
		for(int i=0;i<=n-2;i++){
		
		if(arr[i]%temp1==0 && arr[i]!=temp1 &&arr[i]>0){ 
		arr[i]=0;}
	}
	}
	for(int i=0;i<=n-2;i++){
		if(arr[i]!=0){
			int k=arr[i];
			brr[i]=k;
		}
	}
	int t=1;
	for(int i=0;i<=n-2;i++){
		if(brr[i]!=-1){ 
			
			
		cout<<brr[i]<<" ";
			
			if(t%5==0){cout<<endl;}
			t++;
		
	}
	
}}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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];
	int m=2;
	for(int i=0;i<n-1;i++){
		a[i]=m;
		m++;
	}
	cout<<endl;
	int z=2;
	for(z=2;z<n-1;z++){	
	for(int i=0;i<n-1;i++){

		for(int j=2;j<n-1;j++){
		if (a[i+1]==j*z){
		 	a[i+1]=1;}
		}
		
	}
	}
	for(int i=0;i<n-1;i++){
		if(a[i+1]!=1) {z=a[i+1] ;
		break;
		}
	}
	int counter=1;
	for(int i=0;i<n-1;i++){
		
		if (a[i]!=1) {
		cout<<a[i]<<" ";
		counter++;
	}
	if(counter%5==1){cout<<endl;}
	
	
}	
}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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;
    }
    arr[0]=arr[1]=0;
    int p=2;
    while(p<n){
        int k=2;
        while(k*p<=n){
            arr[k*p]=0;
            k++;
        }
        int i=p+1;
        while (p<=n)
        {
            if(arr[i]!=0) {p=arr[i]; break;}
            i++;
        }
    }
    int b=1;
    for (int i = 0; i < n+1; i++)
    {
        if(arr[i]!=0) 
        {cout<<arr[i]<<" ";
        if(b%5==0) cout<<endl;
        b++;}
    }
    
    return 0;  
}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
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 a[n];
int prime[n];
for (int i=0;i<n;i++) prime[i]=0;
int c=2;
for (int i=0;i<n;i++) {
	a[i]=c;
	c=c+1;
	if (c==(n+1)) break;
		      }
int k=0;
for (int 
	if (a[j]==p) int d=j;
	for (int i=1;i<n;i++) {
		if (a[i]%p ==0) {prime[k]=a[i];k=k+1;}
			      }
	for (int b=p;b<2*p;b++) {
		for (int 


for (int i=0;i<n;i++) cout<<prime[i]<<" ";
}

Grading criterion: Variable Names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor variable names
Rating D: 0
Assigned grade: C