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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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



int main(){
        std::vector<int> vec;
        int a,b;
        cin >> b;
        for(int i=0;i<b;i++){
                cin>>a;
                vec.push_back(a);
        }
        for(int i=vec.size()-1;i>=0;i--) cout << vec[i] << " ";
        cout << endl;
        for(int i=1;i<vec.size()-1;i++){
                if((vec[i]>vec[i-1])&&(vec[i]>vec[i+1])){
                        cout << i;
                        break;
                }
        }


}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

Student submission:
#include<iostream>
using namespace std;
void print(int A[],int n){
     for(int i=n-1;i>=0;i--){
        cout<<A[i]<<" ";
     }cout<<endl;
}

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

Student submission:
#include<iostream>
using std::cin, std::endl, std::cout;
int main(){
    int n; cin>>n;
    int Arr[100];
    for(int i=0; i<n; i++){
        cin>>Arr[i];
    }
    for(int i=(n-1); i>=0; i--){
        cout<<Arr[i]<<" ";
    }
    cout<<endl;
    int i=1;
    while(Arr[i]>Arr[i-1]) i++;
    i=i-1;
    cout<<i;
    

}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

int main() {
    int a[100]; int n;
    cin >> n;
    for(int j=0; j<n; j++) { cin >> a[j]; }
    
    int k=0;
    for(int j=1; j<n-1; j++) {
        if(a[j]>a[j-1] && a[j]>a[j+1]) { k=j; }
    }

    for(int j=n-1; j>=0; --j) {
        cout << a[j] << " ";
    }
    cout << endl << k;
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

Student submission:
#include<iostream>
using namespace std;
int main() {
    int arr[100] = {};
    int n, count=0;
    for (int i=0; i<n; i++) cin >> arr[i];
    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]))) count++;
    }
    cout << endl;
    cout << count;
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

int main(){
    int n;
    cin >> n;
    int A[100] = {};
    for (int r = 0;r<n ;r++) cin >> A[r];
    for (int r = (n-1); r >= 0; r-- )cout << A[r] <<' ';
    cout << endl;
    int r = 1;
    while (!(A[r] > A[r-1] && A[r] > A[r+1])) r++;
    cout << r << endl;

    
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

Student submission:
#include<iostream>
using namespace std;
int main(){
    int A[100]={};
    int N,a;
    cin>>N;
    for(int count=0;count<N;count++){
        cin>>a;
        A[count]=a;
    }
    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;
        }
    }
    return 0;
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

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

    for(int i=0; i < n && n >= 3; 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: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

Student submission:
#include <iostream>
using namespace std;
int main(){
    int n; cin>>n;
    int A[100];
    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<<" ";
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

Student submission:
#include <iostream>

using namespace std;

int main(){
    int 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;
            break;
        }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

using namespace std;

int main(){
    int a;
    vector<int> v;
    while (cin >> a){
        v.push_back(a);
    }
    for(int i=(v.size()-1); 0<i; i--){
        cout << v[i] << " ";
    }
    cout << endl;
    for(int i=1; i<(v.size()-1); i++){
        if (v[i]>v[i+1]&&v[i]>v[i-1]){
            cout << i-1;
        }
    }
}

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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

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

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

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

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

Grading criterion: Prints array/vector in reverse

Rating A: Correctly prints the array/vector in reverse order

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