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

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

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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){
 int i,j;
 for(int i=0; i<n; i++)
  {if (A[i]<A[i+1]);
 	return 1;}
 	
 for (int j=0; j<n; j++)
 {if ( A[j]>A[j-1]);
       return 2;}
       return 3;
     }
     
     
 int main()
 {
 int n ;
cin>>n;
cin>>A[];
 

 for(int i=0; i<n; i++)
 cout<<"1"<<endl;
 for (int j=0; j<n; j++)
 cout<<"2"<<endl;
 cout<<"3"<<endl;
 }

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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=1; i<n; i++) {  int   
	     maxindex= 0;
	    if(a[maxindex]<a[i]) maxindex=i;
	   if (maxindex ==n) cout<< "1" ;
	   if (maxindex != n) cout << "3";} 

	   if (a[0]> a[1])for (int i =n-2;0<=i; i--){int    
	       maxindex= n-1;
	      if(a[maxindex]<a[i]) maxindex=i;
	      if (maxindex==0) cout<< "2";
	      if (maxindex !=0) cout << "3";
	      } 
	      return 1;
}	  
  
int main() { int n, i;
            
      int a[i] ;
      for (int i=0; i<n; i++) {cin >> a[i];}       
         isIncreasingDecreasing ( a,n) ;
           }

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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=1, Dec=1;
	for(int i=0; i<n-1; i++){
		if(A[i]<A[i+1])
			Inc++;
		
	}
	for(int i=0; i<n-1; i++){
		if(A[i]>A[i+1])
			Dec++;
	}
	if(Inc==n)
		return 1;
	else if(Dec==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 << isIncreasingDecreasing(a,n);
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 isInc = false;
	bool isDec = false;
	if(A[0] > A[1]){
		isDec = true;
	}else{
		isInc = true;
	}
	
	
	
	for(int i = 0; i<n-1; i++){
		if(isInc){
			if(A[i] < A[i+1]){
				continue;
			}else{
				isInc = false;
				break;
			}
		}
		else if(isDec){
			if(A[i] > A[i+1]){
				continue;
			}else{
				isDec = false;
				break;
			}
		}
	}
	
	if(isInc){
		return 1;
	}
	else if(isDec){
		return 2;
	}
	else if(isInc == false && isDec == false){
		return 3;
	}
	return 0;
}

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

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 IncreasingDecreasing(int* A,int n){
           for(int i=0;i<n;i++){
           for(int j=i+1;j<=n;j++){
            if(A[j]>A[i])return 1;
             else if(A[j]<A[i]) return 2;
             else return 3;}}
           }
int main(){
  int n;
   cin>>n;
   int array[n];
   for(int i=0;i<n;i++){
         cin>>array[i];
       }
IncreasingDecreasing(array,n);


}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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]){dec++;}
                                                             if(A[i]<A[i+1]){inc++;}
                                                             }
                                                             if(inc==(n-1))return 1;
                                                             else if(dec==(n-1))return 2;
                                                             else return 3;
                                                             
                                        
                                        }
int main(){
          int n;
          cin>>n;
          int arr[n];
          for(int i=0;i<n;i++){cin>>arr[i];}
          int x=isIncreasingDecreasing(arr,n);
          cout<<x;
          
          }

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 isIncreasingDecreasing(int *a,int n){
    int b=0,c=0;
    
    for(int i=0;i<n-1;i++){
       if(a[i]<a[i+1]){
        b++;
        }
        }
    if(b==n-1){return 1;}
    
    for(int i=0;i<n-1;i++){
       if(a[i]>a[i+1]){
        c++;
        }
        }
    if(c==n-1){return 2;}
    
    if (b!=n-1 && c!=n-1){return 3;}
 }
 
 
 int main(){
 int n,x;
 cin>>n;
 int a[n];
 
 for(int i =0;i<n;i++){
   cin>>a[i];
   }
 x=isIncreasingDecreasing(a,n);
 cout<<x;  
 
 
 
 
 
 }

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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++){
for (int j = i + 1 ; j < n ; j++){
if (A[i] < A[j]);
return 1 ;
else if( A[i] > 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: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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>
#include<math.h>
int isIncreasingDecreasing (int *A, int n){
int maxnois=A[0];
for (int i=1;i<n;i++){
maxnois=max(maxnois,A[i]);}{
if (maxnois==A[n-1])
return 1;
else if (maxnois==A[0])
return 2;
else return 3;}
}
main_program{
int n,*A;
cin>>n;
for(int i=0;i<n;i++)
cin>>A[i];
cout<< isIncreasingDecreasing (A,n)<<endl;}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 j=1;j<=n;j++)
{
cin>>A[j];
}
for(int i=0;i<n;i++)
{
if(A[i+1]>A[i])
{
return 1;
}
else if(A[i+1]<A[i])
{
return 2;
}
else
return 3;
}
}



int main()
{
int n,m;
cin>>n;
m=isIncreasingDecreasing(A,n);
cout<<m;
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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;

void Increasing_seq(int *A,int n){
if([An]<[An+1])
return ;
}
void Decreasing_seq(int *A,int n)
if([An]>[An+1])
return;
int main(){
int i,n,A;
cout<<"enter the number of numbers:";
cin>>n;
for(i=0,i<n,i++){
int[*A];
cout<<"enter the next number:" ;
cin>>A;
}
if (Increasing_seq){
cout<<"1";}
else if (Decreasing_seq){
cout<<"2";}
else{
cout<<"3";}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

Input Format - Non-negative integer n and an array A of n elements
Output Format - The value 1,2 or 3 as described above. 
Constraints
1 <= n < 25

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;

bool dec(int a[], int n){
	bool flag=1;
	for(int i=1;i<n;i++){
		if (a[i-1] < a[i]){flag = 0;}
	}
	return flag;
}

bool inc(int a[], int n){
	bool flag=1;
	for(int i=1;i<n;i++){
		if (a[i-1] > a[i]){flag = 0;}
	}
	return flag;
}

int isIncreasingDecreasing (int a[], int n){
	if (inc(a,n)==1){return 1;}
	else if (dec(a,n)==1){return 2;}
	else {return 3;}
}




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

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 f1=0,f2=0;

	if(n==1)return 1;

	for(int i=0;i<n-1;i++)
	{
		if(a[i]<a[i+1])f1=1;
		if(a[i]>a[i+1])f2=1;

	}

	if(f1==1 && f2==0)return 1;
	else if(f1==0 && f2==1)return 2;
	else return 3;

}

int main()
{
	int n; cin>>n;
	int a[n];

	for(int i=0;i<n;i++)cin>>a[i];

	cout<<isIncreasingDecreasing(a,n);






}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 s1=0;
int s2=0;
for(int i=0;i<n-1;i++){
if(A[i]<A[i+1]) { s1++;}
}

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

if(s1==(n-1)) return 1;
else if(s2==(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<<endl;
cout<<isIncreasingDecreasing(A,n);
}

Grading criterion: Quality of variable names
Rating A: Good Variable Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: B