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;

struct Memo {//at kth index C(N, A, k) is stored

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

int max(int a1, int a2){
        return ((a1>a2)?a1:a2);
}

int C(int N, int A[], int k, Memo& meme){//amount from robbing houses index k onwards, k included
                           //initial func call: k = 0
        if (k > N-1) return 0;
        //if (k == N) return A[N];
        if (meme.has(k)){
            //cout<<"Using "<<k<<" "<<meme.get(k) << endl;
            return meme.get(k);
        }
        else{
                int currC = max(C(N, A, k+1, meme), C(N, A, k+2, meme) + A[k]);
                meme.add(k, currC);
                //cout<<"Setting "<<k<<" "<<currC<<endl;
                return currC;
        }
}

int maxAmt(int N, int A[]){//func to be called by main
        Memo myMeme;
      //for(int i = 0; i<myMeme.NMAX;i++) if(myMeme.filled[i]) cout << "ERR";
      //cout<<endl;
        return C(N, A, 0, myMeme);
}

int main(){
        int N; cin >> N;
        int arr[100];
        for (int i = 0; i<N; i++) cin >> arr[i];

        cout << maxAmt(N, arr);

        return 0;
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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 CheckE(int a[],int k){
     if (k<2)return 0;
    return a[k]+CheckE(a,k-2);
}

int CheckO(int a[],int k){
     if ( k<3)return 0;
    return a[k-1]+CheckO(a,k-3);
}

int main (){

int N;
cin >>N;
int A[N];
if (CheckE(A,N)>CheckO(A,N))return CheckE(A,N);
else return CheckO(A,N);
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
Rating B: Some issue.
Rating C: Major issue. 

Rating D: 0
Assigned grade: B
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>

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 main()

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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>

const int N = 100;

struct Memo {
	static const int NMAX = N;
	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 collect(int n, int A[], int k, Memo& memo) {
	if (k >= n) {
		return 0;
	}
	if (memo.has(k)) {
		return memo.get(k);
	}
	
	int c1 = A[k] + collect(n, A, k + 2, memo);
	int c2 = collect(n, A, k + 1, memo);
	int ans;
	if (c1 > c2) {
		ans = c1;
	} else {
		ans = c2;
	}
	
	memo.add(k, ans);
	
	return ans;
}

int main() {
	int n;
	int A[N];
	
	std::cin >> n;
	
	for (int i = 0; i < n; i++) {
		std::cin >> A[i];
	}
	
	Memo memo;
	
	std::cout << collect(n, A, 0, memo) << std::endl;
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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>

int fun(int A[]; int k =0; int l){
    if(k>=n) return 0;
    return max((fun(A, k+2,l)),(fun(A,k+1,l)));
}
int main(){
    int n;cin>>n;
    int A[n];
    
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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;

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 Collect(int a[],int k,int n,Memo&memo){
    if (memo.has(k)) return memo.get(k);
if(k>n-1)return 0;
else if (k==0) return a[0];
else if (k==1)return((a[0]>=a[1])?a[0]:a[1]);

int ans=(((a[k]+Collect(a,k-2,n,memo))>=Collect(a,k-1,n,memo))?(a[k]+Collect(a,k-2,n,memo)):(Collect(a,k-1,n,memo)));
memo.add(k,ans);
return ans;}

int main(){
int n;
Memo memo;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
cout<<Collect(arr,n-1,n,memo);

}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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];
    }


}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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(){
    int k;
    cin>>k;
    int m=0;
    int n=0;
    int A[k];
    for(int i=0;i<k;i++){
        cin>>A[i];
    }
    for(int x=0;x<k;x+=2){
        n=n+A[x];
    } 
    for(int y=1; y<k; y+=2){
        m=m+A[y];
    }
    if(n>m){cout<<n;}
    else {cout<<m;};
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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 sumAtEvenPlaces(int *A, int N) {
    int sum=0;
    for(int i=0; i<N; i++) {
    if(i%2==0) sum+=A[i];
}
return sum;
}
int sumAtOddPlaces(int *A, int N) {
    int sum=0;
    for(int i=0; i<N; i++) {
    if(i%2!=0) sum+=A[i];
}
return sum;
}

int main() {
    int N; cin>> N;
    int A[N];
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }
    if (sumAtEvenPlaces(A, N)> sumAtOddPlaces(A, N)) cout << sumAtEvenPlaces(A, N) << endl;
    else cout << sumAtOddPlaces(A, N);
    return 0;
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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()
{
    int x;
    cin>>x;
    int A[x];
    for(int i=0; i<x;i++)
    cin>>A[i];
}

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
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 <vector>

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 collect (int A[],int k){
    int sum;
    
}

int main(){
    int n; std::cin >> n;
    int A[n];

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

Grading criterion: Recursion call
Rating A: Correctly sets up the recursive call, with valid parameters and both conditions to rob or not rob the house
Rating B: Some issue.
Rating C: Major issue. 

Rating D: 0
Assigned grade: C