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 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: 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)
{
	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: 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* 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: 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){
cin>>n;
for(int i =0;i<n;i++){
cin>>a[i];}
for(int i=0;i<n-1;i++){
 if (a[i]<a[i+1])
 cout<<"1";}
for(int i=0;i<n-1;i++){
 if  (a[i]>a[i+1])
  cout<<"2";
  else cout<<"3";}
 return 0;
 }
 int main(){
  int n,*a;
  isIncreasingDecreasing(a,n);{
   }
   cout<<"2";
   }

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 m){
int p=0;
for(int i=0;i<m-1;i++){if(a[i]<a[i+1])p++;}
if(p==m-1)return 1;
int k=0;
for(int i=0;i<m-1;i++){if(a[i]>a[i+1])k++;}
if(k==m-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>
#include<math.h>
using namespace std;
int isIncreasingDecreasing(int *A, int n){
int i=0,p=2;
if(n==1) {return 1;}
if(n==2 && A[0]<A[1]) {return 1;}
if(n==2 && A[0]>A[1]) {return 2;}
if(n==2 && A[0]==A[1]) {return 3;}
else{
while(i<n-1){if(A[i]<A[i+1]) {if(i==n-2){return 1;p=1;}i=i+1;} else{break;}}
i=0;
while(i<n-1){if(A[i]>A[i+1]) {if(i==n-2){return 2;p=1;}i=i+1;} else{break;}}
if(p==2) {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);
}

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>
int isIncreasingDecreasing (int *A, int n)
{
    int d=0;
    if(n==1){return 1;}//assuming singleton set to be increasing.can be taken the other way also.
    
    if(n!=1){for(int i=1;i<n;i++)
        { if (
            (A[i-1]>A[i])){
                d++;
            }
        }
        for(int i=1;i<n;i++)
        { if (
            (A[i-1]<A[i])){
                d--;
            }
        }
        if (d==(n-1)){return 2;}
        if (d==(1-n)){return 1;}
        if (d!=(n-1)||d!=(1-n)){return 3;}
        }}
    
main_program{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];}
        int v;
        v=isIncreasingDecreasing(a,n);
        cout<<v;
    }

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 i;
	i=0;
	while (i<n-1){
		if(A[i]<A[i+1]) i++;
		else break;
		}
	if (i==n-1) return 1;
	i=0;
	while (i<n-1){
		if(A[i]>A[i+1]) i++;
		else break;
		}
	if (i==n-1) return 2;
	
	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 j;
if(n>0){
for(j=0;j<(n-1);j++){A[j]<A[j+1];}
}
return 1;
else if(n>0){
for(j=0;j<(n-1);j++){A[j]>A[j+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 count = 0 ;
	for(int i =1 ; i < n ; i++)
	{
		if(A[i-1]<A[i])
		{
			count++ ;
		}
		if(A[i-1]>A[i])
		{
			count-- ;
		}
	}
	if(count == n-1) return 1 ;
	if(count == -(n-1)) return 2 ;
	return 3 ;
}
int main()
{
	int n ; 
	cin >> n ;
	int ar[n] ;
	for(int i = 0 ; i < n ; i++ )
	{
		cin >> ar[i] ;
	}
//	cout << endl ;
	cout << isIncreasingDecreasing(ar , 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 a, i=1, b=0;
	bool x = true;
	for (a=0; a<n; a++) {
		cin>> A[a];
	}
	if (A[0]< A[1]) {
		for (i=1; i<(n-1); i++) {
			x = A[i+1] - A[i] > 0;
			if (x == false) return 3;
		}
		return 1; 
	}
	else if (n==1) {
		return 1;
	}
	else {
		for (i=1; i<(n-1); i++) {
			x = A[i+1] - A[i] < 0;
			if (x == false) return 3;
		}
		return 2; 
		
	}
}
	


int main() {
	int n;
	cin>> n;
	int arr[n];
	cout<< isIncreasingDecreasing(arr, 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>
#include<cmath>
using namespace std;
int main(){
int n;
double r= -(0.5);
double a=1 ;
double s;
double error;
cin>>n;

s =  (pow(r,n)-1)/(r-1)*a;
cout << fixed;       // uses fixed floating point representation

cout.precision(6);  // print six digits after the decimal point

cout<< s<<" ";
error =abs((3*s-2)/2);
cout << fixed;       // uses fixed floating point representation

cout.precision(6);  // print six digits after the decimal point

cout<<error ;

}

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;
int isIncreasingDecreasing(int a[],int n){
int flag=3;
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;
cin>>n;
 int A[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;
void isIncreasingDecreasing(int *A, int n){
         
       int c = 0;
       int h=0;
          for(int i=1;i<n;i++){
          int min = A[0];
          int max = A[n-1];
          
               if(min<A[i]){
               min = A[i];
               c++;}
               if(c==n-1){
               cout<<"1";}
             
             else cout<<"3";
             
               if(max<A[n-i-i]){
               max = A[n-i-1];
               h++;}
               if(h==n-1){
               cout<<"2";}
               
               else cout<<"3";
               
               
               }
          
      
         }
int main(){
int n;
int A[n];
   
cin>>n;
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 main
if (A{0}<A[1]
int isIncreasingDecreasing(int *A, int n){
if {A[0]<A[1]){
for (int i=0;i,n-1; i++){
if A[i]

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

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