func_code_string: #include <iostream>   #include <vector>   #include  <numeric>   #include<cstdlib>   #include <algorithm>    // std::random_shuffle   #define MODD 998244353   #define ll long long   using namespace std;      ll modpow(ll x, ll y) {       ll xs = x;       ll answer = 1;       while(y) {           if (y&1) {               answer = (answer * xs) % MODD;           }           y >>= 1;           xs = (xs * xs) % MODD ;       }       return answer;   }         ll D[22][55555];      char buf[58000000];      int pos;   ll readint() {       while(buf[pos]< 0  || buf[pos]> 9 )           pos++;       ll m=0;       while(buf[pos]>= 0  && buf[pos]<= 9 ) {           m=m*10+buf[pos]- 0 ;           pos++;       }       return m;   }         int main() {       fread(buf, 1, 51000100, stdin);       pos=0;       int n,m;       n=readint();       m=readint();       for(int i=1;i<=n;i++) {           for(int j=1;j<=m;j++) {               D[i][j]=readint();           }       }          ll fact = 1;       for(ll i=1;i<=n;i++) {           fact = (fact*i)%MODD;       }          ll factinv = modpow(fact, MODD-2);          ll counts[22];       ll ans = 0;       for(int j=1;j<=m;j++) {           for(int step=1;step<=n;step++) {               // number of cities with distance >= step+1               counts[step]=0;               for(int i=1;i<=n;i++) {                   counts[step]+=(D[i][j]>=step+1);               }           }           counts[n+1]=0;           ll prod = 1;           for(int step=n;step>=1;step--) {               prod = (prod * (counts[step]-(n-step)))%MODD;           }           prod = (prod * factinv)%MODD;              ll prob_selected = (1-prod+MODD)%MODD;           ans += prob_selected;           ans %= MODD;       }          ans = (ans + MODD)%MODD;          cout << ans << endl;   }