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>
#include<vector>
using namespace std;

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

int main(){
    int n, k;
    cin>>n>>k;
    cout<<count(n,k);
    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 sequences (int n ){

if (n==1),(k==1) return 1;
return (n-1,k)+ (n,k-1);
int main ()
count=0
int n,k;
cin >>n>>k;
if n,k=<0;
return 0;
int sequences = combination (n-1,k)+ (n,k-1)
int sequences = (n-1)!/k!+ n!/(k-1)!
   return count++;
int sequences(count,n,k);
return 0;
cout<<sequences<<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: 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 seq(int n, int k){
    int s=0;
    if (n==1){
        s+=1;
        return s;
    }
    for (int n; n>0; n--){
        s=seq(n-1,k)+seq(n,k-1);
        return s;
    }
}

int main() {
    int n,k;
    cin >> n >> k;
    cout << seq(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 && K!=0) return 1;
    else if(K==1) return N;
    else if(K==0) return 0;
    
    else return C(N-1,K)+C(N,K-1);
}
int main(){
    int n,k;
    cin >> n,k;
    int output=C(n,k);
    cout<< output;

}

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>
using namespace std;

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

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

int main(){
    int n,k;
    cin>>n>>k;
    cout<<seq(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 C(int n, int k){
    if(k == 1 ){
        return n;
    }
    if(n == 1  ){
        return 1;
    }
    int b;
    return b = C(n-1,k)+C(n,k-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 count(int n, int k){

if (n==1 & k!= 0){return 1;}
if (k ==1){return n;}
 else{   return count(n-1,k) + count(n,k-1);}
}

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

cout <<count(n,k);


    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 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;
    int k;
    cin>>n;
    cin>>k;
    cout<<C(n,k);
    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(n==1 && k==1){
        return 1;
    }
    if(n>2 && k>2) {return count(n-1, k) + count(n, k-1) ;}
}
int main(){
    int n,k;
    cin>>n>>k;
    cout<<count(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>
using namespace std;
int nd(int n,int k)
{
    int count=0;
    if(n==k){count+=n;}
    else nd(n-1,k)+nd(n,k-1);
    return count;
    
}
int main()
{
    int n; int k;
    cin>>n>>k;
    cout<<nd(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 count(int n,int k) {
    if(k==0 || n==0) {
    return 0;
    }
    
    if( n==1 && k==2) {
        return 1;
    }
    if (n==2 && k==1) {
        return 2;
    }
    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 y = 0;

int sum ( int n, int k ) {

    if( n==0 && k==0) 
    return y++;

  //  total_count = c1 + c2 ;
  //  c2 = c1 ;
   // c1 = total_count ;

    if ( n != 0 )
    sum ( n-1 , k );

    if ( k != 0 )
    sum ( n , k-1 );

}

int main() {

    int n , k ; 
    cin >> n >> k ;

   // int c1 = 1 , c2 = 0 ;

    int x = sum ( n , k );

    cout << x/2 + 1;

}

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 fun(int n,int k){
    if(n == 0 && k == 0) return 0;
    if((n == 1 && k == 1) || (n == 0 && k == 1) ||(n == 1 && k == 0)) return 1;
    if(k == 0) return 0;
    if(n == 0) return fun(n,k-1);
    return fun(n-1,k) + fun(n,k-1);
}


int main(){
    int n,k;
    cin >> n >> k;
    cout << fun(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(k==1) return n;
    if(n==1) return 1;
    return C(n-1,k)+C(n,k-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 countsequence(int n, int k, int current){
    if (k == 0) return 1;
    int count = 0;
    for (int i = current ; i <= n; ++i){
        count += countsequence(n,k-1,i);
    }
    return count;
}

int main(){
    int n,k;
    cin >> n >> k;
    int result = countsequence(n,k,1);
    cout << result << 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