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>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
int q[n];
for(int i=0;i<n;i++){
cin>>q[i];
}
int a=1,b=1,c=1,d=1;
for(int i=1;i<n;i++){
if(q[0]==q[i]) a++;
}
for(int i=2;i<n;i++){
if(q[1]==q[i]); b++;
}
for(int i=3;i<n;i++){
if(q[2]==q[i]);c++;
}
for(int i=4;i<n;i++){
if(q[3]==q[i]); d++;
}

int k=max(a,b);
int l=max(k,c);
int r=max(l,d);

if(r==a) cout<<q[0]<<' '<<r;
else if(r==b) cout<<q[1]<<' '<<r;
else if(r==c) cout<<q[2]<<' '<<r;
else if(r==d) cout<<q[3]<<' '<<r;
}

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 r,n;
cin>>n;
double a[n+1];
int p[n+1];
for(int i=0;i<(n+1);i++){
cin>>a[i];
}
for(int i=0;i<(n+1);i++){
p[i]=1;
}
for(int j=0;j<(n+1);j++){
for(int i=0;i<(n+1);i++){
if(a[i]==a[j] && i!=j)p[j]++;
}
}
for(int k=0;k<(n+1);k++){
r=p[0];
r=max(p[0],p[k]);
}
if(r==1){
for(int i=0;i<(n+1);i++){
cout<<a[i]<<" "<<r<<endl;
}
}
for(int i=0;i<(n+1);i++){
if(r==p[i]){cout<<a[i]<<" "<<r<<endl;break;}
}
}

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

main_program{
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;
   }
for(int i=0;i<n;i++){
    bool x;
    for(int k=0;k<i;k++){
           if(a[k]==a[i]) x=0;
           else continue;
           }
    if(x==0) continue;
    for(int j=i;j<n;j++){
           if(a[j]==a[i]) b[i]=b[i]+1;
           else continue;
           }
   }
int m;
m=0;
for (int i=0;i<n;i++){
   m=max(m,b[i]);
   }
for (int i=0;i<n;i++){
   if(b[i]==m) cout<<a[i]<<" "<<b[i]<<" ";
   else continue;
   }
}

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 checkElem(int array[] , int n, int x){
	for(int i =0 ; i <n ; i+=2){
		//cout <<"ELEM"<< array[i]<<endl;
		//cout <<"ELEM__"<< x<<endl;

		bool p = array[i] == x;
		//cout << "HEY" << p << endl;
		if(array[i] == x){
			return i;
		}
	}
	return -1;
}

int main(){

	int n;
	cin >> n;
	int arr[n];
// init main array
	for(int i = 0; i<n; i++){
		int t;
		cin >> t;
		arr[i] = t;
	}

	int n_arr[2*n];
// init array elements -1
	for(int i = 0; i<2*n; i++){
                n_arr[i] = -1;
        }
	
// iterating through elements
	int max_used_ind = -2;
	for(int j = 0; j<n; j++){
		int i = arr[j];

		//cout << i;
		if(max_used_ind == -2){
			n_arr[0] = i;
			n_arr[1] = 1;
			max_used_ind = 1;
		}else{
			int k = checkElem(n_arr, 2*n, i);
			//cout << k<< endl;
			if(k != -1){
				n_arr[k+1] = n_arr[k+1]+1;
			}else{
				n_arr[max_used_ind + 1] = i;
				n_arr[max_used_ind + 2] = 1;
				max_used_ind += 2;
			}
		}
	}

	for(int i : n_arr){
		//cout <<i <<endl;
	}
	int max_freq = -1;
	int max_elem;
	for(int i = 1; i <2*n ; i+=2){
		if( n_arr[i] > max_freq){
			max_freq = n_arr[i];
			max_elem = n_arr[i-1];
		}
	}
	cout<<max_elem<< " " << max_freq;
}

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;

void Frequency(int *a,int n)
{

	int i,j,max_freq=0,freq=0,max_ele;
	for(i=0;i<n;i++)
	{
		freq=0;
		for(j=0;j<n;j++)
		{
			if(a[j]==a[i])
			freq++;
		}
		if(freq>=max_freq)
		{
			max_freq=freq;
			max_ele=a[i];
		}
	}
	cout<<max_ele<<" "<<max_freq;
}

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

	Frequency(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: 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],b[n];
for(int i=0;i<n;i++){cin>>a[i];
b[i]=1;}

for(int i=0;i<n;i++){
for (int j=i+1; j<n;j++){
if (b[j]==1){
if (a[i]==a[j]){ b[j]++;b[i]++; }
}
}
}
int p;
int freq=b[0];
for (int i=0;i<n;i++){
if (freq <=b[i]){freq=b[i]; p=i;}
}
cout<<a[p]<<" "<<freq<<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 maxs(int *b,int n)
{
int max_index;
max_index=0;
for(int m=0;m<n;m++)
{
if( b[m]>b[max_index]){max_index=m;}
}
return max_index;
}
int main()
{int n;
cin>>n;
int a[n],b[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int j=0;j<n;j++)
{int k=0;
	for(int i=0;i<n;i++)
	{
	if(a[j]-a[i]==0)k++;
	}
b[j]=k;
}
int l;
l=maxs(b,n);
cout<<a[l]<<" "<<b[l];


}

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],b[n];
	for(int i=0;i<n;i++) {cin>>a[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 maxi=0;
	for(int i=0;i<n;i++) {maxi=max(maxi,b[i]);}
	int t=0;
			for(;t<n;t++) {
			if(maxi==b[t]) {cout<<a[t]<<" ";}
			break;
		}
	cout<<maxi<<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 arr[n];
	for (int i = 0; i<n; i++){
		cin >> arr[i]; 

	//SORTING BEGINS
	}
	int temp;
	for(int j = n-1; j>0;j--){
		int max_index = 0;
		for(int k = 0; k<=j; k++){
			if (arr[k]>arr[max_index]){
				max_index = k;
			}
		}
		temp = arr[max_index];
		arr[max_index] = arr[j];
		arr[j]=temp;
	}
	//SORTING STOPS

	//UNIQUE COUNTER BEGINS
	int u = 1;
	int start = arr[0];
	for(int i = 0; i<n; i++){
		if (start!=arr[i]){
			u++;
			start=arr[i];
		}
	}
	//UNIQUE COUNTER STOPS

	//FREQ-VALUE TALLY BEGINS
	int val_arr[u];
	int freq_arr[u];
	for(int p = 0; p<u;p++){
		freq_arr[p] = 0;
	}

	val_arr[0] = arr[0];
	int ctr = 0;
	for(int l = 0; l<n; l++){
		if (arr[l]!=val_arr[ctr]){
			ctr+=1;
			val_arr[ctr] = arr[l];
			freq_arr[ctr]+=1;
		}
		else {
			freq_arr[ctr]+=1;
		}
	}
	int max_freq = 0;
	int max_index = 0;
	//FREQ-VALUE TALLY ENDS
	
	for (int i = 0; i<u; i++){
		if (freq_arr[i]>max_freq){
			max_freq = freq_arr[i];
			max_index=i;

		}
	}
	cout << val_arr[max_index] << " " << freq_arr[max_index];
}

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;
int Arr[n];
cin>>n;
int i;
for (i=0;i<n;i++){
cout<<endl;
cin>>Arr[i];
}

int m[];
m[i]=i;
int s=0;
for (i=0;i<n;i++)
if (Arr[i]==m[i])
s=s+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<simplecpp>
main_program{
cin>>n;
int a[n];
int p=0;
int x[n];
int maxindex=0;
for(int i=0;i<n;i++)
x[i]=0;
for(int i=0;i<n;i++)
cin>>a[i];
for(int f=0;f<n;f++){
for(int j=f+1;j<n;j++)
if(a[j]==a[f])
x[f]=x[f]+1;}

for(i=1;i<n;i++){
if(x[maxindex]<x[i])maxindex=i;

cout>>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 main(){

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

			for(int m=i-1; m>=0; m--){  if(arr[i]==arr[m])
						{addindex=m;}}
						arr2[addindex]++; }
int maxindex=0;
for(int i=1; i<n; i++){if(arr2[maxindex]<arr2[i]) {maxindex=i;}}

cout<<arr[maxindex]<<" ";  cout<<arr2[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 main(){
           int n,x,m;
           cin>>n;
           int a[n];

           for(int i=0;i<n;i++){
               cin>>a[i];}
        int i=0;
         int c[i]={0};
          for( i=0;i<n-1;i++){
       
              for(int j=i+1;j<n;j++){
                    if(a[i]==a[j]) {c[i]++;}
             }
          m=0;
         if(c[i]>m) {m=c[i];x=i;}
         }
         cout<<a[x]<<" "<<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: 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 <simplecpp>
int argmax (int *a, int L){
int maxindex = 0;
for(int j=1; j<L; j++){
if(a[maxindex] < a[j]) maxindex = j;
}
return maxindex;
}
void selection_sort (int *a, int n){
for(int i=n; i>1;i--){
int maxindex = argmax(a,i);
int x;
x=a[maxindex];
a[maxindex]=a[i-1];
a[i-1]=x;
}
}
main_program {
	int n; cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	selection_sort(a,n);
	int k=1;
	for(int i=1;i<n;i++) {
		if(a[i]!=a[i-1])k++;
	}
	int c[k];
	int x=1,p=1;
	for(int i=1;i<n;i++){
		if(a[i]!=a[i-1]){
			c[x]=p;
			x++;
			p=1;
		}
		else p++;
	}
	int maxindx=argmax(c,k);
	int y=0;
	for(int i=0;i<maxindx;i++){
		y=y+c[i];
	}
	cout<<a[y+1]<<" "<<c[maxindx];
}

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 array[n];
for(int i=0;i<n;i++){
cin>>array[i];
}
int frequency[n];
for(int j=0;j<n;j++){
int m=0;
for(int k=j;k<n;k++){

if(array[j]==array[k]) m++;
}frequency[j]=m;

}int x=0;
for(int l=0;l<n;l++){

if(frequency[x]<frequency[l]) x=l;
}
cout<<array[x]<<" "<<frequency[x];
}

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

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