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) 
{
 
 for(int i=0; i<=n; i++ ) 
  { 
  
  if(A[i] > A[i-1]) 
  
  { cout<< "1" << endl;} 
  
  if ( A[i-1] > A[i] ) 
  { cout<< "2" << endl ; } 
  
  else 
  {cout << "3" << endl; } 
  
  }    
  
   } 

int main() {
int n ;
 cin >> n >>endl;
 int A[n] ;
  
  for(int j=0;j<=n;j++) 
  {cin>> A[j] ; } 
  
  int isIncreasingDecreasing(int A[],int 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 k=n-1;
if (A[0]<A[1]){
for(int i=0;i<n-1;i++){
if (A[i]<A[i+1]) k--;
} 
if (k==0) return 1;
else return 3;
}
else if (A[0]>A[1]){
for(int i=0;i<n-1;i++){
if (A[i]>A[i+1]) k--;
}
if (k==0) return 2;
else return 3;
}
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)<<endl;
}

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 inc=0, dec=0;
	for(int i=0;i<(n-1);i++){
		if(A[i]<A[i+1]) inc++;
		if(A[i]>A[i+1]) dec++;
	}
	if (inc==(n-1)) return 1;
	else if (dec==(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 isIncreasingDecreasing(int *A,int n){
int inc=0,dec=0;
  for(int i=0;i<n-1;i++){
  if(A[i]<A[i+1]){inc++;}
  if(A[i]>A[i+1]){dec++;}
                      }

    if(inc==n-1){return 1;}
    else if(dec==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,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 p=0,q=0,r=0;
for (int i=0;i<n-1;i++)
{	if(A[i]<A[i+1]){p=p+1;}
	else if (A[i]>A[i+1]){q=q+1;}
	else r=r+1;
}
if(p==n-1){cout<<1;}
else if (q==n-1){cout<<2;}
else {cout<<3;}}
int main(){
int n;cin>>n;
if(1<=n && n<25){
int A[n];
for(int 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<iostream>
using_namespace std;

int factorial(int n)
{
	if(n==0) return 1;
	int prod=1;
	for int(i=n: i>0; i=i-1){
		prod(int *A=i);
	}
	return prod	;
}
int main(a=1,b=2,c=3);
{
int a=3, b=342;
	cout<<factorial(3)<<endl;
	cout<<factorial(342)<<endl;
}

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){
for(int i=0;i<n;i++){int maxindex=-9999;  maxindex=max(A[i],maxindex);}
int maxindex;
if(maxindex==A[n-1]) return 1;
else if(maxindex==A[0]) return 2;
else return 3;

}
main_program{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 j=0,k=0;
for(int i=0;i<n-1;){
	
	if(A[i+1]>A[i]){
j++;
i++;
continue;
	}
	else if(A[i+1]<A[i]){
	k++;i++;
	continue;
	}


	}
	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;i++){
	cin>>A[i];
}
int fun;
fun=isIncreasingDecreasing(A,n);
cout<<fun;}

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

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>
#include <cmath>

using namespace std;

int IncreasingDecreasing(int* A, int n)
{
	if(n == 1) return 1;
	
	else
	{
	
	bool flag1, flag2;
	
	for(int i=0; i<n-1; i++)
	{
		if(A[i] < A[i+1])
		{
			flag1 = true;
		}
		
		else
		{
			flag1 = false;
			break;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		if(A[i] > A[i+1])
		{
			flag2 = true;
		}
		
		else
		{
			flag2 = false;
			break;
		}
	}

	if(flag1) return 1;
	if(flag2) return 2;
	else return 3;
	}
}

int main()
{
	int n;
	cin >> n;
	int arr[n];
	
	for(int i=0; i<n; i++)
	{
		cin >> arr[i];
	}
	
	cout << IncreasingDecreasing(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>
#include<math.h>
using namespace std;
/* My method is to first determine whether the array is strictly increasing if not then is it strictly decreasing if not that also then the array is something else */

int isIncreasingDecreasing(int *A,int n)
{
	int z;                 // z will store the job done by the function
	bool flag1, flag2;     
	if (n==1) return z=1;   // SInce we deal with arrays so the indexes have corner cases, in this case,
	                        // it is indecisive if we have only 1 element, whom to compare it to ?
	                        // as nothing was mentioned in the question I put such array to be always increasing 
	                        // this decision was also motivated by the practise case 1 
	for ( int i=0; i<n-1; i++)
	{
		if(A[i]<A[i+1]) flag1=1;     // checks completely for SI array
		else 
		{
			flag1=0; break;      // if not then moves to other cases
		}
	}
	if (flag1 ==1) z=1;                 // ends the program if SI array is found with putting z=1
	else
	{ 
		for(int a=0;a<n-1;a++)
		{
			if(A[a]>A[a+1]) flag2=1;   // checks completely for SD array
			else 
			{
				flag2=0; break;
			}
		}
	if ( flag2==1) z=-1;                  // ends the program if SD array is found with putting z=-1
	else z=0;                             // ends the program if neither of the array is found with putting z=0
	}
	return z;
}	

int main ()
{
	int n;
	cin >> n;
	int A[n];
	for ( int k=0;k<n;k++)
	{
		cin>> A[k];
	}
	int z= isIncreasingDecreasing(A,n);
	if (z==1) cout << "1" ;
	else if (z==-1) cout << "2";
	else cout << "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: B
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;}
for(int i=0; i<n-1; i++){if(A[i]<A[i+1])
{return 1;} }
for(int j=0; j<n-1; j++){if(A[j]>A[j+1]){return 2;}}
 return 3;
}
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0; i<n; i++){
cin>>arr[i];
}
cout<<isIncreasingDecreasing(arr,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<simplecpp>
int main(){
double ans1,ans2,x;
int n1,n2;
cin >> n1;
n2 = n1+1;
n1 = 0;
n2 = 0;
double A(n2);
for(int t=0; 'i' = <2; i++){
cin >> ('Ai');
}
cin >> x ;
for (int t = 0; t <= n2; i++){
ans2 + =(Ai)*pow(x,i); 
}
cout << ans1 << endl << ans2;
}

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 ans,i,seq2=0,seq1=0,a=0;
	if(n<25 && n>=1){
if(A[0]>A[1])
{seq2++;for(i=0;i<n-1;i++){if(A[i]<A[i+1]){a++;}
}}
else if(A[0]<A[1])
{seq1++;
for(i=0;i<n-1;i++)
{ if(A[i]>A[i+1]){a++;}}}

if(seq1>0&& a==0) {return 1;}
else if(seq2>0&& a==0) {return 2;}
else return 3;
}}

int main()
{int num;
cin>>num;
int a[num];
for(int i=0;i<num;i++)
{cin>>a[i];}
cout<<isIncreasingDecreasing(a,num);
}

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 m=0 , r=0 ,p=0  ;
    for ( int l = 0 ; l < n-1 ; l++)
    {
        if ( A[l]<A[l+1]) 
        { 
            m++ ;
        } 
    }
     if ( m==n-1) return 1 ;
    for ( int k = 0 ; k < n-1 ; k++)
    {
        if ( A[k]>A[k+1]) 
        { 
            r++ ;
        } 
    }
    if ( r==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 , n ) << endl;


}

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