CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that accepts a dynamically sized array and performs the following operations:

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

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

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

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

int main(){
    int arr[100];
    int n;
    cin >> n;
    for(int i = 0; i<n ; i++){
        cin >> arr[i];
    }
    int index = n-1;
    for(int i = n-1 ; i>=0 ; i--){
        cout << arr[i] << " ";
        if(i!=n-1 && i!=0 && arr[i]>arr[i-1] && arr[i]>arr[i+1])
            index = i;
    }
    cout << endl << index;
}

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

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

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

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

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

Student submission:
#include<bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
int arr[100];

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 i=1;i<=n-2;i++){
if(arr[i]>arr[i+1]){
    cout<<i;
    break;
}
}
}

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

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

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

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

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

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

int main(){
    int n;
    cin >>n;
    int nums[n];

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

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

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

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

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

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

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

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

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

int main(){
    int n; cin >> n;
    vector<int> v, peak;
    int x;
    for(int i = 0; i < n; i++){
        cin >> x;
        v.push_back(x);
    }
    int next;
    for(int i = n-1; i > 0; i--){
        if(i == n-1) cout << v[n-1] << " ";
        else{
            cout << v[i] << " ";
            if(v[i] > v[i-1] && v[i] > v[i+1]) peak.push_back(i);
        }
    }cout << v[0] << endl;
    for(int i = peak.size(); i > 0;){
        cout << peak[--i];
    }
}

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

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

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

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

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

Student submission:
#include <iostream>
using std::cin;
using std::cout;

int main() {
    int integers[100];
    int number_of_numbers;
    cin >> number_of_numbers;

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

    for(int i = 0; i<number_of_numbers; i++){
        cout << integers[number_of_numbers-i-1];
        if(i != number_of_numbers-1) cout << " ";
    }
    cout << '\n';

    for(int j=1; j<number_of_numbers-1; j++){
        if(integers[j] > integers[j-1] && integers[j] > integers[j+1]){
            cout << j << '\n';
            break;
        }
    }
    
    return 0;
}

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

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

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

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

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

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

int main(){
    int n,max=0,k=0;
    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]<<" ";
        if(i!=0 && i!=n){
            if((L[i]>=L[i-1] && L[i]>=L[i-1]) ){
                max=(max>L[i]?max:L[i]);
            }
        }
        if(max==L[i]) k=i;
    }
    cout<<endl;
    cout<<k;
}

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

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

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

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

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

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

int main(){
    int a[100]={},n,peak;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=n-1;i>=0;i--){
        if((i>0 && i<n-1)&&(a[i]>a[i-1] && a[i]>a[i+1])){
            peak = i;
        }
        cout << a[i] << " ";
    }
    cout << endl;
    cout << peak;
}

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

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

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

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

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

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

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

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

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

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

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

Student submission:
#include <iostream>
using std::cout; using std:: cin; using std::endl;

int main(){
    int A[100];
    int n;
    cin>>n;
    for (int i=0; i<n; ++i){
        cin >> A[i] ;
    }
    for (int i=n-1; i>=0; --i){
        cout<< A[i] << " ";
    } 
    cout << endl;
    for (int i=1; i<n-1; ++i) {
        if (A[i]>A[i-1] && A[i]>A[i+1]) {
            cout << i;
        }
    }
    
}

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

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

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

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

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

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

int main(){
    int n;
    cin>>n;
    int arr[100];
    for(int i=0;i<n;i++) cin>>arr[i];
    int peak=-1;
    for(int i=n-1;i>=0;i--){
        cout<<arr[i]<<" ";
        if(i>0 && i<n-1 && arr[i]>arr[i-1] && arr[i]>arr[i+1]) peak=i;
    }
    cout<<endl<<peak;
}

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

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

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

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

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

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

int peak(vector<int> integers) {
    for (int i{1}; i<integers.size()-1; i++) {if (integers[i]>integers[i-1] && integers[i]>integers[i+1]) return i;}
}

int main() {
    int n, input;
    cin >> n;

    vector<int> integers{};
    for (int i{0}; i<n; i++) {cin >> input; integers.push_back(input);}

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

    cout << peak(integers);

    return 0;
}

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

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

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

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

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

Student submission:
#include<iostream>
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: Finding the Peak element
Rating A: correctly writes the logic for peak element

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

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

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

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

Student submission:
#include <iostream>
#include <vector>

using std::cout;
using std::cin;
using std::vector;
using std::endl;

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

int main() {
    int n;
    cin>>n;
    int vec[n];
    for(int i = 0; i < n; i++) {
        int num;
        cin>>num;
        vec[i] = num;
    }
    for(int j = n-1; j >= 0; j--) {
        cout<<vec[j]<<" ";
    }
    cout<<endl;
    cout<<peak(vec, n);
}

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

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

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

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

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

Student submission:
#include <iostream>
#include <vector>

using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> vec(n, 0);
    for (int i=0; i<n; ++i)
    {
        cin >> vec[i];
    }

    for (int i=0; i<n; ++i)
    {
        if (i!=n-1) cout << vec[n-1-i] << ' ';
        else cout << vec[n-1-i];
    }

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

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

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

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

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

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

Student submission:
#include<iostream>
#include<vector>
int main()
{
    std::vector<int>x;
    int n;std::cin>>n;
    for(int i=0;i<n;i++)
    {
        int temp;std::cin>>temp;
        x.push_back(temp);
    }
    
    for(int i=n-1;i>=0;i--)
    {
        std::cout<<x[i]<<' ';
    }
    std::cout<<' '<<std::endl;
    
    int y;
    for(int i=1;i<=n-2;i++)
    {
        if((x[i]>x[i-1]) && (x[i]>x[i+1]))
        {y=i;break;}
    }
    std::cout<<y;
}

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

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

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

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

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

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

}

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

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

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

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

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

Student submission:
#include<bits/stdc++.h>
using namespace std;
int main(){
int A[100];
int n;
cin>>n;
for(int i=0;i<n;i++){
    cin>>A[i];
}
for(int i=n-1;i>=0;i--){
    cout<<A[i]<<" ";
}
cout<<endl;
for(int i=1;i<n-1;i++){
if(A[i]>A[i-1]&&A[i]>A[i+1]){cout<<i; return 0;}
}
}

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

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

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

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

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

Student submission:
#include <iostream>
int main() {
    using namespace std;
    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-1; i++) {
        if (p[i-1] < p[i] && p[i+1] < p[i]) {
            cout << i;
            delete[] p;
            p = nullptr;
            break;
        }
    }
}

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

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

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

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

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

Student submission:
#include<iostream>
#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: Finding the Peak element
Rating A: correctly writes the logic for peak element

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

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

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

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

Student submission:
#include<iostream>
using std::cout;using std::cin;using std::endl;
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: Finding the Peak element
Rating A: correctly writes the logic for peak element

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