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

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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>
            #include <vector>
            using namespace std;

            int main(){
                int n;
                cin>>n;
                vector<int>V={};
                for(int i=0;i<n;i++){
                    int x;
                    cin>>x;
                    V.push_back(x);
                }
                for(int i=n-1;i>=0;i--){
                    cout<<V[i]<<" ";
                }
                int peak=0;
                int peak_index;
                int count;
                for(int x: V){
                    if(x>peak){peak=x; peak_index=count;}
                    count++;
                }
                cout<<endl<<peak_index;
            }

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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>
#include<vector>
using namespace std;
int main(){
    vector<int> list;
    int n;
    cin >> n;
    list.resize(n);
    for(int i=0;i<n;i++) cin >> list[i];
    for(int i=n;i>0;--i){
        cout<<list[i-1]<<" ";
    }
    cout<<endl;
    for(int i=1;i<n-1;i++){
        if((list[i-1]<list[i]) && (list[i]>list[i+1])) cout<<i;
    }
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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;
    std::cin >> n;
    int* arr = new int[n];
    int peak=0;
    for (int i=0; i<n; i++)
    {
        std::cin >> arr[i];
        if (arr[i]>arr[peak])
        peak=i;
    }
    for (int i=0; i<n/2; i++)
    {
        std::swap(arr[i],arr[n-1-i]);
    }
    for (int i=0; i<n; i++)
    std::cout << arr[i] << " ";
    std::cout << std::endl;
    std::cout << (peak);
    delete[] arr;
    return 0;
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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, max;

        std::cin >> n;

        int m=n;

        int p[100];

        for (int i=0; i<n; i++)
        {

                std::cin >> p[i];

        }
        for (int i=0; i<n; i++)
        {

                if(p[i]<p[i+1] && p[i+1]>p[i+2])
                {
                        max = i+1;
                        break;
                }
                else continue;

        }

        for(int i=0; i<(n-1)/2; i++)
        {

                std::swap(p[i],p[m-1]);
                m--;

        }
        for(int i=0; i<n; i++)
        {

        std::cout << p[i] << " ";

        }

        std::cout << "\n";
        std::cout << max;

}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: B
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>
#include<vector>
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> arr(n);
    for(int i = 0; i < n; i++) cin >> arr[i];
    for(int i = n-1; i >= 0; i--) cout << arr[i] << " "; //printing in rev order
    cout << endl;
    for(int i = 1; i < n-1; i++){
        if(arr[i] > arr[i-1] && arr[i] > arr[i+1]){
            // if condition implies element at i is a peak
            cout << i;
            break;
        }
    }
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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>
#include<vector>
using namespace std;

int main(){
    vector<int> v;
    int n,x;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        v.push_back(x);
    }
    x=n-2;
    for(int i=n-1;i>=0;i--){
        cout<<v[i]<<' ';
        if(v[x]<v[i]&&i!=0&&i!=n-1) x=i;
    }
    cout<<endl;
    cout<<x<<endl;
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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

}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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=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: Finding the Peak element
Rating A: correctly writes the logic for peak element

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,std:: cout,std::endl;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
    int num;
    cin>>num;
    arr[i]=num;
}
for(int j=n-1;j>=0;j--){
    cout<<arr[j]<<" ";
}
cout<<endl;
for(int j=1;j<n-1;j++){
    if((arr[j]>arr[j-1])&&(arr[j]>arr[j+1])){
        cout<<j;
        break;
    }
}
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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<<endl;
        }
    }
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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>
#include <vector>

using namespace std;

int main(){

    int n = 0;
    cin >> n;

    vector<int> in;

    for(int it = 0; it < n ; it++){
        
        int x = 0;
        cin >> x;
        in.push_back(x);
    }

    for(int it = 1; it <= n ; it++){
        
        cout << in[n - it] << " ";

    }

    cout << '\n';

    for(int it = 1; it < n - 1 ; it++){
        
        if((in[it] > in[it-1]) && (in[it] > in[it+1])){

            cout << it;

        }
    }


}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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>
#include <vector>
using namespace std;
typedef std::vector<int>::iterator itr;

int main(){
    int n;
    cin >> n;
    vector<int> A;
    A.resize(n);
    for(int& x : A){
        cin >> x;
    }
    for(itr p = A.end() - 1; p>=A.begin(); p--){
        cout << *p << " ";
    }
    for(itr p = A.end() - 2; p>A.begin(); p--){
        if(*(p-1) < *p && *(p+1) < *p){
            cout << endl << p - A.begin();
            break;
        }
    }
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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::cout;using std::cin; using std::endl; using std::swap;
void end_to_first(int N[],int n)
{ int endi=n-1;
for(int i=0; i<n;i++)
swap(N[endi],N[i]);}

int main(){
   int i;
   int N[i];
    for(int i=3;i<=100;i++){
int n;
cin>>n;
end_to_first(N,i);
cout<<N[i];
    }
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

Rating B: Some Issue.
Rating C: Major Issue.
Rating D: 0
Assigned grade: B
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 readarray(int a[],int n){
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
}
void printreversed(int a[],int n){
    for(int i=n-1;i>=0;i--){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}
void printpeak(int a[],int n){
    for(int i=1;i<n-1;i++){
        if(a[i]>a[i-1]&&a[i]>a[i+1])cout<<i;
    }
}
int main(){
    int arr[100];
    int n;
    cin>>n;
    readarray(arr,n);
    printreversed(arr,n);
    printpeak(arr,n);
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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>
#include<vector>
using namespace std;
int main()
{
    int n,x;
    cin >> n;
    vector<int> X(n);
    for(int i=0;i<n;i++) {cin >> X[i];}
    for(int i=0;i<n;i++) cout << X[n-1-i] << " ";
    cout << endl;
    for(int i=1;i<n-1;i++)
    {
        if((X[i-1]<X[i])&&(X[i]>X[i+1])) cout << i;
    }
    return 0;
}

Grading criterion: Finding the Peak element
Rating A: correctly writes the logic for peak element

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