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<simplecpp>
main_program{
	int n,i,arr[n];
	cin>>n;
	for(i=0;i<n;i++){
		cin>>arr[i];
	}
	cout<<arr[0]<<ends<<"4"<<endl;
	cout<<arr[1]<<ends<<"4"<<endl;
	cout<<arr[2]<<ends<<"4"<<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 i = 0; i < n; i++)
{
	cin >> a[i];
}

int major = a[0];
int repeat = 0;

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

for (int i = 0; i < n; i++)
{
	int var= 0;
	if (a[i] != major)
	{
		for (int j = i; j < n; j++)
		{
			if (a[j] == a[i])
			var++;
		}
	}
	if (var > repeat)
	{
		repeat = var;
		major= a[i];
	}
}

cout << major << " " << repeat;
}

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;
unsigned int arr[n];
for(int i=0;i<n;i++){
cin >> arr[i];}
int freq_entry[n]={0};
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
if(arr[j]==arr[k]){
freq_entry[j]++;}
}
}
int max_freq=freq_entry[0];
for(int i=1;i<n;i++){
if (freq_entry[i]> max_freq){
max_freq=freq_entry[i];}}
int x=0;
while(x>=0){
if (max_freq==freq_entry[x]) cout << arr[x];break;
x++; }
cout << " " << max_freq << "\n";
while(max_freq>0){
max_freq--;
for(int y=0;y<n;y++){
if (freq_entry[y]==max_freq){ cout<< arr[y];
cout << " " << max_freq << "\n";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<iostream>

using namespace std;

int main(){
	int n,a;
	cin>>n;
	int arr[n];
	int carr[n];
	int iarr[n];
	for(int i=0;i<n;i++){
		cin>>a;
		arr[i]=a;
	}
	for(int i=0;i<n;i++){
		carr[i]=0;
	}
	for(int i=0;i<n;i++){
		iarr[i]=0;
	}
	int j;
	for(int i=0;i<n;i++){
		int a;a=arr[i];
		iarr[i]=a;
		for(int j=0;j<i;j++){
			if (iarr[j]==iarr[i]) iarr[i]=0;
		}
	}
	
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int c=0;
			if (iarr[i]==arr[j]) c=c+1;
		}
		carr[i]=c;
	}	
	for(i=0;i<n;i++){
		if (iarr[i]!=0) cout<<iarr[i]<<carr[i];
	}
}

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 maxarr(int num, int *arr){
    int max=0;
    for(int i=0;i<num;i++){
        if(max<arr[i]) max = arr[i];
    }
    for(int j=0;j<num;j++){
        if(arr[j]==max) return j;
    }
}

int main(){
    int n;
    cin>>n;
    int NC[n];
    for(int i=0;i<n;i++){cin>>NC[i];}
    int freq[n];
    for(int t=0;t<n;t++){
        freq[t]=0;
    }
    for(int l=0;l<n;l++){
        for(int m=0;m<n;m++){
            if(NC[l]==NC[m]) freq[l]++;
        }
    }
    int tar = maxarr(n, freq);
    cout<<NC[tar]<<" "<<freq[tar];
}

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,m=1,a=0;
cin>>n;
int arr[20],num[40];
for(int i=0;i<n;i++){
cin>>arr[i];
}
/*cout<<n;
for(int i=0;i<n;i++){
cout<<arr[i];
}*/

/*for(int i=0;i<n;i++){
if (i==0){for(int j=i+1;j<n;j++){
if(arr[j] == arr[i]) m++;}
num[a]=arr[i];
num[a+1]=m;
a=a+2;
m=1;
}

else {for(int k=0;k<i;k++)
if(arr[k]!=arr[i]){ 
for(int j=i+1;j<n;j++){
if(arr[j] == arr[i])m++;}
num[a]=arr[i];
num[a+1]=m;
a=a+2;
m=1;
}
else break;
}
}
for(int i=0;i<=a;a=a+2)
cout<<num[i]<<num[a+1];*/
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(arr[j]==arr[i]) m++;
}
num[a]=arr[i];
num[a+1]=m;
m=1;
a=a+2;
}
/*for(int i=0;i<2*n;i=i+2)
{cout<<num[i]<<num[i+1];}*/
int maxindex=1;
for(int i=1;i<2*n;i=i+2){
if(num[maxindex]<num[i]) maxindex=i;
}
for(int i=1;i<2*n;i=i+2){
  if(num[i]==num[maxindex]){
cout<<num[i-1]<<" "<<num[maxindex]<<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 i=0; i<n; i++)
		cin >> a[i];
	int freq[n]={0};
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<n; j++)
		{
			if(a[i]==a[j])
				freq[i]++;
		}
	}
	int index=0;
	int max=0;
	for(int i=0; i<n; i++)
	{
		if(freq[i]>max)
		{
			index=i;
			max = freq[i];
		}	
	}
	cout << a[index] <<" "<<max<<endl;
	
	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 <simplecpp>
void swap (int *a, int *b)
{
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
}
int argmax (int *seq1, int L)
{
        int maxindex = 0;
        for(int j=1; j<L; j++){
                if(seq1[maxindex] < seq1[j]) maxindex = j;
        }
        return maxindex;
}
void selection_sort (int *data, int n)
{
    for(int i=n; i>1;i--)
    {
        int maxindex = argmax(data,i);
        swap(&data[maxindex],&data[i-1]);
    }
}
main_program
{
int n1;
cin>>n1;
int seq[n1];
for(int i=0;i<n1;i++)
	{
	cin>>seq[i];
	}
cout<<endl;
selection_sort(seq,n1);

int a[n1]={0};
a[0]=1;
for(int i=1;i<n1;i++)
	{
	int j=1;
	if (seq[i]==seq[i-1])
		{
		while (seq[i]==seq[i-1])
			{a[j]++;}
		}
	j=j+1;	
	}
int k=sizeof(a);
int s=argmax(a,k);
cout<<s;
}

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];
int maxn=0;
int maxfreq=0;
int x=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]>maxn)
maxn=a[i];
}
for(int i=0;i<=maxn;i++)
{
int freq=0;
for(int j=0;j<n;j++)
{
if(a[j]==i) freq++;
}
if(freq>maxfreq)
{
maxfreq=freq;
x=i;
}
}
cout<<x<<" "<<maxfreq;
}

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 cin_numbers(int *A, int n){
for(int i=0; i<n; i++) cin>>A[i];
}


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

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

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

void selectionsort(int *freq, int n){
for (int i=n; i>0; i--){
	int maxindex = argmax(freq,i);
	swap(freq[maxindex],freq[i-1]);
	}
}


int main(){
int n; cin>>n;
int A[n]; 
cin_numbers(A,n);
int freq[n];int C[n];
for (int i=0; i<n: i++) freq[i] = 0;
create_histogram(A,freq,n);
for (int i=0; i<n;i++){
	C[i] = freq[i];
selectionsort(freq,n);
int y = freq[n-1];
for (int i=0; i<n;i++){
	if (freq[n-1]==C[i])
	return [i];
}
cout<<A[i]<<" "<<freq[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: 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;
#include<cmath>

void f(int* A,int N){
	int maxnum=0;
	int mi=0;
	for(int j=0;j<N;j++){
		int k=1;
		for(int i=j+1;i<N;i++){
			if(A[j]==A[i]){
				k++;
			}
		}
		if(k>maxnum){
			maxnum=k;mi=j;
		}
	}
	cout<<A[mi]<<" "<<maxnum;
}

int main(){
	int N;cin>>N;
	int A[N];
	for(int j=0;j<N;j++){
		cin>>A[j];
	}
	f(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: 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 <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> v;
 for (int i=1;i<=n;i++)
 {
 int temp;
 cin>>temp;
 v.push_back(temp);
 }

map<int,int> count;

 for(int i=0;i<n;i++)
 {
  count[v[i]]=0;
 }

for(int i=0;i<n;i++)
 { 
  count[v[i]]++;
 }

int max=-2121212121;
int key;

for(int i=0;i<n;i++)
 {
  if(count[v[i]]>max)
  {
   key=v[i];
   max=count[v[i]];
  }
 }

cout<<key<<" "<<count[key];
}

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;
int maxindex=0;
cin>>n;
int a[n];
int hist[n];
for(int i=0;i<n;i++)
{
hist[i]=0;
}
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int j=0;j<n;j++)
{
	for(int i=0;i<n;i++)
	{
	if(a[j]==a[i])
	hist[j]=hist[j]+1;
	}
}
for(int i=1;i<n;i++)
{
if(hist[maxindex]<=hist[i])
maxindex=i;
}
cout<<a[maxindex]<<" ";
cout<<hist[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 *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;
    cin>>n;
    int A[n];
    for(int i=0;i<n;i++) cin>>A[i];
    int k;      
    k=A[argmax(A,n)];
    int a[k];
    for(int i=0;i<k;i++) a[i]=0;
    for(int j=0;j<n;j++){
    for(int i=0;i<k;i++){
       if (A[j]==i+1) a[i]=a[i]+1;
}
}   cout<< argmax(a,k)+1 <<" "<< a[argmax(a,k)] ;
    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 input[n];
for(int i=0;i<n;i++)
{cin>>input[i];}
int number[9999];
for(int i=0;i<9999;i++)
{number[i]=0;}
for(int i=0;i<n;i++)
{
for(int j=0;j<9999;j++)
{
if(input[i]==j) {number[j]++;}
else continue;
}
}
int maxval=0;
for(int i=1;i<9999;i++)
{
if(number[i]>number[maxval]) {maxval=i;}
else continue;
}
cout<<maxval<<" "<<number[maxval];
}

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 count[n];
for (int j=0;j<n;j++)
{
count[j]=0;
}
for (int k=0;k<n;k++)
{
for (int l=0;l<n;l++)
{
if (a[k]==a[l])
{
count[k]=count[k]+1;
}
}
}
int mod=0, t;
for (int m=0;m<n;m++)
{
mod=max(mod,count[m]);
}
if (count[t]==mod)
{
cout << a[t] << " " << mod << '\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: B