Why am I getting this error?

i am getting this error :
prog.cpp: In function ‘int main()’:
prog.cpp:31:29: error: invalid types ‘int[int]’ for array subscript
sum=sum+a[i][j];

here is my program
‘’’
#include
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int n,m;
cin>>n>>m;
int a[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
int query;
cin>>query;

    while(query--){
        int a,b,x,y;
        cin>>a>>b>>x>>y;
        a-=1;
        b-=1;
        x-=1;
        y-=1;
        int sum;
        for(int i=a;i<=x;i++){
             sum=0;
            for(int j=b;j<=y;j++){
                sum=sum+a[i][j];
            }
            cout<<sum<<endl;
        }
    }
    
}
return 0;

}
‘’’
this is the problem that I am trying to solve : Grid Game - Prefix Sum Problem | CodeChef

you are declaring the variable “a” two times (line 11, line 21)
in line 31, the second “a”, a int, will be used.