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 size;cin>>size;
    vector<int> vct(size,0);
    for(int i=0;i<size;i++)
    {
        cin>>vct[i];
    }
    for(int i=size-1;i>=0;i--)cout<<vct[i]<<" ";
    cout<<endl;
    for(int i=1;i<size-1;i++)
    {
        if((vct[i]>vct[i-1])&&(vct[i]>vct[i+1]))
        {cout<<i; break;}
    }
    return 0;
}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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,x;
    cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        cin>>x;
        A[i]=x;
    }
    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;
    } 
}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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 peak[n];
    for(int i=0;i<n;i++)
    cin >> peak[i];

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

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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<<" "){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: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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 reversearrandpeak(int arr[],int n){
    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<<" ";
        }
    }
}
int main(){
    int n;
    cin>>n;
    int arr[100];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    reversearrandpeak(arr,n);

}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

int main(){
    int n; cin >> n;
    vector<int> vec = {};

    for(int i = 0; i < n; i++){
        int a; cin >> a; 
        vec.push_back(a);
    }

    for(int i = n-1; i >= 0; --i){
        cout << vec.at(i) << " ";
    }

    cout << "\n";
    for(int i = 1; i < n-1; i++){
        if((vec.at(i) > vec.at(i-1)) && (vec.at(i) > vec.at(i+1))){
            cout << i;
            break;
        }
    } 
}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

    for(int i= n-1; i>=0; --i) cout<<arr1[i]<<' ';
    cout<<endl;

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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 x){
    for(int i=0;i<x;i++){
        cout << arr[x-1-i] << " ";
    }
}
int pkfndr(int arr[],int x){
    for(int i=0;i<x-1;i++){
        if(arr[i]>arr[i+1])return i;
    }
}


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

}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

    // NOTE: acc to qn, peak > 0, so using 0 as a default value
    int peak = 0;

    cin >> A[0];

    for(int i = 1; i < n; i++) {
        cin >> A[i];
        if (!peak && A[i] < A[i-1])
            peak = i-1;
    }

    while (n)
        cout << A[--n] << ' ';
    
    cout << endl;

    cout << peak;
}

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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

Grading criterion: Declaration of variables and array/vector.
Rating A: correctly declares the two variables n, and array/vector

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