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

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

	for(int i=0;i<n;i++)
	{
		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: 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_no(int*a,int*b){
int temp=*a;
*b=*a;
temp=*b;}
int min_ind(int *a,int n ,int k){
int min_ind =k;

for(int i=k;i<n;i++){
if(a[i]<a[min_ind]){
min_ind=i;
} 
}
return min_ind;

}
void sort( int *a, int n){
for(int i=0;i<n;i++){
swap(i,a[min_ind(a,n,i)]);
}
}


int main(){
int n;
cin>>n;
int a[n];

for(int i =0;i<n;i++){
cin>>a[i];}
sort(a,n);
for(int 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: 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];

	int indexOfMin = 0, temp;
	for(int i = 0; i < n - 1; i++){
		indexOfMin = i;
		for(int j = i + 1; j < n; j++){
			if(arr[j] < arr[indexOfMin])
				indexOfMin = j;
		}

		temp = arr[indexOfMin];
		arr[indexOfMin] = arr[i];
		arr[i] = temp;
	}

	for(int i = 0; i < n; i++)
		cout << arr[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 swap(int *a,int *b)
{
	int temp;
	temp=*a;
	*a=*b;
	*b=temp;
}
int main()
{
	int n;
	cin>>n;
	int A[n];
	for(int i=0;i<n;i++)
	{
		cin>>A[i];
	}
	for(int j=0;j<n-1;j++)
	{
		for(int k=0;k<n-j-1;k++)
		{
			if(A[k]>=A[k+1])
			{
				swap(&A[k],&A[k+1]);
			}
			else
			{
				continue;
			}
		}
	}
	for(int l=0;l<n;l++)
	{
		cout<<A[l]<<" ";
    }
}

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>
void swap(int *a,int *b)
{
int temp=*a;
*a=*b;
*b=temp;
}
void arr(int a[],int n)
{int min=100000;

	
	for(int k=0;k<n;k++)
	{
	int ctr=0;
		for(int j=k;j<n;j++)
	{ 
		if(min>a[j])
		{
		min=a[j];
		ctr++;
			}
	
	 	swap(a[j],a[ctr]);
	 }
	for(int i=0;i<n;i++){
	cout<<a[i]<<" ";}
	}
	
}


main_program{
int a[100];
int n;
cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	arr(a,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: 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 i,j,n,pos,element,tmp;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
pos = i;
element=a[i];
for(j=i;j<n;j++)
{
if(a[j]<a[pos])
{
pos=j;
element=a[j];
}
}
a[pos]=a[i];
a[i]=element;

}

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: 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 &p,int &q){
 int temp=p;p=q;q=temp;
 }
 int mindex(int *a,int n,int i){
 int minindex=i;
 for(int j=i;j<n;j++){if(a[minindex]>a[j]) minindex=j;}
 return minindex;
 }
 void msort(int *a,int n){
 for(int i=0;i<n;i++){
 swap(a[i],a[mindex(a,n,i)]);
 }
 }
 int main(){
 int n;
 cin>>n;
 int  a[100];
 for(int j=0;j<n;j++) cin>>a[j];
 msort(a,n);
 for(int j=0;j<n;j++) cout<<a[j]<<" ";
 }

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 swapR (int& a, int& b){
int temp = a; a = b; b = temp; return;
}

int main(){

	int n,q;
	
	cin >> n;
	
	int a[n];
	
	for(int i=0;i<n;i++){
	
		cin >> a[i];
	
	}
	
	for(int p=0;p<n-1;p++){
	
		for(int k=n-1;k>p;k--){		
			
			if(a[k]<a[k-1]){
			
				swapR(a[k],a[k-1]);
			
			}
												
		}
	
	}
	
	for(int y=0;y<n;y++){
	
		cout << a[y] << " ";
	
	}

}

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 inp (int *a, int n){
for (int i = 0; i < n; i++) cin >> a[i];
}

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

int argmin (int *scores, int L,int n){
int minindex = (n-1);
for(int j=L;j<n; j++){
if(scores[minindex] > scores[j]) minindex = j;
}
return minindex;
}

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

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

int main(){
	int n;
	cin>>n;
	int a[n];
	inp(a,n);
	selection_sort(a,n);
	pri(a,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: 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];
fot(int i=0;i<n;i++)
{cin>>A[i]}
for(int 0;i<n;i++)
{
int min=A[i];
for(int j=0;j<n;j++)
{
 if(A[j]<min)
{
  min=A[j];
  int temp=A[i];
  A[i]=A[j];
  A[j]=temp;
}
}
}

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