CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

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 maximum=0;
    for(int i=0; i<n; i++){
        for(int j=i+2; j<n; j++)
        if(maximum< a[i]+a[j])
        maximum=a[i]+a[j];
    }

    int sum=0;
    for(int i=0; i<n; i+=2){
        sum=sum+a[i];
    }
    cout<<sum;
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include<iostream>
#include <vector>
using std::cout; using std::cin; using std::endl;
int Collect(int arr[],int k , int n){
    if(k > n - 1){
        return 0;
    }
    else if(arr[k] + Collect(arr,k + 2,n) > Collect(arr, k + 1,n)){
        return arr[k] + Collect(arr,k + 2,n);
    }
    else{
        return Collect(arr, k + 1 , n);
    }
}
int main(){
    int n;
    cin>>n;
    int t;
    int A[n];
    for(int i = 0; i < n; i++){
        cin>>t;
        A[i] = t;
    }
    int h = Collect(A,0,n);
    cout<<h;
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include <iostream>
#include  <vector>
#include <algorithm>
using namespace std;
int maxMoney(vector<int>& A,int k, vector<int>& memo){
    if(k>=A .Size ()) retuen 0;
    if (memo[k] !=-1) return memo [k];
    int robCurrent =A[K]+maxMoney(A,K=2, memo);
    int skipcurrent = maxMoney(A,K+1,memo);
    return 0;
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: C
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include <iostream>
using namespace std;
int main() {
    struct Memo {

   static const int NMAX = 200;
   bool filled[NMAX] = {};
   int memo[NMAX];
   bool has(unsigned i) { return filled[i]; }
   int get(unsigned i) { return memo[i]; }
   void add(unsigned i, int val) {
       memo[i] = val;
       filled[i] = true;
   }
};
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: C
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include <iostream>
#include <iomanip>
using namespace std;
int collect(int A[], int k, int N)
{
    int sum=0;
   
    while(k<N)
    {
        sum+=A[k];
        k+=2;
    }
    return sum;

}

int main() 
{
    int N;
    cin>>N;
    int A[N];
    for(int i=0;i<N; i++)
    {
        cin>>A[i];
    }
    if(collect(A, 0,N)>collect(A,1,N ))
    cout<<collect(A,0,N);
    else
    cout<<collect(A, 1,N);
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include<iostream>
using namespace std;
// struct Memo {
//    static const int NMAX = 200;
//    bool filled[NMAX] = {};
//    int memo[NMAX];
//    bool has(unsigned i) { return filled[i]; }
//    int get(unsigned i) { return memo[i]; }
//    void add(unsigned i, int val) {
//        memo[i] = val;
//        filled[i] = true;
//    }
// };
int robbery(int arr[], int n){
    int even=0;
    int odd=0;
    for(int i=0; i<n; i=i+2){
        even+=arr[i];
    }
    for(int j=1; j<n; j=j+2){
        odd+=arr[j];
    }
    return even>odd ? even : odd;
}
int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    cout<<robbery(arr, n);
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

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

void functionf(int A[], int n)
{
    int temp=n;
    if(temp){ functionf(A,n-1); }
    else return;
    return;
}

long int g(int A[], int n)
{
    int flag=n;
    functionf(A,n);
    
    if(n==5) {cout<<"11";}
    if(n==6) {cout<<"25";}
    if(n==100) {cout<<"17242";}
    return 1;
}

int main(){
    int n;
    cin>>n;
    int A[n];
    for(int i=0 ; i<n ; i++)
    {
        cin>>A[i];
    }
    functionf(A,n);
int z=g(A,n);
    
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int n;
void maxmoney (int A , int k) {
    if (k>n || k<0) {
        maxmoney(A,k) = 0;
    }
    else {
        maxmoney(A,k) = maxmoney(A,k+1) + maxmoney(A,k+2);
    }
    cout << maxmoney(A,k) << endl;
}
int main () {
int n;
int A[n];
for (int i=0; i<n; i++) {
    cin >> A[i];
} 
    maxmoney(A,k);
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

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 n1=0; int n2=0;
    for(int i=0;i<(n);i++){
        if(i%2==0) n1=n1+A[i];
    }
    for(int i=0;i<(n);i++){
        if(i%2==1) n2=n2+A[i];
    }   
    cout<<(n1>n2? n1:n2);
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

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

}
if(even>odd){
    cout<<even;
}
else{
   cout<<odd;
    }
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A
Problem: Title: House Robbers

Problem Description

A robber is planning to rob houses along a street. Each house has a certain amount of money. However, the robber cannot rob two adjacent houses because doing so will trigger the alarm system.

Your task is to determine the maximum amount of money the robber can steal without robbing two adjacent houses.

You must solve this problem using recursion and/or memoization.



Your Task

1. Read an integer n representing the number of houses.
2. Read n integers into an array A[], where A[i] represents the money in the i-th house.
3. Implement a recursive function to decide at each house whether to rob it or skip it.
4. Use a base condition to stop recursion.
5. Use memoization to optimize repeated calculations.
6. Return the maximum money that can be robbed and print it.



Rules

- If you rob a house, you cannot rob the next adjacent house.
- At each index, you must decide:
  - Rob the current house and move to i+2, OR
  - Skip the current house and move to i+1.
- The answer is the maximum value obtained from these choices.



Input Format

- An integer n.
- n integers representing the money in each house.



Output Format

- Print a single integer representing the maximum money that can be robbed.


Assumptions on Input

- 1 <= n <= 10^5  
- 0 <= A[i] <= 10^9

Student submission:
#include <iostream>
using namespace std;
/*struct Memo {

   static const int NMAX = 200;
   bool filled[NMAX] = {};
   int memo[NMAX];
   bool has(unsigned i) { return filled[i]; }
   int get(unsigned i) { return memo[i]; }
   void add(unsigned i, int val) {
       memo[i] = val;
       filled[i] = true;
   }
};*/
int C (int A[], int k/*, Memo& memo*/){
    //if(memo.has(A[k])) return memo.get(A[k]);
    if(k<0)
    return 0;
    int ans=A[k]+C(A, k-2/*, memo*/);
    //memo.add(A[k],ans);
    return ans;
}
int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i=0; i<N; i++)
    cin >> A[i];
    //Memo memo;
    int x = C(A, N-1/*, memo*/);
    int y = C(A, N-2/*, memo*/);
    if(x>y)
    cout << x;
    else if(y>x)
    cout << y;
}

Grading criterion: Declaration of variables and array
Rating A: correctly declares the variable n and array/vector

Rating B: Some issue. 

Rating C: Major issue. 
Rating D: 0
Assigned grade: A