func_code_string: #include <bits/stdc++.h>   using namespace std;      using ll = long long;   using ld = long double;      int a[25][50005];      const int MOD = 998244353;      int add(int a, int b){       a += b;       if(a >= MOD) a -= MOD;       return a;   }      int mul(int a, int b){       return (1LL*a*b)%MOD;      }      int pw(int a, int b){       if(b == 0) return 1;       int res = pw(a, b/2);       res = mul(res, res);       if(b%2) res = mul(res, a);       return res;   }      int main(){       ios_base::sync_with_stdio(false), cin.tie(0);       cout.precision(10);       cout << fixed;          int n, m;       cin >> n >> m;       for(int i=1; i<=n; i++){           for(int j=1; j<=m; j++){               cin >> a[i][j];               a[i][j]--;           }       }       int res = 0;       for(int j=1; j<=m; j++){           vector <int> vec;           for(int i=1; i<=n; i++){               vec.push_back(a[i][j]);           }           sort(vec.begin(), vec.end());           int ways = 1;           for(int g=0; g<vec.size(); g++){               ways = mul(ways, vec[g] - g);           }           if(ways == 0) continue;           res = add(res, ways);       }       int fact = 1;       for(int i=1; i<=n; i++) fact = mul(fact, i);       int p = add(mul(fact, m), MOD - res);       p = mul(p, pw(fact, MOD-2));       cout << p;       return 0;   }   