CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

Student submission:
#include<iostream>
using namespace std;
int main(){
    int n,x;
    bool elements(n)={};
    cin>>n>>elements(n)>>x;
    for (int j=0; j<=n;++j){
      bool reversed(n)={};
      reversed(j)=elements(n-j);
      cout>>reversed(j)>>endl;
    }
    for(int i=0;elements(i)>x;++i){
        int sum =0;
        sum+=elements(i);
        cout<<sum<<endl;
    }
    return 0;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

int main(){
    int n,x,sum=0;
    cin >> n;
    int arr[n];

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

    cin >> x;

    for (int j=0 ; j< n ; j++){
        if(arr[j]>x){
            sum += arr[j];
        }
    }

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

    cout << endl;

    cout << sum;


}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

    }
    int x;
    cin>>x;
            int sum=0;

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

    return 0;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

Student submission:
#include <iostream>

using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];

    int i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int x;
    cin>>x;
    int sum=0;
    
    
    for(i=n-1;i>=0;i--)
    {
        if(a[i]>x)
        sum+=a[i];
        cout<<a[i]<<" ";
    }
    cout<<endl;
    cout<<sum;
    
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

using namespace std;

int main() {

int n = 0;
cin >> n ;

vector<int> numbers ;
int elements;
for (int i = 0 ;i<n;i++) {
    cin >> elements ;
    numbers.push_back(elements);
}

int X = 0 ;
cin >> X ;

for (int j = numbers.size()-1 ;j<numbers.size();j--) {
    cout << numbers[j] << " ";
}



int sum = 0;

for (int k = 0 ; k < numbers.size();k++) {
    if (numbers[k] > X) {
        sum = sum+numbers[k];
    }
    else{
        continue;
    }
}
cout << endl ;
cout  << sum;


}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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;
int x;
cin>>x;
int sum=0;
for(int i=0;i<n;i++){
    if(a[i]>x){
        sum=sum+a[i];
    }
}
cout<<sum<<endl;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

Student submission:
#include<iostream>
using namespace std;
int main(){
    int n;cin>>n;
    int array[n];
for(int k=0;k<n;k++){
    cin>>array[k];
}
for(int j=(n-1);j>=0;j--){
    cout<<array[j]<<' ';
}
cout<<'\n';
int o;cin>>o;
int sum =0;
for(int y=0;y<n;y++){
    if(array[y]>o){
        sum=sum+array[y];
    }
}cout<<sum;}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

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

    vector<int> v(n);

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

    int x;
    cin>>x;

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


     cout<<endl;

    int sum=0;
     for(int i=0;i<n;i++)
    {
       if(v[i]>x)
       sum+=v[i];
    }

    cout<<sum;






 }

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

int main()
{
    int sum=0;
    int n;
    cin>>n;
    int arr[n];

    for(int i=0;i<n;i++)
    {
        int p;
        cin>>p;
        arr[i]=p;
    }
    int X;
    cin>>X;
    for(int i=n-1;i>=0;i--)
    {
        cout<<arr[i]<<" ";
        if(arr[i]>X)
        {
            sum+=arr[i];
        }
    }
    cout<<endl;
    cout<<sum;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

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

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

int main()
{
    int n,x;
    cin>>n;
    vector <int> v(n);
    for (int i=0 ; i<n;i++ )
    {cin>>v[i];}
    cin>>x;
    for (int i=n-1; i>=0; i--)
    {cout<<v[i]<<" ";}
    cout<<endl;
    int sum = 0;
    for (int i=0;i<n;i++)
    {
        if (v[i]>x)
        {
            sum +=v[i];
        }
        
    }
    cout<<sum;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

using namespace std;

int main()
{
    vector <int> v={};
    int n,x;
    cin>>n;

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

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

    int check, sum=0;
    cin>>check;

    for(int i=0; i<n; i++)
    {
        if(v[i]>check) {sum=sum+v[i];}
    }

    cout<<"\n"<<sum;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

    for(int j=0; j<n; j++)
    {
        cout<<arr[n-j-1]<<" ";
    }
    cout<<endl;

    int sum=0;
    for(int k=0; k<n; k++)
    {
        if(arr[k]>X)
       { sum+=arr[k];}
        
    }
    cout<<sum;
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

Student submission:
#include<iostream>
#include<vector>
using namespace std;
void rev(const vector<int>&arr,int x){
    int sum =0;
    for(int i :arr){
        if (i>x){sum+=i;
        }
    cout<<sum;
    return;
    }
}
int main (void){
    vector<int>arr;
    int n,x;
    cin>>n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        arr::push_back(a);
    }
    cin>>x;
    for(int i=0;i<n;i++){
        cout<<arr[n-i-1];
    }
    sum (arr, x)
}

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: Write a C++ program that performs the following operations:
1. Input:
   Accept an integer 'n' representing the size of an array.
   Accept 'n' integer elements and store them in the array.
   Accept another integer 'x'.

2. Reverse Printing:
   Print the array elements in reverse order separated by spaces

3. Sum Calculation:
   Calculate and display the sum of all elements greater than 'x'

### Input Format
n
A1 A2 A3 ... An
x

### Output Format
First line: elements of the array in reverse order
Second line: sum of all elements greater than 'x'

### Constraints
'1 ≤ n ≤ 1000'
'-10^6 ≤ A[i], x ≤ 10^6'

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

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

Grading criterion: Calculating sum
Rating A: correctly keeps accumulating the sum if greater than x

Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A