C++ Solution
class Solution {\npublic:\n    int numSubmatrixSumTarget(vector>& A, int t) \n    {\n        \n        int i,n,m;\n        n=A.size();\n        if(n==0)\n      
class Solution {\npublic:\n    int numSubmatrixSumTarget(vector<vector<int>>& A, int t) \n    {\n        \n        int i,n,m;\n        n=A.size();\n        if(n==0)\n        {\n            return 0;\n        }\n        m=A[0].size();\n        if(m==0)\n        {\n            return 0;\n        }\n        \n        int j;\n        for(i=0;i<n;i++)\n        {\n            for(j=1;j<m;j++)\n            {\n                A[i][j]+=A[i][j-1];\n            }\n        }\n        \n        int ans=0;\n        map<int,int>ma;\n        \n        for(int sc=0;sc<m;sc++)\n        {\n            for(int cc=sc;cc<m;cc++)\n            {\n                ma.clear();\n                ma[0]=1;\n                int sum=0;\n                for(i=0;i<n;i++)\n                {\n                    sum+=A[i][cc]-(sc>0?A[i][sc-1]:0);\n                    ans+=ma[sum-t];        \n                    ma[sum]++;\n                }\n            }\n        }\n        \n        return ans;\n        \n    }\n};
['C', 'C++']