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 val=0;
for(int i=0;i<n-1;i++){
if(A[i]<A[i+1]){
val+=1;
}
else if(A[i]>A[i+1]){
val+=-2;}
}
if(val==n-1){return 1;}
else if(val==-2*(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];
}
if(1 <= n&& n < 25){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<cmath>
using namespace std;
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 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)
{
if(n!=1)
{
for(int i=0;i<n-1;i++)
{
if(A[i]<A[i+1]&&i==(n-2))
{
return 1;
}
if(A[i]>A[i+1]){break;}
}
for(int j=0;j<n-1;j++)
{
if(A[j]>A[j+1]&&j==(n-2))
{
return 2;
}
if(A[j]<A[j+1]){break;}
}
return 3;
}
return 1;
}

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

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

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

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 m,i;
cin>>m;
for(int i=0;i<m;i++){
cin>>A[i];
}
for(int j=0;j<m;j++){
if(A[i]>A[j]){
j=i+1;
return 1;
}
if(A[i]<A[j]){ 
i=j+1;
return 2;
}
if (A[i]>!A[j] && A[i]<!A[j]){
return 3;
}
}
}
int main(){
int n;x;
return isIncreasingDecreasing(x,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=0,t=0;
while(i<=(n-2)){
if(A[i]<A[i+1]);
else break;
i++;
t++;
}
if(t==(n-1)) {a=1;}
int u=0;
while(i<=(n-2)){
if(A[i]>A[i+1]);
else break;
i++;
u++;
}
if(u==(n-1)) {a=2;}

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

                 else if( a[i+1]<a[i] )
                  
                 {  
           
                     cout<<2<<endl; }
                 else { 
                   
                     cout<<3 <<endl; }       

                                     }  }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: 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>

main_program{
int n,i=1;
float a=1;
float r=-0.5;
float x;
cin>>n;
float Sn;
Sn=float (a*(1-x))/float (1-r);
while(i<=n){
x=1;
x=x*r;
i++;
}
float er;
er=float (abs(Sn-2/3)*3)/float (2);
cout<<fixed;
cout.precision(6);
cout<<Sn<<" "<<er;
}

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)
{
	bool flag1=true,flag2=true;
	int i;
	for(i=0;i<n-1;i++)
	{
		if(A[i]>A[i+1]) flag1=false;
	}
		for(i=0;i<n-1;i++)
	{
		if(A[i]<A[i+1]) flag2=false;
	}
	if(flag1 == false && flag2==false) return 3;
	else if(flag1 == true) return 1;
	else return 2;
}
int main()
{
	int n,i;
	cin>>n;
	int x[n];
	for(i=0;i<n;i++)
	{
		cin>>x[i];
	}
	cout << isIncreasingDecreasing(x,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 b=1, d=2, e=3;
int i=0;
while(i<n-1){
 if(A[i]<A[i+1]){
i=i+1;}}
return b;
while(i<n-1){
 if(A[i]>A[i+1]){
i=i+1;}}
return d;
  return e;
}

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

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<simplecpp>


int isInceasingDecreasing (int *A, int n), arr[25]
{
  {
  if(arr[n]<arr[n+1])
  return 1
  };

  {
      else if(arr[n]>arr[n+1])
  return 2
  };

  {
      else ()
  return 3
  };




main_program{

    int n;
    arr[n];
	cin>> n >> arr[n];

    return f;
}

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 k=0,m=0;
	for(int i=0;i<n-1;i++){
	if(a[i]<a[i+1]){
	k++;
	}
	if(a[i]>a[i+1]){m++;
	}
	}
if(k==n-1){return 1;}
else if(m==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: 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(){
	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[0]<A[1] && A[1]<A[2]) cout<<"1"<<endl;
	    if (A[0]>A[1] && A[1]>A[2]) cout<<"2"<<endl;
	        {return 2;}
	    if (!(A[0]<A[1] && A[0]>A[1])) cout<<"3"<<endl;
	    	{return 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: 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()
{
	int n,i;
	cin>>n;
	float sn=0.00,term=2.00,err;
	const float conv=2.00/3.00;
	
	for(i=1;i<=n;i++)
	{
		term=term/2;
		if(i%2!=0)	sn=sn+term;
		else		sn=sn-term;
	}
	if(conv>sn)     err=(conv-sn)/conv;
	else		err=(sn-conv)/conv;
	cout<<fixed;
	cout.precision(6);
	cout<<sn<<" "<<err;
}

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



        }
	flag=0;
	if(A[0]>A[1])
	{
		for(int j=0;j<=n-2;j++)
		{
			if(A[j]<A[j+1])
			{
				flag=1;
			}

		}
		if(flag==0)
		{
			return 2;
		}

	else
	{
		return 3;
	}
        }
}
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>arr[i];
	}
	cout;
	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