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{
    int n,openCount=0,closeCount=0,i=1;
    cin>>n;
    bool done=false;
    while(!done){
        char input;
        cin>>input;
        if (input=='('){openCount=openCount+1;}
        else if(input==')'){closeCount=closeCount+1;}
        i=i+1;
        if (i>n){done=true;} 
        }
    if(openCount=closeCount){cout<<"VALID 0";}
    else if (openCount!=closeCount){cout<<"INVALID "<<openCount-closeCount<<endl;}    
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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 a;
int o=0 , c=0;
int i=0;
while (i<n){
    cin >>a ;
    if ( a=='(') o++;
    else  c++;
    i++;
}
if (a== '(') cout <<"INVALID "<< o-c;
else if ((o-c)==0) cout << "VALID "<< o-c ;
else cout << "INVALID "<< o-c;
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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 m,n,p=0,q=0;
    char x,a='(',b=')';
    cin>>n;
    repeat(n){
        cin>>x;
        if(x==a)
            p+=1;
        else
            q+=1;
    }
    m=p-q;
    if(p!=q)
        cout<<"INVALID"<<" "<<m;
    else
        cout<<"VALID"<<" "<<m;
    }

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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 input;
    cin >> n;
    int openCount=0,closeCount=0;
    bool validity=true;
    cin>>input;
    if (input==')'){validity=false;closeCount+=1;}
    else{openCount+=1;}
    repeat(n-1){
        cin >> input;
        if(input=='('){openCount+=1;}
        else{closeCount+=1;}
    }
    if (validity==true){
        if(openCount==closeCount){validity=true;}
        else{validity=false;}
    }
    if (validity==true){
        cout<<"VALID "<<openCount-closeCount;
    }
    else{cout<<"INVALID "<<openCount-closeCount;}
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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 a; 
    cin >> n;
    for (int i=1;1<=n;i++)
    cin>> a;
    int count = 0;
    if (a=='(') count++;
    if (a== ')')count--;
    if (count==0 ) cout << "VALID 0";
    else cout << "INVALID" << count ; 
    
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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;
  int count1=0 , count2=0;
  int f=0;

  for(int i=1; i<=n ; ++i ){
  char in;
  cin >>in;
  
  if(in=='('){++count1; }
  if(in==')'){++count2;}
  if(count2>count1){f++; }
  }
  if(count1==count2 && f==0){cout <<"VALID " <<"0"; }
  if(count1==count2 && f!=0){cout <<"INVALID " <<"0"; }

  if(count1!=count2){
  cout <<"INVALID ";
  int out=(count1-count2) ;
  cout << out ;
  }
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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{
    char c;
    char a;
    char b;
    int d=0;
    cin>>a;
    cin>>b;
    bool x=false;
    if(b=='('){
        x=true;
        d++;
    }
    else if(b==')'){
        d--;
    }
    repeat(3){
        cin>>c;
        if(c=='('){
              d++;
        }
        else if (c==')'){
            d--;
        }
      
    }
    if(x && d==0){
        cout<<"VALID "<<d;
    }
    else{cout<<"INVALID "<<d;}
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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,p=0; cin>>n;
    repeat(n)
   { char c;
  cin>>c;  
if (c=='(') p++;
else p--;
   }
   if (p==0)cout <<"VALID " <<p;
   else cout <<"INVALID "   <<p;
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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=1;
    cin >> n;
    if(n%2 == 0){
        repeat(n){
            char c;
            cin >> c;
            
        }
    }
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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,a,b=0,d=0,e=0;
    char c;
    cin>>n;
    for(cin>>c,a=1;a<=n;a++,cin>>c){
        if(c=='('){
            b++;
        }
        else if(c==')'){
            d++;
        }
        if(b<d){
            e=1;
        }
    }
    if(e==0&&b==d){
        cout<<"VALID"<<" "<<(b-d);
    }
    else {
        cout <<"INVALID"<<" "<<abs(b-d);
    }
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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;
    int k=0;
    int counter1=0;
    int counter2=0;
    char c;
    bool validity=0;
    while(k<n){
        cin>>c;
        if(c=='(')
            counter1++;
        if(c==')')
            counter2++;
        if((counter1-counter2)<0)
            validity=1;

        k++;
    }
    if(validity==1 || (counter1-counter2)!=0)
        cout<<"INVALID "<<(counter1-counter2);
    if(validity==0 && (counter1-counter2)==0)
        cout<<"VALID "<<(counter1-counter2);

}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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 n;
	int o=0,c=0;char a;
	bool done=true;
	cin>>n;
	repeat(n){
		cin>>a;
		if(a=='('){
			++o;
		}
		else if(a==')'){
			++c;
		}
		if(c>o){
			done=false;
		}
	}
	int d= o-c;
	if(!done){
		cout<<"INVALID "<<d;
	}
	else{
		if(d!=0){
			cout<<"INVALID "<<d;
		}
		else{
			cout<<"VALID "<<d;
		}
	}
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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 {
    char c; int n, openCount = 0, closeCount = 0;
    int i = 1; bool invalidity = false;
    cin>>n;
    for( cin>>c; i<=n ; cin>>c, i++ ) {
        if (c == '(') openCount++;
        if (c == ')') closeCount++;
        if (closeCount > openCount) {invalidity = true;} //if in any case, the closed brackets exceed the open ones, we will be sure to print invalid even if final N = 0.
    }
    int N = openCount - closeCount;
    if ((N == 0) && (invalidity != true)) {
        cout<<"VALID "<<N;
    }
    else cout<<"INVALID "<<N;
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
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, opencount=0,closecount=0;
    cin>>n;
    char c;
    bool val=false;
    cin>>c;
    if(c==')'){
        closecount++;
        val=true;
    }
    else if(c=='('){
        opencount++;
    }

    for (int i=0;i<(n-1);i++){
        cin>>c;
        if(c=='('){
            opencount++;
        }
        else if(c==')'){
            closecount++;
        }
    }
    if(val){
        cout<<"INVALID"<<" "<<(opencount-closecount);
    }
    else{
        if((opencount-closecount)==0){
            cout<<"VALID"<<" "<<(opencount-closecount);
        }
        else{
            cout<<"INVALID"<<" "<<(opencount-closecount);
        }
    }
}

Grading criterion: Printing Valid and Invalid
Rating A: correctly prints VALID / INVALID and the count based on the condition
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: B