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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
using namespace std;
int 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
using namespace std;
int isIncreasingDecreasing( int *A, int n){
 if(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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing(int *A,int n)
{	if(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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
int  isIncreasingDecreasing(int*A, int n)
{if(n==1) return 1;
 for(int j=0; j<n;j++)
  {                if(A[j]<A[j+1])
{while(j==n-1)
{return 1;}}

 if(A[j]>A[j+1])
{while(j==n-1)  
        {return 2;}
}
else return 3;
}
}

#include<iostream>
using namespace std;
int main()
{
int n,A[n];
cin>>n;
for(int i=0;i<n;i++)
{cin>>A[i];
}
cout<<isIncreasingDecreasing(A,n);



}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
#define N 100

using namespace std;

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

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

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


int isIncDec( int a[] , int n){
	int p=1, q=1 ;


	for(int i=0 ; i<n-1 ; i++){
	

		if(a[i]>a[i+1]) p++;
		else if(a[i]<a[i+1])q++;
	}
    if(n==1) return 1;
    if(p==n) return 2;
    else if(q==n) return 1;
    else return 3;

}

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,vertical,horizontal;
cin>>n;
if(n%2==1&&n>0){vertical = n number of '*'; horizontal = n number of '*';
cout<<vertical<<horizontal;}
else cout<<0;}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int main()
{
	int nums[]={1,2,3,4,5,6,7,8,};

     int = sizeof{}\sizeof{[1]};
	int = "genaral array":;
	int = {n>1;i++};
	 non-negative integer = {nums,n}
	int = "\n"

	




}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

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

int isIncreasingDecreasing(int*A,int n){
bool a=true,b=true,c=true;
for(int j=1;j<n;j++){
if (A[j-1]<A[j]){continue;}
else {a= false; break;}
}

for(int k=1;k<n;k++){
if (A[k-1]>A[k]){continue;}
else { b= false; break;}
} 
if(a) return 1;
else if(b) return 2;
else return 3;
}

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

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

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


int main ()
{
int n;
cin>>n;
int A[n];
cout << isIncreasingDecreasing(A, n);
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing(int *A, int n)
{int i;
for( i=0; i<n; i++)
if( A[i+1]>A[i])return 1;
if (A[i+1]<A[i]) return 2;
else return 3;}

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

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

int increasing(int* A,int n) {

int main()
	int n = 3;
	int a = 103-1.5;
	int h = 2;
	cout >> 1
	cin >> n;
	cin >> a;
	cin >> h;
	int a(n);
	for(i = 0; i < n; i++)
		cin >> a(n)

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing(int *a,int n){
	int inc=0,dec=0;
	for(int i=0;i<n-1;i++){
		if(a[i]<a[i+1]) {
			inc++;
			}
		else break;
		}
	for(int i=0;i<n-1;i++){
		if(a[i]>a[i+1]) {
			dec++;
			}
		else break;
		}
	if(inc==n-1) return 1;
	else if(dec==n-1) return 2;
	else return 3;
	}
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		}
	cout<<isIncreasingDecreasing(a,n);
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>

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

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

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: No extra qualities
Rating C: 0
Rating D: 0
Assigned grade: B