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>

  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: Correctness of loop for iteratively finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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>
#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: Correctness of loop for iteratively finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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<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: Correctness of loop for iteratively finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 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: Correctness of loop for iteratively finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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;
    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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
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 (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 finding minimum elements of sub-array
Rating A: The loop traverses through the array correctly finding all the minimum elements correctly
Rating B: Partially correct loop for traversing through the array to find the minimum elements
Rating C: No loop or Totally wrong loop for traversing through the array
Rating D: 0
Assigned grade: B