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 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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: C
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: C
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: C
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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;
#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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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;
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: C
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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];}
//inputted the array
//int b[n];int c[n];
//determine no of distinct elements

for(int i=0;i<n;i++){
	int x=1;
	for(int j=i+1;j<n;j++){
		if(a[j]==a[i]){
			int temp=a[j];
			a[j]=a[i+x];
			a[i+x]=temp;}
		}
	}
//for(int i=0;i<n;i++){cout<<a[i]<<' ';}
//determine distinct values
/*int val=a[0];
int c=1;
for(int i=0;i<n;i++){
	if(a[i]!=val){c++;}
	}
// c is number of distinct numbers
int ans[2*c];
int d=0;
int j=0;
for(int i=0;i<n;i++){
	if(a[i]==val){d++;}
	else{ans[j]=val;ans[j+1]=d;d=i;j=j+2;}
	}
for(int i=0;i<2*c;i++){cout<<ans[i];}
int i=0;
int max=0;
int val=a[0];
while(i<n){
	int c=0;
	if(a[i]==val){c++;}
	}
*/
int max=0;
int d=0;
int val=a[0];
for(int i=0;i<n;i++){
	if(a[i]==val){d++;}
	if(a[i]!=val || i==(n-1)){
		if(max<d){max=d;}
		d=0;val=a[i];
		}
	}
//cout<<max<<endl;


d=0;
val=a[0];
for(int i=0;i<n;i++){
        if(a[i]==val){d++;}
        
                if(max==d){cout<<val<<" "<<d<<endl;break;}
                //d=0;val=a[i];
                
        }



}

Grading criterion: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
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 arr1[n];								//input array
	for(int i=0; i<n; i++){cin>> arr1[i];}
	
	int arr2[n];								//array of distinct elements
	int arr3[n]={0};							//array of frequency of distinct elements
	int distinct = 0;							//number of distinct elements
	
	for(int i=0; i<n; i++)
	{
		int found = 0; 
		for(int j=0; j<distinct; j++)
		{
			if(arr1[i]==arr2[j]){ arr3[j]+=1; found = 1; break;}
		}
		if(found == 0){arr2[distinct] = arr1[i]; arr3[distinct] = 1; distinct += 1; }
	}
	
	int maxindex=0;								//index of element with greatest frequency
	for(int j=0; j<distinct; j++){
		if(arr3[maxindex]<arr3[j]){maxindex = j;}
	}
	cout<< arr2[maxindex] << " " << arr3[maxindex];
}

Grading criterion: Quality of variable names
Rating A: Good Variables Names
Rating B: Ok Variable Names
Rating C: Poor Naming of Variables
Rating D: 0
Assigned grade: B