CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing (int* A, int n){
	
	int hist[n];
	for (int i=1; i<n; i++){
		if (A[i]>A[i-1]){
			hist [i-1]=1;
		}
		else hist[i-1]=0;
	}
	int sum=0;
	for(int i=0; i<n-1; i++){
		sum= sum + hist[i];
	}
	if (sum==n-1) return 1;
	else if (sum==0) return 2;
	else return 3;
}

int main(){
	int n;
	cin>>n;
	int y;
	int arr[n];
	for (int j=0; j<n; j++){
        cin>>arr[j];
	}
	y=isIncreasingDecreasing(& arr[0], n);
	cout<<y;
	
	
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <simplecpp>
main_program 
{
	int n;float Sn=0,i=1,j=2,a=0.5,p,error; cin >> n;
	while(i<=n)
	{
		Sn=Sn+pow(a,i-1);i=i+2;
	}	
	while(j<=n)
	{
		Sn=Sn-pow(a,j-1);j=j+2;
	}
	cout << fixed;
	cout.precision(6);
	
	p=float(2)/float(3);
	error=abs(Sn-p)/p;
	cout << Sn << " " << error;

}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>

using namespace std;

int isIncreasingDecreasing(int *a, int n){
int flag=0;
for(int i=0;i<n-1;i++){
if(a[i]<a[i+1])
{
continue;}
flag=1;
}
if(flag==0){
cout<<"1";
return 0;
}
flag=0;
for(int i=0;i<n-1;i++){
if(a[i]>a[i+1])
{
continue;}
flag=1;
}
if(flag==0){
cout<<"2";
return 0;
}
cout<<"3";
return 0;
}

int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
	cin>>arr[i];
}
isIncreasingDecreasing(arr,n);
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

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

int isIncreasingDecreasing(int *A, int n){
int i;

         if(A[i]<A[i+1]){
             return 1;
         }
         else if (A[i]>A[i+1]){
             return 2;
         }
         else{
         return 3;
         }
}

int main(){
int n,i;
cin>>n;
int A[n];
for(i=0;i<=n-1;i++){
     cin>>A[i];
     }
  isIncreasingDecreasing(A,n);
  return 0;
  }

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
using namespace std;
int isIncreasingDecreasing(int *A,int n){
int j=0,k=0;
while(A[j+1]>A[j] && j<n-1){j++;}
if(j==n-1){return 1;}
while(A[k]>A[k+1] && k<n-1){k++;}
if(k==n-1){return 2;}
else return 3;}
int main(){
int *A,n;
cin>>n;
for(int y=0;y<n;y++){cin>>A[y];}
cout<<isIncreasingDecreasing(A,n);}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
using namespace std;
int isIncreasingDecreasing (int *A, int n){
int b=0,c=0;
for (int i=0;i<n-1;i++) {
if (A[i]<A[i+1]) b++ ;
else if (A[i]>A[i+1]) c++ ;
}
if (b==n-1) cout<<1;
else if (c==n-1) cout << 2;
else cout << "3";
return 4;
}
int main(){
int i,n;
cin >> n;
if ((n>=1)&&(n<25)){
int A[n];
for (i=0;i<n;i++){
cin >> A[i];
}
isIncreasingDecreasing(A,n);
}
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>

int isIncreasingDecreasing (int *A[], int n)
   {int r,i,j;
  
	for (i=0;i<n;i++)
		{for (j=1; j<n; j++)
	         {  if (A[i]> A[j])
		        r = 1;
		        else if (A[i]<A[j])
		        r=2;
		        else
		        r=3;		     
		     }
		 }
   return r;
   }

main_program
{
	int i,n,r;
	cin >> n;
    int A[n];
	
	for (i=0;i<n;i++)
		{ cin >> A[i];}
	isIncreasingDecreasing (A[n],n);
	cout<< r;
	

			     
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>
main_program{
	
	int n;
	cin>>n;
	int arr[n](int n);

	for (int i=0;i<=(n-1);i++){
		
		if (arr[i]<arr[i+1]){
			return 1;
		    }
		
		else if (arr[i]>arr[i+1]){
			return 2;
		    }

		else {
			return 3;
		    }
		   


		}
	}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing(int *o,int n){
int counter=0;
int counter1=0;
	for(int j=0;j<n-1;j++){
	if(o[j]<o[j+1])counter++;
	else if(o[j]>o[j+1])counter1++ ;
	}
	if(counter==n-1)return 1;
	else if(counter1==n-1)return 2;
	else return 3;
	}
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
	cin>>a[i];
	}
cout<< isIncreasingDecreasing(&a[0],n);
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

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

int incresingdecresing(int*A,int n)
{   
    for(int i=0;i<(n-1);i++)
    {if(A[i]<A[i+1])
    {
        return 1;
    }
    else if(A[i]>A[i+1])
    {
        return 2;
    }
    else
    {
        return 3;
    }
    }
   return 0;
 
}
  int main()
{
    int n,A[n],i;
    cin>>n;
    for(int i=0; i<n;i++)
    {
        cin>>A[i];
    }
    cout<<incresingdecresing(A,n);
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing(int *A,int n){
while(true){
if(A[0]<A[1]){
for(int i=0;i<n-1;i++){
       if(A[i]<A[i+1]){
           }
        else{
         return 3;
        break;
         }
     }
return 1;
break;
}
else{

if(A[0]>A[1]){
for(int i=0;i<n-1;i++){
       if(A[i]>A[i+1]){
           }
        else{
         return 3;
        break;
         }
}
return 2;
break;
}




return 3;
break;
}
}}
int main(){
int n;
cin>>n;
int A[n];
for(int i=0;i<n;i++){
cin>>A[i];

}
cout<<isIncreasingDecreasing(A,n);

}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing (int *A,int  n){
int a=0;
for(int i=1;i<n;i++){
if(A[i]<A[i-1]){
a--;
}
if(A[i]>A[i-1]){
a++;
}
}
if(a==n-1){
return 1;
}
if(a==-n+1){
return 2;
}
else{
return 3;
}
}
int main(){
int n;
cin>>n;
int A[n];
int k;
for(int i=0;i<n;i++){
cin>>A[i];
}
k=isIncreasingDecreasing(A,n);
cout<<k;
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
using namespace std;
int isIncreasingDecreasing (int *A,int n)
{

	int j,k;
	j = 0;
	k = 0;
	for(int i=0;i<n-1;i++)
	{
		if(A[i]<A[i+1])
	{j++ ;}
		else if(A[i]>A[i+1])
	{k++ ;}
	}
	if(j==n-1)
	{return 1;}
	else if(k==n-1)
	{return 2;}
	else 
	return 3;
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<=n-1;i++)
	{cin>>a[i];}
	cout<<isIncreasingDecreasing(a,n);}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

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

int isIncreasingDecreasing (int *A, int n)
{
	if(n==1) return 1;	
	
	int dec=0,inc=0;

	for(int i=0;i<n-1;++i)
	{
	if(A[i]>A[i+1]) dec++;

	else if(A[i]<A[i+1]) inc++;
	}

	if(dec==(n-1)) return 2;

	else if(inc==(n-1)) return 1;

	else return 3;
}

int main()
{
int n;

cin >> n;

int array[n];

for(int i =0; i<n; ++i) cin >> array[i];

cout << isIncreasingDecreasing(array,n);
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing (int *A, int n){
int val=0;
for(int i=0;i<n-1;i++){
if(A[i]<A[i+1]){
val+=1;
}
else if(A[i]>A[i+1]){
val+=-2;}
}
if(val==n-1){return 1;}
else if(val==-2*(n-1)){return 2;}
else return 3;
}
int main(){
int n;
cin>>n;
int A[n];
for(int i=0;i<n;i++){
cin>>A[i];
}
if(1 <= n&& n < 25){cout<< isIncreasingDecreasing (A,n);}
}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int   isIncreasingDecreasing(int *A,int n){
for(int i=0; i<n; i++){


if(A[i]<A[i+1]){
return 1;}
else if(A[i]>A[i+1]){
return 2;}


else return 3;}}
int main(){
int n;
cin>>n;
int A[n];
for(int i=0; i<n; i++){cin>>A[i];}
cout<<isIncreasingDecreasing(A,n);}

Grading criterion: Quality and number of comments.
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C