CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: You are given a sequence of integers. Your task is to reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

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

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

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

}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

Student submission:
#include<replaceOdd.cp>

}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

//using std::cout; using std::cin; using std::vector; using std::endl; std::pop_back; using std::push_back;
using namespace std;

int main(){

    vector<int> A;
    int noOfInputs; cin >> noOfInputs;
    if (noOfInputs > 100) return -1; //according to question, vector cannot take more than 100 integers
    for (int i = 0; i < noOfInputs; i++) {
        int input; cin >> input;
        A.push_back(input);
    }
    
    for(int i = noOfInputs - 1; i >= 0; i--) {
        cout<<A[i]<<" ";
    }

    cout<<endl;
    
    for(int i =  0; i < noOfInputs; i++) {
        if (A[i]%2 == 1) A[i] = 0;
        cout<<A[i]<<" ";
    }
    
    
    
    
    return 0;
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

Student submission:
#include<iostream>
using namespace std;
int main() { 
    int A[100]={};
    int num;
    cin>>num;
    for(int i=0;i<num;i++){
        cin>>A[i];
    }
    for(int j=num-1;j>=0;j--){
        cout<<A[j]<<" ";
    }
    cout<<endl;
    for(int k=0;k<num;k++){
        if(A[k]%2!=0){
            A[k]=0;
        }
    }
    for(int l=0;l<num;l++){
        cout<<A[l]<<" ";
    }
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

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

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

    for(int i =0; i < size; i++){
        cout << nums[size - i - 1] << " ";
    }
    cout << endl;
    for(int i = 0; i < size; i++){
        if(nums[i]%2 == 1){
            nums[i] = 0;
        }
        else{
            continue;
        }
    }
    for(int i = 0; i < size; i++){
        cout << nums[i] << " ";
    }
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

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 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]%2==1) arr[i]=0;
    }
    for(int i=0;i<n;i++){
        cout<<arr[i]<<" ";
    }
    return 0;
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

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]<<" ";
    }
    cout<<endl;
    for(int i=0;i<n;++i){
        if(arr[i]%2==0){
            cout<<arr[i]<<" ";
        }
        else{cout<<0<<" ";}
    }
    return 0;

}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

        }
        cout<<" "<<endl;
        for(int i=0;i<x;i++)
        {
            if(num[i]%2!=0)
            {
               num[i]=0;
            }
        }
        for(int i=0;i<x;i++)
        {
            cout<<num[i]<<" ";
        }
}
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

Student submission:
#include<iostream>
using namespace std;
void reverse(int arr[],int n){
    for(int i=0; i<n; i++){
        cout<<arr[n-1-i]<<" ";
        
    }
    cout<<endl;
}
void replaceOdd(int arr[],int n){
    for(int i=0; i<n; i++){
        if(arr[i]%2!=0){
         cout<<"0"<<" ";
        }
        else{
            cout<<arr[i]<<" ";
        }
       
    }
    
}
int main(){
    int n;
    cin>>n;
    int arr[100];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    reverse(arr,n);
    replaceOdd(arr,n);
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

Student submission:
#include <iostream>
using namespace std;
void swap(int m,int n) {
    int tmp=m;
    m=n;n=tmp;
}
int reverse (int A[],int n) {
    int maxi=0;
    for(int i=0;i<n;i++) {
        if (A[i]>A[maxi]) {
            maxi=i;
            swap(A[maxi],A[0]);
        }
    }
    return A[maxi];
    
}
int main() {
    int n;cin>>n;n<100;
    int A[n];
    for(int i=0;i<=n-1;i++) {
        cin>>A[i];
    }
    for(int i=n;i>0;i--) {
    cout<<reverse(A,i);
    }
    cout<<endl;
    for(int i=n;i>0;i--)
    {
        if (reverse(A,i)%2 !=0) {
        A[i]=0;
    }
    }
    for (int i=n;i>0;i--)
    cout<<reverse(A,i);

}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

Student submission:
#include<iostream>
using std::cin;
using std::cout;
int main(){
    int A[100];
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>A[i];
    }
    for(int j=n-1; j>=0; j--){
        cout<<A[j]<<" ";
    }
    cout<<"\n";
    for(int i=0; i<n; i++){
        if(A[i]%2!=0){
            A[i]=0;
        }
    }
    for(int k=0; k<n; k++){
        cout<<A[k]<<" ";
    }
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

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

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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 reverse the sequence, print it, and then replace all odd numbers in the original sequence with 0 and print the modified sequence.



Your Task

1. Read an integer N representing the number of elements.
2. Read N integers into an array/vector.
3. Print the elements in reverse order.
4. Traverse the original array and replace every odd number with 0.
5. Print the updated array after replacement.



Input Format

- An integer N.
- N integers representing the elements.



Output Format

- First line: Print the array in reverse order with spaces.
- Second line: Print the modified array where all odd numbers are replaced by 0.

Assumptions on Input

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

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

int main(){
    int x;
    cin>>x;
    vector<int>A(x);
    for (auto& p:A){
        cin>>p;
    }
    for (auto p=A.end()-1; p>=A.begin();p--){
        cout<<*p<<" ";
    }
    cout<<"\n";
    for (auto& p:A){
        if(p%2!=0){
            p=0;
        }
    }
    for (auto p:A){
        cout<<p<<" ";
    }
}

Grading criterion: Accepting inputs
Rating A: correctly accepts n, and array/vector as input

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