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){
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: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
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: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int isIncreasingDecreasing(int *A, int n)
{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: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

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

int 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: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
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: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
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: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>
main_program{
	int i=0,n;
	cin>>n;
	int A[n];
	repeat(n){cin>>A[i]; i++;}
	
	for(i=0;i<n;i++;){
if(A[i+1]>A[i])cout<<1;
else if(A[i+1]<A[i])cout<<2;
else cout<<3;
}
}

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

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
using namespace std;
int f(int A[],int n)
	{
	int j=0,k=0,l=0;
	for(int i=0;i<n-1;i++)
		{
		if(A[i]<A[i+1])
		{j=j+1;}
		else if(A[i]>A[i+1])
		{k=k+1;}
		}
	if(n==1){cout<<"1";}
	else if(k==0&&j!=0)
        {cout<<"1";}

	else if(j!=0&&k!=0)
	{cout<<"3";}
	else if(j==0&&k!=0){cout<<"2";}
	}
int main()
	{
	int n;
	cin>>n;
	int A[n];
	for(int i=0;i<n;i++)
		{
		cin>>A[i];
		}
	f(A,n);
	}

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

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include <iostream>
#include <cmath>
using namespace std;
int main (){
double s=2 0/3.0;
double pp=1 0;
tut n;cin>>n;
double sum=1.00
double next;
for (tut t=1 cin==){
int s=pow(-1,i);
cout s;
next=(1/(pp*2))*s;
pp=pp*2
    sum= sum+next
    cout<<next<<endl;
    cout<<sum;
double sn = 2/3;
   cout>>sn;
}

Grading criterion: Should be done in one scan of array
Rating A: If it is done in one scan
Rating B: If it isn't done in one scan
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>
# include <cmath>
using namespace std;
int isIncreasingDecreasing (int A[],int n)
{
int tempi=0;
int tempd=0;

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



}
if (tempi!=n-1 && tempd !=n-1)
{return 3;}

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

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

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

Sample input - 33 4 2
Sample output - 3

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

int isIncDec(int *A, int n){
int inc,dec;
inc = 0;
dec = 0;
for(int i = 0; i<n-1; i++){
if(A[i] < A[i+1]){
inc++;
}
if(A[i] > A[i+1]){
dec++;
}
}
if (inc == n-1) return 1;
if (dec == n-1 && inc != n-1) return 2;
if(inc != n-1 && dec != n-1) 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);
}

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

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int isIncreasingDecreasing(int* A, int n){
	int p=0;int a,b;
	for(int j=1;j<n;j++){
	if(A[p]>A[j]){ a=1; p=j;}
	else{ a=0; break;}
	}
	for(int j=1;j<n;j++){
	if(A[p]<A[j]){ b=1; p=j;}
	else{b=0;break;}
	}
	if(a==0 && b==1)return 1;
	if(a==1 && b==0)return 2;
	else return 3;
	}
int main(){
	int n;
	cin>>n;
	if(n>1 && n<26){
	int A[n];
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	cout<< isIncreasingDecreasing(A,n);
	}
	else if(n==1)cout<<"1";
	
}

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

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

Sample input - 33 4 2
Sample output - 3

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

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

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

Sample input - 33 4 2
Sample output - 3

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

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

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

Sample input - 33 4 2
Sample output - 3

Student submission:
#include<simplecpp>

int isIncreasingDecreasing (int *A, int n){
     bool inc=true,dec=true;
     for(int i=0;i<n-1;i++){
     if(A[i]>A[i+1]){inc=false;}
     }
     for(int i=0;i<n-1;i++){
     if(A[i]<A[i+1]){dec=false;}
     }
     if(inc){return 1;}
     else if (dec){return 2;}
     else 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: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the number n and an array A of n numbers as input from the user. The program should then contain a function which determines whether the array is in strictly increasing order (in which case the function should return 1), or else determine whether the array is in strictly decreasing order (in which case the function should return 2), and return 3 otherwise. The format of the function is int isIncreasingDecreasing (int *A, int n). The program should then print the value returned by the function on a new line. You must implement this via a function, otherwise you will get no credit. For simplicity, assume that all entries in the array are unique.

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

Sample input - 33 4 2
Sample output - 3

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

void myswap(int& a, int& b){
	int temp=a;
	a=b;
	b=temp;
}

int argmax(int *A, int n){
	int maxindex=0;
	for (int j=1;j<n;j++){
		if (A[maxindex]<A[j]) maxindex=j;
	}
	return maxindex;
}

int argmin(int *A, int n){
	int minindex=0;
	for (int j=1;j<n;j++){
		if (A[minindex]>A[j]) minindex=j;
	}
	return minindex;
}


void increasingsort(int* A, int n, int* B){
	
	for (int i=n;i>1;i--){
		int maxindex=argmax(A,i);
		myswap(B[maxindex],B[i-1]);
	} 
}

void decreasingsort(int* A, int n, int* C){
	
	for (int i=n;i>1;i--){
		int minindex=argmin(A,i);
		myswap(C[minindex],C[i-1]);
	} 
}

int equal(int* A, int* B, int n){
	int x=0;
	for (int i=0; i<n; i++){
		if (A[i]==B[i]) x++; 
	}
	if (x==n) return(1);
	else return(2);
}

int isIncreasingDecreasing(int* A, int n){
	int B[n], C[n];
	for (int j=0;j<n;j++) {B[j]=A[j]; C[j]=A[j];}
	
	increasingsort(A,n,B);
	decreasingsort(A,n,C);
	int x=equal(A,B,n);
	int y=equal(A,C,n);
	if (x==1) {return 1;}
	else if (y==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];
	int a;
	a=isIncreasingDecreasing(A,n);
	cout<<endl<<a;	
}

Grading criterion: Implemented in a function.
Rating A: If implemented in the function
Rating B: If not implemented in the function
Rating C: 0
Rating D: 0
Assigned grade: A