CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program{
    
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program
{
        int a=0;
        int b=0;
        int n;
        cin>>n;
    while(n>=0)
    {
        char input;
        cin>>input;
        if(input=='(')
        {
            a=a+1;
        }
        if(input==')')
        {
            b=b+1;
        }
    }
    int c=(a-b);
    if (c!=0)
    {cout<<"INVALID "<<c<<endl;}
    else{
        cout<<"VALID "<<c<<endl;
    }
    n--;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program{
    int n,i=1,opencount=0,closecount=0,s=0,p=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        char c;
        cin>>c;
        if (c=='(')
        { 
            opencount=opencount+1;
        }
        if (c==')')
        {
            closecount=closecount+1;
        }
        if ((i==1 && c!='(') || (i==n && c!=')'))
        {
            p=p+1;
        }
    }
    s=opencount-closecount;
    if ( p==0 && s==0)
    {
        cout<<"VALID"<<" "<<s; 
    }
    if (p!=0)
    {
        cout<<"INVALID"<<" "<<s;
    }
    

}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program{
	int n;int c1=0; int c2=0;bool valid=true;
	cin>>n;
    char c;
    cin>>c;

	for(int i=0;i<n;i++, cin>> c){
	if (c=='(') c1++;
	if (c==')') c2++;
	if (c2>c1 )  valid=false;
	}
	int s=c1-c2;
	if(valid) {if (s==0) cout<<"VALID "<< s; else {valid=false;cout<<"INVALID"<<s;}}
	else cout<<"INVALID "<<s;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>
main_program{
int n=0;
cin >> n;
int open,close =0;
char c;

if (n==0){
    cout << "VALID 0";
}
int diff = open-close;
bool final = true;
cin >> c;
if (c==')'){
    close++;
    final = false;}
else 
    open++;

for (int i=1;i<n;i++){
    
    cin >> c;
    if (c=='(')
        open++;
    else 
         close++;
    diff = open-close;
    
}



if (open!=close)
    cout << "INVALID "<<diff;
else if (open==close && final==false)
    cout << "INVALID 0";
else 
    cout << "VALID 0";

}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: B
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>

main_program{
        int n;
        cin>>n;
        char input;
        char '(';
        char ')';
        int i;
        for(i=1; i<=n; i++){
                cin>>input;
        }

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>
main_program {
    unsigned int n;
    cin>>n;
    int open=0,close=0;
    int op=0,cl=0;
    for(int i=0; i<n; i++) {
        char input;
        cin>>input;
        if(input==')') close++;
        else if(input=='(') open++;
    }
    for(int i=0; i<n; i++) {
        char input;
        cin>>input;
        if(input==')') cl++;
        else if(input=='(') op++;
        if(cl>op) break;
        else continue;
    }
    if(op>=cl && open==close) cout<<"VALID 0";
    else cout<<"INVALID"<<" "<<abs(open-close);
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program{
    int n,temp=1,ocount=0,ccount=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        char c;
        cin>>c;
        if(c=='('){ocount++;}
        else{ccount++;}
        if(i<n&&ocount-ccount<0){
            temp=0;
            }
        
    }
    if(temp==0){cout<<"INVALID "<<ocount-ccount;}
    else{
        if(ocount!=ccount){cout<<"INVALID "<<ocount-ccount;}
        else{cout<<"VALID "<<0;}
    }
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>
main_program{
unsigned int x,y,n; int k; bool v=0; char input;
cin>>n; x=0; y=0;
for(unsigned int i=0; i<n; ++i) {cin>> input;
        if (input=='(') {++x;}
        else if (input==')') {++y;};
        k=x-y;
        if (k<0) {v=1;}
        }
        k=x-y;
        if (v || k!=0) {cout<<"INVALID ";} else {cout<<"VALID ";} cout<<k;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program {
        int n,a,b,c;
        char '(','')';
        cin >> n,(,);
        '('==a;
        '('==b;
        a=1;
        b=-1;
        c=a+b;
        if(c==0) {
                cout<<"VALID 0";
        }
                else cout<<"INVALID "<<c;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: C
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program{
    int n;
    cin>>n;
    int N,openCount=0,closeCount=0,flag=0;
    char c;
    for(int i =0;i<n;i++){
        cin>>c;
        if(c=='('){
            openCount+=1;
        }
        else if(c==')'){
            closeCount+=1;
        }

        if(i==0){
            if(c=='('){
                flag++;
            }
        }
        if(i==n-1){
            if(c==')'){
                flag++;
            }
        }
    }
    N=openCount-closeCount;
    if(N==0&&flag==2){
        cout<<"VALID "<<N;
    }
    else{
        cout<<"INVALID"<<N;
    }
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>
main_program{
    int n,b,c,e,f,i;
    bool d=true;
    cin >> n;
    i=0;
    string a;
    cin >> a;
    while(i<=n-1){
        if(a[i]=='('){
           e+=1;
        }
        else if(a[i]==')'){
            f+=1;
        }
        else if(e<f){
            d=false;
            cout << "INVALID ";
            break;
        }
        i++;
    }
    for(int i=0; i<=(n-1);i++){
        if(a[i]=='('){
           b+=1;
        }
        else if(a[i]==')'){
            c+=1;
        }
    }

    if(d==true&&(b-c)!=0){
        d=false;
        cout << "INVALID ";

    }
    else if(d==true) cout << "VALID ";
    cout <<b-c;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>
main_program{
    int n;
    cin>>n;
    char c;
    int n1=0,n2=0,k=0;
    for(int i=0; i<n;i++){
        cin>>c;
        if (c=='(') {n1++;}
        else if (c==')') n2++;
        if ((n1-n2)<0) k=-1;
    }
    if (k==-1) cout << "INVALID" << " "<<n1-n2;
    else if (n1-n2==0) cout << "VALID" << " "<<0;
    else cout << "INVALID" <<" "<< n1-n2;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include<simplecpp>
main_program {
 int n,a,b; a=0; b=0;  
 bool r=true; 
 cin>>n;
 for(int i=0;i<n;i++){
        char c;
        cin>>c;
        if(c=='(') {++a;}
        if(c==')') {++b;}
        if(b>a) {
            r=false; }        
        
    }
 if(a!=b) {r=false;}
 if(r) {cout<<"VALID"<<" "<<(a-b);}
 else {cout<<"INVALID"<<" "<<(a-b);}
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A
Problem: A sequence of characters ‘(‘ and ‘)’ is said to be balanced or valid, if it can be obtained from a valid mathematical expression by erasing all other symbols. For instance, from a mathematical expression like (1+2)*((3+4)*(1+2)) yields a balanced sequence ()(()()). On the other hand, the sequence (() or the sequence )( is not balanced. Write a C++ program to read a sequence of characters consisting of characters ‘(‘ and ‘)’ and identify if it is VALID or INVALID. To check whether a sequence is valid, it is enough to keep track of the count of ‘(‘s and ‘)’s seen at any point in the sequence, when scanning the sequence left to right. You can use a few examples to understand when a sequence becomes invalid. 
Input Format
A non-negative integer n, followed by a sequence of n characters consisting of ‘(’ and ‘)’  

Output Format
VALID N
or
INVALID N 

where N = openCount - closeCount, where openCount is the number of  ‘(’ symbols and  closeCount is the number of  ‘)’ symbols in the sequence.

Student submission:
#include <simplecpp>
main_program{
        int n; char c; bool valid = true;
        int counter = 0, openCount = 0, closeCount = 0;
        cin>>n;
        for(int i = 0; i < n; i++){
                cin>>c;
                if(c=='('){
                        counter++;
                        openCount++;
                }
                else if(c==')'){
                        counter--;
                        closeCount++;
                }
                if(counter<0) valid = false;
        }
        if(counter != 0) valid = false;
        if(valid) cout<<"VALID "<<openCount-closeCount;
        else cout<<"INVALID "<<openCount-closeCount;
}

Grading criterion: Final count
Rating A: correctly computes the count of '(' - ')
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A