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;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n;i++){
		cin >> arr[i];
	}
	int counttemp,temp,max;
	temp = 1;

	for(int j = 0;j< n;j++){
		counttemp = 1;
		if(n > 1){
			for(int k = (j + 1);k < n;k++){
				if(arr[j] > 0){
					if(arr[j] == arr[k]){
						arr[k] = -1;
						counttemp = counttemp + 1;
				}
				}
			}

		}
		if(counttemp > temp){
			temp = counttemp;
			max = arr[j];
		}
	}

if(n == 1){
	max = arr[0];
}
	cout << max << " " << temp;

}

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;
	long long int val[n], rep[n], check[n], maxnum=0;
	for(int i=0; i<n; i++){
		cin>>val[i];
		rep[i]=0;
		check[i]=0;
	}
	for(int i=0; i<n; i++){
		if(check[i]==0){
			for(int j=0; j<n; j++){
				if(val[i]==val[j]){
					rep[i]++;
					check[j]=1;
				}
			}
		}
		check[i]=0;
	}
	for(int i=0; i<n; i++){
		maxnum=max(maxnum, rep[i]);
	}
	for(int i=0; i<n; i++){
		if(rep[i]==maxnum && check[i]==0){
			cout<<val[i]<<" "<<rep[i]<<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 I[n];
int R[n];
for(int i=0;i<n;i++){int x;cin>>x;I[i]=x;}
for(int i=0;i<n;i++)
{
int a=I[i];
int r=0;
for(int j=0;j<n;j++)
{
if(a==I[j]){r++;}
}
R[i]=r;

}

int k=0;
for(int i=0;i<n;i++){if(R[i]>R[k])k=i;}

cout<<I[k]<<" "<<R[k];


}

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, temp;
   cin>>n;
   int arr[100];
   int ele[100];
   int count[100], k=0;
   for(int i=0;i<n;i++){
     cin>>arr[i];
     count[i]=0;
     ele[i]=0; }
   for(int i=0;i<n;i++){
    if(arr[i] != 0){
     for(int j=i+1;j<n;j++){
         if(arr[i]==arr[j]){ count[k]++; } } 
     ele[k]=arr[i]; count[k]++;  k++; } }

     int maxcount=count[0];
   for(int i=0;i<k;i++){
      if(maxcount<=count[i]){ maxcount=count[i]; temp=i; } }

   cout<<ele[temp]<<" "<<count[temp];
}

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 (float *arr, int L){
int maxindex = 0;
for(int j=1; j<L; j++){
if(arr[maxindex] < arr[j]) maxindex = j;
}
return maxindex;
}
void selection_sort (float *data, int n){
for(int i=n; i>1;i--){
int maxindex = argmax(data,i); 
elements (from index 0 to index i-1)
myswap(&data[maxindex],&data[i-1]);
}
}
#define MAXSIZE 12
int main()
{int n;
cin>>n;
int arr[n];
for (i=0;i<n;i++)
{cin>>arr[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>
using namespace std;
int main(){
int n,d=0;
cin>>n;
int arr[n],arr1[n];
for(int i=0;i<n;i++){
arr1[i]=1;
}
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(arr[i]==arr[j]) arr1[i]++;
}
}
cout<<endl;
int max=arr1[0];
for(int i=0;i<n;i++){
if(arr1[i]>max) max=arr1[i];
}
for(int i=0;i<n;i++){
if (arr1[i]==max){
cout<<arr[i]<<" "<<arr1[i]<<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:
//22B1068
//finding mod lol

#define VALUE 0
#define TIMES 1

#include <iostream>
using namespace std;

int main(){
	bool found = false; //will be used to check if the vaue just entered had already been entered before
	int n, counter = 0, max = 0, index;
	cin >> n;
	int a[n], b[n][2];           //b[i][VALUE] will store the value of a[i] and b[i][TIMES] will store the number of repetitions
	for (int i = 0; i < n; i++){
		b[i][VALUE] = -1;   //initialising so that garbage values don't pose a problem. For b[i][TIMES], initialisation will happen in line 27
		cin >> a[i];
		found = false;
		for (int j = 0; j < counter; j++){
			if(b[j][VALUE] == a[i]){
				b[j][TIMES]++;
				found = true;
				break;
			}
		}
		if (found == false){
			b[counter][VALUE] = a[i];
			b[counter][TIMES] = 1;
			counter++;

		}

			
			
	}


	for (int i = 0; i < counter; i++ ){ //finds max TIMES and then eventually prints it
		
		if (max < b[i][TIMES]){
			max = b[i][TIMES];
		}
			

	}

	for (int i = 0; i < counter; i++ ){
		if(b[i][TIMES] == max)
			cout << b[i][VALUE] << " " << b[i][TIMES] << "\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
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,i,j;
cin>>n;
int ar[n];
for(i=0;i<n;i++)
cin>>ar[i];
int d=0,max=ar[0],c;
for(i=0;i<n;i++)
{
c=0;
for(j=0;j<n;j++)
{
if(ar[j]==ar[i])
c++;
}
if(c>d)
{
d=c;
max=ar[i];
}
}
cout<<max<<" "<<d;
	}

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

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, i=0, j=0;
cin>>N;
int arr[N];
for (i=0; i<N; i++) cin>>arr[i];
int arr1[N];
for (i=0; i<N; i++) arr1[i]=0;
for (i=0; i<N; i++)
 {
 for (j=0; j<N; j++)
  {
  if (arr[i]==arr[j]) arr1[i]++;
  }
 }
int x=arr1[0], y=0;
for (i=0; i<N; i++)
 {
 if (arr1[i]>x)
  {
  x=arr1[i];
  y=i;
  }
 }
cout<<arr[y]<<' '<<x<<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>
#include<cmath>
#include<math.h>
using namespace std;
void myswap(int*a,int*b){
int temp=*a;*a=*b;*b=temp;}
int max(int*k,int n){
int maxindex=0;
for(int i=1;i<n;i++){if(k[maxindex]<k[i])maxindex=i;}return maxindex;}
void argmax(int*k,int n){
for(int i=1;i<n;i++){
int maxindex=max(k,i);
myswap(&k[maxindex],&k[i-1]);}}
int main(){
	int n;int c=0;
	cin>>n;
	int a[n],k[20];
	for(int x=0;x<20;x++){k[x]=0;}
	for(int i=0;i<n;i++){
		cin>>a[i];}
	for(int x=0;x<n;x++){
	for(int j=0;j<n;j++){
	
	if(a[x]==a[j]){
	k[x]++;}}}
	int*d=k;
	argmax(k,20);
	for(int t=0;t<20;t++){
	if(d[t]==k[19])cout<<a[t]<<" ";break;;
	
	}cout<<k[19]+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<bits/stdc++.h>
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++)
{
	int count=0;
	for(int j=0;j<n;j++)
	{	if(a[i]==a[j]){count++;}}
	b[i]=(count);
}
int high=b[0];
for(int i=0;i<n;i++)
{
high=max(high,b[i]);
}
for(int i=0;i<n;i++)
{
if(b[i]==high)
{
cout<<a[i]<<" "<<high;
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>
#include <cmath>
#include <string.h>
using namespace std;

int main() {
int n=0;
cin>>n;
int list[n];
int freq[n];
//int sort[n];
	int i=0;
	for(i=0;i<=n-1;i++) {
	 cin>>list[i];
	}
	
	i=0;
	int j=0;

	for(i=0;i<=n-1;i++) {	
	freq[i]=0;	
		for(j=0;j<=n-1;j++) {
		if(list[j]==list[i]) freq[i]++;
		}
	}
	
//	cout<<endl; i=0;
//	for(i=0;i<=n-1;i++) {
//	cout<<list[i]<<" ";
//	}
//	cout<<endl; i=0;
//	for(i=0;i<=n-1;i++) {
//	cout<<freq[i]<<" ";
//	}
	
	int k=0;
	i=0; j=0;
	for(i=0;i<=n-1;i++) {
		if(freq[i]>j) {j=freq[i]; k=i;}
	}
	cout<<list[k]<<" "<<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 max(int *c,int n){
int maxindex=0;
for(int r=0;r<n;r++){
if(c[maxindex]<c[r]) maxindex=r;
}
return maxindex;
}
int main(){
int n;
cin>>n;
int a[n];
int b[n];
for(int q=0;q<n;q++) b[q]=0;
for(int i=0;i<n;i++) cin>>a[i];
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
if(a[k]==a[j]) b[j]++;
}
}
int w=max(b,n);
cout<<a[w]<<" "<<b[w];
}

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;
	if(1<=n<20)             // find a better way to satisfy conditions/limits/bounds
	{ 
	    int a[n],b[n][2];
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
		}
		for(int i=0;i<n;i++)
		{
			int k=0;
			for(int j=0;j<n;j++)
			{
				if(a[i]==a[j])k++;      //counting the number of times each element occurs
			}
			b[i][0]=a[i];
			b[i][1]=k;               //storing the number and count in a 2D array
		}
		int c=b[0][1],d;       // very important to initialize c here for n=2 for loop doesn't run and if values are '=' then then if are unsatisfied
		if(b[0][1]>b[1][1]) c=b[0][1];
		if(b[0][1]<b[1][1]) c=b[1][1];
		for(int i=0;i<n-2;i++)         // i going from 0 to n-3 and is defined for function only
		{
			d=b[i+2][1];
			if(d>c)c=d;  // comparing two elements storing the bigger one and comparing bigger with next
		}
		int i;
		for(i=0;i<n;i++)
		{
			if(b[i][1]==c) break; 
		}
		cout<<b[i][0]<<" "<<c;
	}
	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 occ(int x, int arr[], int n){  //number of x in arr[] of size n
	int ans=0;

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

		if(arr[i]==x) ans++;
	}

	return ans;
}

int main(){

	int n;
	cin>>n;
	int arr[n], freq[n];

	for(int i=0; i<n; i++){  //input

		cin>>arr[i];
	}

	for(int i=0; i<n; i++){  //makes freq array

		freq[i] = occ(arr[i], arr, n);
	}

	int maj, max=0;

	for(int i=0; i<n; i++){  //finds max element of freq[]

		if(freq[i]>max){

			maj = i;
			max = freq[i];
		}
	}

	cout<<arr[maj]<<" "<<freq[maj];
}

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