c++ | easy | short
\n# Code\n\n#define ll long long int\nclass Solution {\npublic:\n    int maxTrailingZeros(vector<vector<int>>& grid) {\n        int n=grid.size();\n        int 
\n# Code\n```\n#define ll long long int\nclass Solution {\npublic:\n    int maxTrailingZeros(vector<vector<int>>& grid) {\n        int n=grid.size();\n        int m=grid[0].size();\n        vector<vector<pair<ll,ll>>> v(n,vector<pair<ll,ll>>(m,{0,0})),ltr,utd,rtl,dtu;\n        \n        for(ll i=0;i<n;i++)\n        {\n            for(ll j=0;j<m;j++)\n            {\n                ll z=grid[i][j],c1=0,c2=0;\n                while(z%2==0)\n                {\n                    z/=2;\n                    c1++;\n                }\n                while(z%5==0)\n                {\n                    z/=5;\n                    c2++;\n                }\n                v[i][j].first=c1;\n                v[i][j].second=c2;\n            }\n        }\n        ltr=utd=rtl=dtu=v;\n        for(ll i=0;i<n;i++)\n        {\n            for(ll j=1;j<m;j++)\n            {\n                ltr[i][j].first+=ltr[i][j-1].first;\n                ltr[i][j].second+=ltr[i][j-1].second;\n            }\n        }\n        for(ll i=0;i<n;i++)\n        {\n            for(ll j=m-2;j>=0;j--)\n            {\n                rtl[i][j].first+=rtl[i][j+1].first;\n                rtl[i][j].second+=rtl[i][j+1].second;\n            }\n        }\n        for(ll j=0;j<m;j++)\n        {\n            for(ll i=1;i<n;i++)\n            {\n                utd[i][j].first+=utd[i-1][j].first;\n                utd[i][j].second+=utd[i-1][j].second;\n            }\n        }\n        for(ll j=0;j<m;j++)\n        {\n            for(ll i=n-2;i>=0;i--)\n            {\n                dtu[i][j].first+=dtu[i+1][j].first;\n                dtu[i][j].second+=dtu[i+1][j].second;\n            }\n        }\n        ll ans=0;\n        for(ll i=0;i<n;i++)\n        {\n            for(ll j=0;j<m;j++)\n            {\n                ll c1,c2,c3,c4;\n                ll x1,x2,x3,x4;\n                ll a,b;\n                a=v[i][j].first;\n                b=v[i][j].second;       \n                \n                c1=ltr[i][j].first;\n                c2=rtl[i][j].first;\n                \n                c3=utd[i][j].first;\n                c4=dtu[i][j].first;\n                \n                x1=ltr[i][j].second;\n                x2=rtl[i][j].second;\n                \n                x3=utd[i][j].second;\n                x4=dtu[i][j].second;\n                \n                ans=max(ans,min(c3+c1-a,x3+x1-b));\n                ans=max(ans,min(c3+c2-a,x3+x2-b));\n                ans=max(ans,min(c4+c1-a,x4+x1-b));\n                ans=max(ans,min(c4+c2-a,x4+x2-b));\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']