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<iostream>
using namespace std;
void swap (int &a , int &b)
{
	int =t;
	t=a;
	a=b;
	b=t;

}

int find Minindex (int arr [ ], int left, int n)


{
	int minIndex =left;
	for (left=left+1;left<n; left + +)
	{
	if (arr [minIndex] > arr [left])
	{
	minIndex = left;

	}
	}
	return minIndex;
}
void selectionsort (int arr [ ], int left, int n)
{
	for (int i=0; i<n-1,i++)
	{
	int minIndex = find MinIndex (arr,i,n);
	swap (arr[i],arr [minIndex]);
}
}
int main();
{
	int n;
	cin >> n;
	int arr [n];
	for (int i=0;i<n;i++)
	{
	cin >> arr [i];
	}
	SelectionSort (arr,n);
	for (int i=0;i<n;i++)
	{
	cout << arr [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: 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 n;
cin>>n;
int A[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<simplecpp>
  int k,m;
  void swap (int *A) {
  int temp = A[k];
  A[k]=A[m];
  A[m]=temp;
  return;
  }
main_program {
  int n,i,j,k=0; cin>>n;
  int A[n] ;
  for (i=0;i<n;i++) {cin>>A[i] ;}
    int temp_min=A[0];

  while (k<n-1) {
                for (j=0;j<n-k;j++) {
                    if (A[j]<=temp_min ) { temp_min= A[j] ;}}
                for (j=0;j<n;j++) {
                    if (temp_min == A[j] ) { m=j ;} } 
                swap (A);
k++;
  }
 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<simplecpp>
void swap (float *a, float *b)
{
    float temp;
    temp = *a;
    *a = *b;
    *b = temp;
}
int argmin (float *marks, int L, int n)
{
	int minindex = L;
	for(int j=L+1; j<n; j++){
		if(marks[minindex] > marks[j]) minindex = j;	//Update the minindex
	}
	return minindex;
}
void desired_sort (float *data, int n)
{
    for(int i=0;i<n-1;i++)
    {
        int minindex = argmin(data,i,n); //Call the argmin to find min from A[i] to A[n-1].
        swap(&data[minindex],&data[i]);  //swap the values A[i] and A[minindex] using call by refrence.
		//Now the first i+1 elements are in exact position as in sorted array.
   	}
}
main_program
{
    float A[30];
    int i,n;
	cin >> n;
    for (i= 0; i < n; i++)
    {
        cin >> A[i];
    }
    desired_sort(A,n);
    for (i= 0; i < n-1; i++)
    {
        cout << A[i] << " ";
    }
	cout << A[n-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: 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 &x,int &y){
int q=x;
x=y;
y=q;
}
main_program{
int n;
cin>>n;
int x[25];
for(int i=0;i<n;i++){
 cin>>x[i];
 }
for(int i=0;i<n;i++){
 int r=i;
 for(int j=i;j<n;j++){
  if (x[j]<x[r]) {r=j;}
 }
 swap(x[i],x[r]);
 cout<<x[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 Swap(int &a,int &b)
{
	int t;
	t=a;
	a=b;
	b=t;
}

int findMinIndex(int arr[],int left,int n)
{
	int minIndex=left;
	for(left=left+1;left<n;left++)
	{
		if(arr[minIndex]>arr[left])
		{
			minIndex=left;
		}
	}
	
	return minIndex;
}
void SelectionSort(int arr[],int n)
{
	for(int i=0;i<n-1;i++)
	{
		int minIndex=findMinIndex(arr,i,n);
		Swap(arr[i],arr[minIndex]);
	}
}

int main()
{
	int n;
	cin>>n;
	
	int arr[n];
	
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	
	SelectionSort(arr,n);
	for(int i=0;i<n;i++)
	{
		cout<<arr[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(){
		int n;
		cin>>n;
		int arr[n];
		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
			if (arr[i]<arr[j])
			{ int temp;
			temp=arr[i];
			arr[i]=arr[j];
			arr[j]=temp;}}}
			
			for(int i=0;i<n;i++){
				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: 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 arr[n];
	for(int i=0;i<n;i++)
        {cin>>arr[i];}
    for(int i=0;i<n-1;i++){
    	   for(int j=i+1;j<n;j++)
    	   	   if(arr[j]<arr[i]){
    	   	   	   int temp= arr[j];
    	   	   	   arr[j]=arr[i];
    	   	   	   arr[i]=temp;

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

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>

  using namespace std;

  int non integers = n;

  int  n  <  25 ;


   // write your code here //

int mainprogram ()

  {

int arr [7] = {5,4,-7,11,-4,-8,10}

   cout << [5] << endl
   cout << [2] << endl
   cout << [4] << endl
   cout << [1] << endl
   cout << [0] << endl
   cout << [6] << endl
   cout << [3] << endl

  }


  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: 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>
#define N 100
using namespace std;
int main() { 
int n, A[N], a, m;
cin>>n;

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

for (int i=0; i<n-1; i++){
	m=i;
	for (int j=i; j<n; j++){
		if (A[j]<A[m]){m=j;}
		}
	//A[m] is the minimum element
	swap(A[i], A[m]);
	}


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 (int *A, int n){
	int minindex = n-1;
	for(int j=n-2; j>=0; j--){
		if(A[minindex] > A[j]){
			minindex = j;
		}
	}
	return minindex;
}

void myswap (int& a, int& b){
	int temp = a; a = b; b = temp;
	return;
}

void selection_sort (int *A, int n){
	for(int i=0; i<n;i++){
		int minindex = argmin(A,n);
		myswap(&A[minindex],&A[i]);
	}
}

main_program{
	int n,A[25];
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>A[i];
	}
	selection_sort(A,n);
	for (int p=0;p<n;p++){
		cout<<A[p];
	}
}

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 n;
cin>>n;
int A[n];
int i;
for(i=0;i<n;i++)
{
cin>>A[i];
}int l,k;
int j;int c;
for(i=0;i<n;i++)
{c=0;
for(j=i;j<n;j++)
{c++;
if(c==1)
{l=A[j]; k=j;
}
if(l>A[j])
{
l=A[j];
k=j;
}
}
int d=A[i];
A[i]=l;
A[k]=d;
}
for(i=0;i<n-1;i++)
cout<<A[i]<<" ";
cout<<A[n-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: 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;
    float A[n];
    for(int i = 0 ; i < n; i++){
        cin >> A[i];
    }for(int i = 0; i <n; i++){
        int index = i;
        float swap;
        for(int j = i; j <n; j++){
            if(A[j] < A[index]){index = j;}
        }swap = A[i];
        A[i] = A[index];
        A[index] = swap;
    }for(int i = 0; i < n-1 ; i++){
        cout<< A[i] << " ";
    }cout<< A[n-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: 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 argmin(int*number, int l){
    int minindex=0;
    for(int j=1,j<l;j++){
        if(number[min index]>number[j])minindex =j;
    }
    return minindex;
}
void selection sort(int *data,int n){
    for(int i=0;i<n;i++){
        int minindex=argmin(data,i);
        swap(&data[minindex],&data[0])
    }
}
int main{int i,n;
cin>>n;
for (i=o;i<n;i++){
    cin>>A[i];
}
selection sort (A,n);
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: 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>
int swap (int a, int b){
              int temp = a;
              a = b;
              b = temp;
              cout<<a<<" "<<b;
    return 0;          
}
main_program{
            int n;
            cin>>n;
            int a[n];
            for(int i=0;i<n;i++){
            cin>>a[i];
            for(int j;j>i&&j<n;j++){
            while(a[i]>a[j]){
                            swap (a[i],a[j]);
            }
            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 swap(int *a,int *b)
{ int temp=*a;
	*a=*b;
	*b=temp;
}
 int minindex(float*A,int n)
{
	int index=0;
	for(int i=0;i<n;i++)
	{
		if (A[i]>A[i+1]) index=i;
	}
	return index;
}
void selection_sort(float* A,int n)
{
	for (int i=n;i>0;i--)
	{
		for (int j=0;j<i;j++){
			ind=minindex(A,i);
			swap(A[ind],A[j]);
		}

	}
}
void print(float*A,int n)
{
	for(int i=0;i<n;i++)
	cout<<A[i]<<" ";
}

int main()
{
	float A[25];
	int n;
	cin>>n;
	for (int i=0;i<n;i++) cin>>A[i];
selection_sort(A,n);
cout<<print;


	
	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: B