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,i=0,j=0;
    char z;
    cin >>n;
    cin >>z;
    char temp =z;
    while (z!=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: 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>

int main() {
        char c; int N = 0; int n = 0; bool  valid = true;
        int a;
        cin >> a;
        if(a > 0) {
        while(cin >> c) {
                if(c == '(') {
                        N++;
                        n++;
                }
                else if(c == ')') N--;
                if(c == ')' && n == 1) valid = false;
        }
        }
        if(N == 0 && valid) cout << "VALID " << N << endl;
        else cout << "INVALID " << N << endl;
        return 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<iostream>
using namespace std;
int main(){
    int n; cin>>n;
    int o=0,c=0,N;
    bool dikkat=false;
    for(int i=0;i<n;i++){
        char b; cin>>b;
        if(i==0 && b==')') dikkat=true;
        if(i==n-1 && b=='(') dikkat=true;
        if(b=='(') o++;
        else if(b==')') c++;
    }
    N= o-c;
    if(N==0 && !dikkat) cout<<"VALID "<<N;
    else if(N==0 && dikkat) cout<<"INVALID "<<N;
    else if(N!=0) 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;
    cin>>n;
    char R[n];
    for(int i=0;i<n;++i){
        cin>>R[i];
    };
    int r=0,s=0;
    for(int i=0;i<n;++i){
        if(R[i]='('){
            ++r;
        }
    };
    for(int i=0;i<n;++i){
        if(R[i]=')'){
            ++s;
        };
    };
    int N=r-s;
    if(N!=0){
        cout<<"INVALID "<<N<<endl;
    }
    if(N==0){
        cout<<"VALID "<<N<<endl;
    }
}

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;
    int i = 1;
    int numleftbrackets = 0, numrightbrackets = 0;
    char parentheses; bool valid;
    cin >> parentheses;
    i += 1;
    if (parentheses == ')') {
        valid = false;
        numrightbrackets += 1;
    } else if (parentheses == '(') {
        valid = true;
        numleftbrackets += 1;
    }
    while(i <= n) {
        char bracket;
        cin >> bracket;
        if (bracket == '(') {
            numleftbrackets += 1;
        } else if (bracket == ')') {
            numrightbrackets += 1;
        }
        i += 1;
    }
    if (valid == true) {
        if (numleftbrackets == numrightbrackets) {
            valid = true;
        } else {
            valid = false;
        }
    }
    int m;
    m = numleftbrackets - numrightbrackets;
    if (valid == true) {
        cout << "VALID " << 0;
    } else {
        cout << "INVALID " << m;
    }
}

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 a;
    int openCount=a;
    int closeCount=(n-a);
    cin>>n;
    cin>>a*( + (n-a)*)
    if(openCount==closeCount){
        cout<<"VALID"<<0;
    }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: 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;
	char c;
	int m =0;
	int openCount=0; int closeCount=0;
	for(int i=1; i<=n;i++)
	{
		cin>>c;
		if(c == '(')
		{
			openCount=openCount+1;
		}
		else if(c==')')
		{
			closeCount=closeCount+1;
		}
		if(closeCount>openCount)
		{
			m=1;

		}
	}
	int N = openCount-closeCount;
	if( m ==1)
	{
		cout<<"INVALID "<<N<<endl;
	}
	else 
	{
	if (openCount == closeCount)
	{
		cout<<"VALID "<<N<<endl;
	}
	else 
		

	{
		cout<<"INVALID "<<N<<endl;
	}
	}

}

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 a;
    cin >> a;
    int i=0, p=0, m=0, n=0;
    bool x=1;
    while (x) {
        char c;
        cin >> c; 
        if (c == '(' ) {
            m=m+1;
        }
        if (c == ')' ) {
            n=n+1;
        }
        if (n>m) {
            p=p+1;
        }
        i = i+1;
        if (i==a) {
            x=0;
        }
    }
    if (p==0 && m==n) {
        cout << "VALID 0" << endl;
    }
    else {
        cout << "INVALID " << m-n << endl;
    }
}

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 d=0; int e=0;int s;
	repeat(n){
		cin>>c;
		if (c=='(') ++d;
		else if (c==')') --d;
		if (d<0)s=d;
	}
    if (s<0 || d!=0)cout<<"Invalid"<<" "<<d;
		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{
        int n;char c;
        int o=0,b=0;
        bool valid=true;
        cin>>n;
        if(!n) cout<<"VALID"<<' '<<0;
        else{
                repeat(n){
                        cin>>c;
                        if(c=='(') o++;
                        else if(c==')') b++;
                        if(b>o) valid=false;
                }
                if(valid){
                        if(o==b){
                                cout<<"VALID"<<' '<<0;
                        }
                        else cout<<"INVALID"<<' '<<((b>o)?(b-o):(o-b));
                }
                else{
                        cout<<"INVALID"<<' '<<((b>=o)?(b-o):(o-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; cin >> n; //total number of inputs
	int count = 0;//will keep track of type of parentheses
	int z=1; // if count is 0 but input is still invalid
	for (int i=1; i<=n; i++)
	{
		char c; 
		cin >> c;
		if(c == '(')
			count++;
		else if (c == ')')
			count--;
		if((i==1) && (count<0))
			z=0;
	}
	if(count == 0)
	{
		if(z==0)
			 cout << "INVALID " << count << endl;
		else
			cout << "VALID " << count << endl;	
	}
	else
		cout << "INVALID " << count << endl;
}

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 ch;
    int openCount,closeCount,num = 0;
    while(n!=0){
        cin >> ch;
        if(ch == '('){
            openCount++;
        }
        else{
            closeCount++;
        }
        n--; 
        num = openCount - closeCount;
        if(num != 0){
            if(n==0){
            cout << "INVALID " << num; 
            } 
            if(num == -1){
                cout << "INVALID 0";
                break;
            }
        }
        else{
         if(n==0){
                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{
	cin>>noskipws;
	int n;
	int openCount=0,closedCount=0;
	cin>>n;
	int i=0;
	char c;
        
	while(i<n){
		cin>>c;
		if(c==' '){}
		else{
			if(c=='('){
				openCount++;
			}
			else if(c==')'){
				closedCount++;
			}
			i++;
		}

	}
	
	if(openCount==closedCount){
		cout<<"VALID 0";
	}
	else{
		cout<<"INVALID "<<openCount-closedCount;
	}
	
}

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,open=0,close=0,k;
	cin>>n;
	char c,c1,cn;
	cin>>c1;
	if(c1=='(')
	{
		open+=1;
	}
	else if(c1==')')
	{
		close+=1;
	}
	for(int i=1;i<(n-1);i++)
	{
		cin>>c;
		if(c == '(')
		{
			open+=1;
		}
		if(c == ')')
		{
			close+=1;
		}
	}
	cin>>cn;
	if(cn=='(')
	{
		open+=1;
	}
        else if(cn==')')
	{
		close+=1;
	}
	k=open-close;

	if(c1=='(' && cn==')')
	{
        	if((open-close)==0)
        	{
	        	cout<<"VALID"<<" "<<k;
	        }
        	else cout<<"INVALID"<<" "<<k;
	}
	else
	{
		 cout<<"INVALID"<<" "<<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