CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

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

int main(){
    int n;
    cin>>n;
    int arr[n];
    int m;
    for(int i =0 ; i<n ; i++){
        cin>>m;
        arr[i] = m;
    }
    for(int j = n-1 ; j>=0 ; j--){
        cout<<arr[j]<<" ";
    }
    cout<<endl;
    bool flag1 = true;
    for(int i =1 ; i<n ; i++){
        if(arr[i]<arr[i-1]){
            flag1 = false;
            break;
        }
    }
    bool flag2 = true;
    for(int i =1 ; i<n ; i++){
        if(arr[i]>arr[i-1]){
            flag2 = false;
            break;
        }
    }
    bool flag3 = true;
    for(int i =1 ; i<n ; i++){
        if(arr[i]=arr[i-1]){
            flag3 = false;
            break;
        }
    }
    if(flag3==true) cout<<"B"<<endl;
    else{
        if(flag1==true && flag2==false) cout<<"A"<<endl;
    if(flag1==false && flag2==true) cout<<"D"<<endl;
    if(flag1==false && flag2==false) cout<<"N"<<endl;
    }
    
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

Student submission:
#include <iostream>

using namespace std;


void max_to_end(int B[], int n) { 
int maxi=0;
for(int i=1; i<n; i++)
if(B[i] > B[maxi])
maxi = i;
swap(B[maxi],B[n-1]);
}

bool checka (int A[], int B[], int n) {
    bool val = true;
    for (int i = 0; i < n; i++) {
        if (A[i] != B[i]) {
            val = false;
            return val;
        }
    }
    return val;
}

bool checkd (int A[], int B[], int n) {
    bool val = true;
    for (int i = 0; i < n; i++) {
        if (A[i] != B[n - 1 - i]) {
            val = false;
            return val;
        }
    }
    return val;
}

bool checkn (int A[], int B[], int n) {
    bool val = true;
    for (int i = 0; i < n; i++) {
        if (A[i] != B[0]) {
            val = false;
            return val;
        }
    }
    return val;
}

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

    int nums[n];
    int B[n];

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



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

    for (int i=n; i>0; i--) {
        max_to_end(B,i);
    }

    bool a, d, b;

    a = checka(nums, B, n);
    d = checkd(nums, B ,n);
    b = checkn(nums, B, n);

    if(b == true) {
        cout << endl << 'B' << endl;
    }

    if (a == true && b == false) {
        cout << endl << 'A' << endl;
    }

    if (d == true && b == false) {
        cout << endl << 'D' << endl;
    }

    if (a == false && d == false) {
        cout << endl << 'N' << endl;
    }
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

Student submission:
#include<iostream>
using namespace std;
int main ()
{
int n;
int i;
int j;
int k;
int z;

cin>>n;
int nums[n];
for (i=0; i<n; i++){
    cin>>nums[i];
}
for (j=0; j<n; j++){
    nums[j]=nums[n-j-1];
}
for (k=0; k<n; k++){
cout<<nums[k]<<' '<<endl;
}
for (z=0;z<n; z++){
    if (nums[i]=nums[i+1]){
        cout<<'B'<<endl;
    }
    else if ((nums[i+1]=nums[i]) || nums[i+1]>nums[i]){
        cout<<'A'<<endl;
    }
    else if ((nums[i+1]=nums[i]) || nums[i+1]<nums[i]){
        cout<<'D'<<endl;
    }
    else 
    cout<<'N'<<endl;
}
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

Student submission:
#include<iostream>
using namespace std ;
void revArray(int a[],int n)
{   
    if(n==0) return ;
    cout<<a[n-1]<<" ";
    revArray(a,n-1);
    
}
int main ()
{
    int n ;
    cin>>n;
    int nums[n];
    for(int i=0;i<n;i++)
    {
        cin>>nums[i];
    }
    revArray(nums,n);
    cout<<endl;
    bool A =true;
    for(int i=0;i<n-1;i++)
    {
        if(nums[i+1]<nums[i]) 
        {
           A=false;
           break;
        }
    }
    bool D=true;
    for(int i=0;i<n-1;i++)
    {
        if(nums[i+1]>nums[i]) 
        {
           D=false;
           break;
        }
    }
    bool B=true;
    for(int i=0;i<n-1;i++)
    {
        if(nums[i+1]=nums[i]) 
        {
           B=false;
           break;
        }
    }
    if(A==true) cout<<"A"<<endl;
    else if (B==true) cout<<"B"<<endl;
    else if(D==true)  cout<<"D"<<endl;
    else cout<<"N"<<endl;
    return 0;

}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

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;
    int cnt=1;
    for(int i=0;i<n-1;i++){
        if(a[i+1]==a[i])cnt++;
    }
    if(cnt==n)cout<<'B';
    else{
        cnt=1;
        for(int i=0;i<n-1;i++){
            if(a[i+1]>=a[i])cnt++;
        }
        if(cnt==n)cout<<'A';
        else{cnt=1;
        for(int i=0;i<n-1;i++){
            if(a[i+1]<=a[i])cnt++;
        }
        if(cnt==n)cout<<'D';
        else cout<<'N';
        }

    }
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

Student submission:
#include <iostream>
#include<vector>
using namespace std;
int main()
{
    int n = 0;
    cin >> n;
    vector<int> nums;
    for(int i =0 ; i < n; i++)
    {
        int temp;
        cin >> temp;
        nums.push_back(temp);
    }
    for(int i = (nums.size()-1) ; i >=0; i--)
    {
        cout << nums[i] << " ";
    }
    cout << endl;
    for(int i =0 ; i < (nums.size()-1); i++)
    {
        if(nums[i] == nums[i+1])
        {
            if(i == (nums.size()-2))
            {
                cout << "B";
                return 0;
            }
        }
        else
        break;
    }
    for(int i =0 ; i < (nums.size()-1); i++)
    {
        if(nums[i] >= nums[i+1])
        {
            if(i == (nums.size()-2))
            {
                cout << "D";
                return 0;
            }
        }
        else
        break;
    }
    for(int i =0 ; i < (nums.size()-1); i++)
    {
        if(nums[i] <= nums[i+1])
        {
            if(i == (nums.size()-2))
            {
                cout << "A";
                return 0;
            }
        }
        else
        break;
    }
    cout << "N";

}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

Student submission:
#include <iostream>
using namespace std ;
int main () {
    int n ;
    cin >> n ;
    int nums [n];
char c;

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


    int reverse [n] ;

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


    for (int i = 0 ; i < n ; i++ ){
        cout << reverse [i] << " ";
    }
  cout << "\n";

for (int i = 0 ; i < n - 1 ; i++){
    if ( nums [i] == nums [i+1]) {c == 'B'; break ;}
        else if ( nums [i] >= nums [i+1]) {c == 'D'; break ;}
    else if ( nums [i] <= nums [i+1]) {c  == 'A'; break ;}

    else c == 'N';
}
cout << c ;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

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]<<" ";
}return 0;}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: C
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

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


    int con=0;
    for(int i=0;i<n;i++){
        if(nums[i]!=nums[0]){++con;}
    }
    
    int asc=0;
    for(int i=0;i<n-1;i++){
        if(nums[i]>nums[i+1]){++asc;}
    }
   
    int dec=0;
    for(int i=0;i<n-1;i++){
        if(nums[i]<nums[i+1]){++dec;}
    }

    if(con==0){cout<<"B";}
    else if(asc==0){cout<<"A";}
    else if(dec==0){cout<<"D";}
    else{cout<<"N";}

    return 0;
}

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: You are given a sequence of integers. Your task is to analyze the order of the elements in the sequence, print the sequence in reverse order, and determine the category of the sequence based on how the elements are arranged.



Categories

After reading the sequence, determine which of the following categories it belongs to:

A - Ascending Order  
   All elements are in strictly increasing order.

D - Descending Order  
   All elements are in strictly decreasing order.

B - Constant Order  
   All elements are equal.

N - None  
   The sequence does not belong to any of the above categories.



Your Task

1. Read an integer n representing the number of elements.
2. Read n integers into an array or vector.
3. Print the elements in reverse order.
4. Traverse the array to determine its category:
   - If every next element is greater than the previous, it is Ascending (A).
   - If every next element is smaller than the previous, it is Descending (D).
   - If all elements are equal, it is Constant (B).
   - Otherwise, it is None (N).
5. Print the corresponding category character after printing the reversed array.



Input Format

- An integer n.
- n integers representing the elements of the array.



Output Format

- First, print the array in reverse order with spaces.
- Then print a single character on a new line representing the category:
  A, D, B, or N.


Assumptions on Input

- 1 <= n <= 10^5
- Elements are integers.

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

}

//&& nums[i]==nums[i+1]

Grading criterion: Traversing of the loop
Rating A: correctly traverses the loop n times
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A