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>
#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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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<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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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)
{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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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)
{ 
    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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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;
//Final

int isIncreasingDecreasing (int *A, int n){
int ret=0;
int ctr1=0,ctr2=0;
for (int i=0; i < n-1 ; ++i){

if (A[i]<A[i+1]){ctr1=ctr1+1;}
}
for (int i=0; i < n-1 ; i++){
int ctr=0;
if (A[i]>A[i+1]){ctr2=ctr2+1;}
}
if (ctr1==n-1){ret=1;}

else if (ctr2==n-1){ret=2;}
else {ret=3;}
//cout << ctr2<<n<<ret;

cout << ret;
return ret;}

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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){
for (int i=0; i<n-1; i++){int b=0;
	if (A[i]<A[i+1]) b++;
if (b==n-1){
 return 1;}}
for (int i=0; i<n-1; i++){ int c=0;
	if (A[i]>A[i+1])c++;
if (c==n-1){
 return 2;}}
return 3;
}
int main(){
int n=1; int A[n];
cin>>n;
for (int i=0; i<n; i++) cin>>A[i];
 if (n==1) cout<<"1";
if (n>1) {int m= IsIncreasingDecreasing (A, n);
cout<<m;
} 
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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<simplecpp>
using namespace std;
int isIncreasingDecreasing(int *A,int n)
{int c=0,d=0,m=0;int i;
	for(i=0;i<n-1;i++)
	{
	if(A[i]<A[i+1])
	c++;
	else if(A[i]>A[i+1])
	d++;
	else
	m++;
	}
	if(c==i)
	return 1;
	else if(d==i)
	return 2;
	else
	return 3;
}
int main()
{int n; int a[100];

cin>>n;

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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)
{int i,j;
for(i=0; i<n; i++){
for(j=i+1; j<n; j++){
if(A[i]>A[j]){return 2;}
else if(A[i]<A[j]){return 1;}
}}
}
int main(){
int n,i;
cin>>n;
int A[n];
if(n>=1 && n<25){
for(i=0; i<n; i++)
{cin>>A[i];}
cout<<isIncreasingDecreasing(A,n);
}}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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 main { 
 {
 A[n] {m1<m2<m3<..<mn} ;
 return 1 ;
 }
 {
 A[n] {m1>m2>m3>..>mn} ;
 return 2;
 }

 else{
return 3;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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)
{
	int i,m=3;
	for(i=0;i<n-1;i++)
	{
		if(A[i]<A[i+1])
		{
			m=1;
		}
		else
		{
			m=3;
			break;
		}
	}
	if(m==3)
	{
	 	  for(i=0;i<n-1;i++)
       		  {
               		 if(A[i]>A[i+1])
               	 	 {
                	       m=2;
               		 }
               	 	 else
                  	{
                        	m=3;
                        	break;
                	}
        	}
	}
	if(n==1)   m=1;
	return m;
}
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int j=0;j<n;j++)
	{
		cin>>arr[j];
	}
	int p=isIncreasingDecreasing(&arr[0],n);
	cout<<p;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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){
int i;
for(i=0;i<n-1;i++){
		if(A[i]<A[i+1]){continue;}
		else{break;}	
}
if(i==n-1){return 1;}
else{
int j;
for(j=0;j<n-1;j++){
		if(A[j]>A[j+1]){continue;}
		else{break;}	
}
if(j==n-1){return 2;}
else{return 3;}
}

}



int main(){
int n;
cin>>n;
int A[n];
if(n>=1&&n<25){
for(int i=0;i<n;i++){
	cin>>A[i];
}
cout<<isIncreasingDecreasing(A,n);
}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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 maxspace ( int *A,int n){
int maxindex = 0;
for (int j =1;j<n;j++){
if (A[maxindex] < A[j]) maxindex = j;
}
return maxindex;
}
int minspace (int *A, int n){
int minindex = 0;
for (int j = 1;j<n;j++){
if (A[minindex] > A[j]) minindex = j;
}
return minindex;
}
int isIncreasingDecreasing(int *A,int n){
int maxindex = maxspace(A,n);
int minindex = minspace(A,n);
if (maxindex == n-1){
bool flag1 = 0;
for (int j = 0;j<n;j++){
if (maxspace (A,j+1) != j) flag1 = 1;
}
if (flag1 == 0) return 1;
else return 3;
}
else if (minindex == n-1){
bool flag2 = 0;
for (int k = 1; k<n;k++){
if (minspace (A,k+1) != k) flag2 = 1;
}
if (flag2 == 0) return 2;
else return 3;
}
else return 3;
}



int main (){
int n;
int A[100];
int q;
cin >> n;
if (n>=1 && n <25){
for (int i = 0;i<n;i++){
cin >> A[i];
}
q = isIncreasingDecreasing( A,n);
cout << q;
}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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<simplecpp>
int isIncreasingDecreasing(int *A,int n)
{ int maxnum=*A[0];
 for(int j=1;j<=n;j++)
 {if(maxnum<*A[j])
 maxnum=*A[j];
 *A[j]=*A[j+1];
 return(1);
 else if(maxnum>*A[j])
  maxnum=*A[j];
  *A[j]=*A[j+1];
  return(2);
  else return(3);
 }}
 main_program
 {int n,A[25];
 for(int i=0;i<=n;i++)
 cin>>A[i];
 cout<<isIncreasingDecreasing(&A,n)}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
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 main(){
int [A]={n};
cin>>n>>[A];
for(i=0, i<=n, i++){
if((n+1)<n){cout<<"1";}
else if((n+1)>n){cout<<"2";}
else {cout<<"3";}}

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