CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Rock-Paper-Scissors is a simple game played by two people, where the two players simultaneously gesture any one of the three objects ‘rock’, ‘paper’, or ‘scissors’. The rules are straightforward: rock beats scissors, scissors beats paper, and paper beats rock. The outcome of each round is a win for the player whose object beats that of the other player, or a tie if both players choose the same object. For example, if player 1 chooses rock and player two chooses paper, then player 2 wins as paper beats rock. 

Write a C++ program to accept two characters as input from the user. These denote the choice made by player 1 and player 2, respectively. The choices would be r for rock, p for paper, and s for scissors. Print which player wins (1 or 2, or T for tie). 

Input Format Two characters in lowercase. 

Output Format 1 or 2 or T 

Assumptions on Input Assume that the characters input by the user will be either r, p, or s.

Student submission:
#include <simplecpp>
main_program{
    char player1, player2;
    cin>>player1>>player2;
    if(player1!=player2)
    {
      if(player1=='r') {if (player2=='p') cout<<"2";
                           else cout<<"1";
    }  
    if(player1=='p')  {
        if(player2=='r') cout<<"1";
        else cout<<"2";
    } 
    if(player1=='s')  {
        if (player2=='p')  cout<<"1";
        else cout<<"2";
    }
    }
     else {cout<<"T";}
}

Grading criterion: Comparing for player 1 and 2 win
Rating A: correctly compares all cases of player 1 winning.
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: Rock-Paper-Scissors is a simple game played by two people, where the two players simultaneously gesture any one of the three objects ‘rock’, ‘paper’, or ‘scissors’. The rules are straightforward: rock beats scissors, scissors beats paper, and paper beats rock. The outcome of each round is a win for the player whose object beats that of the other player, or a tie if both players choose the same object. For example, if player 1 chooses rock and player two chooses paper, then player 2 wins as paper beats rock. 

Write a C++ program to accept two characters as input from the user. These denote the choice made by player 1 and player 2, respectively. The choices would be r for rock, p for paper, and s for scissors. Print which player wins (1 or 2, or T for tie). 

Input Format Two characters in lowercase. 

Output Format 1 or 2 or T 

Assumptions on Input Assume that the characters input by the user will be either r, p, or s.

Student submission:
#include<simplecpp>
main_program {
    char a,b;
    cin >> a >> b;
    if(a=='r' && b =='p') {
        cout << "2" << endl;
    }
    else if(a=='p' && b=='r') {
        cout << "1" << endl;
    }
    else if (a=='p'&& b=='s') {
        cout << "2" << endl;
    }
    else if (a=='s' && b=='p') {
        cout << "1" << endl;
    }
    else if (a=='r' && b=='s') {
        cout << "1" << endl;
    }
    else if (a=='s' && b=='r') {
        cout << "2" << endl;
    }
    else if ((a=='s'&&b=='s') || (a=='r'&&b=='r') || (a=='p'&&b=='p')){
        cout <<"T"<< endl;
    }


}

Grading criterion: Comparing for player 1 and 2 win
Rating A: correctly compares all cases of player 1 winning.
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: Rock-Paper-Scissors is a simple game played by two people, where the two players simultaneously gesture any one of the three objects ‘rock’, ‘paper’, or ‘scissors’. The rules are straightforward: rock beats scissors, scissors beats paper, and paper beats rock. The outcome of each round is a win for the player whose object beats that of the other player, or a tie if both players choose the same object. For example, if player 1 chooses rock and player two chooses paper, then player 2 wins as paper beats rock. 

Write a C++ program to accept two characters as input from the user. These denote the choice made by player 1 and player 2, respectively. The choices would be r for rock, p for paper, and s for scissors. Print which player wins (1 or 2, or T for tie). 

Input Format Two characters in lowercase. 

Output Format 1 or 2 or T 

Assumptions on Input Assume that the characters input by the user will be either r, p, or s.

Student submission:
#include<simplecpp>
bool win(char c1, char c2){
    bool ow = true;
    if((c2=='r'&&c1=='s')||(c2=='s'&&c1=='p')||c2=='p'&&c1=='r'){
        ow=false;
    }
    return ow;
}
main_program{
    char c1,c2;
    cin>>c1>>c2;
    cout<<endl;
    bool ow = win(c1, c2);
    if(c1==c2){
        cout<<"T";
    }
    else if(ow){
        cout<<"1";
    }
    else{
        cout<<"2";
    }
}

Grading criterion: Comparing for player 1 and 2 win
Rating A: correctly compares all cases of player 1 winning.
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: Rock-Paper-Scissors is a simple game played by two people, where the two players simultaneously gesture any one of the three objects ‘rock’, ‘paper’, or ‘scissors’. The rules are straightforward: rock beats scissors, scissors beats paper, and paper beats rock. The outcome of each round is a win for the player whose object beats that of the other player, or a tie if both players choose the same object. For example, if player 1 chooses rock and player two chooses paper, then player 2 wins as paper beats rock. 

Write a C++ program to accept two characters as input from the user. These denote the choice made by player 1 and player 2, respectively. The choices would be r for rock, p for paper, and s for scissors. Print which player wins (1 or 2, or T for tie). 

Input Format Two characters in lowercase. 

Output Format 1 or 2 or T 

Assumptions on Input Assume that the characters input by the user will be either r, p, or s.

Student submission:
#include<simplecpp>
main_program{
    char a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"T";
    }else
    if(a=='r' && b=='s'){
        cout<<"1";

    }else
    if(a=='s' && b=='p'){
        cout<<"1";

    }else
    if(a=='p' && b=='r'){
        cout<<"1";
    }else
    if(a=='s' && b=='r'){
        cout<<"2";
    }else
    if(a=='p' && b=='s'){
        cout<<"2";
    }else
    if(a=='r' && b=='p'){
        cout<<"2";
    }
}

Grading criterion: Comparing for player 1 and 2 win
Rating A: correctly compares all cases of player 1 winning.
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: Rock-Paper-Scissors is a simple game played by two people, where the two players simultaneously gesture any one of the three objects ‘rock’, ‘paper’, or ‘scissors’. The rules are straightforward: rock beats scissors, scissors beats paper, and paper beats rock. The outcome of each round is a win for the player whose object beats that of the other player, or a tie if both players choose the same object. For example, if player 1 chooses rock and player two chooses paper, then player 2 wins as paper beats rock. 

Write a C++ program to accept two characters as input from the user. These denote the choice made by player 1 and player 2, respectively. The choices would be r for rock, p for paper, and s for scissors. Print which player wins (1 or 2, or T for tie). 

Input Format Two characters in lowercase. 

Output Format 1 or 2 or T 

Assumptions on Input Assume that the characters input by the user will be either r, p, or s.

Student submission:
#include<simplecpp>
main_program{
    char a,b;
    cin>>a>>b;
    if((a=='r'&&b=='p')||(a=='s'&&b=='r')||(a=='p'&&b=='s')){
        cout<<"2";
    }
    else if(a==b){
        cout<<"T";
    }
    else{
        cout<<"1";
    }
}

Grading criterion: Comparing for player 1 and 2 win
Rating A: correctly compares all cases of player 1 winning.
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: Rock-Paper-Scissors is a simple game played by two people, where the two players simultaneously gesture any one of the three objects ‘rock’, ‘paper’, or ‘scissors’. The rules are straightforward: rock beats scissors, scissors beats paper, and paper beats rock. The outcome of each round is a win for the player whose object beats that of the other player, or a tie if both players choose the same object. For example, if player 1 chooses rock and player two chooses paper, then player 2 wins as paper beats rock. 

Write a C++ program to accept two characters as input from the user. These denote the choice made by player 1 and player 2, respectively. The choices would be r for rock, p for paper, and s for scissors. Print which player wins (1 or 2, or T for tie). 

Input Format Two characters in lowercase. 

Output Format 1 or 2 or T 

Assumptions on Input Assume that the characters input by the user will be either r, p, or s.

Student submission:
#include <simplecpp>
main_program {
    char c1, c2;
    cin >> c1 >> c2;
    if(c1 == 'r' && c2 == 'p') 
    cout << "2" << endl;
    else if (c1 == 'p' && c2 == 'r')
    cout << "1" <<endl;
    else if(c1 == 's' && c2 == 'p')
    cout << "1" << endl;
    else if(c1 == 'p' && c2 == 's')
    cout << "2" << endl;
    else if (c1 == 'r' && c2 == 's')
    cout << "1" <<endl;
    else if (c1 == 's' && c2 == 'r')
    cout << "2" << endl;
    else if (c1 == c2)
    cout << "T" << endl;

}

Grading criterion: Comparing for player 1 and 2 win
Rating A: correctly compares all cases of player 1 winning.
Rating B: Some issue.
Rating C: Major issue.
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

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

int Binary(int m, int l) {

        if (m==0) return 0;

         else if (m==1) {
            if (l==0 || l==1) return 1;
            else return 0; }

        else if (l==1) return m;
        else if (l==0) return 1;
        else if (l>=m) return 0;
        else return (Binary(int (m-1),int (l)) + Binary(int (m-2), int (l-1)));
}

int main() {
    int a,b;
    cin>>a>>b;
    cout << Binary(a,b) << endl;

}

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

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

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

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

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

Student submission:
#include<iostream>
using namespace std;
void binary(int n, int k, int &count){
    if(n <= 0 || k <=0){
        return ;
    }
    count++;
    binary(n-1, k, count);
    binary(n-2, k-1, count);

}

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

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

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

int B(int n, int k){
    if(n<k || (k==n-1 && n%2==0)) return 0;

    if(n==1&&k==1) return 1;
    return (B(n-1,k)+B(n-2,k-1));
}

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

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

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

int count(int a,int b){
    if(a<b) return 0;
    else if(a==0 || b==0) return 0;
    else if(a==1 && b==1) return 1;
    else if(a==2 && b==1) return 2;
    else {
        int x=count(a-1,b)+count(a-2,b-1);
        return x;}
}
int main(){
    int a,b;
    cin>>a>>b;
    int v=count(a,b);
    cout<<v;
}

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

Student submission:
#include<iostream>
using namespace std ;
int binary(int m ,int n){
    if(m/2+1<n){return 0 ;}
    else if(m==2 && n==1){return 2 ;}
    else if(m==2 && n==0){return 1 ;}
    else if(m==2 && n==2){return 0 ;}
    else if(m==1 && n==0){return 1 ;}
    else if(m==1 && n==1){return 1 ;}
    else {return binary(m-1,n)+binary(m-2,n-1) ;}
}
int main(){
    int n,k ;
    cin >> n >> k ;
    cout << binary(n,k) << endl ;
}

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

Student submission:
#include <iostream>
//#include <vector>
using namespace std;
/**void sort (vector <int>& a)
{
    //cout << "??";
    for (int l=0; l < a.size(); l++)
    {
        for (int k=0; k < a.size()-1; k++)
        {
            cout << "?";
            if (a[k]>a[k+1]) {swap(a[k],a[k+1]);cout<<'*';}
            //cout << a[k] << " " << a[k+1] << endl;
        }
        //for (int x: a) cout << x;
        //cout << endl;
    } 
}
int sum (vector<int> x)
{
    int s;
    for (int y: x) s+=y;
    return s;
}

void sort (vector<vector <int>>& a)
{
    for (int l=0; l < a.size(); l++)
    {
        for (int k=0; k < a.size()-1; k++)
        {
            if (sum(a[k])>sum(a[k+1])) swap(a[k],a[k+1]);
        }
    } 
}
int main(void)
{
    vector <int> a = {1,2,3,0};
    for (int x: a) cout << x ;
    sort(a);
    for (int x: a) cout << x;
    vector <vector<int>> mat = {{0,1},{0,0}};
    cout << sum(mat[1]);
    swap(mat[0],mat[1]);
    cout << mat[0][1];
}**/
int B (int n,int k)
{
    if(k==1) return n;
    if(k>(n-k+1)) return 0;
    if (k==(n-k+1)) return 1;
    //return 69;
    return (B(n-1,k)+B(n-2,k-1));
}
int main(void)
{
    int n,k;
    cin >> n >> k;
    cout << B(n,k);
}
//98 88,77 78,

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

Rating B: some issue
Rating C: major issue
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to count the number of binary strings (strings containing only '0' and '1') of length 'n' that contain exactly 'k' pairs of consecutive 1s. You must deduce the logical stopping points (base cases) for your recursion by considering the physical constraints of binary strings. For example, consider what happens when 'k' is 0, what the maximum number of consecutive pairs could possibly be in a string of length 'n', or if it is physically possible to have 1 pair in a string of length 1.

Code Requirements:

1. Input:
Read two integers 'n' and 'k' from the user.

'n' is the length of the binary string.

'k' is the number of consecutive pairs of 1s required.

2. Recursive Function & Base Cases:
Define a recursive function Bin(int n, int k) that returns the number of valid binary strings. Do not use arbitrary or hardcoded base cases. You must logically deduce and implement the correct base cases based on the physical constraints described in the context above.

3. Recursive Relation:
The function must follow this specific recursive relationship:
Bin(n, k) = Bin(n-1, k) + Bin(n-2, k-1)

4. Function Call:
Call the recursive function from the main() function and print the result.

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

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

Grading criterion: Declarations of variable and taking input
Rating A: Correctly declares and reads two integers as input

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