#include using namespace std; #define int long long const int p=998244353; int po(int a,int b) {if(b==0) return 1; if(b==1) return a; if(b%2==0) {int u=po(a,b/2);return (u*u)%p;} else {int u=po(a,b-1);return (a*u)%p;}} int inv(int x) {return po(x,p-2);} const int maxn=4e5+5; int fact[maxn];int invf[maxn]; int c1(int n,int k) { if(n>t; while(t--) { int n,m;cin>>n>>m;int a[n];for(int i=0;i>a[i]; map u;for(int i=0;i > v;for(auto [key,val]:u) v.push_back({key,val}); sort(v.begin(),v.end());reverse(v.begin(),v.end()); int l=n,r=n; int res=1;int tot=0;int rem=v.size(); for(auto [ma,c]:v) { --rem; if(ma==r-c && 2*(r-c)+c>=n) { ++tot; if(l==r && rem) {res*=2;res%=p;} r-=c; } else if(ma==l-c && 2*(l-c)+c>=n) { ++tot; l-=c; } else { int h=(l+r-c); if(h%2==1) {res*=0;res%=p;} if(h!=2*ma) {res*=0;res%=p;} tot+=2; int o=l-h/2; res*=c1(c,o);res%=p; l=h/2;r=h/2; } } res*=c1(m,tot);res%=p; cout<<(res%p+p)%p<<'\n'; } return 0; }