CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int f(int x,int n,int *a){
int c=0;
for(int i=0;i<n;i++){
if(a[i]==x) c+=1;}
return c;}
int main(){
int n;
cin>>n;
int a[n],b[n];
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=0;}
for(int j=0;j<n;j++){
 b[j]=f(a[j],n,a);
}
int x,t=0;
for(int i=0;i<n;i++)
{ if(b[i]>t) {x=i;t=b[i];}
}
cout<<a[x]<<" "<<t;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include <iostream>
#include <cmath>
using namespace std;
int main (){
	int n;
	cin >> n;
	int a[n], b[n];
	for (int x=0; x<n; x++)
	{cin >> a[x];}
	for (int y=0; y<n; y++)
	{ b[y]=0;}
	for (int i=0; i<n; i++)
	{
		for (int j=i+1;j<n; j++)
	{ if (a[i]==a[j]) b[i]++;}
	}
	for (int k=0; k<n; k++)
	{
		if (b[k]>b[k+1])
		{
			b[k+1]=b[k];
			a[k+1]=a[k];
		}
		
	}
	
	cout << a[n-1] << " " << b[n-1]+1;
		
		
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int maxindex(int a[],int n)
{  int x=0;
   for(int i=0; i<n; i++)
   {  if(a[i]>a[x]) x=i;
   }
   return x;
}
int main()
{  int n;
   cin >> n;
   double array[n];
   int num[n];
   for(int i=0; i<n; i++)
   {  cin >> array[i];
      num[i]=0;
   }
   for(int i=0; i<n; i++)
   {  for(int j=i; j<n; j++)
      {  if(array[i]==array[j]) num[i]++;
      }
   }
   cout << array[maxindex(num,n)] << " ";
   cout << num[maxindex(num,n)];
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int maxval(int* a, int n){
	int res = 0;
	for(int i = 0; i < n; i++)
	{
		if(a[i] > a[res])
			res = i;
	}
return res;
}
int maxrep(int* ar,int n){int ans;
		int val[n];
	for(int i = 0; i < n; i++)
	{
		val[i] = 0;
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(ar[j] == ar[i])
				val[i]++;
		}
		ans = maxval(val,n);
	}
	return ans;
}
int main(){
	int n;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	int maxindex, maxres;
	maxindex = maxrep(arr,n);
	maxres = arr[maxindex];
	int m = 0;
	for(int i = 0;i < n; i++)
	{ 
		if(arr[i] == arr[maxindex])
			m++;
	}
	cout << maxres << " " << m;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int main()
{int  n,arr[n];
cin>>n>>arr[n];
int m=1;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(arr[i]==arr[j] && i!=j) m++;


}
cout<<m<<endl;
}


}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

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


int freq(int * A,int i,int n){
	int x=0;
	for (int j=0; j<n; j++){
		if (A[i]==A[j])
			 x++;
}
return x;
}


int main(){

int n;

cin >> n;

int A[n];

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

int max=0;

for (int k=0;k<n;k++){
	if (freq(A,k,n) > freq(A,max,n)) {
	max=k;
	}
}

for (int i=0;i<n;i++){
	bool flag=0;
	for (int j=0;j<i;j++){
		if (A[i]==A[j]) {
			flag=1;
		}
	}
	if (flag==0){
		if(freq(A,i,n)==freq(A,max,n)){
			cout << A[i]<< " " << freq(A,max,n) << "\n";
		}
	}
}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

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


int argmax (int *scores, int L){
int maxindex = 0;
for(int j=1; j<L; j++){

if(scores[maxindex] < scores[j]) maxindex = j;
}
return maxindex;
}



int main(){
int n,d=0;
cin>>n;

int a[n];


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

for(int j=0;j<n;j++){
if(a[i]==a[j]) d++;}
b[i]=d;
d=0;
}

int maxindex= argmax(b,n);


cout<<a[maxindex]<<" "<<b[maxindex];}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
#include<cmath>

using namespace std;

int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
	{
	cin>>a[i];
	}
int c[n];
for(int i=0;i<n;i++)
	{
	c[i]=1;
	}
for(int i=0;i<n;i++)
	{
	for(int j=(i+1);j<n;j++)
		{
		if(a[i]==a[j])
		{
		c[i]++;
		}
		}
	}
int max=0;
for(int i=1;i<n;i++)
	{
	if(c[max]<c[i]){max=i;}
	}

cout<<a[max]<<" "<<c[max];
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: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

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

void mode(int *a,int n){
	int max = 0,mode = 0;
	for(int i = 0;i<n;i++){
		if(a[i]>=max){
			max = a[i];
		}
	}
	max++;
	int b[max];
	for(int j = 0;j<max;j++){
		b[j] = 0;
	}
	for(int k = 0;k<n;k++){
		b[a[k]] = b[a[k]]+1;
	}
	for(int h = 0;h<max;h++){
		if(b[h]>=mode){
			mode = b[h];
		}
	}
	for(int r = 0;r<max;r++){
		if(b[r] == mode){
			cout<<r<<" "<<b[r]<<endl;
		}
	}
}
int main(){
	int n,count = 0;
	cin>>n;
	int arr[n];
	for(int i = 0;i<n;i++){
		cin>>arr[i];
	}
	mode(arr,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: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for{
(int i=0;i<n;i++)
cin>>arr[i];
}
int a[19];
for{ (i=0;i<20;i++)
a[i]=0;
}
for( int j=0; j<n;j++){
if (arr[j]==1) a[1]++;
else if (arr[j]==2) a[2]++;
else if (arr[j]==3) a[3]++;
else if(arr[j]==4) a[4]++;
else if(arr[j]==5) a[5]++;
else if (arr[j]==6) a[6]++;
else if(arr[j]==7) a[7]++;
else if(arr[j]==8) a[8]++;
else if(arr[j]==9) a[9]++;
else if(arr[j]==10) a[10]++;
else if(arr[j]==11) a[11]++;
else if(arr[j]==12) a[12]++;
else if(arr[j]==13) a[13]++;
else if(arr[j]==14) a[14]++;
else if(arr[j]==15) a[15]++;
else if(arr[j]==16) a[16]++;
else if(arr[j]==17) a[17]++;
else if(arr[j]==18) a[18]++;
else if(arr[j]==19) a[19]++;

}

for(int k=0; k<n; k++)
{cout<<k+1<<a[k]<<endl;
}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
void swap(int& x,int& y){
int temp=x;x=y;y=temp;
}
int main(){
int n,i=0,j=0;
int a[n];
cin>>n;
for(int l=0;l<n;l++){
cin>>a[l];}
while(i<n){
for(int k=0;k<n;k++){
if(a[i]>a[k]) swap(a[i],a[k]);
else continue;}
i++;}
int b[n],m=0,x=0;
for(int q=0;q<n;q++){
b[q]=0;}
while(m<n){
if(a[x]==a[x+1]) b[m]++;
else m++;
x++;}
while(j<n){
for(int r=0;r<n;r++){
if(r==n) cout<<a[b[j]]<<" "<<b[j]<<endl;
if(b[j]>=b[r]) continue;
else break;}
j++;}
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

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 b[n];
for(int i=0;i<n;i++){b[i]=0;}
b[n-1]=1;
for(int i=0;i<n-1;i++){
     for(int j=i;j<n;j++){
         if(a[i]==a[j]){b[i]++;}}}
int maxindex=0;
for(int i=1;i<n-1;i++){
     if(b[maxindex]<b[i]){maxindex=i;}}
cout<<a[maxindex]<<" "<<b[maxindex];
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int argmax (int* arr, int L){
int maxindex = 0;
for(int j=1; j<L; j++){
if(arr[maxindex] < arr[j]) maxindex = j;
}
return maxindex;
}
int main(){
int n,x,z;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];}
x=argmax(arr,n);
z=arr[x];
int hist[z+1];
for(int j=0;j<z+1;j++){hist[j]=0;}
for(int k=0;k<n;k++){hist[(arr[k])]=hist[(arr[k])]+1;}
int a=argmax(hist,z+1);
cout<<a<<" "<<hist[a]<<endl;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

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

int main(){
int n;//size of array
cin >> n;

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

int max = arr[0];
for(int i = 0; i<n; i++)
{
if (arr[i] > max) max = arr[i];
}
cout<< max;

int num=0;
for(int i = 0; i<n; i++)
{
if(arr[i] == max) num++;
}
cout<<" "<<num << endl;
}

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int main()
{
 int N;
 cin>>N;
 int a[N];
 for(int h=0; h<N; h++)
 {
 cin>>a[h];
 }
 
 int c,b, m=a[0];
 for(int i=0; i<N; i++)
{
   int b=0;
  // int m=a[0];
  for( int j=0; j<N; j++)
  {
  if(a[j]==a[i]) b++;
  }
 if(b>c)
 {
  c=b; 
  m=a[i]; 
 }
 //cout<<c; 
}
cout<<m<<" ";
cout<<c;
 }

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>

main_program(
int n;
cin>>n;
int a[n];
int b[n];
for(int i=0;i<n;i++){b[i]=0;}
for(i=0;i<n;i++){
cin>>a[i];}
int j=0;
int t=0;
int i=0;
while(i<n){
while(j<n){
if(a[i]==a[j]){b[i]++;}
j++;)}
i++;
}
int z=b[0];
for(int k;k<n;k++){
z=max(z,b[k+1]);}
int h=*z;
cout<<h<<" ";

while(x<n){if(y>=b[x+1]){int y=b[x];
for(int c=0;c<n;c++){
if(b[c]=>b[c+1]){b[c+1]=b[c];}
else if(b[c]<b[c+1])continue;}
cout<<b[n-1];

Grading criterion: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: Nothing Extra
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take user input n, the size of a 1D integer array, followed by the array entries as inputs. The program should then determine the majority element of the array, i.e., the element which occurs the most often. It should then display the majority element and how many times it occurs in the array. You may assume that the array contains only non-negative numbers. You may also assume that the array contains only one majority element. 

Input Format - Integers n, followed by elements of the integer-valued array.
Output Format - Print the values of the majority elements followed by frequency (a separate line for each element). 

Constraints
n is a positive integer, n >= 1 and n < 20

Sample input	12	3 1 2 1 2 3 2 1 3 3 2 1
Sample output 	3 4	1 4	2 4

Student submission:
#include<iostream>
using namespace std;
int main(){
int n;cin>>n;int b[n],a[n];
for(int i=0;i<n;i++){cin>>a[i];}
for(int i=0;i<n;i++){b[i]=0;}
for(int i=0;i<n;i++){for(int j=0;j<n;j++){if(a[i]==a[j]){b[i]++;}}}
int maxvalind=0;
for(int i=0;i<n;i++){if(b[maxvalind]<b[i]){maxvalind=i;}}
cout<<a[maxvalind]<<" "<<b[maxvalind];}

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