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;

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

void findpeak(int a[],int n){
    int i= 1;
    int peak=0;
    for(;i<n-1;i++){
        if((a[i-1]<a[i]) && (a[i]>a[i+1])){
              peak=i;
        }
    }
    cout<<peak;
}

int main(){
             int x;cin>>x;
             int p[x];
             for(int i=0;i<x;i++){
                     cin>>p[i];
             }
       reverse(p,x);
       cout<<endl;
       findpeak(p,x);


}

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 q;
    cin>>q;
    int numbs[q];
    for(int i=0;i<q;i++){
        cin>>numbs[i];
    }
    for(int i=(q-1);i>=0;i--){
        cout<<numbs[i]<<" ";
    }
    cout<<endl;
     for(int i=0;i<q;i++) {
        if(i!=0 || i!=(q-1)) {
            if(numbs[i-1]<numbs[i]&&numbs[i+1]<numbs[i]) {
                cout<<i<<endl;
            }
            else continue;
        }
        else continue;
    }
    return 0;
}

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,peak;
    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]){
            peak=i;
        }
    }
    cout<<peak;
}

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>
#include<vector>
using std::cin; using std::cout; using std::vector; using std::endl;
int main(){
    int n; cin>>n;
    vector<int> inp;
    for(int i=0;i<n;i++){
        int x; cin>>x;
        inp.push_back(x);
    }
    for(int i=n-1;i>=0;i--){
        cout<<inp.at(i)<<" ";
    }
    cout<<endl;
    for(int i=1;i<n-1;i++){
        if(inp.at(i)>inp.at(i-1)&&inp.at(i)>inp.at(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 <vector>
#include <iostream>
using namespace std; 
int main(){
    int ncases; 
    cin>>ncases; 
    vector<int> values(ncases); 
    for (int i =0; i<ncases;i++){
        cin>>values[i]; 
    }
    int peak = -1; 
    for (int i = ncases-1; i>=0; i--){
        if (i!=0 && i!= ncases-1){
            if (values[i]>values[i-1] && values[i]>values[i+1]){
                peak = i; 
            }
        }
        cout <<values[i]<<" "; 
    }
    cout<<endl<<peak; 
}

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 std::cin, std::cout;

int main(void)
{
    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-1-i] << " ";
    }
    cout << "\n";
    int peak=-1;
    for (int i=1; i<(n-1); i++)
    {
        if (a[i]>a[i-1] && a[i]>a[i+1])
        {
            peak=i;
            break;
        }
    }
    cout << peak;
}

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-1]<arr[i] && arr[i+1]<arr[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;
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] << " ";
        }
    for (int i=0; i<n; i++) {
        if (arr[i] > arr[i-1] && arr[i] > arr [i+1]) {
            cout << endl << 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[n], t=0;
    while( t!=n ) cin >> a[t++];
    for(int i=n-1; i>-1; 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 << endl;
            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[100];
    for(int i=0;i<n;i++) cin>>arr[i];
    for(int i=n-1;i>=0;i--) cout<<arr[i]<<' ';
    cout<<'\n';
    for(int i=1;i<n-1;i++){
        if((arr[i-1]<arr[i]) && (arr[i]>arr[i+1])){
            cout<< i <<'\n';
            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 std::cin;
using std::cout;

int main() {
    int N;
    cin >> N;
    int arr[100];
    for (int i = 0; i < N; ++i) {
        cin >> arr[i];
    }
    for (int i = N-1; i >= 0; --i) {
        cout << arr[i] << ' ';
    }
    cout << '\n';
    for (int i = 1; i < N-1; ++i) { // endpoints cannot be `peak`
        if (arr[i] > arr[i-1] && arr[i] > arr[i+1]) {
            cout << i << '\n';
            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 peak(int a[], int n){
    for(int i=1;i<n-1;i++){
        if((a[i] > a[i+1]) && (a[i]>a[i-1])){
            return i;
        }
    }
    return -1;
}

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;
    cout << peak(a,n) << endl;
    return 0;
}

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 std::cin; using std::cout; using std::endl;

int main(){
    int c;
    cin>>c;
    int A[c];
    int B[c];
    for(int i=0;i<c;i++){
        int p;
        cin>>p;
        A[i]=p;
    }
    for(int j=0;j<c;j++){
        B[j]=A[c-j-1];
    }
    for(int k=0;k<c;k++){
        cout<<B[k]<<" ";
    }
    cout<<endl;
    for(int l=1;l<c-1;l++){
        if(A[l]>A[l-1] && A[l]>A[l+1]){
            cout<<l;
        }
    }
}

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

}

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 std::cout; using std::cin; using std::endl;

int main(){
    int N[100];
    int n; cin>>n;
    bool t=true;
    for(int i=0; i<n; i++) cin>>N[i]; int j;
    for(int i=0; i<n; i++){
        cout<<N[n-1-i]<<" ";
        if(N[i]>N[i+1] &&t){
            j=i;
            t=false;
        }
    }
    cout<<endl<<j;
}

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[n];

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

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

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

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

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

int main() {
    int n;
    cin>>n;
    vector<int> A={};
    for (int i=0;i<n;i++) {
        int x;
        cin>>x;
        A.push_back(x);
    }
    for (int i=n-1;i>=0;--i) {
        cout<<A[i]<<" ";
    }
    cout<<endl;
    for (int i=1;i<(n-1);i++) {
        int a=A[i-1];
        int b=A[i];
        int c=A[i+1];
        if ((b>a) && (b>c)) {
            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