Operations on a Matrix

problem link: CodeChef: Practical coding for everyone

my code:
#include
#include<bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t–)
{
int n,m,q;
cin>>n>>m>>q;
int a[n][m];
map<int,int> row;
map<int,int> col;
int i,x=0,y=0,j,countodd=0;
for(i=1;i<=q;i++)
{
cin>>x;
if(row.find(x)==row.end())
row.insert(make_pair(x,1));
else
row[x]++;
cin>>y;
if(col.find(y)==col.end())
col.insert(make_pair(y,1));
else
col[y]++;
x=0;y=0;
}
for(auto& it:row)
{
for(i=0;i<m;i++)
a[it.first-1][i]+=it.second;
}
for(auto& iu:col)
{
for(i=0;i<n;i++)
a[i][iu.first-1]+=iu.second;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
if(a[i][j]%2!=0)
countodd++;
}
}
cout<<countodd<<‘\n’;
}
// your code goes here
return 0;
}

plzz tell me where am i getting wrong.