I tried many different cases and my program worked but still codechef's response is 'wrong answer'

problem link: http://www.codechef.com/problems/MAXCOUNT/

My program runs for all inputs I tried, but still gives wrong answer.

my program:

#include<stdio.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t–)
{
int n;
scanf("%d",&n);
int t=0;
int a[2][n];
for(int i=0;i<n;i++)
{a[1][i]=0;
a[0][i]=NULL;}
while(n–)
{
int c;
scanf("%d",&c);
int i=0;
for(i=0;i<t;i++)
{
if(a[0][i]==c)
{

                break;
            }
        }
        if(a[0][i]!=c)
            ++t;
        ++a[1][i];
        a[0][i]=c;
    }
    int g=a[1][0],g1=a[0][0];
    for(int i=0;i<t;i++)
    {
        if(a[1][i]>g)
        {
            g=a[1][i];
            g1=a[0][i];
        }
    }
    printf("%d %d\n",g1,g);
}

}

Please paste your code properly.