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;

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: 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<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: 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>
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: 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 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: 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 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: 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;
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 cal1(int arr[] , int n,int i, int sum, int memo[], int k){
    if(i>=n){
        return sum;
    }
    if(memo[k]!=-1){
        return memo[k];
    }
    memo[k]=sum+arr[i];
    sum=sum+arr[i];
    return cal1(arr,n,i+2,sum,memo,k+1);
}
int cal2(int arr[] , int n,int i, int sum, int memo[], int k){
    if(i>=n){
        return sum;
    }
    if(memo[k]!=-1){
        return memo[k];
    }
    memo[k]=sum+arr[i];
    sum=sum+arr[i];
    return cal2(arr,n,i+2,sum,memo,k+1);
}

int main(){
    Memo m;
    for(int i=0;i<201;i++){
        m.memo[i]=-1;
        }
     int n;
     cin>>n;
     int arr[n];
     for(int i=0;i<n;i++){
        cin>>arr[i];
     }
     int sum1=cal1(arr,n,0,0,m.memo,0);
     for(int i=0;i<201;i++){
        m.memo[i]=-1;
     }
     int sum2=cal2(arr,n,1,0,m.memo,0);
     if(sum1>sum2){
        cout<<sum1<<endl;
     }else{
        cout<<sum2<<endl;
     }

 



    return 0;
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether 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;

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 (){
int N;
cin>>N;
cout << 11;
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether 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 N;
    cin>>N;
    int A[N];
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
    }
    
    return 0;
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether 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 std::cin;
using std::cout;

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){
    if(k>=n) return 0;
    int total1=0, total2=0;
    for(int i=k+1;i<n;i++){
        total1 += A[i] + Collect(A, i+2, n);
        total2 += Collect(A,i+1,n);
    }
    if(total1>total2) return total1;
    else return total2;
}

int main(){
    int n, t;
    int A[100];
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> t;
        A[i] = t;
    }
    cout << Collect(A,0,n);
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether 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>
using namespace std;
int total1=0 ;
int j=0 ;
int theft1(int j, int n, int a[]){
   if(j>=n) return total1;
   else return a[j]+theft1(j+2,n,a) ;
}
int total2=0 ;
int k=1 ;
int theft2(int k, int n, int a[]){
   if(k>=n) return total2;
   else return a[k]+theft2(k+2,n,a) ;
}
int main(){
    int n;
    cin >> n ;
    int a[n];
    for(int i=0;i<n;i++){
        
        cin >> a[i];
    }
    int c= theft1(j,n,a);
    int b= theft2(k,n,a);
    if(c>=b)
     cout << c;
     else cout << b;
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether 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>
using namespace std;
int Collect(int collect[],int n){
    
}
int main(){
    int n;
    cin>>n;
    int collect[n];
    for(int i=0;i<n;i++){
        cin>>collect[i];
    }
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether 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:
using namespace std;
#include<iostream>
 void swap(int &a,int &b)
 {
    int c;
    c=a;
    a=b;
    b=c;
 }
int main()
{
    int n,k;
    cin>>n>>k;
    swap(n,k);
    cout<<n<<k;
     
}

Grading criterion: Deciding rob or not rob
Rating A: Correctly decides whether to rob or not rob the house.
Rating B: Some issue.
Rating C: Major issue. 

Rating D: 0
Assigned grade: C