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

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 NMAX = 100; int n; cin >> n;
    int Array[NMAX];
    for (int i = 0; i < n; i++) {
        cin >> Array[i];
    }
    for (int i = n-1; i >=1; i--) {
        cout << Array[i] << " ";
    }
    cout << Array[0] << "\n";

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

}
for(int i=1;i<n-1;i++)
{if(A[i]>A[i-1]&&A[i]>A[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 check(int arr[],int n){
    for(int i=1;i<n-1;i++){
        if((arr[i]>arr[i-1])&&(arr[i]>arr[i+1])){
            return i;
        }
    }
}
int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int rev[n];
    for(int i=0;i<n;i++){
        rev[i]=arr[n-i-1];
    }
    for(int i=0;i<n;i++){
        cout<<rev[i]<<" ";
    }
    cout<<endl;
    cout<<check(arr,n)<<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];
    for (int i=0; i<n; i++ ) cin >> A[i];
    for (int i=0; i<n; i++ ) cout << A[(n-1)-i] << " ";
    cout << endl;
    for (int i=0; i<n; i++ ) {
        if (i==0 || i==n) continue;
        else {
            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 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;
        }
    }
    cout<<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;
    int A[n];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(int i=n-1;i>=0;i--)
    {
        cout<<A[i];
        if(i==0)
        {
            cout<<endl;
        }
        else
        {
            cout<<" ";
        }
    }
    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 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 A[n];
    for(int i=0;i<n;++i){
        cin>>A[i];
    }

    for(int j =0; j < n;++j){
        cout << A[n-j-1] << " ";
    }
    cout << '\n';
    int count = 0 ;
    for(int i = 0; i < n-1 ; ++i){
        if(A[i] > A[i+1] && A[i] > A[i-1]){
            cout <<count;
            break;
        }
        count++;
    }


}

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

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

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

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

    print(a, n);
    cout  << "\n" <<find(a,n);
}

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