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 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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

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

Constraints:

* n < 25

Input Format:

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

Output Format:

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

Student submission:
include<iostream>
using namespace std;
int main()
{int n;
cin>>n;
int A[n];
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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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>
main_program{
int n,,int a[],int i1,int i2;
cin>>n;
int a[];
for (i=0;i<n;i++);{
if(a[0]>a[i]);{
i++;
int temp=a[0];
a[0]=a[i];
a[i]=temp;
}
}
for(j=i+1;j<n-1;j++);{
if(a[1]>a[j]);{
j++;
int temp=a[1];
a[1]=a[j];
a[j]=temp;
}
}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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;

 a->array
 x->exponential array

   for(int j=0;j<=n-1;j++)
      int m=a[j]; {
      int x=j;

   for(i=j,i<n-1,i++)
      if(m>a[i+1]){
       m=a[i+1];
       x=i+1;
      }
      }
     a[x]=a[j];
     a[j]=m;->print array

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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>

main_program{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
 cin>>a[i];
for(int i=0;i<n-1;i++)
{
  for(int j=i+1;j<n;j++)
{
  if(a[j]<a[i]){
  int temp=a[j];
  a[j]=a[i];
  a[i]=temp;
}
}


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





}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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>
#include<cmath>

using namespace std;


int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int k=0;k<n;k++)
	{
		cin>>arr[k];
	}
	for(int i=n;i>=0;i--)
	{
		for(int j=n;j>=n-i;j--)
		{
			int mini=0;
			if(arr[j]<arr[mini])
			{
				swap(arr[j],arr[mini]);
			}
			mini=j;
		}
		cout<<arr[i]<<" ";
	}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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<stdio.h>
#include<conio.h>

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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];
	}
	
	int i;
	for (i=0; i<n; i++)
	{
		
		int minindex=i,temp = a[i];
		for (int k=i; k<n; k++)
		{
			if (a[k] <= a[minindex] ) {minindex = k;}
		}
		
		a[i] = a[minindex];
		a[minindex] = temp;
	}
	for (int i = 0; i<n; i++)
	{
		cout << a[i] << " ";
	}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 argmin(int*A, int n){
                    int minindex=0;
                    for(int j=1;j<n;j++){
                                       if(A[minindex]<A[j]) minindex=j;
                                       }
                    return minindex;
                       }
void swap(int *a,int *b){
                                      int temp=*a;
                                     *a=*b;
                                      *b=temp;
                                      return;}
void sorting(int *A,int n){
                        for(int i=n;i>1;i--){
                                            int minindex=argmin(A,i);
                                           swap(&A[minindex],&A[n-i]);
                                            }
                         }
int main(){
int n;cin>>n;
int *A;
for(int i=0;i<n;i++){cin>>A[i];}
sorting(A, n);
int j;
for(j=0;j<n; j++){cout<<A[j]<<" ";}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

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

Constraints:

* n < 25

Input Format:

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

Output Format:

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

Student submission:
#include<simplecpp>
main_program{
int n;
cin>>n;
int a[25];
for(int i=0;i<n;i++){
cin>>a[i];}
for(int j=1;j<n;j++){
	if(a[j]>a[j-1]) return 0;
	else if swap(a[j],a[j-1]);
}
	for(int k=0;k<n;k++){
	cout<<a[k];}	
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 arr[n];
for(int i=0;i<n;i++){cin>>arr[i];}
for(int k=0;k<n;k++){for(int j=n-1;j>k;j--){if(arr[k]<arr[j]){int temp=arr[j];
                                                                arr[j]=arr[k];
                                                                arr[k]=temp;}
                                         }

 
 }for(int l=n-1;l>=0;l--){cout<<arr[l]<<" ";}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 Min;
	int idx;
	for(int i=0;i<n;i++){
	cin >> A[i];
	}
	for(int i=0;i<n;i++){
	 Min = 1000;
	for(int j=i;j<n;j++){
	if(A[j] < Min){
	Min = A[j];
	idx = j;}
	}
	A[idx] = A[i];
	A[i] = Min;
	}

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

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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>
#include <cmath>
using namespace std;



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++){
        int m=a[j];
        int x=j;

        for(int i=j;i<n-1;i++){
            if(m>a[i+1]){
                m=a[i+1];
                x=i+1;
            }
        }
        a[x]=a[j];
        a[j]=m;
 
}
    for(int i=0;i<n;i++){

        cout<<a[i]<<" ";
    }

}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 min_index(int *a,int n,int j)
{
	int min=n;
	for(int i=n-1;i>=j;i--)
	{
		if(a[min]>a[i]) min=i;
	}
	return min;
}
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 min=min_index(a,n,i);
		int temp=a[i];
		a[i]=a[min];
		a[min]=temp;
	}
	for(int i=0;i<n;i++) cout<<a[i]<<" ";
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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>
main_progaram{
int n , i ;
cin>>n;
a[i];
for(i=0;i<<n;i++) {
cin>>i;
}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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;
void swap (int &a, int &b){
int temp = a; a = b; b = temp;
return;
}
int min (float &arr[25], int n){
int minindex = 0; int &l=0;
for(int j=l; j<n; j++){
if(arr[minindex] > arr[j]) minindex = j;
}
return minindex;
}

	int n ; float A[25];
cin>>n;
for (int i = 0; i < n; i++) cin >> A[i];
int k=0;
for(int i =0; i<n;i++){
	minindex = min(A[25],n);
	swap(A[minindex],A[k]);
	k=k+1;
	l=l+1;
}
for (int i = 0; i < n; i++) cout<<A[i];}


}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 sort(int A[], int n){
int p,r;
for(p=0; p<n; p++){
    for(r=0; r<n-1; r++){
       if(A[r]<A[r+1]){
        A[r+1]=A[r];
       }
     swap(A[r+1], A[p]);
}
}
return A[n];
}

int main{
int A[], n;
cin>>n;
for(int i=0; i<n; i++){
cin>>A[i];
}
 sort(A , n);
 int m = sort(int A[], int n);
cout<<m;
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 swap(int *A,int *B){
	int temp=*A;
	*A=*B;
	*B=temp;
	return 0;
}

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]<<" ";
}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

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

Constraints:

* n < 25

Input Format:

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

Output Format:

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

Student submission:
#include<simplecpp>
void swap(float *a,float *b)
{
float temp;
temp=*a;
*a=*b;
*b=temp;}
int avgmin(float *marks,int L)
  {
int minindex=0;
for(int j=0;j<L;j++)
{
  if(marks[minindex]<marks[j])  minindex=j;}
return minindex;
}
void selection_sort(float *A,int n)
{ for(int i=n;i>1;i--)
  {
	int minindex=avgmin(A,i);
	swap(&A[minindex],&A[i-1]);}}


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

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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;
return;
}
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n<25;i++){
cin>>a[i];
}
for(int j=0;j<n<25;j++){
    for(int k=1;k<n<25;k++){
while(a[k]<a[j]){
   swap(a[j],a[k]);
  }
}
  }
for(int y=0;y<n<25;y++){
  cout<<a[y];
    }
 return 0;
     }

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B