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 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: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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>
#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: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: D
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: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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;
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: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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 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: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: D
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 im=0,dm=0;
	for(int i=0;i<n-1;i++)
	{
		if(A[i]<A[i+1]){im++;}
		if(A[i]>A[i+1]){dm++;}
	}
	if(im==(n-1)) return 1;
	else if(dm==(n-1)) return 2;
	else return 3;
}
int main()
{
	int n;
	cin>>n;
	int array[n];
	for(int i=0;i<n;i++){cin>>array[i];}
	int a=isIncreasingDecreasing(array,n);
	cout<<a;
}

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: A
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>
int isIncreasingDecreasing (int *A, int n){
int a=0,b=0;
for(int i=1; i<n;i++){
	if(A[i]>A[i-1])
	{
	a=a+1;
	}
	}
for(int i=1; i<n;i++){
	if(A[i]<A[i-1])
	{
	b=b+100;
	}
	}
if (a==(n-1)) return 1;
if (b==100*(n-1)) return 2;
return 3;
}
main_program{

int y;
cin>>y;
#define s y
int X[s];

for(int i=0;i<y;i++){
	cin>>X[i];
	}
cout<<isIncreasingDecreasing(X,y);
}

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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){
	
	int hist[n];
	for (int i=1; i<n; i++){
		if (A[i]>A[i-1]){
			hist [i-1]=1;
		}
		else hist[i-1]=0;
	}
	int sum=0;
	for(int i=0; i<n-1; i++){
		sum= sum + hist[i];
	}
	if (sum==n-1) return 1;
	else if (sum==0) return 2;
	else return 3;
}

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

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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;float Sn=0,i=1,j=2,a=0.5,p,error; cin >> n;
	while(i<=n)
	{
		Sn=Sn+pow(a,i-1);i=i+2;
	}	
	while(j<=n)
	{
		Sn=Sn-pow(a,j-1);j=j+2;
	}
	cout << fixed;
	cout.precision(6);
	
	p=float(2)/float(3);
	error=abs(Sn-p)/p;
	cout << Sn << " " << error;

}

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: D
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=0;
for(int i=0;i<n-1;i++){
if(a[i]<a[i+1])
{
continue;}
flag=1;
}
if(flag==0){
cout<<"1";
return 0;
}
flag=0;
for(int i=0;i<n-1;i++){
if(a[i]>a[i+1])
{
continue;}
flag=1;
}
if(flag==0){
cout<<"2";
return 0;
}
cout<<"3";
return 0;
}

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

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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){
int 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,i;
cin>>n;
int A[n];
for(i=0;i<=n-1;i++){
     cin>>A[i];
     }
  isIncreasingDecreasing(A,n);
  return 0;
  }

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: D
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
using namespace std;
int isIncreasingDecreasing(int *A,int n){
int j=0,k=0;
while(A[j+1]>A[j] && j<n-1){j++;}
if(j==n-1){return 1;}
while(A[k]>A[k+1] && k<n-1){k++;}
if(k==n-1){return 2;}
else return 3;}
int main(){
int *A,n;
cin>>n;
for(int y=0;y<n;y++){cin>>A[y];}
cout<<isIncreasingDecreasing(A,n);}

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
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=0,c=0;
for (int i=0;i<n-1;i++) {
if (A[i]<A[i+1]) b++ ;
else if (A[i]>A[i+1]) c++ ;
}
if (b==n-1) cout<<1;
else if (c==n-1) cout << 2;
else cout << "3";
return 4;
}
int main(){
int i,n;
cin >> n;
if ((n>=1)&&(n<25)){
int A[n];
for (i=0;i<n;i++){
cin >> A[i];
}
isIncreasingDecreasing(A,n);
}
}

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: A
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>

int isIncreasingDecreasing (int *A[], int n)
   {int r,i,j;
  
	for (i=0;i<n;i++)
		{for (j=1; j<n; j++)
	         {  if (A[i]> A[j])
		        r = 1;
		        else if (A[i]<A[j])
		        r=2;
		        else
		        r=3;		     
		     }
		 }
   return r;
   }

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

			     
}

Grading criterion: Is the implementation able to correctly determine whether the array is in increasing order, decreasing order or any other
Rating A: Fully Correct
Rating B: Almost Correct
Rating C: Tried something in somewhat right direction. (eg implemented any one out of 3)
Rating D: Code is not there or totally wrong.
Assigned grade: C