CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

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=n-1; i>=0; i--){
        cout<<A[i]<<" ";
    }
    cout<<endl;
    for(int j=1;j<n-1;j++){
        if(A[j]>A[j-1]&&A[j]>A[j+1])
        {
            cout<<j;
            break;
        }
    }
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include <iostream>

int main(){
    int n, m = 0; std::cin >> n;
    int peakind[100] = {};
    int list[100] = {};
    for(int i = 0; i < n; i++){
        std::cin >> list[i];
    }
    for(int j = 0; j < n-2; j++){
        if(list[j] < list[j+1] && list[j + 1] > list[j + 2]){
            peakind[m] = j + 1; m++;
        }
    }
    for(int k = 0; k < n; k++){
        std::cout << list[n - 1 - k];
        if(k != n - 1){
            std::cout << " ";
        }
        else std::cout << std::endl;
    }
    for(int l = 0; l < m; l++){
        std::cout << peakind[l];
        if(l != m - 1){
            std::cout << " ";
        }
        else std::cout << std::endl;
    }
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include <iostream>
using namespace std;

int main ()
{
    int n;
    cin>>n;

    int a[n];
    //taking input of array
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    //print elements of array in reverse order
    for(int i = n - 1; i >= 0; i--)
    {
        cout<<a[i]<<" ";
    }

    //find out index of peak element by going through the entire array and finding the element greater than its neighbours
    int idx;
    for(int i = 1; i < n - 1; i++) //first and last element cannot be peak elements
    {
        if(a[i-1] <  a[i] && a[i] > a[i+1])
        {
            idx = i;
            break; //because only 1 such element exists, we break as soon as such an element is found
        }
    }
    cout<<endl<<idx;
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;
int main(){
int A[200];
int n;
cin >> n;
for(int i=1;i<=n;i++){
    int a;
    cin >> a;
    A[i]=a;}
    for (int j=1;j<=n;j++){
        cout << A[n-j+1] << " ";}
    cout << endl;
    for(int k=1;k<=n-2;k++){
        if (A[k]<A[k+1]&& A[k+1]>A[k+2]){
            cout << k;
        }
    }


}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using std::cin; using std::cout;using std::endl;
int main()
{int n,x=0;
 cin>>n;
 int arr[n],ar[n];
 for(int i=0;i<n;i++)
 {cin>>arr[i];
      ar[n-1-i]=arr[i];}
      for(int i=0;i<n;i++)
      {cout<<ar[i]<<" ";
      if(arr[i]>arr[x]){x=i;}
      }
      cout<<endl<<x;}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

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];
    }
    for(i=n-1;i>=0;i--){
        cout<<a[i]<<" ";
    }
    for(i=1;i<n-1;i++){
        if(a[i+1]<a[i]){break;}
    }
    cout<<endl<<i;
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a[100];
for(int i=0;i<n;++i){cin>>a[i];}
for(int i=0;i<n;++i){cout<<a[n-i-1]<<" ";     }
cout<<endl;
int index=0;
for( ;index<n-1;++index){
    if(a[index]>a[index+1]){break;}
}
cout<<index;




}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;
int main()
{
    int n;
    int a[100];
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=n-1;i>=0;i--)
    {
        cout<<a[i]<<" ";
    }
    cout<<endl;
    for(int i=1;i<n-1;i++)
    {
        if(a[i]>a[i-1]&&a[i]>a[i+1])
        {
            cout<<i;break;
        }
    }return 0;
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

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=n-1;i>=0;i--){
        cout<<a[i]<<" ";
    };
    cout<<endl;
    for(int i=1;i<n-1;i++){
        if(a[i]>a[i-1] && a[i]>a[i+1])cout<<i;
    };
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

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=n-1;i>=0;i--){
        cout<<arr[i]<<" ";
    }
    cout<<endl;
    for(int i=1;i<n-1;i++){
        if((arr[i]>arr[i-1])&&(arr[i]>arr[i+1]))
        cout<<i<<" ";
    }
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int A[100];
    for(int i = 0; i < n; i++) {
        cin >> A[i];
    }
    for (int i = n - 1; i >= 0; i--) {
        cout << A[i] << " ";
    }
    cout << endl;
    int j = 1;
    while(j < n) {
        if ((A[j] > A[j - 1]) && (A[j] > A[j + 1])) {
            cout << j;
            break;
        }
        j++;
    }
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;
int main() {
    int n,m;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=n-1;i>=0;i--){
        cout<<arr[i]<<" ";
    }
    for(int i=1;i<n-1;i++){
        if((arr[i]>arr[i-1])&&(arr[i]>arr[i+1])){
            cout<<endl;
            cout<<i;
            break;
        }
    }
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

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=n-1;i>=0;i--)
    {
        cout<<arr[i]<<" ";
    }
    cout << endl;
    for (int i=1;i<=n-2;i++)
    {
        if (arr[i]>arr[i-1]&& arr[i]>arr[i+1])
        {
            cout << i;
            break;
        }
    }
}

Grading criterion: Accepting input
Rating A: correctly accepts n, and array/vector as input

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;

int main(){
    int n;
    cin>>n;
    int no[n];
    for(int i=0;i<n;i++){
                        cin>>no[i];}
    for(int i=1;i<=n;i++){cout<<no[n-i]<<" ";}
    cout<<endl;
    
    for(int i=1;i<n;i++){
        if(no[i-1]<no[i] && no[i+1]<no[i]){cout<<i<<endl;}
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

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=n-1;i>=0;i--){
        cout<<arr[i]<<" ";
    }
    cout<<endl;
    for (int i=1;i<n-1;i++){
        if(arr[i]>arr[i-1]&&arr[i]>arr[i+1]){
            cout<<i;
        }
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;

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

        for(int i=n-1; i>=0; i--) {
            cout<<A[i]<<" ";
        }
        cout<<endl;

        for(int i=1; i<n-1; i++) {
            if(A[i-1]<=A[i] && A[i+1]<=A[i]) {
                cout<<i;
            }
        }
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;

void reverse(int arr[],int n)
{
    for(int i=0;i<n;i++)
    {
        cout<<arr[n-1-i]<<" ";
    }
    cout<<endl;
}

void maxi(int arr[],int n)
{
    for(int i=1;i<n-1;i++)
    {
        if(arr[i]>arr[i-1] && arr[i]>arr[i+1])
        cout<<i<<" ";
    }
    cout<<endl;
}

int main()
{
    int n;
    cin>>n;
    if(n>100)
    {
        cout<<"exceeded capacity";
        return 0;
    }
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    reverse(arr,n);
    maxi(arr,n);
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int arr[100];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    for(int j=n-1; j>=0; j--){
        cout<<arr[j]<<" ";
    }
    cout<<endl;
    for(int i=1; i<n-1; i++){
        if((arr[i]>arr[i-1])&&(arr[i]>arr[i+1])){
            cout<<i;
            break;
        }
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;
int main(){
    int a[100];
    int n;
    cin >> n;
    for(int i=0;i<n ;++i){
        cin >> a[i];
    }
for(int i=0;i<n;++i){
    cout << a[n-i-1]<< " " ;
}
cout << endl;
for(int i=1;i<n-1;++i){
    if(a[i]>a[i-1]&&a[i]>a[i+1]){
        cout << i;
        break;
    }
}
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

Initialization: Accept an integer n denoting the array size, followed by n integer elements.

Reverse Traversal: Output the array elements in reverse sequence, space-separated, on a single line.

Peak Detection: Identify all "peak" elements within the array. A peak is strictly defined as an element that is greater than both its preceding and succeeding neighbors. Print the 0-based indices of all identified peaks on a new line, separated by spaces. If the array contains no peaks, leave the second line blank.

Student submission:
#include<iostream>
using namespace std;

int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)cin>>arr[i];
    for(int i=0;i<n;i++)cout<<arr[n-1-i]<<" ";
    cout<<endl;
    for(int i=1;i<n-1;i++){
        if(arr[i]>arr[i-1] && arr[i]>arr[i+1])cout<<i;
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: A