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 i=0;

 while(i<n){int k=i+1;
          if(A[i]<A[k]) i++;
           else return 3;
            }
         return 1;

while(i<n){int r=i+1;
            if(A[i]>A[r]) i++;
            else return 3;
    }return 2;}
int main(){
int n;
cin>>n;
int A[n];

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

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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){
bool flag=1;
for(int i=0;i<n-1;i++)
{
if(A[i]>A[i+1]){flag=0; break;}

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

}
if(flag){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<<isIncreasingDecreasing(arr,n);

}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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>
void isIncreasingDecreasing(int *A, int n){
    int l;
    int i=0;
    int d=0;
    
  
   for (l=1; l<n; l++) {
        if (A[l] > A[l-1]) {
        i = i+1;
        }
        
        else if (A[l] < A[l-1]) {
        d = d+1;
        }
    }    
  
  
  if(i == (n-1)) cout << 1;
  else if (d == (n-1)) cout << 2;
  else cout << 3;
  

}

int main () {
   int m,k;
   cin >> m;
   
   int B[m];
   for (k=0;k<m;k++) {
   cin >> B[k];
   }
   
  isIncreasingDecreasing( B,  m);
    
   }

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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 i,j;

int isIncreasingDecreasing (int *A, int n){
	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[i]>A[i+1]);
		return 2;
	}
}
	


int main(){
	int a[100],N,x;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>a[i];
	}
	x=isIncreasingDecreasing(a,N);
	if(x%11==0) return 1;
	else if(x%2==0) return 2;
	else return 3;
	
	
	
	

}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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 is(int *a, int n) {
	int e=0, b=0, c=0;
	for (int i=n-1; i>0; i--) {
		if (a[i] > a[i-1]) {
			e++;
		}
		else if (a[i] < a[i-1]) {
			b++;
		}
		else {
			c++;
		}
	}
	if (e == n-1) {
		return 1;
	}
	else if (b == n-1) {
		return 2;
	}
	else {
		return 3;
	}
}
int main () {
	int n;
	cin >> n;
	int a[n];
	for (int p= 0; p <n ; p++) {
		cin >> a[p];
	}
	cout << is (a, n);
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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>

using namespace std;

int main()
{
	 
	 int order (int B)

	  cout << size (B) << size (A);
	  
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
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){
	bool inc=true, dec=true;
	for(int i=0;i<n-1;i++){
		if(A[i]>A[i+1]){
			inc=false;
		}
		if(A[i]<A[i+1]){
			dec=false;
		}
	}
	if(inc){return 1;}
	if(dec){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: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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++){

	if (A[i]<=A[i+1]) ;
else break;

}
return 1;
}



for(int i=0;i<n-1;i++){

	if(A[i]>=A[i+1]) return 2;

else break;
}



 return 3;
}

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

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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<array>
using namespace std;

/*int bs(int* ar,int n)
{
  int copy[n];
  int flag=0;
  for(int i=0;i<n;i++)
  copy[i]=ar[i];
  
  for(int i=0;i<n-1;i++)
  {
    for(int j=0;j<n;j++)
    {
      if(ar[j]<ar[i])
       {
       int temp=ar[i];
       ar[j]=ar[i];
       ar[i]=temp;
      }
    }
    }
    
    
    for(int i=0;i<n;i++)
    {
     if(copy[i]==ar[i])
     flag=1;
     else
     {
     flag=0;
     break;
     }
     return flag;
     }
     }*/
     
     
     
     
     


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

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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 incdec(int* A, int n){
			if(n==1) return 1;
			for( int i=0; i<n-1; i++)
			{if (A[i]<A[i+1]){if (i==n-2) return 1;}
			else break;}
			for(int i=0; i<n-1; i++)
			{if (A[i]>A[i+1]){if (i== n-2) return 2;}
			else break;}
			return 3;
			 }
int main(){
	int n;
	cin>>n;
	int A[n];
	for(int i=0; i<n; i++)
	{cin>>A[i];}
	cout<<incdec(A,n);
	  }

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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 j=1;j<n;j++)
{
//int maxindex=0;
if (a[j+1]>a[j])

return 1;

else if(a[j+1]<a[j])
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],n);
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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;
#define MAXSIZE 25
int main(){
int n;
cin>>n;
int*A[n];
cin>>*A[n];
int isIncreasingDecreasing(int*A, int n);
int i;
if(i>=0 && i<=n){
if(*A[i+1]>*A[i]){
cout<<"1";}
else if(*A[i+1]<*A[i]){
cout<<"2";}
else {cout<<"3";}
}
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
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 is (int a[], int n) {

int p=0;
for (int i=0 ; i<n ; i++)

{

if (a[i]<a[i+1])
{p+=1; }

else if (a[i]>a[i+1])
{p+=2;}

else return 3;

}
if(p==n){return 1;}
else if (p==2*n){ 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<< is(a,n);
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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 IncreasingDecreasing(int *A,int n)
{for(int j=1;j<=n-1;j=j+1)
{if (A[j]<A[j+1]) return 1;
else if (A[j]>A[j+1])return  2;
else return  3;
}return 0;
}
int main()
{int n,i,A[n];
cin>>n;
while(i<=n)
{cin>>A[i];
i=i+1;
}
cout<< IncreasingDecreasing(A,n);
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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)
{
	if(n==1) return 1;
	else if(A[1]>A[0])
	{
		for(int i=1; i<n-1; i++)
		{
			bool flag = A[i+1]<A[i];
			if(flag) return 3;
		}
		return 1;
	}
	else
	{
		for(int i=1; i<n-1; i++)
		{
			bool flag = A[i+1]>A[i];
			if(flag) return 3;
		}
		return 2;
	}
}


int main()
{
	int n, A[25];
	cin>>n;

	for(int j=0; j<n; j++) cin>>A[j];
	
	int p =isIncreasingDecreasing(A,n);
	cout<<p;

}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
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* arr, int n)
{   int arr1[n];
    int arr2[n];
	for(int i=0;i<n;i++) 
{
	arr1[i]= *arr;
		arr2[i]= *arr;
		arr++;
}
 
 for(int i=1;i<n;i++) 
 {
  for(int j=i;j>0 && arr1[j-1]<arr1[j];j--) 
  { 
    int temp=arr1[j];
    arr1[j]=arr1[j-1];
      arr1[j-1]=temp;
  }
 } 
 
 for(int i=0;i<n;i++)
 {  for(int j=0;j<n;j++) 
 {   if(n==1) 
 { 
  return 1;}
  
	 if(arr1[i]==arr2[i] && j==n-1) 
	 { 
	  return 2;}
	 else if(arr1[i]==arr2[n-1-i] && j==n-1) 
	 { 
	   return 1;}
	 else if(j==n-1 || (arr1[j]==arr1[j+1])) 
	 { 
	 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);
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A