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;
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: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 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: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: C
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: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: C
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: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: C
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 (float *scores, int L)
	{
	int minindex=0;
	for (int j=0; j<L; j++)
		{
		if (scores[minindex]>scores[j]) minindex=0;
		}
	return minindex;
	}

void selction_sort (float *data, int n)
	{
	for(int i=n; i>1; i--)
		{
		int minindex=argmin(data,i);
		
		void swapV (int a=&data[minindex], int b=&data[i-1])
		int temp=a; ab; b=temp; return;
		}
	}
int main()
	{
	int n;
	cin >> n;
	int A[n];
		for(int i=0; i<n; i++)
			{
			cin >> A[i];
			}
	}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: C
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 minval(int *a, int n, int l){
	int p=n-1;
	for(int j=n-1; j>l-1; j=j-1){
		if(a[p] > a[j]) p = j;	
	}
	return p;
}

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

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 min_index(int *a, int n, int index)
{
	int mini=index;
	for(int i=index;i<n;i++)
	{
		if(a[mini]>a[i])
		{
			mini=i;
		}
	}
	return mini;
}
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=min_index(a,n,i);
		int temp= a[i];
		a[i]=a[mini];
		a[mini]=temp;
	}

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



}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 i,j,n;
cin>>n;
int A[n];
for(i=0;i<n;i++)
cin>>A[i];
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(A[j]<A[i])
{
int temp;
temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
}
for(i=0;i<n;i++)
cout<<A[i]<<" ";
return 0;
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 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++)
                      {int temp =arr[j];
                       arr[j]=arr[i];
                       arr[i]=temp;}}


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




}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: C
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;
double min(float* a,int n,int k)
{
	float m=min(a[k],a[k+1]);
	for (int i=k+2; i<n;i++)
	{
		if(m>=a[i]){m=a[i];}
	}
	return m;
		
}
void swap(float &a, float &b)
{
	float temp =a;
	a=b;
	b=temp;
}
int main()
{
	int n;
	cin>>n;
	float a[n];
	for (int i=0; i<n;i++)
	{
		cin>>a[i];
	}
	for(int k=0;k<n;k++)
	{
		for(int i=k;i<n;i++)
		{
			if(min(a,n,k)==a[i])
			{swap(a[i],a[k]);}
		}
	}
	for (int i=0; i<n;i++)
	{
		cout<<a[i]<<" ";
	}
	
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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_array(int *arr[],int n)
	int min;
	min=arr[0];
	for (int i=0;i < n;i+=1){
		int j;
		for ( j=i+1;j < n;j+=1){
			if (arr[j]<min){
				min=arr[j];   
			}
		arr[j]=arr[i];
		arr[i]=min;
		}
	}
int main(){
int n;
cin>>n;

int arr[n];

for (int i=0;i < n;i +=1){
	cin>>arr[i];
	}
sort_array(arr,n);

for (int j=0;i < n;j+=1){
	cout<<arr[i]<<" ";
	}	
	
return 0;
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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[i]>=A[j])
			{
				int temp=A[i];
				    A[i]=A[j];
				    A[j]=temp;
			}
		}
		cout<<A[i]<<" ";
	}
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 argmin (int A[], int n)
{
  int minindex = 0;
   for(int j=1; j<n; j++)
    {
     if(A[minindex] > A[j])
     minindex = j;
     }
    }
 void sort (int B[], int n)
 {
   for (int i=1; i<n; i++)
   {
   int minindex = argmin(B, i);
   myswap(&B[minindex], &B[i-1]);
   }
 }

int main(){
cin>>n; 
int A[n];
for(int k=0; k<n; k++){
       cin>>A[K];
   }
   cout<<B[n];
   }

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: C
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 minindex = 0;
	for(int j=1; j<L; j++){
		
		if(marks[minindex] < marks[j]) minindex = j;
	}
	return minindex;
}


void selection_sort (float *data, int n)
{
    for(int i=n; i>1;i--)
    {
        int minindex = argmin(data,i); 
        swap(&data[minindex],&data[i-1]); 
    }
}


main_program
{
   
    int i,n;
     cin >> n;
      float A[n];

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

    
    


    selection_sort(A,n);
    
    for (i=0; i <n; i++)
    {
        cout << A[i] << " ";
    }
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 p=i;
        for(int j=i; j<n; j++){
            if(a[p]>a[j]){
                p=j;
            }
        }    
        int t=a[i];
        a[i]=a[p];
        a[p]=t;
    }
    for(int i=0; i<n; i++){
        cout << *(a+i) << " ";
    }                
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
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 mini(int *a,int l)
    {
    int m=0;
    for (int i=0;i<l;i++)
        {
        if (a[m]>a[i]) m=i;
        }
    return m;
    }
    
    
void sort(int *d, int n)
    {
    for(int i=n;i>1;i--)
        {
        int minindex=mini(d,i);
        int temp=d[n-i];
        d[n-i]=d[minindex];
        d[minindex]=temp;
        }
    }
    

int main()
{    
int k;
cin>>k;
int a[k];
for(int i=0;i<k;i++)
    {
    cin>>a[i];
    }
sort(a,k);
for (int i=0;i<k;i++)
    {
    cout<<a[i]<<" ";
    }
}

Grading criterion: Correctness of loop for iteratively swapping elements of sub-array with the minimum elements
Rating A: The loop traverses through the array correctly swapping all the minimum elements with the first index
Rating B: Partially correct loop for traversing through the array to swap all the minimum elements with the first index
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: B