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

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

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

    for (int i = 1; i < n; i++){
        if (v[i] < v[i-1]){
            cout << endl << i-1 << endl;
            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>
#include <vector>
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 k = 1;k<n-1;k++){
        if((arr[k-1] < arr[k]) && (arr[k] > arr[k+1])){
            cout << k;
            break;
        }
    }
}

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

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

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

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

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

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

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

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

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

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

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

Student submission:
#include<iostream>
using namespace std;
int main(){
    int n;cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        cin>>A[i];
    }if(n<3 &&n>100) cout<<0;
    else {
        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 A[] = {} ;

int main(){
  
}

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: C
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 i;
    cin>>i;
    int v[100];
    for( int j=0;j<i;j++){
        cin>>v[j];
    }
    int w[i];
    for(int j=0;j<i;j++){
        w[j]=v[i-j-1];
        cout<<w[j]<<" ";
    }
    cout<<endl;
    for(int k=1;k<i-1;k++){
        if((v[k-1]<v[k])&&(v[k+1]<v[k])){
            cout<<k;
            break;
        }
    }

}

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

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

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

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

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

Student submission:
#include <iostream>
using namespace std;
int main(){
    int n=0;
    cin >> n;
    if (n<=100){
        int arr[n]={};
        int k = 0;
        for (int i = 0; i<n; i++){
            cin>>k;
            arr[i]=k;
        }

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

        cout<<endl;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Student submission:
#include<iostream>
int main(){
    int n;bool found=0;int b;
    std::cin>> n;
    int a[n];
    for (int i=0;i<n;i++) {std::cin >> a[i];}
    for(int i=n-1;i>0;i--){             // cant use a[0] since we will be using i-1
        std::cout << a[i] << " ";
    if (!found && (a[i]>a[i-1])) {
        b=i;found =1;
        }
    }
    std::cout << a[0] << std::endl << b; // we didnt take case of a[0] earlier
}

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

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

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

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

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

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

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

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

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

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

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

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

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

int peak(vector<int> arr,int num) {
    for(int i=1;i<num;i++) {
        if(arr[i]>arr[i-1] && arr[i]>arr[i+1]) return i;
    }
}

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

int main() {
    vector<int> arr;
    int num;
    cin>>num;
    for(int i=0;i<num;i++) {
        int a;
        cin>>a;
        arr.push_back(a);
    }
    print(arr,num);
    cout<<endl;
    cout<<peak(arr,num);
}

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

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