what is more better approach than this one, for worst case to get one ans correct means that answer is same for all questions , otherwise worst case will always be 0. I got only 37 points .
#include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int n,m,k,ind,max=0,i,j;
cin>>n>>m>>k;
int f[m+1],a[k];
for(i=0;i<n;i++)
{max=0; ind=0;
for(j=0;j<m+1;j++)
{
f[j]=0;
}
for(j=0;j<k;j++)
{
cin>>a[j];
f[a[j]]++;
}
for(j=0;j<m+1;j++)
{
if(max<f[j])
{
max=a[j];
ind=j;
}
}
cout<<ind<<endl;
}
} return 0;
}