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 w = 0;
    bool k = true;
    int a=0;
    int b=0;

    if(A[0]<A[1]){
        for(int i=0; i<n;i++){
            if(A[i]<A[i+1] && k){
                k = true;
                a=1;
                b=0;
            }else{
                k = false;
                a=0;
            }
        }
    }
    k = true;
    if(A[0]>A[1]){
        for(int i=0; i<n;i++){
            if(A[i]>A[i+1] && k){
                k = true;
                a=0;
                b=1;
            }else{
                if(!(i==(n-1))){
                    k = false;
                    b=0;
                }
            }
        }
        
    }
    if(a==1 && b==0){
        w=1;
    }else if(a==0 && b==1){
        w=2;
    }else if(a==0 && b==0){
        w=3;
    }
    return w;
}




int main(){
//getting vals
    int n;
    cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
//execute
    int k = isIncreasingDecreasing (A,n);
    cout<<k;
}

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=0;
while(i<n-1) {


if (A[i] < A[i+1])
i++;
if(i=n-2)
cout<<"1";

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


}
int j=0;
while(j<n-1) {





 if (A[j] > A[j+1])
j++;
if(j=n-2)
cout<<"2";

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


}
}





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

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 incdec(int *a,int n)
{
if(n==1)
return 1;
int r=3;
int inc=0;
for(int i=0;i<n-1;i++)
{
if(a[i]<a[i+1])
inc++;
}
if(inc==n-1)
r=1;
if(inc==0)
r=2;
return r;
}
void inp(int *a,int n)
{
for(int i=0;i<n;i++)
cin>>a[i];
}
int main()
{
int n;
cin>>n;
int arr[n];
inp(arr,n);
cout<<incdec(arr,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: 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>
int isIncreasingDecreasing(int *A, int n)
{
     int i=0,l=0;
     while(i<(n-1))
     {
        if(A[i] < A[i+1])
        {
            l++;
       
        }
        else if(A[i] > A[i+1])
        {
           l--; 
         
        }
        else
        {
          break;
        }
        i++;
     }
     
     if(l==(n-1))
     {
       return(1);
     }
     else if(l==-(n-1))
     {
       return(2);
     }
     else
     {
       return(3);
     }
}
main_program
{
    int n,s,i;
    cin>>n;
    int A[n];
    for(i=0;i<n;i++)
    {
    
       cin>>A[i];
    }
    s=isIncreasingDecreasing(A,n);
    cout<<s;
    
}

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

int main()
{
int n;
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; 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: 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 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: 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 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: 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 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: 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 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: 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 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: 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){
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: 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 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: 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 (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: 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>
#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: 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