This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define maksim gay
#define int ll
#define pb push_back
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define mem(a,i) memset(a,i,sizeof(a))
#define in insert
#define lb lower_bound
#define ub upper_bound
const int MAX=400;
const int inf=1e10;
const int N=2e5;
const int mod=998244353;
int binpow(int a,int n){
  if(n==0)return 1;
  if(n%2)return a*binpow(a,n-1)%mod;
  int k=binpow(a,n/2);
  return k*k%mod;
}
int n,m;
int d[20][20];
int a[MAX],b[MAX];
int dp[(1<<20)];
int f[(1<<20)];
int cnt[(1<<20)];
int bit(int i,int j){
  return (i>>j)&1;
}
void add(int &x,int y){
  x+=y;
  if(x>=mod)x-=mod;
  if(x<0)x+=mod;
}
void solve(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i];
    d[a[i]-1][b[i]-1]=d[b[i]-1][a[i]-1]=1;
  }
  for(int i=0;i<(1<<n);i++){
    f[i]=1;
    for(int j=0;j<n;j++){
      if(bit(i,j))cnt[i]++;
      for(int k=j+1;k<n;k++){
        // cout<<i<<" "<<j<<" "<<k<<" "<<d[j][k]<<"\n";
        if(bit(i,j)&&bit(i,k)&&d[j][k]){
          f[i]=0;
        }
      }
    }
    // cout<<i<<" "<<f[i]<<"\n";
  }
  dp[0]=1;
  for(int i=1;i<(1<<n);i++){
    for(int j=i;j;j=(j-1)&i){
      if(f[j]){
        // cout<<i<<" "<<j<<"\n";
        if(cnt[j]%2==1){
          add(dp[i],dp[j^i]);
        }
        else add(dp[i],-dp[j^i]);
      }
    }
    // cout<<i<<" "<<dp[i]<<"\n";
  }
  // cout<<dp[(1<<n)-1]<<"\n";
  cout<<dp[(1<<n)-1]*m%mod*binpow(2,mod-2)%mod<<"\n";
}
main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t=1;
  // cin>>t;
  while(t--){
    solve();
  }
}
Compilation message (stderr)
amusementpark.cpp:85:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   85 | main(){
      | ^~~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |