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 order(int *A,int n){
	int x=0;
	if (n==1){return 1;}
	for(int i=0;i<n-1;i++){
		if (A[i]>A[i+1]){x+=1;}
		else{break;}
		}
		if (x==(n-1)){return 2;}
	x=0;
	for(int i=0;i<n-1;i++){
		if (A[i]<A[i+1]){x+=1;}
		else{break;}
		}
		if (x==(n-1)){return 1;}
		else {return 3;}}
int main(){
	int n;
	cin >> n;
	int a[n];
	for (int i=0;i<n;i++){cin >> a[i];}
	cout << order(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 random(int arr[],int n);
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){cin>>arr[i];}
cout<<random(arr,n);}
int random(int arr[],int n){
if(n==1)return 1;
bool truthi,truthd;
if(n>1) {for(int i=0;i<n-1;i++){truthi=arr[i]<arr[i+1];}
if(truthi==true)return 1;

if(truthi==false){
for(int i=0;i<n-1;i++){truthd=arr[i]>arr[i+1];}
if(truthd==true)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 j=0;
  {while(A[j+1]>A[j]&&j<(n-1))j++;
  if(j==n-2) return 1;}
  {while(A[j+1]<A[j]&&j<(n-1))j++;
  if(j==n-2) return 2;}
  return 3;} 
int main(){
int n;
int A[n];
cin>>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<functional>
using namespace std;{
function(array[n]){
for( int i=0; i<=n; i++){
if(array[i]<=array[i+1]){
return 1;}
else if( array[i]>=array[i+1]){
return 2;}
else{
return 3;}
}
}
int main(){
int array[n];
cin>>n;
cout<<function(array[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 a=0;
int k1=0;
if (n==1) {return 1;}
while (a<n-1)
{
if (A[a+1]<A[a]){k1++;}
a++;
}
if (k1==n-1) {return 2;}
else if (k1==0) {return 1;}
else {return 3;}
}
int main()
{
int n;
cin >> n;
int A[n];
int i=0;
while (i<n)
{
cin >> A[i];
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  isIncreasingDecreasing(int* a,int n){
	int b[n];
	int s=0;
	int p,l,m;
	p=1;
	l=2;
	m=3;
	for(int r=0;r<n-1;r=r+1){
	
		if (a[r]<a[r+1]) {
		b[r]=1;}
		else if(a[r]>a[r+1]){
		b[r]=0;
		
		}}
		for(int r=0;r<n-1;r=r+1){
			s=s+b[r];
		
		}
		if(s==n-1) {return p;}
		if (s==0){ return l;}
		if (s!=n-1&&s!=0){return m;}


}




int main(){
	int n;
	cin>>n;
	int a[n];
	for(int r=0;r<n;r=r+1){
	
		cin>>a[r];
	
	
	
	}
	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)

{
    {
        if ( A[1] < A[n])
          return 1;
         


        if(  A[1]> A[n] )
           return 2;
    }
   else  return 2;
}




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

    }

   cout<<isIncreasingDecreasing;




}

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 p , int B[])

{int k=3;
{for(int i=0; i<p;i++)
{if (B[i]<B[i+1]) {k=1;}}
{for(int i=0; i<p;i++)
if (B[i]>B[i+1]) {k=2;}}
cout<<k;
return k;}
}

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

isIncreasingDecreasing (n, A );
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 <iostream>
#include <math.h>
using namespace std;
int main(){
int n,i,a,b;
double s,k,e;
cin>>n;
s=1;
i=1;
while(i<n){
a=pow(2,i);
b=pow(-1,i);
k=(float)b/(float)a;
s=s+k;
i++;
}

e=fabs(1.5*s-1);
cout<<fixed;
cout.precision(6);
cout<<s<<" "<<e;
}

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

	return 3;
	}
}
main_program{
	int arr[50], n;
	cin >> n;
	for (int x = 0; x < n; x++){
	cin >> arr[x];
	}
	int response = isIncreasingDecreasing(arr, n);
	cout << response;
}

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 c=0;
if(n==1) return 1;

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


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

else c=3;

}
return c;

}
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 i=1; int b=A[0]; int c=0, d=0;
 while(i<n){
  if(b>A[i]) c+=1; 
  else d+=1;
  b=A[i];
  i+=1; }
 if(n==1) return 1;
 if (c==n-1) return 2; 
 else if(d==n-1) return 1;
 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: 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 c=0,d=0;
	for(int i=0;i<n-1;i++)
	{
	if(a[i]<a[i+1]){c=c+1;}
	}
	for(int i=0;i<n-1;i++)
	{
	if(a[i]>a[i+1]){d=d+1;}
	}
	
	if(c==n-1){return 1;}
	else if(d==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<simplecpp>
main_program{

int n;
cin>>n;

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

int isIncreasingDecreasing(int *A, int n){
for (int i=0;i<n;i++){

if (A[i]<A[i+1]);
return 1;


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


else;
return 3;
}
}


int t;

t = isIncreasingDecreasing (A,n);
cout<<t;

}

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 <iostrea>
using namespace std;
int (isIncreasingDecreasing(int A[], int n);
 for (int i=0; i<n; i++){
if (A[i]<(i+1){
}
return 1;
}
for (int j=0; j>n; j++){
else if (A[j]>(j+2){
}return 2;
}
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<iostream>
using namespace std;
int isIncreasingDecreasing(int *A, int n)
{
	int chk1=1;
	int chk2=1;
	for(int l=0;l<(n-1);l=l+1)
	{
		if(A[l]>=A[l+1]){chk1=0;}
	}
	for(int l=0;l<(n-1);l=l+1)
	{
		if(A[l]<=A[l+1]){chk2=0;}
	}
	if(chk1==1){return 1;}
	else if(chk2==1){return 2;}
	else{return 3;}
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int l=0;l<n;l=l+1)
	{
		cin>>a[l];
	}
	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