CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int c(int n, int k){
    if(n==1){
        return 1;
    }
    if(k==1){
        return n;
    }
    if(n==0|k==0){
        return 0;
    }

    
    return c(n-1,k)+c(n,k-1);
}

int main(){
    int n,k;
    cin>>n>>k;
    cout<<c(n,k)<<endl;
    return 0;
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int count(int n,int k ){
if(k==0)return 0;
if(n==0)return 1;

return count(n-1,k)+count(n,k-1);

}


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

    cout<<count(n,k);
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

Student submission:
#include<iostream>
using namespace std;
int countingsequence (int n , int k){
    if (n == 1) return k;
    if (k == 1) return 1;
    return countingsequence(n,k-1) + countingsequence(n-1,k);
}
int main(){
    int n , k;
    cin >> n >> k;
    cout<<countingsequence(n , k);


}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

Student submission:
#include<iostream>
using namespace std;
int C(int n,int k){
    if(n==1) return 1;
    if(k==1) return n;

    return C(n-1,k)+C(n,k-1);
}

int main() {
    int n,k;
    cin >> n >>k;
    int ans = C(n,k);
    cout << ans;
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

Student submission:
#include <iostream>
using namespace std;
int C(int i, int j) {
    int p;
    if (i==1) return 1;
    if (j==1) return i;
    return C(i-1,j)+C(i,j-1);
}

int main() {
    int n,k;
    cin>>n>>k;
    cout<<C(n,k);
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int CountSeq(int n , int k ){
  
  if ( n == 1) return 1 ;
  if (k == 1)  return n ;
  return CountSeq(n-1, k) + CountSeq(n, k-1) ;
}

int main () {
    int n, k ; 
    cin >> n >> k ;
    cout << CountSeq(n, k) << endl ; 
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

using namespace std;

// void fun(int arr, int max, int n, int &count){
    
//     if(arr[n]=max){
//         count = count +1;
//         return;
//     }
//     arr[3]={1,1,1};
    
//     for(int i=n-1;i>=0;i++){
//         while(arr[i]=max){
//             arr[i]=arr[i]+1;
//             fun(arr,max-1,n-1,count);
//             count = count +1;
//         }
//     }
    
// }

int main(){
    int n,m;
    int count=1;
    cin>>n>>m;

    

    if(n==2&&n==2){
        cout<<3;
    }else if(n==3&&m==3){
        cout<<10;
    }else if(n==4&&m==4){
        cout<<35;
    }
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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


int count(int n, int k){
    if(n==1 && k==1){
        return 1;
    }
    if(n==1 && k==0){
        return 0;
    }

    return count(n-1,k)+ count(n,k-1);

}





int main(){
    int n,k;
    cin>>n>>k;
    cout<<count(n,k);
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int n=0;

    int factorial(int n) {
        if(n <= 1) return 1;
        else return n*factorial(n-1); // defining factorial
    }
int main {
     int n=0;
     int k=0;
     int N[n];
     for(int i=1; i<n; i++)
      N[i] =0;
      void min_to_beg(int N[], int i, int n) {
        int min_i=i;
        for(int j=i+1; j<n; j++)
          if(N[j] < N[min_i])
            min_i = j;
        swap(N[min_i],N[i]);  
    }
     int main() {
        ... // read numbers to be sorted into N[0] to N[n-1]
        for (int i=0; i<n-1; i++)
        min_to_beg(A,i,n); // call min_to_beg on the unsorted N[i...n-1]
        ... // print out sorted N



}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int C(int n,int k) {
    if(k==1) {return n;}
    if(n==1) {return 1;}

    int x = C(n-1,k) + C(n,k-1);
    return x;
}

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

    int y = C(n,k);

    cout << y << endl;
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

Student submission:
#include <iostream>

using namespace std;

int com(int n,int k){
    int a = 0;
    if(n==1) { a=1 ;
    return a;
    }
    if(k==1) {a=n ;
    return a ;
    }
    a = com(n-1, k) + com(n,k-1) ;
     return a ;
}
int main(){
    int n , k ;
    cin>>n ;
    cin>>k ;
    int count= com(n,k);
    cout<<count;
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int n;
int k;
 int count(int n, int k) {
        if(k == 0 || n == 0){return 1;}
        return count(n-1, k) + count(n, k-1);
    }

int main(){
    int n, k;
    cin >> n;
    cin >> k;
    return count(n, k);
    cout << count(n, k);
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

Student submission:
#include <iostream>
#include <vector>
using namespace std;
int C(vector <int> vec, int n, int k){
    if(k==0) return 1;
    if(n==1) return 1;
    return C(vec,n-1, k) + C(vec,n, k-1);
}
int main(){
    int n,k;
    cin>>n>>k;
    vector <int> vec;
    for(int i=0; i<n; i++) vec.push_back(i+1);
    cout<<C(vec, n, k);
}

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to calculate the number of possible sequences that can be formed under certain conditions using recursion. The program should define a recursive function 'combination(int n, int k)' which calculates the total number of ways to arrange 'n' and 'k' such that the count follows a specific recursive relationship.

Code must fulfil these requirements:
A. Input: Accept two integers, 'n' and 'k', from the user

B. Recursive Function Definition: Define a recursive function 'int combination(int n, int k)' that follows the rules below:

C. Base Cases:
    1. If 'n == 1' and 'k >= 1', return '1'
       (Only one way to arrange if one element is available but multiple positions exist.)
    2. If 'k == 1' and 'n >= k', return 'n'
       (If there’s only one position, the number of ways equals the number of elements available.)
    3. If either 'n < 0' or 'k < 0', return '0'
       (Negative values are invalid)

D. Recursive Relation: combination(n, k) = combination(n - 1, k) + combination(n, k - 1)

E. Function Call and Output

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

int combination(int n,int k) {
    
    if(n==1&&k==1){
       int combination(n,k)=1;
    }
    while(n>1&& k>1) {
       int combination(n,k)=int combination(n-1,k)+int combination(n,k-1);
        n=n-1;
        k=k-1;
    }
    return combination(n,k);
}

 int main() {
    int n,k;
    cin>>n>>k;
    cout<<combination(n,k)<<endl;
 }

Grading criterion: Declarations of variable, taking input, and final output
Rating A: Correctly declares and reads two integers as input and cout for final output

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A