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 nums[n];
    
    for(int i=0; i<n; i++)
    {
        cin>>nums[i];
    }
    for(int i=0; i<n; i++)
    {
        cout<<nums[n-1-i]<<" ";
    }
    cout<<endl;
    
    int x=0;
    int y=0;
    for(int i=0; i<n-1; i++)
    {
        if(nums[i]<=nums[i+1])
        {
            x++;
        }
        else break;
       int y=0;
       for(int i=0;i<n-1; i++)
       {
        if(nums[i]>=nums[i+1])
        {y++;}
        else break;
       }
    }
       if(x==n-1 && x!=y)
       {
        cout<<'A';
       }
       if(y==n-1 && x!=y)
       {
        cout<<'D';
       }
        if(x!=n-1 && y!=n-1)
       {
        cout<<'N';
        }
       if(x==y)
       {
        cout<<'B';
       }
      

}

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;
    //Input for size of array
    cin>>n;
    int num[n];
    //Take input for array
    for(int i=0; i<n;i++){
        cin>>num[i];
    }
    //reverse array
    for(int x=0;x<n/2; x++){
        swap(num[x],num[n-x-1]);
    }
    //print rev array
    for(int m=0; m<n; m++){
        cout<<num[m]<<" ";
    }

    //Assigning character
    bool asc=true;
    bool dec=true;
    bool con=true;
    //check const
    if(num[0]=num[n-1]){
        for(int t=0;t<n-1;t++){
            if(num[t]!=num[t+1]){
                con=false;
                break;
                }
        }
    }
    //Check increasing
    if(num[0]<num[n-1]){
        for(int r=0;r<n-1;r++){
            if(num[r]>=num[r+1]){
                asc=false;
                break;
                }
        }
    }
    //check decr
    if(num[0]>num[n-1]){
        for(int p=0;p<n-1;p++){
           if(num[p]>=num[p+1]){
                dec=false;
                break;
                }
        }
    }
    if(con==true){
        cout<<"B";
    }
    else if(asc==true){
        cout<<"A";
    }
    else if(dec==true){
        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>
using namespace std;
char check(int nums[],int rev[],int n)
{   int b=0 ,a=0,d=0,n1=0;
    for(int i=0;i<n-1;i++)
    {   
        if(nums[i]==rev[i] && nums[i]==nums[0])
        b++;
        else if(nums[i]<=nums[i+1])
        a++;
        else if(nums[i]>=nums[i+1] )
        d++;
        else
        n1++;
        if(b>a && b>n1 && b>d) return 'B';
        else if(a>b && a>n1 && a>d)return 'A';
        else if(d>a && d>n1 && d>b )return 'D';
        else
        return 'N';
    }
}



int main()
{
    int n;
    cin>>n;
    int nums[n],rev[n];
    for(int i=0;i<n;i++)
    {
        cin>>nums[i];
    }
    for(int i=0;i<n;i++)
   { rev[i]=nums[n-1-i];}
    for(int i=0;i<n;i++)
    {
        cout<<rev[i]<<" ";
    }
    cout<<endl;
    cout<<check(nums,rev,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<simplecpp>
main_program
{
    int num[i];
    if(0<=i<=n){
    cout<<num[]<endl;
    }
    int reverse[] ;
    if (n<=i<=0){
        cout<<reverse;
    }for(int a=0;a<n;a++)
    if(){cout<<"B";

    }
    for(int a=0;a<n;a++)
     else if (){cout<<"A";

    }
    for(int a=0;a<n;a++)
    else if(){ 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: 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; //n=number of integers
    int array[n];
    for(int i=0; i<n; i++) { //accepting a series of integers from the user
        cin >> array[i];
    }
    for(int i=n-1; i>=0; i--) {
        cout << array[i] << " ";
    }
    cout << endl;

    // Case 1 : if in both ascending and descending order
    bool asc_desc=true;
    for(int i=0; i<(n-1); i++) {
        if(array[i]==array[i+1]) asc_desc=true;
        else { asc_desc = false; continue; }  
    }
    if(asc_desc==true) cout << "B" << endl;

    else if (asc_desc==false) {

        // Case 2 : if in ascending order (non-descreasing)
        bool asc;
        for(int i=0; i<(n-1); i++) {
            if (array[i]<=array[i+1]) asc=true;
            else { asc = false; break; }
        }
        if(asc==true) cout << "A" << endl;

        // Case 3 : if in descending order (non-increasing)
        bool desc;
        for(int i=0; i<(n-1); i++) {
            if (array[i]>=array[i+1]) desc=true;
            else { desc = false; break; }
        }
        if(desc==true) cout << "D" << endl;

        // Case 4 : if neither in ascending nor descending 
        if(asc==false && desc== false) 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 x;
    cin>>x;
    int num[x];
    for(int i=0; i<x; i++)
    {
        cin>>num[i];
    }
     
    //printing the reverse array
    for(int i=x-1; i>=0; i--)
        {
        cout<<num[i]<<' ';
        }
    cout<<endl;
  
    //checking the given conditions
    
    for(int i=0; i<x-1; i++)
        {
        if(num[i]==num[++i])
        i++;
        }
      
   
    for(int i=0; i<x-1; i++)
    {
        if(num[i]>num[++i])
        i++;
    }
    
    
    

    for(int i=0; i<x-1; i++)
    {
        if(num[i]<num[++i])
        i++;
    }
        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: 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 j,k,l;
    j=0;k=0;l=0;
    int nums[n];
    for(int i=0;i<n;i++){
        cin>>nums[i];
    }
    for(int i=0;i<n;i++){
        cout<<nums[n-i-1]<<" ";
    }
    cout<<endl;
    
    for(int a=0;a<n-1;a++){
        if(nums[a]>=nums[a+1]){j++;}
    }
    if(j==n-1){cout<<"D";}

    for(int a=0;a<n-1;a++){
        if(nums[a]<=nums[a+1]){j++;}
    }
    if(j==n-1){cout<<"A";}

    for(int a=0;a<n-1;a++){
        if(nums[a]=nums[a+1]){j++;}
    }
    if(j==n-1){cout<<"B";}

    for(int a=0;a<n-1;a++){
        if(nums[a]>=nums[a+1]){j++;}
        if(nums[a]=nums[a+1]){j++;}
        if(nums[a]<=nums[a+1]){j++;}
    }
    if(j!=3*(n-1)){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>

int main(){
    int n; std::cin >> n;
    std::vector <int> nums (n);

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

    char c = 'N';
    for (int i = 0; i < n; i++){
        if (nums[i] == nums[0]) c = 'B';
        else {c = 'N';break;}
        if (i == n - 1) {std::cout << c; return 0;}
    }
    for (int i = 1; i < n; i++){
        if (nums[i - 1] <= nums[i]) c = 'A';
        else {c = 'N';break;}
        if (i == n - 1) {std::cout << c; return 0;}
    }
    for (int i = 0; i < n - 1; i++){
        if (nums[i] >= nums[i + 1]) c = 'D';
        else {c = 'N';break;}
        if (i == n - 2) {std::cout << c; return 0;}
    }
    if (c == 'N') std::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 nums[n];
    
    for(int i=0;i<n;i++){ 
        cin>>nums[i];
        }
    for(int k=n-1; k>=0; k--){
        cout<<nums[k] <<" ";
       }
        cout<<endl;
    for (int j=0 ; j<n;j++){if (nums[j]<=nums[j+1])}
        
        cout<<"A";
    else if (nums[n]>=nums[n+1]){
        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>

using namespace std;

int main(){
    int n;
    cin >> n;
    int nums[n];
    int asc_count = 0, desc_count = 0;
    for(int i = 0; i < n; i++){
        cin >> nums[i];
        if(i > 0){
            if(nums[i] >= nums[i - 1]){
                asc_count++;
            }if(nums[i] <= nums[i - 1]){
                desc_count++;
            }
        }
    }
    for(int i = n - 1; i >= 0; i--){
        cout << nums[i] << " ";
    }
    cout << endl;
    if((asc_count == (n - 1)) && (desc_count == (n - 1))){
        cout << "B";
    } else if(asc_count == (n - 1)){
        cout << "A";
    } else if(desc_count == (n - 1)){
        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