CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
void swap(double &x,double &y)
	{
	  double temp;
	  temp=x;x=y;y=temp;
	}
int minindex(double *A,int i,int n)
	{
	  int minindex=i;
	  for(int j=i+1;j<n;j++)
	    {
	       if(A[minindex]>A[j])
	            minindex=j;
	    }
	  return minindex;
	}	
main_program
{
   int n;
   double A[1000];
   cin>>n;
   for(int i=0;i<n;i++)
       cin>>A[i];
   for(int i=0;i<n;i++)
   	{
          swap(A[i],A[minindex(A,i,n)]);
   	}
   for(int i=0;i<n;i++)
      cout<<A[i]<<" ";
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

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


int main()
{
   int n,i,c,j,k,min,temp,l;
   cin>>n;
   int a[n];
   for(i=0;i<n;i++)
   {
      cin>>a[i];
   }
  
   
   
   for(j=0;j<n;j++)
   {
      
      for(k=j;k<n;k++)
      {
        if(a[k]<a[j])
        {
        min=a[k];
        c=k;
        
        }
        
      }
      
      temp=a[c];
      a[c]=a[j];
      a[j]=temp;
      
      }
      
      for(l=0;l<n;l++)
      {
       cout<<a[l]<<" ";
   
      }
      }

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

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

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,A[n];
cin>>n;
for(int i=0;i<n;i++)
cin>>A[i];
for(int i=0;i<n;i++){
for(int j=i;j<n;j++)
if(A[j]<A[i])
{
int temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
for(int i=0;i<n;i++)
cout<<A[i]<<" ";
return 0;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include <iostream>
using namespace std;
int main() {
    cin>>A[n];
    for(int i=0; i<n;i++)
    cin>>A[i];
}
{
        for(j=0; j<n;j++)
    cin>>A[j];
    int arr[i];
    int main() {
        cout<<"Number of inputs n"<<endl;
        cin>>n;
        for(element with the minimum value);
    }
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>

void swap(int *a, int *b){
	int temp;
	temp=*a;
	*a=*b;
	*b=temp;
}
main_program{
	int n, minindex=0;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	
	for(int i=0;i<n;i++){
		minindex=i;
		for(int j=i+1;j<n;j++){
			if(a[j]<a[minindex]) minindex=j;
		}
		if(a[i]>a[minindex]) swap(&a[i],&a[minindex]);
	}
	
	for(int i=0;i<n;i++) cout<<a[i]<<" ";
	
	
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
int argmin(float *scores, int L){
	int minindex = 0;
	for(int j=1; j<L; j++){
		// update the index if a larger element is found
		if(scores[minindex] > scores[j]) minindex = j;	
	}
	return minindex;
}
void selection_sort (float *data, int n){
for(int i=n; i>1;i--){
int minindex = argmin(data,i);
myswap(&data[minindex],&data[i-1]);
}
}
main_program{
	return myswap;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

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

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

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

	for (int i=0; i<n; i++)
	{
		int minI=i;
		for (int j=i; j<n; j++)
		{
			if (a[j] < a[minI])
			{
				
				swap(a[j],a[minI]);
			}
		}
	}

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


}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

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

void input(int*a, int n){
	for (int k=0;k<n;k++){
		cin>>a[k];
}
}

void output(int*a,int n){
	for (int k=0;k<n;k++){
		cout<<a[k]<<" ";
	}
	cout<<endl;
}

int min(int *a,int n,int k){
int min=a[k],temp=k;
for (int i=k;i<n;i++){
if (a[i]<min){
min=a[i];
temp=i;}}
return temp;}

int main(){
int n,k=0,minindex,temp;
cin>>n;
int a[n];
input(a,n);

for (int i=0;i<n;i++){
minindex=min(a,n,i);
temp=a[i];
a[i]=a[minindex];
a[minindex]=temp;
}

output(a,n);
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

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

int main(){
int n,i;
cin>>n;
int A[n];


void selection_sort (float *data, int n)
{
for(int i=n; i>1;i--){
int maxindex = argmax(data,i); 
elements (from index 0 to index i-1)
myswap(&data[maxindex],&data[i-1]);
}
}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
void swap(int *a, int k, int b){
	int t= a[k];
	a[k]=a[b];
	a[b]=t;

}
int mini(int*a, int n,int min){
	
	int i=min+1, k=min;
	repeat(n-k-1){
		if(a[i]<a[min]) min=i;
		i++;

	}
	return min;
}

main_program{
	int n;
	cin>>n;
	int p[n],i=0;
	repeat(n){
		cin>>p[i];
		i++;
	}
	int s=0;
	repeat(n-1){
		int t= mini(p,n,s);
		swap(p,t,s);
		s++;

	}
	int j=0;
	repeat(n){
		cout<< p[j]<<" " ;
		j++;

	}



}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
void swap(int& arr[i],int& min)
{
		{
			int temp=min;min=arr[i];arr[i]=temp;
		}
	return;
}
main_program{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n-1;i++){
	int min=arr[0];
	for(int i=0;i<n-1;i++){
	if(arr[i]<min){cout<<arr[i];}
	else swap(arr[i],min){cout<<arr[i];}
	}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int main()
{
int a[100];
int i,n,min,j,k;
int dumb;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(j=0;j<n-1;j++)
{

min=a[j];
for(i=0+j;i<n;i++)
{
if(a[i]<=min)
{
min=a[i];
}
}
for(k=0;k<n;k++)
{
if(min==a[k])
break;
}
dumb=a[j];
a[j]=min;
a[k]=dumb;
}
for(i=0;i<n;i++)
cout << a[i] <<" ";
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int n;
int argmin(int A[],int x){
	int minval=n-1;
	for(int i=n-2;i>=n-x;i--){
		if(A[minval]>A[i]){minval=i;}
	}return minval;}

void sort(int A[],int n){
	for(int i=0;i<n-1;i++)
	{int minval=argmin(A,n-i);
	 int temp=A[minval];
	A[minval]=A[i];
	A[i]=temp;}
}
int main(){
	cin>>n;
	int A[n];for(int i=0;i<n;i++){cin>>A[i];}
	sort(A,n);
    for(int j=0;j<n;j++){cout<<A[j]<<" ";}
}

Grading criterion: Reading Input
Rating A: Correctly Reads Inputs
Rating B: Fails To Read Input
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>

using namespace std;

void sorted_array(int *A, int n){
                           for(int j=0; j<n; j++){
                              for(int x=j+1; x<n; x++){
                                   if(A[j]>A[x]) swap(&A[j] &A[x]);
                                 }
                                 }
                                 } 
                                                              
int main() {
            int N;
             cin>>N;
            int A[30];
             if (N<25){
               for(int i=0; i<N; i++){
                                    cin>>A[i];
                                 }
                                 }
                sorted_array(A, N);
                for(int m=0; m<N; m++){
                  cout<<" "<<A[m];
                  }
                  }

Grading criterion: Reading Input
Rating A: Correctly Reads Inputs
Rating B: Fails To Read Input
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
 void sort(int *a,int n){
 	  for(int i=0;i<n;i++){
 	  	for(int j=i+1;j<n;j++){
 	  		if(a[i]>a[j])swap(a[i],a[j]);
 	  	}
 	  }
 	  for(int k=0;k<n;k++){
 	  	cout<<a[k]<<" ";
 	  }
 	}
int main(){
	  int n;
	  
	  cin>>n;
	  
	  int a[n];
	  for(int i=0;i<n;i++){
	  	cin>>a[i];

	 }
	 sort(a,n);
	}

Grading criterion: Reading Input
Rating A: Correctly Reads Inputs
Rating B: Fails To Read Input
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>

main_program{
int a;
int n;
int i;
cin>>n;
   int q[n];
for ( int i=0; i<n; i++){
     cin>> a;
     q[i]=a;
     }
for (int j=(n-1); j=0 ; j--){
      swap(q[j], max( q[]  ));
      
      }
      cout << q[] << " ";
}

Grading criterion: Reading Input
Rating A: Correctly Reads Inputs
Rating B: Fails To Read Input
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
void swap( int a , int b){
                         int temp =a ;
                         a=b;
                         b=temp;
                         }
int argmin(int *a , int n , int i){
                          int mini=n-1;
                          while(i<n-1){
                                      if(a[mini]>a[i]) mini=i;
                                      i++;
                                      }
                          return mini;
                          }
void selectionsort(int *a , int n ){
                                   for(int i=1 ; i<n ; i++){
                                                           int min=argmin( a , n , i-1 );
                                                           swap( a[min] , a[i-1]);
                                                           }
                                   }
int main(){
          int n;
          cin>>n;
          int a[n];
          for (int i=0 ; i<n ; i++){
                                   cin>>a[i];
                                   }
          selectionsort(a , n);
          for(int i=0 ; i<n ; i++){
                                  cout<<a[i];
                                  }
          }

Grading criterion: Reading Input
Rating A: Correctly Reads Inputs
Rating B: Fails To Read Input
Rating C: 0
Rating D: 0
Assigned grade: A