CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to collect a positive integer n from the user, and then collect n character strings from the user (containing only lower case alphabets and no other characters, not even spaces). The strings need not be of equal length but the maximum length of any string should be 11. The strings should be stored in an appropriate 2D array. Your program should then include the following:

1. A function string_compare which takes two strings as input and returns 1 if the first string appears before the second string in alphabetical order, -1 if the second string appears before the first in alphabetical order, and 0 if the two strings are equal to each other. 

2. A function string_sort which sorts the character strings in reverse alphabetical order using the selection-sort algorithm.

Your program should also print the number of string_compare operations (i.e. how many times the string_compare routine was called) and the number of string swaps performed. 

Constraints
n is a positive integer, n < 15

The maximum length of any of the strings should be 11, excluding the NULL character

The character strings should contain only lower case alphabets

Student submission:
#include <iostream>
using namespace std;
#define MAX 100
int string_compare (char *first, char * second){
int i = 0;
while (true){
if (first[i] == 0 && second[i] == 0) return 0;
if (first[i] == 0) return -1;
if (second[i] == 0) return +1;
if (first[i] < second[i]) return -1;
if (first[i] > second[i]) return +1;
i++;
}
return 0;
}
int argmax (char A[][MAX], int L){
	int i;
	int j=0;
	for(i=1;i<L;i++){
	    	int m = string_compare(&A[j],&A[i])
	    	if (m == -1) ;
	    	if(m==1) j=i;
	    	else ;
	}
	return j;
}
void string_sort(char A[][MAX]){

	for(int i=n; i>1;i--){
		int maxindex = argmax(s,i);
		myswap(&A[maxindex],&A[i-1]);
	}
}
int main(){
	int n;
	cin>>n;
	char A[n][MAX];
int count=0;
while (cin.getline(A[count++], 11)); // terminated by ctrl-Z
	string_sort(A);
	for(int i=0;i<n;i++){
		int m;
		for(int j=0;j<12;j++){
			if(A[i][j]='\0') m=j;
		}
		for(m-1;m<=0;m--){
	 	cout<<A[i][m];
		}
		cout<<"\n";
}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to collect a positive integer n from the user, and then collect n character strings from the user (containing only lower case alphabets and no other characters, not even spaces). The strings need not be of equal length but the maximum length of any string should be 11. The strings should be stored in an appropriate 2D array. Your program should then include the following:

1. A function string_compare which takes two strings as input and returns 1 if the first string appears before the second string in alphabetical order, -1 if the second string appears before the first in alphabetical order, and 0 if the two strings are equal to each other. 

2. A function string_sort which sorts the character strings in reverse alphabetical order using the selection-sort algorithm.

Your program should also print the number of string_compare operations (i.e. how many times the string_compare routine was called) and the number of string swaps performed. 

Constraints
n is a positive integer, n < 15

The maximum length of any of the strings should be 11, excluding the NULL character

The character strings should contain only lower case alphabets

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

int compare_function(char a[],char b[])
{
int i=0,j=0;
while(a[i] || b[j])
{
	if(a[i]==b[j])
	continue;
	else if(a[i]>b[j])
	{
	return -1;
	break;
	}
	else
	{
	return 1;
	break;
	}
	i++;j++;
}
if(i==j)
return 0;
}

void string_sort(char a[][100],int n)
{
	int i,j,k;
	char temp;
	for(k=0;k<n;k++)
	{
	for(i=0;i<strlen(a[k])-1;i++)
	{
	for(j=i+1;j<=strlen(a[k]);j++)
	{
	if(a[i]<a[j])
	{
	temp=a[k][i];
	a[k][i]=a[k][j];
	a[k][j]=temp;
	}
	}
	}
	cout << a[k];
	}
	cout << k;
 }
int main()
{
	char a[100][100];
	int n,i;
	cin>>n;
	for(i=0;i<n;i++)
	cin >> a[i];
	string_sort();
	string_compare();

}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
main_program{
    int n;cin>>n;
    int number=0;
    char ch2='b';
    for(int i=0;i<n;i++){
        char ch1;cin>>ch1;
        if((ch1=='a'||ch1=='e'||ch1=='i'||ch1=='o'||ch1=='u') && (ch2!='a' && ch2!='e' && ch2!='i' && ch2!='o' && ch2!='u')){
            number++;
        }
        else if((ch1=='a'||ch1=='e'||ch1=='i'||ch1=='o'||ch1=='u') && (ch2=='a' || ch2=='e' || ch2=='i' || ch2=='o' || ch2=='u')){
            number=number;
        }
        ch2=ch1;
}
cout<<number<<endl;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include <simplecpp>

main_program {
	int n; cin>>n;
	char ch;
	bool prev=false;
	int count=0;
	while(n--) {
		cin>>ch;
		if(ch=='a'||ch=='e'||ch=='o'||ch=='i'||ch=='u') {
			if(!prev) {
				count++;
				prev=true;
			}
		} else {
			prev=false;
		}
	}
	cout<<count;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
main_program {
        int n=0;
        char ch='a';
        char chi='b';
        cin >> n;
        int count=0;
        for(int i=0; i<n; i++) {
                cin >> ch;
                if((ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') && (chi!='a' && chi!='e' && chi!='o' && chi!='u' && chi!='i')) {
                        count++;
                }
                chi=ch;
        }
        cout << count;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
main_program{
    int n;
    cin >> n;
    int count=0;
    char c1;char c2;
    for(int i=1;i<=n;i++){
        cin >> c1;
        if((c2!='a')&&(c2!='e')&&(c2!='i')&&(c2!='o')&&(c2!='u')){
            if((c1=='a')||(c1=='e')||(c1=='i')||(c1=='o')||(c1=='u')){
            count++;
        }
        }
        c2=c1;
    }
    cout << count;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
main_program{
int n,c;
cin>>n;
c=0;
char a;
for(int i=0;i<n;i++){

cin>>a;
if (char(a)==char('a')){
    c+=1;
}
if (char(a)==char('e')){
    c+=1;
}
if (char(a)==char('i')){
    c+=1;
}
if (char(a)==char('o')){
    c+=1;
}
if (char(a)==char('u')){
    c+=1;
}
}

}
cout<<c;




}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>

main_program{
   int n;
   cin >> n;
   int count=0,prev=0,cluster=0;
   for (int i=0;i<n;i++){
          char w;
          cin >> w;
          if (w=='a' || w == 'e' || w == 'i' || w == 'o' || w == 'u') {
                  count++ ;
                  if (prev == 0) cluster++;
                  prev=1;
          }
          else {
                  count = 0;
                  prev = 0;
            }
}
  cout << cluster ;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
main_program{
        int n,i=1,k=0;
        cin >> n;
        while(i<=n){
                char g;
                cin >> g;
                if(g!='a'&&g!='e'&&g!='i'&&g!='o'&&g!='u'){
                        i++;
                        continue;
                }
                else{
                        k++;
                        i++;
                        while(1){
                                char j;
                                cin >> j;
                                if(j!='a'&&j!='e'&&j!='i'&&j!='o'&&j!='u'){
                                        i++;
                                        break;
                                }
                                else {
                                    i++;
                                    continue;
                                }
                        }
                }
               }
        cout << k;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include <simplecpp>
main_program{
        int n, x=0, y=0;
        cin >> n;
        repeat(n){
                char c;
                cin >> c;
                if (c == 'a' || c=='e' || c=='i' || c=='o' || c=='u') x++;
                else {
                        if (x>0) y++;
                        x=0;
                }
        }
        if (x>0) y++;
        cout << y << endl;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: Problem Description

You are building a text analyzer tool. One of its features is detecting vowel clusters in a word.

Your task is to write a program that takes a word and counts how many vowel clusters it contains.

What is a Vowel Cluster?

A vowel cluster is a group of one or more vowels (a, e, i, o, u) that appear consecutively without any consonants in between.

Examples:

- "ae" is one vowel cluster.  
- "a" is one vowel cluster.  
- "abc" has one vowel cluster: "a".  

For example, in the word "beautiful", the vowels "eau" form one vowel cluster. Later, "i" and "u" form their own clusters. Hence, the word contains 3 vowel clusters in total.

--------------------------------------------------

Input Format

- An integer n, the length of the word.  
- A word of n lowercase English letters.

--------------------------------------------------

Output Format

- Print a single integer representing the number of vowel clusters in the word.

--------------------------------------------------

Assumptions on Input

1 <= n <= 100000  

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the result.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
main_program{
        int n,r,c=0;
        cin>>n;
        r=n;
        char p;
        while(r>=0){
                cin>>p;
                r--;
                int q=0;
                while((p=='a'||p=='e'||p=='i'||p=='o'||p=='u')&&(r>=0)){
                        q++;
                        cin>>p;
                        r--;
                }
                if (q!=0){
                        c++;
                }
        }
        cout<<c<<endl;
}

Grading criterion: Declaration of variables
Rating A: correctly declares the variables as required

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A